{"openapi":"3.1.0","info":{"title":"BFXN API","version":"1.0.0","summary":"One API for video and music generation.","description":"Create generation tasks for video and music models, track them, and receive signed webhooks. All amounts are integer micros (1 USD = 1,000,000). Agent-readable guide: https://bfxn.com/docs/agent-quickstart.md"},"servers":[{"url":"https://api.bfxn.com","description":"Production"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Models"},{"name":"Quotes"},{"name":"Assets"},{"name":"Tasks"},{"name":"Billing"}],"paths":{"/v1/models":{"get":{"operationId":"listModels","tags":["Models"],"summary":"List the models and modes enabled for your workspace","responses":{"200":{"description":"Models","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelList"}}}},"401":{"description":"Missing, invalid or revoked API key (`invalid_api_key`, `api_key_revoked`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Source IP not allowed for this key (`ip_not_allowed`), model not enabled, or permission denied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Workspace concurrency or model queue limit reached. Retry after the `Retry-After` header with the same `Idempotency-Key`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Temporarily unavailable or model paused. Retry after `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/models/{model_id}/schema":{"get":{"operationId":"getModelSchema","tags":["Models"],"summary":"Get the input JSON Schema for each mode of a model","parameters":[{"name":"model_id","in":"path","required":true,"schema":{"type":"string","example":"kling-4.0"}}],"responses":{"200":{"description":"Schemas","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelSchema"}}}},"401":{"description":"Missing, invalid or revoked API key (`invalid_api_key`, `api_key_revoked`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Source IP not allowed for this key (`ip_not_allowed`), model not enabled, or permission denied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Model not available.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Workspace concurrency or model queue limit reached. Retry after the `Retry-After` header with the same `Idempotency-Key`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Temporarily unavailable or model paused. Retry after `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/quotes":{"post":{"operationId":"createQuote","tags":["Quotes"],"summary":"Price a request without charging (free, valid for 30 minutes)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteRequest"}}}},"responses":{"200":{"description":"Quote","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"401":{"description":"Missing, invalid or revoked API key (`invalid_api_key`, `api_key_revoked`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Source IP not allowed for this key (`ip_not_allowed`), model not enabled, or permission denied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Invalid parameters (`invalid_parameter` with `error.param`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Workspace concurrency or model queue limit reached. Retry after the `Retry-After` header with the same `Idempotency-Key`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Temporarily unavailable or model paused. Retry after `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/assets/uploads":{"post":{"operationId":"createAssetUpload","tags":["Assets"],"summary":"Get a one-time upload URL for an input image (PNG or JPEG, up to 10 MB)","description":"PUT the exact file bytes to `upload.url` with the returned `upload.headers` within 15 minutes, then call `POST /v1/assets/{asset_id}/complete`. Images must be 300-3840 px per side, shorter side at most 2160 px, aspect ratio 0.4-2.5. Assets can be used for 30 days.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetUploadRequest"}}}},"responses":{"201":{"description":"Upload URL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetUpload"}}}},"401":{"description":"Missing, invalid or revoked API key (`invalid_api_key`, `api_key_revoked`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Source IP not allowed for this key (`ip_not_allowed`), model not enabled, or permission denied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Invalid `content_type` or `bytes`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Workspace concurrency or model queue limit reached. Retry after the `Retry-After` header with the same `Idempotency-Key`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Temporarily unavailable or model paused. Retry after `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/assets/{asset_id}/complete":{"post":{"operationId":"completeAssetUpload","tags":["Assets"],"summary":"Verify an uploaded image and mark it ready (safe to retry)","parameters":[{"name":"asset_id","in":"path","required":true,"schema":{"type":"string","example":"asset_example"}}],"responses":{"200":{"description":"Asset (`ready` or `rejected` with `reject_reason`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Asset"}}}},"401":{"description":"Missing, invalid or revoked API key (`invalid_api_key`, `api_key_revoked`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Source IP not allowed for this key (`ip_not_allowed`), model not enabled, or permission denied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Asset not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"`asset_not_ready`: the file has not been uploaded yet, or the upload expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Workspace concurrency or model queue limit reached. Retry after the `Retry-After` header with the same `Idempotency-Key`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Temporarily unavailable or model paused. Retry after `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/assets/import":{"post":{"operationId":"importAsset","tags":["Assets"],"summary":"Import an input image from a public HTTPS URL","description":"The platform downloads the file (public addresses only, up to 3 redirects, 30 seconds) and verifies it. If the download keeps failing, upload the file instead.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetImportRequest"}}}},"responses":{"201":{"description":"Ready asset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Asset"}}}},"401":{"description":"Missing, invalid or revoked API key (`invalid_api_key`, `api_key_revoked`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Source IP not allowed for this key (`ip_not_allowed`), model not enabled, or permission denied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"`asset_rejected`: the URL is not allowed, unreachable, or the file does not meet the image requirements.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Workspace concurrency or model queue limit reached. Retry after the `Retry-After` header with the same `Idempotency-Key`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Temporary download failure (`service_unavailable`); retry later or upload the file.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/assets/{asset_id}":{"get":{"operationId":"getAsset","tags":["Assets"],"summary":"Get an asset's status","parameters":[{"name":"asset_id","in":"path","required":true,"schema":{"type":"string","example":"asset_example"}}],"responses":{"200":{"description":"Asset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Asset"}}}},"401":{"description":"Missing, invalid or revoked API key (`invalid_api_key`, `api_key_revoked`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Source IP not allowed for this key (`ip_not_allowed`), model not enabled, or permission denied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Asset not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Workspace concurrency or model queue limit reached. Retry after the `Retry-After` header with the same `Idempotency-Key`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Temporarily unavailable or model paused. Retry after `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tasks":{"post":{"operationId":"createTask","tags":["Tasks"],"summary":"Create a generation task (reserves the maximum cost)","description":"Requires an `Idempotency-Key` header. Retrying with the same key and body returns the original task (`Idempotent-Replayed: true`); the same key with a different body returns `409 idempotency_conflict`. Keys are kept for 24 hours.","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":1,"maxLength":255},"description":"Unique per logical request, 1-255 visible ASCII characters."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTaskRequest"}}}},"responses":{"202":{"description":"Accepted (also returned for an idempotent replay)","headers":{"Idempotent-Replayed":{"schema":{"type":"string","enum":["true"]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTaskResponse"}}}},"401":{"description":"Missing, invalid or revoked API key (`invalid_api_key`, `api_key_revoked`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Insufficient balance (`insufficient_balance`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Source IP not allowed for this key (`ip_not_allowed`), model not enabled, or permission denied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`idempotency_conflict`, `quote_expired` or `quote_mismatch`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Invalid parameters, `budget_exceeded`, or invalid `callback_url`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Workspace concurrency or model queue limit reached. Retry after the `Retry-After` header with the same `Idempotency-Key`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Temporarily unavailable or model paused. Retry after `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listTasks","tags":["Tasks"],"summary":"List tasks, newest first","parameters":[{"name":"model","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"$ref":"#/components/schemas/TaskStatus"}},{"name":"created_after","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"created_before","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"cursor","in":"query","schema":{"type":"string"},"description":"`next_cursor` from the previous page."}],"responses":{"200":{"description":"Page of tasks (without download links)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskList"}}}},"401":{"description":"Missing, invalid or revoked API key (`invalid_api_key`, `api_key_revoked`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Source IP not allowed for this key (`ip_not_allowed`), model not enabled, or permission denied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Workspace concurrency or model queue limit reached. Retry after the `Retry-After` header with the same `Idempotency-Key`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Temporarily unavailable or model paused. Retry after `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tasks/{task_id}":{"get":{"operationId":"getTask","tags":["Tasks"],"summary":"Get a task, its outputs and billing","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","example":"task_example"}}],"responses":{"200":{"description":"Task","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Task"}}}},"401":{"description":"Missing, invalid or revoked API key (`invalid_api_key`, `api_key_revoked`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Source IP not allowed for this key (`ip_not_allowed`), model not enabled, or permission denied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Task not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Workspace concurrency or model queue limit reached. Retry after the `Retry-After` header with the same `Idempotency-Key`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Temporarily unavailable or model paused. Retry after `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tasks/{task_id}/cancel":{"post":{"operationId":"cancelTask","tags":["Tasks"],"summary":"Cancel a task that has not been sent to the model yet","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","example":"task_example"}}],"responses":{"200":{"description":"Canceled task (the reservation is released)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Task"}}}},"401":{"description":"Missing, invalid or revoked API key (`invalid_api_key`, `api_key_revoked`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Source IP not allowed for this key (`ip_not_allowed`), model not enabled, or permission denied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Task not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`task_not_cancelable`: the task was already sent to the model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Workspace concurrency or model queue limit reached. Retry after the `Retry-After` header with the same `Idempotency-Key`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Temporarily unavailable or model paused. Retry after `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/balance":{"get":{"operationId":"getBalance","tags":["Billing"],"summary":"Get available and reserved balance and concurrency","responses":{"200":{"description":"Balance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Balance"}}}},"401":{"description":"Missing, invalid or revoked API key (`invalid_api_key`, `api_key_revoked`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Source IP not allowed for this key (`ip_not_allowed`), model not enabled, or permission denied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Workspace concurrency or model queue limit reached. Retry after the `Retry-After` header with the same `Idempotency-Key`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Temporarily unavailable or model paused. Retry after `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{"taskEvent":{"post":{"operationId":"taskEventWebhook","summary":"Sent to the task's callback_url when it reaches a final state","description":"Signed with Standard Webhooks headers `webhook-id`, `webhook-timestamp`, `webhook-signature` (space-separated `v1,<base64 HMAC-SHA256>` of `{id}.{timestamp}.{raw body}`). Verify, check the timestamp is within 5 minutes, dedupe by `webhook-id`, then fetch the task for download links. Non-2xx responses are retried after 5, 30 and 120 seconds. Redirects are not followed.","parameters":[{"name":"webhook-id","in":"header","required":true,"schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"webhook-signature","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Acknowledge receipt"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Workspace API key: `Authorization: Bearer bfxn_live_...`"}},"schemas":{"Input_kling_4_0_text_to_video":{"type":"object","additionalProperties":false,"required":["prompt"],"properties":{"prompt":{"type":"string","minLength":1,"maxLength":2500,"pattern":"\\S","description":"What the video should show."},"resolution":{"type":"string","enum":["720p","1080p"],"default":"720p"},"duration_seconds":{"type":"integer","enum":[5,10,15],"default":5},"aspect_ratio":{"type":"string","enum":["16:9","9:16","1:1","21:9"],"default":"16:9"}},"title":"Kling 4.0 · Text to video","x-schema-version":"2026-11-29"},"Input_kling_4_0_image_to_video":{"type":"object","additionalProperties":false,"required":["image_asset_id"],"properties":{"image_asset_id":{"type":"string","pattern":"^asset_[A-Za-z0-9]{8,40}$","description":"ID of a ready image asset (PNG or JPEG) to use as the first frame. Upload it with POST /v1/assets/uploads or /v1/assets/import first."},"prompt":{"type":"string","maxLength":2500,"default":"","description":"How the scene should move. Optional; the aspect ratio follows the image."},"resolution":{"type":"string","enum":["720p","1080p"],"default":"720p"},"duration_seconds":{"type":"integer","enum":[5,10,15],"default":5}},"title":"Kling 4.0 · Image to video","x-schema-version":"2026-11-29"},"Input_muse_video_text_to_video":{"type":"object","additionalProperties":false,"required":["prompt"],"properties":{"prompt":{"type":"string","minLength":1,"maxLength":4000,"pattern":"\\S","description":"What the video should show."},"resolution":{"type":"string","enum":["720p","1080p"],"default":"720p"},"duration_seconds":{"type":"integer","enum":[5,10],"default":5},"aspect_ratio":{"type":"string","enum":["16:9","9:16","1:1"],"default":"16:9"},"generate_audio":{"type":"boolean","description":"Ask for a synced soundtrack. Omit to let the model decide."}},"title":"Muse Video · Text to video","x-schema-version":"2026-11-29"},"Input_muse_video_image_to_video":{"type":"object","additionalProperties":false,"required":["image_asset_id","prompt"],"properties":{"image_asset_id":{"type":"string","pattern":"^asset_[A-Za-z0-9]{8,40}$","description":"ID of a ready image asset (PNG or JPEG) to use as the first frame. Upload it with POST /v1/assets/uploads or /v1/assets/import first."},"prompt":{"type":"string","minLength":1,"maxLength":4000,"pattern":"\\S","description":"How the scene should move."},"resolution":{"type":"string","enum":["720p","1080p"],"default":"720p"},"duration_seconds":{"type":"integer","enum":[5,10],"default":5},"aspect_ratio":{"type":"string","enum":["16:9","9:16","1:1"],"description":"Optional; by default the model follows the image."},"generate_audio":{"type":"boolean","description":"Ask for a synced soundtrack. Omit to let the model decide."}},"title":"Muse Video · Image to video","x-schema-version":"2026-11-29"},"Input_suno_v6_text_to_music":{"type":"object","additionalProperties":false,"required":["prompt"],"properties":{"prompt":{"type":"string","minLength":1,"maxLength":500,"pattern":"\\S","description":"Describe the song; lyrics are written for you."},"instrumental":{"type":"boolean","default":false,"description":"No vocals."}},"title":"Suno v6 · Text to music","x-schema-version":"2026-11-29"},"Input_suno_v6_custom":{"type":"object","additionalProperties":false,"required":["lyrics","style","title"],"properties":{"lyrics":{"type":"string","maxLength":5000,"description":"Lyrics; section tags like [Verse] and [Chorus] are supported. May be empty for instrumentals."},"style":{"type":"string","minLength":1,"maxLength":200,"description":"Comma-separated style tags, e.g. \"pop, female vocals, upbeat\"."},"title":{"type":"string","minLength":1,"maxLength":80},"exclude_styles":{"type":"string","maxLength":200,"description":"Styles to avoid."},"instrumental":{"type":"boolean","default":false}},"title":"Suno v6 · Custom lyrics and style","x-schema-version":"2026-11-29"},"Error":{"type":"object","required":["request_id","error"],"properties":{"request_id":{"type":"string"},"task_id":{"type":"string","description":"Present when the error relates to an existing task."},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","example":"invalid_parameter"},"message":{"type":"string"},"param":{"type":"string","description":"Field path for validation errors, e.g. `input.duration_seconds`."},"retry_after_s":{"type":"integer"}}}}},"TaskStatus":{"type":"string","enum":["queued","running","finalizing","succeeded","failed","canceled"]},"ModelList":{"type":"object","properties":{"request_id":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["video","audio"]},"modes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"billing_unit":{"type":"string","enum":["second","item","run"]},"schema_version":{"type":"string"}}}}}}}}},"ModelSchema":{"type":"object","properties":{"request_id":{"type":"string"},"model":{"type":"string"},"modes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"schema_version":{"type":"string"},"billing_unit":{"type":"string"},"input_schema":{"type":"object","description":"JSON Schema for `input`."}}}}}},"QuoteRequest":{"oneOf":[{"type":"object","title":"kling-4.0 / text_to_video","required":["model","mode","input"],"properties":{"model":{"const":"kling-4.0"},"mode":{"const":"text_to_video"},"input":{"$ref":"#/components/schemas/Input_kling_4_0_text_to_video"}}},{"type":"object","title":"kling-4.0 / image_to_video","required":["model","mode","input"],"properties":{"model":{"const":"kling-4.0"},"mode":{"const":"image_to_video"},"input":{"$ref":"#/components/schemas/Input_kling_4_0_image_to_video"}}},{"type":"object","title":"muse-video / text_to_video","required":["model","mode","input"],"properties":{"model":{"const":"muse-video"},"mode":{"const":"text_to_video"},"input":{"$ref":"#/components/schemas/Input_muse_video_text_to_video"}}},{"type":"object","title":"muse-video / image_to_video","required":["model","mode","input"],"properties":{"model":{"const":"muse-video"},"mode":{"const":"image_to_video"},"input":{"$ref":"#/components/schemas/Input_muse_video_image_to_video"}}},{"type":"object","title":"suno-v6 / text_to_music","required":["model","mode","input"],"properties":{"model":{"const":"suno-v6"},"mode":{"const":"text_to_music"},"input":{"$ref":"#/components/schemas/Input_suno_v6_text_to_music"}}},{"type":"object","title":"suno-v6 / custom","required":["model","mode","input"],"properties":{"model":{"const":"suno-v6"},"mode":{"const":"custom"},"input":{"$ref":"#/components/schemas/Input_suno_v6_custom"}}}]},"Quote":{"type":"object","properties":{"request_id":{"type":"string"},"quote_id":{"type":"string"},"model":{"type":"string"},"mode":{"type":"string"},"input":{"type":"object","description":"Normalized input with defaults applied."},"currency":{"type":"string","const":"USD"},"price_version":{"type":"string"},"unit":{"type":"string"},"quantity":{"type":"integer"},"unit_price_micros":{"type":"integer"},"amount_micros":{"type":"integer"},"max_amount_micros":{"type":"integer"},"expires_at":{"type":"string","format":"date-time"}}},"CreateTaskRequest":{"allOf":[{"oneOf":[{"type":"object","title":"kling-4.0 / text_to_video","required":["model","mode","input"],"properties":{"model":{"const":"kling-4.0"},"mode":{"const":"text_to_video"},"input":{"$ref":"#/components/schemas/Input_kling_4_0_text_to_video"}}},{"type":"object","title":"kling-4.0 / image_to_video","required":["model","mode","input"],"properties":{"model":{"const":"kling-4.0"},"mode":{"const":"image_to_video"},"input":{"$ref":"#/components/schemas/Input_kling_4_0_image_to_video"}}},{"type":"object","title":"muse-video / text_to_video","required":["model","mode","input"],"properties":{"model":{"const":"muse-video"},"mode":{"const":"text_to_video"},"input":{"$ref":"#/components/schemas/Input_muse_video_text_to_video"}}},{"type":"object","title":"muse-video / image_to_video","required":["model","mode","input"],"properties":{"model":{"const":"muse-video"},"mode":{"const":"image_to_video"},"input":{"$ref":"#/components/schemas/Input_muse_video_image_to_video"}}},{"type":"object","title":"suno-v6 / text_to_music","required":["model","mode","input"],"properties":{"model":{"const":"suno-v6"},"mode":{"const":"text_to_music"},"input":{"$ref":"#/components/schemas/Input_suno_v6_text_to_music"}}},{"type":"object","title":"suno-v6 / custom","required":["model","mode","input"],"properties":{"model":{"const":"suno-v6"},"mode":{"const":"custom"},"input":{"$ref":"#/components/schemas/Input_suno_v6_custom"}}}]},{"type":"object","properties":{"quote_id":{"type":"string","description":"Optional. Locks the quoted price if it is still valid and matches the input."},"max_amount_micros":{"type":"integer","minimum":0,"description":"Optional budget cap. Rejected with `budget_exceeded` if the task may cost more."},"callback_url":{"type":"string","format":"uri","description":"Optional public https URL (default port) for signed webhooks."},"metadata":{"type":"object","maxProperties":16,"additionalProperties":{"type":"string","maxLength":500},"description":"Up to 16 string values, echoed back in tasks and webhooks."}}}]},"CreateTaskResponse":{"type":"object","properties":{"request_id":{"type":"string"},"task_id":{"type":"string"},"status":{"$ref":"#/components/schemas/TaskStatus"},"status_url":{"type":"string","example":"/v1/tasks/task_example"},"task":{"$ref":"#/components/schemas/Task"}}},"AssetUploadRequest":{"type":"object","required":["content_type","bytes"],"properties":{"filename":{"type":"string","maxLength":200},"content_type":{"type":"string","enum":["image/png","image/jpeg"]},"bytes":{"type":"integer","minimum":1,"maximum":10485760,"description":"Exact file size; the upload URL only accepts this size."}}},"AssetImportRequest":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri","maxLength":8192},"filename":{"type":"string","maxLength":200}}},"Asset":{"type":"object","properties":{"request_id":{"type":"string"},"asset_id":{"type":"string","example":"asset_01HZY8K2M4"},"status":{"type":"string","enum":["pending_upload","ready","rejected","expired"]},"kind":{"type":"string","enum":["image"]},"source":{"type":"string","enum":["upload","import"]},"mime_type":{"type":"string"},"bytes":{"type":["integer","null"]},"width":{"type":["integer","null"]},"height":{"type":["integer","null"]},"filename":{"type":["string","null"]},"reject_reason":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time","description":"After this time the asset cannot be used for new tasks."}}},"AssetUpload":{"type":"object","properties":{"request_id":{"type":"string"},"asset":{"$ref":"#/components/schemas/Asset"},"upload":{"type":"object","properties":{"method":{"type":"string","enum":["PUT"]},"url":{"type":"string","format":"uri"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Send these headers with the PUT, unchanged."},"expires_at":{"type":"string","format":"date-time"}}}}},"Task":{"type":"object","properties":{"request_id":{"type":"string"},"task_id":{"type":"string"},"status":{"$ref":"#/components/schemas/TaskStatus"},"status_reason":{"type":["string","null"],"enum":["waiting_for_capacity","awaiting_confirmation","provider_busy","preparing_assets","retrying_delivery",null]},"model":{"type":"string"},"mode":{"type":"string"},"input":{"type":"object"},"error":{"type":["object","null"],"properties":{"code":{"type":"string","enum":["content_rejected","generation_failed","delivery_failed","asset_fetch_failed","timeout"]},"message":{"type":"string"}}},"files_expire_at":{"type":["string","null"],"format":"date-time","description":"Result files are kept until this time (30 days after success by default). After it, the task and billing stay visible but no download links are issued."},"files_expired":{"type":"boolean","description":"True once files_expire_at has passed; outputs then have url = null."},"outputs":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["video","audio"]},"mime_type":{"type":"string"},"url":{"type":["string","null"],"format":"uri","description":"Signed download link, valid for 15 minutes; every task fetch returns a fresh one (omitted in webhooks)."},"expires_at":{"type":["string","null"],"format":"date-time","description":"When the download link expires (omitted in webhooks)."},"bytes":{"type":"integer","description":"File size in bytes."},"duration_seconds":{"type":"number","description":"Media length when the model reports it."},"title":{"type":"string","description":"Track title (music models)."}}}},"billing":{"type":"object","properties":{"currency":{"type":"string","const":"USD"},"state":{"type":"string","enum":["reserved","charged","released"]},"price_version":{"type":"string"},"unit":{"type":"string"},"quantity":{"type":"integer"},"max_amount_micros":{"type":"integer"},"charged_micros":{"type":["integer","null"]}}},"callback_url":{"type":["string","null"]},"metadata":{"type":"object","additionalProperties":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"finished_at":{"type":["string","null"],"format":"date-time"}}},"TaskList":{"type":"object","properties":{"request_id":{"type":"string"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Task"}},"next_cursor":{"type":["string","null"]}}},"Balance":{"type":"object","properties":{"request_id":{"type":"string"},"currency":{"type":"string","const":"USD"},"available_micros":{"type":"integer"},"reserved_micros":{"type":"integer"},"concurrency":{"type":"object","properties":{"active":{"type":"integer"},"limit":{"type":"integer"}}}}},"WebhookEvent":{"type":"object","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","description":"Same as the `webhook-id` header; stable across retries."},"type":{"type":"string","enum":["task.succeeded","task.failed","task.canceled","webhook.test"]},"created_at":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"task":{"$ref":"#/components/schemas/Task"}}}}}}}}