{"openapi":"3.1.0","info":{"title":"shuut API","version":"1.0.0","description":"Generate images, videos and audio with the models on shuut.ai. Prices are in credits (1 credit = US$0.01) and are charged from the account's balance, with the same limits, safety rules and concurrency as the web app. Each model's `input` fields: GET /v1/models/{id} → input_schema."},"servers":[{"url":"https://shuut.ai/v1"}],"security":[{"bearer":[]},{"apiKey":[]}],"paths":{"/models":{"get":{"operationId":"listModels","summary":"List models","security":[{},{"bearer":[]},{"apiKey":[]}],"parameters":[{"name":"kind","in":"query","schema":{"type":"string","enum":["image","video","audio"]}}],"responses":{"200":{"description":"Models available through the API in the caller's country.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Model"}}},"required":["object","data"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"451":{"$ref":"#/components/responses/Error"}}}},"/models/{id}":{"get":{"operationId":"getModel","summary":"Get a model with its input_schema","description":"The id contains slashes (e.g. bytedance/seedance-2.5); send it as is.","security":[{},{"bearer":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The model.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelDetail"}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"410":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"451":{"$ref":"#/components/responses/Error"}}}},"/generations":{"post":{"operationId":"createGeneration","summary":"Create a generation","description":"Charges the price once. The price is quoted again inside this call and the generation is made at that price (409 quote_changed only if it moves within the same call — retry with the same Idempotency-Key); an earlier /estimate is not a binding price. Send an Idempotency-Key so a retry never charges twice: the same key with the same body returns the same generation (200, idempotent-replayed: true); a different body is 409 idempotency_conflict. https references are imported as files first (counts toward the daily URL import limit).","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationRequest"}}}},"responses":{"200":{"description":"Replayed: this Idempotency-Key already made this generation. Nothing new was charged.","headers":{"idempotent-replayed":{"schema":{"type":"string","const":"true"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Generation"}}}},"202":{"description":"Created and queued.","headers":{"Location":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Generation"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"410":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"451":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"},"504":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"listGenerations","summary":"List generations made with the API (newest first)","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"cursor","in":"query","schema":{"type":"string"},"description":"next_cursor of the previous page."}],"responses":{"200":{"description":"A page of generations.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Generation"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}},"required":["object","data","has_more","next_cursor"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/generations/estimate":{"post":{"operationId":"estimateGeneration","summary":"Price a generation without creating it","description":"Same body and checks as createGeneration; nothing is charged and no generation is made. https references are imported as files (imported_files) so the real call can reuse them — this stores files and counts toward the daily URL import limit (30 a minute, 300 a day per account).","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationRequest"}}}},"responses":{"200":{"description":"The price.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Estimate"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"451":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}}}},"/generations/{id}":{"get":{"operationId":"getGeneration","summary":"Get a generation (optionally wait for a change)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[0-9A-Za-z]{1,40}$"}},{"name":"wait","in":"query","schema":{"type":"integer","minimum":0,"maximum":20,"default":0},"description":"Seconds to hold the request until the status changes (long poll). An unconfirmed generation is held for the full wait, then read again."}],"responses":{"200":{"description":"The generation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Generation"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/generations/{id}/cancel":{"post":{"operationId":"cancelGeneration","summary":"Cancel a queued generation (full refund)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[0-9A-Za-z]{1,40}$"}}],"responses":{"200":{"description":"Canceled and refunded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Generation"}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/files":{"post":{"operationId":"uploadFile","summary":"Upload a reference file","description":"Images and audio up to 20 MB, video up to 100 MB. Send the raw bytes with their Content-Type, or multipart/form-data with field `file`. The account owner must have accepted the media upload notice once in a browser (otherwise 403 media_consent_required).","requestBody":{"required":true,"content":{"image/*":{"schema":{"type":"string","contentMediaType":"image/*"}},"video/*":{"schema":{"type":"string","contentMediaType":"video/*"}},"audio/*":{"schema":{"type":"string","contentMediaType":"audio/*"}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","contentMediaType":"application/octet-stream"}},"required":["file"]}}}},"responses":{"201":{"description":"Stored.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/File"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/account":{"get":{"operationId":"getAccount","summary":"Balance and concurrency","responses":{"200":{"description":"The account of the API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"401":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/openapi.json":{"get":{"operationId":"getOpenApi","summary":"This document","security":[{}],"responses":{"200":{"description":"OpenAPI 3.1 document."}}}}},"webhooks":{"generation":{"post":{"summary":"A generation ended","description":"Sent once per generation that was created with webhook_url, when it completes, fails or is canceled (a generation whose provider outcome is still being checked — unconfirmed — is not ended yet). Deliveries run every minute. Signed with Standard Webhooks headers: webhook-id (\"<generation id>.<status>\", stable across retries), webhook-timestamp (seconds), webhook-signature (\"v1,<base64 HMAC-SHA256 of '{id}.{timestamp}.{body}' with the base64-decoded secret after 'whsec_'>\"). Get the secret at https://shuut.ai/account#api. Answer 2xx within 5 s. Network errors, timeouts, 408, 429 and 5xx are retried at the first run after 30 s (about 1 min), 2 min, 10 min, 30 min, 1 h, 3 h and 6 h (8 attempts); other 4xx and redirects stop delivery.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received."}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"Authorization: Bearer shuut_sk_…"},"apiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":1,"maxLength":100},"description":"Recommended. Same key + same body = one generation, charged once. A key whose generation failed or was canceled cannot be reused (409 idempotency_key_reused)."}},"responses":{"Error":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code (see the error table in the docs)."},"message":{"type":"string"},"param":{"type":"string","description":"The field at fault, e.g. input.duration."},"retryable":{"type":"boolean"},"retry_after_seconds":{"type":"integer"},"request_id":{"type":"string"}},"required":["code","message","request_id"],"additionalProperties":true}},"required":["error"]},"Money":{"type":"object","properties":{"credits":{"type":"integer"},"usd":{"type":"string","examples":["1.20"]}},"required":["credits","usd"]},"Model":{"type":"object","properties":{"object":{"const":"model"},"id":{"type":"string","examples":["bytedance/seedance-2.5"]},"name":{"type":"string"},"kind":{"type":"string","enum":["image","video","audio"]},"category":{"type":"string","enum":["image","video","voice","music","sfx"]},"description":{"type":["string","null"]},"maker":{"type":["string","null"]},"released":{"type":["string","null"]},"available":{"type":"boolean"},"unavailable_reason":{"type":"string","enum":["region","not_open","unavailable"]},"opens_at":{"type":"string"},"tool":{"type":"string","description":"The shuut web tool that makes the same thing."},"pricing":{"type":"object","properties":{"credits":{"type":["integer","null"],"description":"One run at the default settings. For aspect-ratio-priced models, one 9:16 run. For voice, one line of `per_line.max_chars` characters."},"usd":{"type":["string","null"]},"unit":{"type":"string","enum":["image","second","run"]},"unit_credits":{"type":["integer","null"],"description":"Credits for one unit (one image, one second, or one run), rounded up. A run's price is computed unrounded and rounded up once, so for per-second models `unit_credits × seconds` can be higher than the quote. Use `by_duration` when present, or `/v1/generations/estimate`."},"unit_usd":{"type":["string","null"]},"by_resolution":{"type":"object","additionalProperties":{"type":"integer"},"description":"Credits per unit (one image or one second) at each resolution. A `<resolution>:silent` key is the price without generated audio. Only on models with resolution tiers."},"basis":{"type":"object","description":"The settings `unit_credits` and `by_resolution` are priced at. `aspect_ratio` is set only on models whose price changes with the aspect ratio.","properties":{"resolution":{"type":["string","null"]},"quality":{"type":["string","null"]},"aspect_ratio":{"type":["string","null"]}},"required":["resolution","quality","aspect_ratio"]},"by_aspect_ratio":{"type":"object","additionalProperties":{"type":"integer"},"description":"Credits for one run at each aspect ratio, at the default resolution and quality. Only on image models whose price changes with the aspect ratio."},"per_line":{"type":"object","description":"Voice only. `credits` and `unit_credits` are one line of `max_chars` characters. Every line in a request is priced like its longest line: the price is the longest line's price × the number of lines. The shorter the longest line, the lower the per-line price, down to `min_credits`.","properties":{"max_chars":{"type":"integer"},"min_credits":{"type":"integer"}},"required":["max_chars","min_credits"]},"by_duration":{"type":"object","additionalProperties":{"type":"integer"},"description":"Credits for one run of each length in seconds. Only on models priced per length."},"quote_is_upper_bound":{"const":true,"description":"The quote is an upper bound; the difference to the actual charge is refunded when the generation finishes."},"includes_job_fee":{"const":true,"description":"The per-second price includes a fixed per-job cost, so unit price × seconds is higher than the quote."}},"required":["credits","usd","unit","unit_credits","unit_usd","basis"]}},"required":["object","id","name","kind","available","pricing"]},"ModelDetail":{"allOf":[{"$ref":"#/components/schemas/Model"},{"type":"object","properties":{"capabilities":{"type":"object","properties":{"resolutions":{"type":"array","items":{"type":"string"},"description":"Resolutions this model makes; empty when it has no resolution choice."},"default_resolution":{"type":["string","null"]},"aspect_ratios":{"type":"array","items":{"type":"string"},"description":"Aspect ratios for image and video models; empty otherwise."},"durations":{"type":["object","null"],"description":"Length in seconds for video, music and sound effects; null for images and voice.","properties":{"min":{"type":"number"},"max":{"type":"number"},"allowed":{"type":"array","items":{"type":"number"},"description":"Only these lengths, when set."},"default":{"type":"number"}},"required":["min","max","default"]},"max_outputs":{"type":["integer","null"],"description":"Most files one request makes: images per request, script lines for voice (one file per line), otherwise 1."},"audio":{"type":"string","enum":["none","optional","always"],"description":"Whether the model makes sound: never, on request (`generate_audio`), or always."},"qualities":{"type":"array","items":{"type":"string"},"description":"Quality choices. Only on image models that have them."},"needs_consent":{"type":["string","null"],"enum":["person","voice",null],"description":"Set when input.consent must be true: `person` for a real person's likeness, `voice` for a real person's voice."}}},"input_schema":{"type":"object","description":"JSON Schema (2020-12) of this model's input."},"example_request":{"$ref":"#/components/schemas/GenerationRequest"}},"required":["input_schema"]}]},"GenerationRequest":{"type":"object","properties":{"model":{"type":"string"},"input":{"type":"object","description":"Fields per model: GET /v1/models/{model} → input_schema. Unknown fields are rejected (400 invalid_input with param). Reference files take a shuut file id or a public https URL."},"webhook_url":{"type":"string","format":"uri","maxLength":2048,"description":"Public https URL called once when the generation ends."},"max_cost_credits":{"type":"integer","minimum":0,"description":"Refuse (409 max_cost_exceeded, nothing charged) if the price is higher."}},"required":["model"],"additionalProperties":false},"Output":{"type":"object","properties":{"type":{"type":"string","enum":["image","video","audio"]},"file_id":{"type":"string","description":"Use as a reference in another generation."},"url":{"type":"string","description":"Signed URL, valid until expires_at (24 h). Fetch the generation again for a fresh one."},"original_url":{"type":"string","description":"Full-resolution file when url is a playback copy."},"mime":{"type":"string"},"width":{"type":"integer"},"height":{"type":"integer"},"duration":{"type":"number"},"fps":{"type":"number"},"thumbnail_url":{"type":"string"},"expires_at":{"type":"string","format":"date-time"}},"required":["type","url","mime","expires_at"]},"Generation":{"type":"object","properties":{"object":{"const":"generation"},"id":{"type":"string","pattern":"^[0-9A-Za-z]{1,40}$"},"model":{"type":"string"},"status":{"type":"string","enum":["queued","processing","completed","failed","canceled"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"cost":{"type":"object","properties":{"credits":{"type":"integer"},"usd":{"type":"string"},"refunded_credits":{"type":"integer"}},"required":["credits","usd","refunded_credits"]},"outputs":{"type":"array","items":{"$ref":"#/components/schemas/Output"}},"error":{"type":["object","null"],"properties":{"code":{"type":"string"},"message":{"type":"string"}}},"unconfirmed":{"type":"boolean","description":"Present (true) while the provider's outcome is still being checked: status stays processing, results may still change or arrive, and the unconfirmed part is not refunded yet. Do not resubmit; check again after poll_after_seconds."},"poll_after_seconds":{"type":"integer","description":"With unconfirmed: when to check again (60)."},"webhook":{"type":["object","null"],"properties":{"url":{"type":"string"},"state":{"type":"string","enum":["waiting","due","delivered","failed"]}}},"links":{"type":"object","properties":{"self":{"type":"string"},"cancel":{"type":"string"}}},"adjustments":{"type":"object","description":"Only on create: settings made differently from the request, e.g. duration fitted to an allowed length: { requested, applied }."}},"required":["object","id","model","status","cost","outputs","error","webhook","links"]},"Estimate":{"type":"object","properties":{"object":{"const":"estimate"},"model":{"type":"string"},"cost":{"$ref":"#/components/schemas/Money"},"settings":{"type":"object","description":"What would be made: resolution, aspect_ratio, duration, num_outputs, generate_audio, quality."},"adjustments":{"type":"object"},"balance_credits":{"type":["integer","null"],"description":"Credits this account can spend now: the wallet that pays (the team's for a member creating with the team balance), capped by the member's remaining monthly limit."},"sufficient_balance":{"type":["boolean","null"],"description":"false when the real call would be refused before charging: not enough credits, or blocked_code."},"blocked_code":{"type":"string","enum":["team_member_cap","team_inactive","team_member_paused"],"description":"The error the real call would return before charging."},"limit":{"type":["integer","null"],"description":"With team_member_cap: the member's monthly limit."},"used":{"type":["integer","null"],"description":"With team_member_cap: credits used this month."},"quote_seconds":{"type":"number","description":"Priced at this length because the model may lengthen the clip; a shorter result is refunded the difference."},"quote_is_upper_bound":{"type":"boolean","description":"true when the price is the most you pay: with quote_seconds (the clip may come back shorter), or for models settled at the provider's actual charge when the generation finishes. The difference is refunded. Same meaning as `pricing.quote_is_upper_bound` on the model."},"max_cost_credits":{"type":"integer"},"within_max_cost":{"type":"boolean"},"imported_files":{"type":"array","description":"https references stored as files for this estimate (the daily URL import limit was used); pass these file ids to create to avoid importing again.","items":{"type":"object","properties":{"url":{"type":"string"},"file_id":{"type":"string"}}}}},"required":["object","model","cost","adjustments"]},"File":{"type":"object","properties":{"object":{"const":"file"},"id":{"type":"string","pattern":"^[0-9A-Za-z]{1,40}$"},"mime":{"type":"string"},"bytes":{"type":"integer"},"width":{"type":"integer"},"height":{"type":"integer"},"duration":{"type":"number"},"fps":{"type":"number"},"converted_from":{"type":"string"}},"required":["object","id","mime","bytes"]},"Account":{"type":"object","properties":{"object":{"const":"account"},"balance":{"$ref":"#/components/schemas/Money"},"wallet":{"type":"string","enum":["personal","team"],"description":"team: the member creates with the team balance (also when that team cannot be used right now — see team.usable)."},"team":{"type":["object","null"],"description":"Only for a member creating with the team balance.","properties":{"usable":{"type":"boolean"},"monthly_cap_credits":{"type":["integer","null"]},"month_used_credits":{"type":["integer","null"]}}},"concurrency":{"type":"object","properties":{"limit":{"type":"integer"},"active":{"type":"integer"}}}},"required":["object","balance","wallet","concurrency"]},"WebhookEvent":{"type":"object","properties":{"type":{"type":"string","enum":["generation.completed","generation.failed","generation.canceled"]},"id":{"type":"string","description":"Same as the webhook-id header."},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Generation"}},"required":["type","id","created_at","data"]}}}}