Skip to main content

REST API

Use the reference in the sidebar for parameters, request bodies, and responses. The OpenAPI JSON includes the optional generation endpoints. A running instance advertises its own enabled routes at /openapi.json.

Stage an image​

Send up to 20 MiB of PNG, JPEG, or WebP bytes as the request body. If the server requires authentication, add the same Authorization: Bearer <token> header to each request.

curl --fail-with-body http://localhost:8000/v1/images \
-H 'Content-Type: image/png' \
--data-binary @example.png

Copy the returned id. You can download the staged image from GET /v1/images/{image_id} and delete it with DELETE /v1/images/{image_id}. Edit or group staged images at /v1/images/transform and /v1/images/montage. Check GET /v1/engines before using CLIP matching or YOLO detection. A missing image or model returns HTTP 404. A failed weight download returns HTTP 503 when automatic downloads are enabled.

Resize a staged image​

Replace the example ID with the uploaded image ID. The response gives a new ID for the resized image.

curl --fail-with-body http://localhost:8000/v1/images/transform \
-H 'Content-Type: application/json' \
--data '{"image_id":"00000000000000000000000000000000","width":640,"height":480,"fit":"contain","format":"webp"}'

Generate an image​

Use GET /v1/models to find the exact model ID. The OpenAI-compatible generation route returns the generated image as base64 when you request b64_json.

curl --fail-with-body http://localhost:8000/v1/images/generations \
-H 'Content-Type: application/json' \
--data '{"model":"imagies-sd-turbo","prompt":"a yellow teapot on a wooden table","size":"256x256","response_format":"b64_json"}'

Manage a generation engine​

GET /v1/generation/engines lists engine IDs. The bundled sdcpp engine serves models such as SD Turbo and, in the CUDA image, FLUX.1 Schnell. Use the full model ID returned by GET /v1/models in both generation and model selection requests.

Method and pathResult
GET /v1/generation/engines/{engine}Model inventory, resident model ID, loading and generation state, and idle timeout in seconds.
PUT /v1/generation/engines/{engine}/modelLoad or switch to the model in the JSON body. Returns 204 once the model is ready.
DELETE /v1/generation/engines/{engine}/modelRelease the resident model. Returns 409 while the engine is loading or generating.
DELETE /v1/generation/engines/{engine}/activeCancel the active generation. Returns 204 if the engine is already idle.
curl --fail-with-body -X PUT http://localhost:8000/v1/generation/engines/sdcpp/model \
-H 'Content-Type: application/json' \
--data '{"model":"imagies-sd-turbo"}'

Unknown engine IDs return 404. Deployments that use the old /sdcpp/v1/ paths can keep using them during migration.

Unload all models​

POST /v1/unload stops resident generation and vision model processes. The response lists the released generation model IDs and vision engine names in unloaded. An idle service returns an empty list. A model load or active inference returns HTTP 409. The next request starts its worker again.