Get your API key
Generate a key to fill in every example, or use one from API keys.
Every request is a POST /api/v1/tasks. Pick a model; the rest of the body is the same for all of them.
- Call the API from your server. Your key spends your credits, so never ship it in browser or app code. Your frontend calls your backend; your backend calls us. Users can still upload files from the browser.
- Send an
Idempotency-Keywith every task. Use a new unique value, such as a UUID, for each task. If a request times out, retry with the same key and body: you get the original task back and pay once. More on retries
Your first image request
Create an image from a prompt with any image model.
POST/api/v1/tasks
curl -X POST "https://www.madebycue.dev/api/v1/tasks" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: first-image-generation-001" \ -d '{ "model": "image-1", "prompt": "An amber glass bottle on pale stone in soft morning light.", "aspect_ratio": "16:9", "resolution": "2k"}'Fields & options
| JSON field | What to send |
|---|---|
model | Required · "image-1", "nano-banana-2.1", "gpt-image-2", "gpt-image-2.5-sunburst" or "qwen-image-2.1". |
prompt | Required · Text describing the image, 3–10,000 characters. |
aspect_ratio | Optional · image-1: "16:9" (default), "1:1", "9:16", "3:2", or "2:3". Other models: see Models. |
resolution | Optional · image-1, Nano Banana and GPT Image: "1k", "2k", or "4k". Qwen: "1k", "1.5k" or "2k". |
quality | Optional · GPT Image models only: "low", "medium" (default) or "high"; Sunburst also "xhigh" and "max". |
reference_images | Optional · Image URLs to guide the look or subject. With a model other than image-1, any image input makes the request an edit. |
Media can be HTTPS links, /api/media/… uploads or small data URLs.
Edit an image
Send source_image and describe the change.
POST/api/v1/tasks
curl -X POST "https://www.madebycue.dev/api/v1/tasks" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: first-image-editing-001" \ -d '{ "model": "nano-banana-2.1", "prompt": "Keep the bottle and replace the background with warm ivory.", "source_image": "https://your-site.com/bottle.jpg"}'Fields & options
| JSON field | What to send |
|---|---|
model | Required · "image-1", "nano-banana-2.1", "gpt-image-2", "gpt-image-2.5-sunburst" or "qwen-image-2.1". |
prompt | Required · Text describing the change, 3–10,000 characters. |
source_image | Required · URL of the image to edit. Replace the example URL with your image. |
reference_images | Optional · More image URLs for visual guidance. image-1 accepts four; Nano Banana 14 in total, GPT Image 16, Qwen 10. |
resolution | Optional · Output size, as for generation. |
Media can be HTTPS links, /api/media/… uploads or small data URLs.
Your first video request
Create a video from a prompt. Add start_frame to animate an image.
POST/api/v1/tasks
curl -X POST "https://www.madebycue.dev/api/v1/tasks" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: first-video-generation-001" \ -d '{ "model": "minimax-h3", "prompt": "A slow camera move around an amber bottle in soft morning light.", "duration_seconds": 10}'Fields & options
| JSON field | What to send |
|---|---|
model | Required · "minimax-h3", "seedance-2.5", "wan-3.0" or "gemini-omni-flash". |
prompt | Required · Text describing the video, 3–10,000 characters. |
duration_seconds | Optional · Integer, default 5. MiniMax H3 3–30 (over 15 uses separate shots), Seedance 4–30, Wan 2–30, Gemini 3–10. |
reference_images | Optional · Image URLs for visual guidance. Up to 9; Gemini up to 4. |
start_frame | Optional · Opening frame to animate. Cannot combine references. MiniMax H3 maximum 15 seconds. |
end_frame | Optional · Closing frame; requires start_frame. Not on Gemini. |
reference_videos | Optional · Up to 3 HTTPS video URLs. MiniMax H3, Seedance and Wan. |
reference_audios | Optional · Up to 3 HTTPS audio URLs, with audio=generate. MiniMax H3, Seedance and Wan. |
resolution | Optional · MiniMax H3: 480p (default), 540p, 768p, 1080p. Seedance: 480p, 720p (default), 1080p, 4k. Wan: 480p, 720p (default), 1080p. Gemini: fixed. |
aspect_ratio | Optional · Defaults to 16:9. Supported ratios differ by model; see Models. |
audio | Optional · generate (default) or mute. Gemini always generates audio. |
seed | Optional · MiniMax H3 (-1 randomizes) and Wan. |
Media can be HTTPS links, /api/media/… uploads or small data URLs.
Edit a video
Send source_video and describe the change.
POST/api/v1/tasks
curl -X POST "https://www.madebycue.dev/api/v1/tasks" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: first-video-editing-001" \ -d '{ "model": "minimax-h3", "resolution": "480p", "prompt": "In the first 5 seconds, change the background to warm ivory. Keep the product and camera movement.", "source_video": "https://your-site.com/product.mp4"}'Fields & options
| JSON field | What to send |
|---|---|
model | Required · "minimax-h3", "seedance-2.5", "wan-3.0" or "gemini-omni-flash". |
prompt | Required · Text describing the change, 3–10,000 characters. |
source_video | Required · MiniMax H3: 3–15 seconds. Seedance up to 30, Wan 2–15, Gemini up to 10. Replace the example URL. |
reference_images | Optional · Up to nine image URLs. Not on Gemini edits. |
audio | Optional · generate or mute; MiniMax H3 also preserve (its default when the source has audio). |
resolution | Optional · As for generation. Edits keep the source aspect ratio. |
Media can be HTTPS links, /api/media/… uploads or small data URLs.
Swap a character
Replace a person, animal or object in a 40–600 second video with your character.
POST/api/v1/tasks
curl -X POST "https://www.madebycue.dev/api/v1/tasks" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: first-character-swap-001" \ -d '{ "model": "swap", "prompt": "Replace the presenter with the reference character. Keep the product, background and camera movement.", "source_video": "https://your-site.com/presenter.mp4", "reference_images": [ "https://your-site.com/character.jpg" ]}'Fields & options
| JSON field | What to send |
|---|---|
model | Required · "swap". |
prompt | Required · Who to replace and with whom, 3–10,000 characters. |
source_video | Required · 40–600 seconds. The output keeps its aspect ratio, from 1:4 to 4:1; aspect_ratio is not accepted. |
reference_images | Images of the new character. |
resolution | Optional · 768p, the default and only option for now. |
audio | Optional · preserve (default) or mute. |
queue | Optional · Queue options: policy "wait" (default) or "reject", and optional max_wait_seconds from 1 to 3600. Omit it to set no deadline of your own (a task still waits at most 6 hours for capacity). See Queue & cancellation in the API reference. |
Media can be HTTPS links, /api/media/… uploads or small data URLs.
Get your result
You get back a task id. Poll it every few seconds until status is succeeded.
curl "https://www.madebycue.dev/api/v1/tasks/task_YOUR_ID" \ -H "Authorization: Bearer cue_YOUR_API_KEY"Then download the output. Results are kept for 7 days.
curl "https://www.madebycue.dev/api/v1/tasks/task_YOUR_ID/outputs/0" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ --output resultResponse & task status
{ "id": "task_YOUR_ID", "status": "succeeded", "outputs": [ { "url": "/api/v1/tasks/task_YOUR_ID/outputs/0", "mime": "image/png" } ]}If the status is failed or needs_input, read message before submitting a new task. billing_pending means final usage receipts are still being confirmed. Insufficient credits reject the request instead.
Models & prices
Send one of these as model. image-1, minimax-h3 and swap also improve your prompt. Video edits are billed per source second.
| Model | Supports | Price per second |
|---|---|---|
minimax-h3 | 3–30 s · 480p–1080p · Up to 9 images, 3 videos, 3 audio · Edits: 3–15 s sourceText to videoImage to videoReferencesEdit | Generation$0.21/sEditing$0.52/s |
swap | Source 40–600 sec · 768p · Source aspect ratio · Keeps the source timelineCharacter swap | ≈ $0.20–$0.30/s |
seedance-2.5 | 4–30 s · 480p–4K · Up to 9 images, 3 videos, 3 audio · Edits: up to 30 s sourceText to videoImage to videoReferencesEdit | Generation |
wan-3.0 | 2–30 s · 480p–1080p · Up to 9 images, 3 videos, 3 audio · Edits: 2–15 s sourceText to videoImage to videoReferencesEdit | Generation$0.10/sEditing$0.21/s |
gemini-omni-flash | 3–10 s · 720p · 16:9 or 9:16 · Up to 4 images · Edits: up to 10 s sourceText to videoImage to videoReferencesEdit | Generation$0.14/sEditing$0.16/s |
More API examples
Open the example you need. Each uses the same API key.
Estimate a request
Send the same request body to get a cost estimate before creating a task. Estimating does not spend credits.
curl -X POST "https://www.madebycue.dev/api/v1/estimate" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "minimax-h3", "prompt": "A slow camera move around an amber bottle in soft morning light.", "duration_seconds": 10}'Use cost.estimated for the price in USD. image-1 prices depend on its workflow, so its estimated price is null. Expand Estimate cost in the reference for the full response.
Upload a file
Use this when your image or video is on your computer. Public HTTPS links can be used directly in task requests.
FILE="./bottle.jpg"curl -X POST "https://www.madebycue.dev/api/media/request-upload" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d "$(printf '{"name":"bottle.jpg","mime":"image/jpeg","size":%s}' "$(wc -c < "$FILE")")"# Replace these with key and uploadUrl from the response.UPLOAD_KEY="YOUR_UPLOAD_KEY"UPLOAD_URL="YOUR_UPLOAD_URL"curl -X PUT "$UPLOAD_URL" \ -H "Content-Type: image/jpeg" \ --data-binary "@$FILE"curl -X POST "https://www.madebycue.dev/api/media/confirm" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d "$(printf '{"key":"%s"}' "$UPLOAD_KEY")"curl --location "https://www.madebycue.dev/api/media/$UPLOAD_KEY" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ --output uploaded-image.jpgUse the confirmed url as source_image, source_video, start_frame, or a reference_images entry. Change the name, MIME type, and file path for your file. For videos above 100 MB, use the multipart example below.
Upload a large video
Videos above 100 MB use multipart uploads. First reserve the file through /api/media/request-upload, using its actual size and video MIME type.
curl -X POST "https://www.madebycue.dev/api/media/upload-parts" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "key": "YOUR_UPLOAD_KEY", "uploadId": "YOUR_MULTIPART_UPLOAD_ID", "parts": [ 1, 2 ]}'# Split the file using multipart.partSize from the reservation.# Replace PART_UPLOAD_URL with the URL for this part.curl -X PUT "PART_UPLOAD_URL" \ --data-binary "@part-001" \ --dump-header part-001.headerscurl -X POST "https://www.madebycue.dev/api/media/complete-upload" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "key": "YOUR_UPLOAD_KEY", "uploadId": "YOUR_MULTIPART_UPLOAD_ID", "parts": [ { "partNumber": 1, "etag": "\"ETAG_FROM_PART_1\"" }, { "partNumber": 2, "etag": "\"ETAG_FROM_PART_2\"" } ]}'curl -X POST "https://www.madebycue.dev/api/media/confirm" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "key": "YOUR_UPLOAD_KEY"}'curl -X POST "https://www.madebycue.dev/api/media/abort-upload" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "key": "YOUR_UPLOAD_KEY", "uploadId": "YOUR_MULTIPART_UPLOAD_ID"}'Use key, multipart.uploadId, multipart.partSize, and multipart.partCount from the reservation. Request every part number, upload each slice, then include every part and its ETag when completing. Keep ETag quotes in the JSON string. Abort is an alternative to completing an unfinished upload.
List tasks
List your latest tasks.
curl -X GET "https://www.madebycue.dev/api/v1/tasks" \ -H "Authorization: Bearer cue_YOUR_API_KEY"Cancel a queued character swap
Cancel your character-swap task before processing starts.
curl -X POST "https://www.madebycue.dev/api/v1/tasks/task_YOUR_ID/cancel" \ -H "Authorization: Bearer cue_YOUR_API_KEY"Check can_cancel on the task. A successful cancellation refunds any hold and returns the task with status failed. Once processing has started, cancellation returns 409 ALREADY_STARTED.
Read your usage
Charges, plan credits, purchases and auto-reloads for one month, with daily and per-model totals.
curl -X GET "https://www.madebycue.dev/api/v1/usage?month=2026-10" \ -H "Authorization: Bearer cue_YOUR_API_KEY"Amounts are USD; charges are negative. Months follow UTC and default to the current month. pending lists credits held by requests still running.
Read or delete request logs
Use the request_id returned when creating a task to inspect its request log.
curl -X GET "https://www.madebycue.dev/api/v1/logs?limit=20" \ -H "Authorization: Bearer cue_YOUR_API_KEY"curl -X GET "https://www.madebycue.dev/api/v1/logs/req_YOUR_ID" \ -H "Authorization: Bearer cue_YOUR_API_KEY"curl -X DELETE "https://www.madebycue.dev/api/v1/logs/req_YOUR_ID" \ -H "Authorization: Bearer cue_YOUR_API_KEY"For the next page, add cursor= with the URL-encoded next_cursor from the previous response. Deleting a log does not delete its task or results.
API reference
Full field definitions, limits, billing rules, and error codes.
Video duration limits
| Model | Per-request limit |
|---|---|
minimax-h3 | Generate 3–30 seconds, default 5; frame animation maximum 15. Edit: source 3–15 seconds. |
swap | Source 40–600 seconds, at 24 fps in the source's aspect ratio (1:4 to 4:1). Output is 768p: 768 pixels on the short side, at most 1344×768 pixels in total (16:9 gives 1344×768, 9:16 gives 768×1344, 21:9 gives 1536×672). The duration is checked after the task is accepted: an out-of-range or unreachable source fails the task without a charge instead of returning 400. |
seedance-2.5 | Generate 4–30 seconds, default 5. Edit: source up to 30 seconds. |
wan-3.0 | Generate 2–30 seconds, default 5. Edit: source 2–15 seconds. |
gemini-omni-flash | Generate 3–10 seconds, default 5. Edit: source up to 10 seconds. |
Actual dimensions and duration are returned with the result. MiniMax H3 produces 24 fps video on its own frame grid, so sizes can differ slightly from the tier name.
Edits are billed by source length. Swaps keep the source timeline and use our masking pipeline. Only minimax-h3 (3–15) and wan-3.0 (2–15) edits accept duration_seconds.
Image and video APIs are available on $0/month pay as you go; buy credits in Billing without a subscription. The minimum purchase is $5.45 before tax for $5.00 in credits. The processing fee is 2.9% + $0.30 per purchase.Monthly plan credits are a usage budget. They do not increase these per-request duration limits.
Authentication
Pass Authorization: Bearer cue_YOUR_API_KEY. Create and revoke keys in API keys. Keys are hashed at rest and never expire. Revoke them in API keys when no longer needed. Keep them on your server.
Every task and log is scoped to the authenticated account. A task ID or request ID alone does not grant access.
Estimate cost
Send your task JSON to POST /api/v1/estimate before creating a task. Use the same API key or signed-in session as other endpoints. No subscription or credit balance is required. This endpoint returns 200 OK without creating a task, running planning, fetching media, reserving credits, or triggering a payment. Estimate request bodies are not saved in request logs.
curl -X POST "https://www.madebycue.dev/api/v1/estimate" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"minimax-h3","prompt":"A cinematic product scene","duration_seconds":10}'{ "model": "minimax-h3", "cost": { "currency": "USD", "estimated": 0.55, "exact": false, "basis": "provider_usage" }, "initial_hold": { "amount": 0.55, "credits": 55 }, "required_credits": 55, "funding": { "currency": "USD", "available_credits": 40, "available_usd": 0.4, "required_credits": 55, "required_usd": 0.55, "missing_credits": 15, "missing_usd": 0.15 }, "rate": { "amount": 0.052, "unit": "second" }, "billable_seconds": 10, "notes": []}cost.estimated is the expected customer price in USD, or null when the final price cannot be estimated. cost.exact indicates whether that price is exact under the current pricing configuration. An estimate does not lock a price or guarantee that the request will execute. initial_hold describes the credits reserved when a task is accepted. required_credits is the known minimum balance for acceptance or, for video edits, execution; it is not a maximum spend. Unknown requirements are null. rate.amount is the USD price per output second, or per source second for edits, at the chosen resolution; it is null for images. All money amounts use USD. 100 credits = $1.
funding compares the required amount with your available balance at the time of the estimate. If the requirement is unknown, the required and missing amounts are null. For your current balance alone, GET /api/v1/usagereturns available_credits and balance in USD.
| Model | What can be estimated |
|---|---|
minimax-h3, seedance-2.5, wan-3.0, gemini-omni-flash | Approximate price based on resolution, duration and references. Edits need source_duration_seconds. The deposit is applied to the final charge, which may be higher. |
swap | Flex (default): approximately $0.20–$0.30 per output second. Estimate based on the number of tokens used. Final charges may vary. This endpoint estimates the minimum charge from the source duration; it cannot predict final usage. Supply source_duration_seconds; without it, the price is unknown. The duration is verified before execution. |
image-1 | About $0.20 per image, also the deposit. The final charge follows actual usage and can be higher. |
| Other image models | Price per image at the chosen resolution and quality. |
For a video edit, include an optional positive number named source_duration_seconds alongside the usual source_video and prompt. The final price remains unknown until usage is measured, so cost.exact is false. Use the full source duration, even if your prompt edits only part of it. Sources over the supported edit duration return 400. This field is accepted only by the estimate endpoint for video edits; remove it before sending the JSON to POST /api/v1/tasks.
For dry_run: true, video planning has an exact $0 price. Image planning may incur a charge, so its price remains null and its initial hold is zero. Unlike submitting a dry run to the tasks endpoint, asking for an estimate never starts processing. Both task and estimate requests accept up to 4.5 MB of JSON; no idempotency key is needed for estimates.
All fields & billing
POST /api/v1/tasks accepts JSON. Choose a model; sending a source image or video makes the request an edit. Which fields a model accepts is listed under Models & prices.
| Field | Contract |
|---|---|
model | Required. Image: "image-1", "nano-banana-2.1", "gpt-image-2", "gpt-image-2.5-sunburst", "qwen-image-2.1". Video: "minimax-h3", "swap", "seedance-2.5", "wan-3.0", "gemini-omni-flash". |
prompt | Required. Describe what to create or change, 3–10,000 characters. For video edits, put timing and scope here (“in the first 5 seconds…”). |
reference_images | Image URLs for visual guidance; the limit depends on the model. Defaults to an empty list. |
aspect_ratio | Generation. image-1: "1:1", "16:9" (default), "9:16", "3:2", or "2:3". Other models: see Models & prices. Video edits keep the source ratio; swap takes it from source_video and does not accept aspect_ratio. |
resolution | minimax-h3: 480p (default), 540p, 768p, 1080p. swap: 768p only. seedance-2.5: 480p, 720p (default), 1080p, 4k. wan-3.0: 480p, 720p (default), 1080p. gemini-omni-flash: fixed, omit it. Images: "1k", "2k" or "4k" ("1.5k" instead of "4k" on Qwen). For image-1, 1k supports 1:1, 3:2, 2:3; 2k supports 1:1, 16:9, 9:16; 4k supports 16:9, 9:16. |
quality | GPT Image models: "low", "medium" (default) or "high"; gpt-image-2.5-sunburst also "xhigh" and "max". |
source_image | Image models. The image to change; sending it makes the request an edit. |
source_video | Video models; required for swap. The video to change. minimax-h3 3–15 seconds, seedance-2.5 up to 30, wan-3.0 2–15, gemini-omni-flash up to 10, swap 40–600. |
start_frame | Video generation. An image that becomes the opening frame. Not on swap. |
duration_seconds | Generation: integer, default 5; range per model (minimax-h3 3–30, seedance-2.5 4–30, wan-3.0 2–30, gemini-omni-flash 3–10). Edits: minimax-h3 3–15 and wan-3.0 2–15 only; others follow the source. |
end_frame | Optional image URL with start_frame. Not on gemini-omni-flash. |
reference_videos | Generation with minimax-h3, seedance-2.5 or wan-3.0: up to 3 HTTPS video URLs. For minimax-h3, total 15 seconds and tags <Video 1>, etc. |
reference_audios | minimax-h3, seedance-2.5 and wan-3.0: up to 3 HTTPS audio URLs of at most 15 seconds each, with audio=generate. |
audio | generate (default) or mute. minimax-h3 edits also accept preserve, their default when the source has audio. swap: preserve or mute. gemini-omni-flash always generates audio. |
seed | Integer. minimax-h3 (default -1, random), wan-3.0 and qwen-image-2.1. |
dry_run | Optional. When true, validates the request (and plans it for our own models) and returns status planned. No media. image-1 dry runs bill planning usage; others are free. |
Unknown fields are rejected, and so are fields that are meaningless for the chosen model, such as duration_seconds on swap, return 400 instead of being silently ignored. Task requests and estimate requests may carry up to 4.5 MB of JSON (room for small inline data: attachments); other endpoints accept at most 20 KB. URLs must use HTTPS and a public hostname, with no username or password.
image-1 prices vary by request, with an initial 20-credit deposit. Other models are priced per image or per second, as listed in Models & prices; their deposit is that price, and the final charge follows actual usage. Swap Flex is the default tier, at approximately $0.20–$0.30 per output second. Estimate based on the number of tokens used. Final charges may vary. The initial deposit is 20 credits ($0.20) per source second, rounded up. Deposits are applied to the final charge and are not spending caps. All charges use credits; 100 credits = $1. Completed outputs may include quality.warnings. Failed tasks and needs_input tasks are refunded automatically. Dry runs for images bill planning usage only; video dry runs are free.
Swap Priority: Out of capacityContact us for more details Existing model: "swap" requests use Flex by default. The estimated ranges are not price caps; final charges depend on usage.
Task deposits are held as soon as the amount is known and cannot be spent by other requests. For most tasks that is when you submit; for character swaps it is when processing starts, after the source video is inspected, so a queued swap holds nothing yet. If your balance cannot cover the hold at that point, the task fails without a charge. cost.held shows the USD amount still held; it becomes zero when the task settles or is refunded. The task deposit is not a maximum price: final usage may require additional credits. Insufficient credits reject the request; they do not queue it until a later top-up. If the source duration is not yet verified, the API checks the minimum hold first and verifies the full hold before generation. Unsettled tasks release their held funds when they expire.
With task funding enabled in Billing, auto-reload can cover an unaffordable task or its final usage charge. Larger shortfalls use one payment in multiples of your reload amount, within your monthly cap. If payment confirmation is pending, submission returns 503 RELOAD_PROCESSING; retry with the same idempotency key. If the cap or authorization cannot cover it, submission returns 402 INSUFFICIENT_CREDITS without a billing link by default. Add credits in Billing, then retry. See Errors & retries for the response format and recovery flow.
Upload files & media inputs
References guide the look or subject. Sources are assets to edit. The start frame anchors the opening of a new video. Use the prompt to explain the change you want.
Media fields accept a public HTTPS URL, a stored /api/media/… attachment, or small inline bytes as a data: URL (up to 3 MB decoded).
Upload files using your session or API key: reserve with POST /api/media/request-upload (name, mime, size). Small files return one presigned PUT URL; videos over 100 MB return a multipart session — presign parts with POST /api/media/upload-parts, PUT each slice, assemble with POST /api/media/complete-upload (or abandon with POST /api/media/abort-upload). Then confirm with POST /api/media/confirm to get the /api/media/… URL for the task. Images up to 20 MB, videos up to 1 GiB; uploads are private to your account and expire after 7 days. Linked public videos are fetched up to 100 MB; linked images and audio references up to 20 MB.
Uploads from the browser
Keep the key on your server and let the browser send only the bytes:
- Browser asks your server for an upload. Your server calls
POST /api/media/request-uploadwith your key and returnsuploadUrlandkey. - Browser PUTs the file to
uploadUrlwith the sameContent-Type. The URL works for that one file, for 15 minutes, from any origin. - Your server calls
POST /api/media/confirmwithkeyand uses the returned URL in the task.
const { uploadUrl, key } = await fetch("/your-backend/upload", { method: "POST", body: JSON.stringify({ name: file.name, mime: file.type, size: file.size }),}).then((r) => r.json());await fetch(uploadUrl, { method: "PUT", headers: { "Content-Type": file.type }, body: file,});{ "model": "gpt-image-2", "prompt": "Keep the candle and replace the background with warm ivory.", "source_image": "https://your-site.com/candle.jpg", "reference_images": [ "https://your-site.com/mood.jpg" ]}{ "model": "seedance-2.5", "prompt": "A smooth camera move from the product detail to the full scene.", "start_frame": "https://your-site.com/start.jpg", "duration_seconds": 5}{ "model": "wan-3.0", "prompt": "Change the background to match the reference while preserving the product and camera movement.", "source_video": "https://your-site.com/clip.mp4", "reference_images": [ "https://your-site.com/background.jpg" ]}Task history
GET /api/v1/tasks/{id} returns a task, its submitted request, cost, and expiry. GET /api/v1/tasks returns your latest 30 unexpired tasks in data.
curl "https://www.madebycue.dev/api/v1/tasks/task_YOUR_ID" \ -H "Authorization: Bearer cue_YOUR_API_KEY"Poll every 3 seconds. Every task runs as one job and moves through the same stages: queued → preparing → creating → finishing, then a final status. progress.message describes the current stage and progress.percent gives approximate completion from 0 to 100. When demand is high a task may wait in queued. Scheduling accounts for capacity and fairness. estimate.remainingSeconds gives a low/high range in seconds and estimate.completionAt gives estimated completion timestamps. These are estimates, not deadlines. If the range is null or estimate.stale is true, show a loading message until a fresh estimate arrives. Stop polling at a terminal status.
{ "status": "running", "progress": { "stage": "creating", "message": "Creating your video…", "percent": 42, "updated_at": "2026-10-07T20:00:00.000Z" }, "estimate": { "version": 1, "phase": "planned", "remainingSeconds": { "low": 5, "high": 266 }, "queueSeconds": { "low": 0, "high": 0 }, "executionSeconds": { "low": 5, "high": 266 }, "completionAt": { "earliest": "2026-10-07T20:00:05.000Z", "latest": "2026-10-07T20:04:26.000Z" }, "confidence": "low", "sampleCount": 0, "updatedAt": "2026-10-07T20:00:00.000Z", "stale": false }}{ "status": "queued", "progress": { "stage": "queued", "message": "Your task is in the queue…", "percent": 0, "updated_at": "2026-10-07T20:00:00.000Z" }, "queue": { "state": "waiting", "expires_at": null, "admitted_at": null }}Character swaps waiting in the GPU queue report queue.state(waiting, admitted, parked or resuming), queue.expires_at (nullwhen you set no deadline) and queue.admitted_at. While processing is waiting for GPU capacity, queue.positionis the task's place in line.
A completed task may include quality with status (pending, passed or needs_review) and a warnings list. When needs_review, check the output before use; the task is still billed as completed.
{ "status": "succeeded", "message": "Completed. Review the output before use.", "quality": { "status": "needs_review", "warnings": [ "Parts of the result may not fully match your request. Review the output before use." ] }}A recoverable character-swap failure is resumed once automatically and keeps your hold; if it fails again the hold is refunded. A refunded failure may then return recovery.canResume: true for 24 hours, after which resuming returns 409 NOT_RESUMABLE. Send POST /api/v1/tasks/{id} with an Idempotency-Key to resume saved work. This restores the refunded hold once from available credits; remaining processing is billed normally. Reuse the key after a lost response. Terminal render failures require an explicitly new paid request.
Succeeded tasks list outputs with download URLs: GET /api/v1/tasks/{id}/outputs/{n} serves the mirrored file with the same authentication. billing_pending waits for a usage receipt before releasing outputs. Insufficient credits reject the request; adding funds does not automatically restart a rejected task.needs_input carries a question in message; submit a revised task with a new idempotency key.
Queue & cancellation
Character-swap requests may include a queue object. policy defaults to wait. Set an integer max_wait_seconds from 1 to 3600 to limit the initial wait before processing starts. Omit it to set no deadline of your own: a task still waits for capacity for at most 6 hours before it fails and is refunded. If your deadline, or that limit, expires before processing starts, the task fails and any hold is refunded. The deadline does not limit processing time or a later wait for GPU capacity. Separately, a task that is still unfinished 36 hours after it was created (or last resumed) is stopped and refunded.
{ "model": "swap", "prompt": "Replace the presenter with the reference character.", "source_video": "https://your-site.com/presenter.mp4", "reference_images": [ "https://your-site.com/character.jpg" ], "queue": { "policy": "wait", "max_wait_seconds": 300 }}Use policy: reject to require immediate admission. Queue capacity and account limits can reject a request regardless of its wait preference. Overload returns 503 with QUEUE_FULL or CAPACITY_UNAVAILABLE; an account can hold at most 8 queued or running character swaps in the GPU queue at once, and more return 429 ACCOUNT_QUEUE_FULL. If the queue service itself is unreachable you get 503 QUEUE_UNAVAILABLE. These responses include Retry-After; retry with the same idempotency key. If an earlier attempt left an expired reservation behind, the retry gets a fresh one automatically. queue is only accepted on character swaps; on any other task it returns 400.
For a queued character swap, check can_cancel and processing_state on the task. The state is waiting_to_start, processing, or waiting_for_gpu. The latter means processing has already started and the task cannot be cancelled. These fields supplement the existing task status and progress fields.
{ "id": "task_YOUR_ID", "status": "queued", "can_cancel": true, "processing_state": "waiting_to_start"}Cancel an eligible task with POST /api/v1/tasks/{id}/cancel. Authenticate with the same account that owns the task. No request body is required. Cancellation succeeds only before processing starts; if the task starts while the request is being made, it may return 409 ALREADY_STARTED even if an earlier poll reported can_cancel: true.
curl -X POST "https://www.madebycue.dev/api/v1/tasks/task_YOUR_ID/cancel" \ -H "Authorization: Bearer cue_YOUR_API_KEY"A successful cancellation returns the task with status: failedand refunds any hold (none is held yet while a swap waits to start). Cancelling an already-refunded failed task returns that task with 200 and no second refund. A task that does not exist, has expired, or belongs to another account returns 404 TASK_NOT_FOUND. This cancellation endpoint applies to character swaps in the GPU queue.
{ "id": "task_YOUR_ID", "status": "failed", "can_cancel": false, "message": "Cancelled before processing started.", "cost": { "currency": "USD", "estimated": 0, "charged": 0, "credits_charged": 0, "held": 0 }}{ "error": { "code": "ALREADY_STARTED", "message": "This task has already started processing or is not in the GPU queue." }}Request logs & costs
View Request logs for your requests, status, cost, and time. Select a request to view its submitted JSON. The request ID is returned in both the body and X-Request-Id.
GET /api/v1/logs?limit=20 lists your logs, summary totals, and next_cursor. Pass it as cursor to retrieve the next page. The page size is 1–50. GET /api/v1/logs/{request_id} returns one log with its request, response summary, and events.
cost.estimated initially shows the image deposit, then the settled workflow price once usage is known. Video tasks show their per-second price. cost.charged is the USD amount actually charged and cost.credits_charged the matching credit amount; 100 credits = $1. Both drop to zero when a failed task is refunded. Retries create a diagnostic log but no second task or charge.
Authenticated POST attempts are logged, including validation errors, conflicts, and account rate-limit errors. Unauthenticated requests and read requests are not stored. Invalid bodies are discarded; only a safe error summary is retained. Authorization headers, cookies, and API keys are never copied into request logs. Avoid including secrets in prompts or media URLs.
7-day retention
Tasks, request logs, outputs and uploads are kept for 7 days by default. That leaves enough time to download results, even for long renders or a missed notification.
Tasks and logs stop being readable at their expires_at timestamp. Background cleanup runs every minute and deletes expired database rows, uploaded and mirrored media, and backend executions, including prompts, input URLs, responses, and event details. Actual removal happens on the next successful cleanup run. Idempotent retries do not extend the original task’s expiry.
To permanently delete a request log early, use Request Logs in the dashboard or call DELETE /api/v1/logs/{id} with the request log ID. Success returns 204 No Content. The associated task and its files follow their own expiry schedules.
Credit balances and payment records are separate and do not expire with request logs. Database backups follow the hosting provider’s separate retention policy; deleting active rows does not erase earlier backups.
Rate limits & dedicated capacity
The shared API runs on a best-effort basis. Throughput and completion times depend on available capacity and provider demand; there is no guaranteed processing rate.
New task submissions are limited by lifetime usage spend in USD. Each model has its own limit on queued and running tasks, shared across all API keys and playground sessions on your account. A slot opens when a task finishes.
| Tier | Lifetime spend (USD) | Swap active tasks |
|---|---|---|
| Tier 1 | Under $100 | 1 |
| Tier 2 | $100–under $1,000 | 10 |
| Tier 3 | $1,000–under $5,000 | 100 |
| Tier 4 | $5,000+ | No limit |
Swap limits are 1, 10, and 100 active tasks in Tiers 1, 2, and 3. Whatever your tier, the GPU queue admits at most 8 of your character swaps at a time (429 ACCOUNT_QUEUE_FULL beyond that). Each other model has its own limit of 10, 100, and 1,000 active tasks respectively. Tier 4 starts at $5,000 and has no active-task limit.
Tiers upgrade automatically at $100, $1,000, and $5,000 of settled usage charges. Credit purchases, unused credits, and temporary task holds do not count. These tiers are separate from your subscription. Image and video APIs support pay as you go. View your current tier and lifetime spend in Billing.
A queued or running task, including a dry run or a manually resumed task, occupies one slot. Replaying a task with the same idempotency key does not occupy another slot. Status polling, usage and estimates do not occupy slots.
Exceeding a limit returns HTTP 429 with error code RATE_LIMITED. Wait for a task on that model to finish, then retry with the same Idempotency-Keyand request body.
Approved custom arrangements can waive active task limits for an account across all its API keys and playground sessions. Billing displays these accounts as Custom. Plan access, usage charges, and shared processing capacity still apply.
Need dedicated capacity for your workload? Reach out to support@madebycue.com and we’ll help set up a dedicated deployment for you.
Errors & retries
Send a unique Idempotency-Key for each new task, then reuse that key and the same body when retrying a failed connection. Keys are 1–128 printable non-space ASCII characters. The idempotency window is 7 days; after that, the same key can create a new task. If omitted, the server generates a key and cannot deduplicate your retries.
curl -X POST "https://www.madebycue.dev/api/v1/tasks" \ -H "Authorization: Bearer cue_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: 8f14e45f-ceea-4672-9a3c-2f4b1d6f0b11" \ -d '{"model":"image-1","prompt":"A ceramic mug on a linen table"}'# Timed out? Send the exact same request again.# Same key + same body returns the original task, with no second charge.# Same key + different body returns 409 IDEMPOTENCY_CONFLICT.| Status | Meaning |
|---|---|
400 | Invalid JSON, fields, or pagination cursor. |
401 | Missing, revoked, expired, or invalid credentials. |
402 | INSUFFICIENT_CREDITS: automatic funding could not cover the request. Billing links are opt-in. |
403 | Untrusted browser origin or access denied. |
404 | Task/log/output not found, not owned by you, or expired. |
409 | IDEMPOTENCY_CONFLICT (key used with a different body), IDEMPOTENCY_EXPIRED, ALREADY_STARTED (cancel after processing began), QUEUE_EXPIRED (retry with a new key), NOT_RESUMABLE, TASK_CHANGED, or TASK_SETTLING (retry the resume shortly). |
413 / 415 | Request larger than the endpoint limit (4.5 MB for tasks, 20 KB elsewhere) or not application/json. |
429 | RATE_LIMITED (your active-task limit is reached; a slot opens when a task finishes), ACCOUNT_QUEUE_FULL, or temporary throttling by the hosting platform or provider. Honour Retry-After and retry with the same idempotency key. |
500 / 503 | Temporary service or configuration error, including QUEUE_FULL, CAPACITY_UNAVAILABLE and QUEUE_UNAVAILABLE. Retry using the same idempotency key. |
Insufficient credits and billing recovery
402 INSUFFICIENT_CREDITS responses include error.funding with available, required, and missing amounts in credits and USD. A task that fails a funding check after acceptance returns the same information as top-level funding on the task, when recorded. These amounts reflect the failed check, including any deposit released at final settlement. The missing amount is the credit value shortfall. Checkout applies any top-up minimum, fees, and taxes.
Billing links are off by default. To request one on an eligible payment error, send "include_billing_link": true in the JSON body of POST /api/v1/tasks. For a resume request, add ?include_billing_link=true to the URL. If requested, the link appears in error.actions.
{ "error": { "code": "INSUFFICIENT_CREDITS", "message": "Insufficient available credits. Add credits in Billing.", "funding": { "currency": "USD", "available_credits": 1300, "available_usd": 13, "required_credits": 2000, "required_usd": 20, "missing_credits": 700, "missing_usd": 7 }, "actions": [ { "type": "billing", "label": "Add credits", "url": "https://www.madebycue.dev/billing/access?token=ONE_TIME_TOKEN", "expires_at": "2026-10-16T12:15:00.000Z" } ] }}The link is single-use and expires after 15 minutes. Opening it grants 30 minutes of billing-only access without a separate login. The user chooses a top-up or plan and confirms payment in checkout. The URL contains no API key and grants no access to the rest of the account. Treat it as a temporary credential: do not log or share it. If your app uses a shared platform key, keep links server-side and restrict access to the billing account owner. If link issuance is unavailable, the action points to regular Billing, requires sign-in, and omits expires_at.
A task can also fail for insufficient credits after its initial acceptance, during video reservation or final settlement. In that case, GET /api/v1/tasks/{id} includes the same billing items in top-level actions only when you add ?include_billing_link=true. Payment does not automatically restart work. Submit a rejected request again after payment, or explicitly resume an existing task when recovery.canResume is true. For 503 RELOAD_PROCESSING, wait and retry with the same idempotency key while the automatic payment is pending.