{"openapi":"3.1.0","info":{"title":"Black Forest Labs: FLUX.1 Kontext Pro: Text To Image","version":"sha256:903b990b3adeb84f06f37a4edaa3bdf20c45b32d18aba2be4e023bc5dba5ccd1","description":"Black Forest Labs FLUX.1 Kontext Pro also generates images from text, with strong prompt adherence and consistent, polished results. Pick from 9 aspect ratios, adjust guidance from 1 to 20, turn on prompt enhancement and create up to 4 images per call.","x-model":{"id":"black-forest-labs/flux-kontext-pro/text-to-image","category":"text-to-image","group":{"id":"black-forest-labs/flux-kontext-pro","name":"Black Forest Labs: FLUX.1 Kontext Pro"},"model_url":"https://www.musespan.com/models/black-forest-labs/flux-kontext-pro/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.04 per image. Billed by the number of images actually generated. Each request temporarily reserves $0.04; 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":"black-forest-labs/flux-kontext-pro/text-to-image"},"input":{"allOf":[{"not":{"required":["safety_tolerance"]}},{"not":{"required":["sync_mode"]}}],"properties":{"aspect_ratio":{"default":"1:1","description":"The aspect ratio of the generated image.","enum":["21:9","16:9","4:3","3:2","1:1","2:3","3:4","9:16","9:21"],"title":"Aspect Ratio","type":"string"},"enhance_prompt":{"default":false,"description":"Whether to enhance the prompt for better results.","title":"Enhance Prompt","type":"boolean"},"guidance_scale":{"default":3.5,"description":"\n            The CFG (Classifier Free Guidance) scale is a measure of how close you want\n            the model to stick to your prompt when looking for a related image to show you.\n        ","maximum":20,"minimum":1,"title":"Guidance scale (CFG)","type":"number"},"num_images":{"default":1,"description":"The number of images to generate.","maximum":4,"minimum":1,"title":"Num Images","type":"integer"},"output_format":{"default":"jpeg","description":"The format of the generated image.","enum":["jpeg","png"],"title":"Output Format","type":"string"},"prompt":{"description":"The prompt to generate an image from.","examples":["Extreme close-up of a single tiger eye, direct frontal view. Detailed iris and pupil. Sharp focus on eye texture and color. Natural lighting to capture authentic eye shine and depth. The word \"FLUX\" is painted over it in big, white brush strokes with visible texture."],"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":"FluxProTextToImageInputWithAR","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_FluxProKontextTextToImageOutput"},"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":"black-forest-labs/flux-kontext-pro/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":"black-forest-labs/flux-kontext-pro/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":"black-forest-labs/flux-kontext-pro/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."}}}}}]},"Output_FluxProKontextTextToImageOutput":{"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_registry__image__fast_sdxl__models__Image"},"title":"Images","type":"array"},"prompt":{"description":"The prompt used for generating the image.","title":"Prompt","type":"string"},"seed":{"description":"\n            Seed of the generated Image. It will be the same value of the one passed in the\n            input or the randomly generated that was used in case none was passed.\n        ","title":"Seed","type":"integer"},"timings":{"additionalProperties":{"type":"number"},"title":"Timings","type":"object"}},"required":["images","timings","seed","has_nsfw_concepts","prompt"],"title":"Output","type":"object"},"Output_registry__image__fast_sdxl__models__Image":{"properties":{"content_type":{"anyOf":[{"type":"string"},{"type":"null"}],"default":"image/jpeg","title":"Content Type"},"height":{"title":"Height","type":"integer"},"url":{"title":"Url","type":"string"},"width":{"title":"Width","type":"integer"}},"required":["url","width","height"],"title":"Image","type":"object"}}}}