{"openapi":"3.1.0","info":{"title":"Alibaba: Z-Image Turbo: Text To Image","version":"sha256:14fe72917bc83ffdf5effe423d9a1f471243eaabc5e0506741b227b3152939ba","description":"Alibaba's Z-Image Turbo is a compact 6B-parameter model that turns prompts into lifelike images in 8 steps or fewer. Suits drafts, social posts and high-volume pipelines, with preset or custom sizes, prompt expansion, acceleration levels, seeds, PNG/JPEG/WebP files and batches of 1-4.","x-model":{"id":"alibaba/z-image-turbo/text-to-image","category":"text-to-image","group":{"id":"alibaba/z-image-turbo","name":"Alibaba: Z-Image Turbo"},"model_url":"https://www.musespan.com/models/alibaba/z-image-turbo/text-to-image","catalog_url":"https://www.musespan.com/v1/models"}},"servers":[{"url":"https://api.musespan.com"}],"security":[{"bearerAuth":[]}],"paths":{"/v1/model-tasks":{"post":{"operationId":"createNativeTask","summary":"Create a native result task","description":"Put model parameters inside input. Maximum request body: 4 MiB. Reuse X-Request-Id only with the same body. Completion does not imply final billing settlement. A model task may first wait in our queue (status queued, with an estimated queue_position) while the account or the platform is at its limit of tasks running at once; one still waiting 5 minutes after it was submitted ends as failed with error.code queue_timeout and is not charged. Once sent, a task with no result 15 minutes after it was accepted, or whose submission is still not confirmed 15 minutes after it was sent, ends as failed with error.code generation_timeout and is not charged (any hold is refunded in full); poll for up to 25 minutes to see the final status. To try again, submit a new task with a new X-Request-Id: the old ID keeps returning the failed task. A task still waiting in the queue (status queued with queue_position) can be cancelled with POST /v1/model-tasks/{id}/cancel and the same API key: it ends as failed with error.code cancelled and its hold is refunded in full. A task no longer waiting in the queue (being sent, sent, or ended) cannot be cancelled (409 task_not_cancellable). A task that could not be started because generation is temporarily unavailable ends at once as failed with error.code upstream_unavailable and is not charged (any hold is refunded in full); it does not mean your input was wrong. Try again later with a new X-Request-Id: the old ID keeps returning the failed task. Task objects may gain fields in later versions: ignore fields you do not know. Price: $0.005 per megapixel. Billed by the actual pixels of each output image; larger sizes and more images cost more. 1024×1024 is about 1 megapixel. Each request temporarily reserves $0.01; you are charged for actual usage, usually within a minute: any unused amount is released and any usage above it is charged to your balance, even if that takes it below zero; while your balance is below zero, new requests are paused until a top-up covers it. Failed generations are not charged.","parameters":[{"name":"X-Request-Id","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,128}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input"],"additionalProperties":false,"properties":{"model":{"const":"alibaba/z-image-turbo/text-to-image"},"input":{"allOf":[{"not":{"required":["enable_safety_checker"]}},{"not":{"required":["sync_mode"]}}],"properties":{"acceleration":{"default":"regular","description":"The acceleration level to use.","enum":["none","regular","high"],"title":"Acceleration","type":"string"},"enable_prompt_expansion":{"default":false,"description":"Whether to enable prompt expansion. Note: this will increase the price by 0.0025 credits per request.","title":"Enable Prompt Expansion","type":"boolean"},"image_size":{"anyOf":[{"$ref":"#/components/schemas/Input_ImageSize"},{"enum":["square_hd","square","portrait_4_3","portrait_16_9","landscape_4_3","landscape_16_9"],"type":"string"}],"default":"landscape_4_3","description":"The size of the generated image.","title":"Image Size"},"num_images":{"default":1,"description":"The number of images to generate.","maximum":4,"minimum":1,"title":"Number of Images","type":"integer"},"num_inference_steps":{"default":8,"description":"The number of inference steps to perform.","maximum":8,"minimum":1,"title":"Number of Inference Steps","type":"integer"},"output_format":{"default":"png","description":"The format of the generated image.","enum":["jpeg","png","webp"],"title":"Output Format","type":"string"},"prompt":{"description":"The prompt to generate an image from.","examples":["A hyper-realistic, close-up portrait of a tribal elder from the Omo Valley, painted with intricate white chalk patterns and adorned with a headdress made of dried flowers, seed pods, and rusted bottle caps. The focus is razor-sharp on the texture of the skin, showing every pore, wrinkle, and scar that tells a story of survival. The background is a blurred, smoky hut interior, with the warm glow of a cooking fire reflecting in the subject's dark, soulful eyes. Shot on a Leica M6 with Kodak Portra 400 film grain aesthetic."],"title":"Prompt","type":"string"},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"\n            The same seed and the same prompt given to the same version of the model\n            will output the same image every time.\n        ","title":"Seed"}},"required":["prompt"],"title":"ZImageTurboTextToImageInput","type":"object"}}}}}},"responses":{"202":{"description":"Owned task. Only completed tasks include output; null and empty results can be successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NativeTask"}}}},"400":{"description":"Invalid request: missing or malformed X-Request-Id, or input that does not match the model schema. Nothing was created. native_model_unavailable: this model is served on a different endpoint; read its openapi_url in GET /v1/models, and use an ID from suggested_models there.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"402":{"description":"Insufficient balance. Nothing was created; top up and resend with the same X-Request-Id.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"403":{"description":"This API key cannot use this model.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"404":{"description":"model_not_found: this ID cannot be called with this API key. Nothing was created. Do not resend it unchanged: use an ID from suggested_models or an id from GET /v1/models.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"409":{"description":"request_id_conflict: this X-Request-Id was used with a different request body (another spelling of the model ID also counts as a different body). Resend byte-identical bytes, or use a new X-Request-Id.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"429":{"description":"Too many requests, or too many of your tasks already waiting in the queue (too_many_active_tasks). Tasks beyond the number your account may run at once wait in the queue instead of being refused; this means the queue itself is full. Back off a moment, then resend with the same X-Request-Id.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"503":{"description":"Temporarily unavailable. Retry later with the same X-Request-Id.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}}}}},"/v1/model-tasks/{id}":{"get":{"operationId":"getNativeTask","summary":"Get an owned task","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Owned task. Only completed tasks include output; null and empty results can be successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NativeTask"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"404":{"description":"task_not_found: no task with this ID exists for this API key. If the POST may not have arrived, resend the exact same body with the same X-Request-Id instead of polling.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"429":{"description":"Too many requests. Back off, then query the same task again.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"503":{"description":"Temporarily unavailable. Query the same task again later.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}}}}},"/v1/model-tasks/{id}/cancel":{"post":{"operationId":"cancelNativeTask","summary":"Cancel a task still waiting in the queue","description":"A task still waiting in the queue (status queued with queue_position) can be cancelled with POST /v1/model-tasks/{id}/cancel and the same API key: it ends as failed with error.code cancelled and its hold is refunded in full. A task no longer waiting in the queue (being sent, sent, or ended) cannot be cancelled (409 task_not_cancellable).","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The cancelled task: status failed with error.code cancelled. Cancelling it again returns the same task.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NativeTask"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"404":{"description":"task_not_found: no task with this ID exists for this API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"409":{"description":"task_not_cancellable: the task is no longer waiting in the queue (being sent, sent, or ended). The body includes its current status; keep polling it.","content":{"application/json":{"schema":{"type":"object","required":["error","status"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}},"status":{"enum":["queued","running","completed","failed"],"description":"The task status now; keep polling the task."}}}}}},"429":{"description":"Too many requests. Back off, then try again.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"503":{"description":"Temporarily unavailable. Try again later.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}}}}},"/v1/model-tasks/{id}/artifacts/{index}":{"get":{"operationId":"downloadNativeArtifact","summary":"Download a declared result file using the task owner API key","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"index","in":"path","required":true,"schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"Attachment download. Never execute SVG/HTML result bytes.","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"404":{"description":"artifact_not_found: the task is not completed yet, the index is not one the completed task declares, or the task was submitted with another API key. Poll GET /v1/model-tasks/{id} until status is completed, then download only the indexes its output declares, with the API key that submitted the task.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"429":{"description":"Too many requests or downloads at once. Back off, then download the same file again.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"503":{"description":"Temporarily unavailable. Download the same file again later.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API key"}},"schemas":{"NativeOutput":{"$ref":"#/components/schemas/Output_ZImageTurboOutput"},"NativeTask":{"description":"Task objects may gain fields in later versions: ignore fields you do not know.","anyOf":[{"type":"object","required":["id","model","status"],"additionalProperties":true,"properties":{"id":{"type":"string"},"model":{"const":"alibaba/z-image-turbo/text-to-image"},"status":{"enum":["queued","running"]},"queue_position":{"type":"integer","minimum":1,"description":"Only while the task waits in the queue: its estimated place (1 = next). An estimate that can change; the account may also be at its own limit of tasks running at once, in which case its tasks wait in order for one of its own to finish."}}},{"type":"object","required":["id","model","status","output"],"additionalProperties":true,"properties":{"id":{"type":"string"},"model":{"const":"alibaba/z-image-turbo/text-to-image"},"status":{"const":"completed"},"output":{"$ref":"#/components/schemas/NativeOutput"}}},{"type":"object","required":["id","model","status","error"],"additionalProperties":true,"properties":{"id":{"type":"string"},"model":{"const":"alibaba/z-image-turbo/text-to-image"},"status":{"const":"failed"},"error":{"type":"object","required":["code"],"properties":{"code":{"type":"string","description":"Stable machine-readable failure code; keep a branch for unknown codes. A failed task is not charged, and a retry needs a new X-Request-Id. generation_timeout: no result 15 minutes after the task was accepted, or the submission was not confirmed within 15 minutes. upstream_unavailable: generation was temporarily unavailable and the task was not started; try again later. invalid_parameters: the input was rejected; error.issues lists each rejected field and its rule code. Fix them and submit a new task. Model tasks only, ended before they were sent: cancelled: you cancelled the queued task. queue_timeout: still waiting in the queue 5 minutes after submission. model_unavailable_while_queued: the model became unavailable while the task was queued. insufficient_balance: the balance went below zero while the task was queued; top up first."},"message":{"type":"string"},"issues":{"type":"array","maxItems":8,"items":{"type":"object","required":["field","rule"],"additionalProperties":false,"properties":{"field":{"type":"string","maxLength":256},"rule":{"type":"string","enum":["required","string","integer","number","boolean","array","object","allowed_value","range","length","multiple","invalid","unsupported_value","file_size","file_format","file_unreadable","duration","content_policy"]}}},"description":"Present only with code invalid_parameters: each rejected input field (field is its path in input, for example voice or image_urls[0]) and a rule code. Free-form error text is never returned."}}}}}]},"Input_ImageSize":{"properties":{"height":{"default":512,"description":"The height of the generated image.","exclusiveMinimum":0,"maximum":14142,"title":"Height","type":"integer"},"width":{"default":512,"description":"The width of the generated image.","exclusiveMinimum":0,"maximum":14142,"title":"Width","type":"integer"}},"title":"ImageSize","type":"object"},"Output_ImageFile":{"properties":{"content_type":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The mime type of the file.","examples":["image/png"],"title":"Content Type"},"file_name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The name of the file. It will be auto-generated if not provided.","examples":["z9RV14K95DvU.png"],"title":"File Name"},"file_size":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"The size of the file in bytes.","examples":[4404019],"title":"File Size"},"height":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"The height of the image","title":"Height"},"url":{"description":"The URL where the file can be downloaded from.","title":"Url","type":"string"},"width":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"The width of the image","title":"Width"}},"required":["url"],"title":"ImageFile","type":"object"},"Output_ZImageTurboOutput":{"properties":{"has_nsfw_concepts":{"description":"Whether the generated images contain NSFW concepts.","items":{"type":"boolean"},"title":"Has Nsfw Concepts","type":"array"},"images":{"description":"The generated image files info.","items":{"$ref":"#/components/schemas/Output_ImageFile"},"title":"Images","type":"array"},"prompt":{"description":"The prompt used for generating the image.","title":"Prompt","type":"string"},"seed":{"description":"Seed of the generated Image. It will be the same value of the one passed in the input or the randomly generated that was used in case none was passed.","title":"Seed","type":"integer"},"timings":{"additionalProperties":{"type":"number"},"description":"The timings of the generation process.","title":"Timings","type":"object"}},"required":["images","timings","seed","has_nsfw_concepts","prompt"],"title":"ZImageTurboOutput","type":"object"}}}}