Generating video and images
One request quotes the work, checks it against max_cost and the spending limit, reserves the quoted maximum and starts it: POST /v1/generations. The answer is 201 with the generation.
The request
Section titled “The request”| Field | Required | Description |
|---|---|---|
model |
Yes, unless quote is sent |
The model ID, for example seedance-2.5. See Models. |
input |
Yes, unless quote is sent |
The model’s parameters. Their names, types and defaults are the model’s input_schema. |
max_cost |
No | The most you will pay, in tokens. If the quoted maximum is higher, nothing is created and the answer is 402 max_cost_exceeded with the quote. Without it the spending limit is the only ceiling. |
project |
No | Where the outputs go. Defaults to the credential’s default project. |
quote |
No | Start a quote you requested earlier instead of sending model and input. See Pricing and quotes. |
use_brief |
No | Apply the project’s brief to the prompt. Default false. See Projects and assets. |
metadata |
No | Up to 20 key-value strings of your own (keys up to 40 characters, values up to 500). Returned on the generation and in webhooks. |
Send an Idempotency-Key with every start, so that a retry after a timeout never starts a second generation.
Text to video
Section titled “Text to video”# Generates a 5-second video and waits up to 60 seconds for it. Spends at most 400 tokens.set -euo pipefailAPI="${HL_API_BASE:-https://api.halationlab.ai/v1}"
curl -sS --fail-with-body "$API/generations" \ -H "Authorization: Bearer $HALATIONLAB_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Prefer: wait=60" \ -H "Content-Type: application/json" \ -d '{ "model": "seedance-2.5", "input": { "prompt": "A red fox running through snow", "duration": 5, "aspect_ratio": "16:9" }, "max_cost": 400 }'Text to image
Section titled “Text to image”# Generates one square image. Spends at most 100 tokens; if the price is higher, nothing starts.set -euo pipefailAPI="${HL_API_BASE:-https://api.halationlab.ai/v1}"
curl -sS --fail-with-body "$API/generations" \ -H "Authorization: Bearer $HALATIONLAB_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Prefer: wait=60" \ -H "Content-Type: application/json" \ -d '{ "model": "flux.2-pro", "input": { "prompt": "A studio photo of a red ceramic mug on a linen tablecloth, soft window light", "aspect_ratio": "1:1" }, "max_cost": 100 }'Image to video from a URL
Section titled “Image to video from a URL”Media parameters take a public HTTPS URL directly. The file is imported into the project as an asset first, then used:
# Animates an image from a public URL. The URL is imported as an asset first. Spends at most 400 tokens.set -euo pipefailAPI="${HL_API_BASE:-https://api.halationlab.ai/v1}"IMAGE="${HL_SAMPLE_IMAGE_URL:-https://docs.halationlab.ai/media/sample-image.png}"
curl -sS --fail-with-body "$API/generations" \ -H "Authorization: Bearer $HALATIONLAB_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Prefer: wait=60" \ -H "Content-Type: application/json" \ -d @- <<JSON{ "model": "seedance-2.5-image-to-video", "input": { "first_frame": "$IMAGE", "prompt": "The ball rolls slowly to the right, soft studio light", "duration": 5 }, "max_cost": 400}JSONParameters
Section titled “Parameters”input follows each model’s schema, listed on its model page and in GET /v1/models/{model}. Most models share a small core:
| Parameter | Meaning |
|---|---|
prompt |
What to make. Text-to-speech models take text instead. |
duration |
Length in seconds. Some models also accept "auto". |
aspect_ratio |
Frame shape, such as "16:9". |
resolution |
Output size tier, such as "720p", "1080p" or "4k". |
seed |
The same seed with the same settings gives a similar result. |
Model-specific parameters are in snake_case. Omitted parameters take their documented default, and an unknown parameter is refused with 422 parameter_unknown naming it, so a typo never passes silently. When several parameters are wrong, the error lists each in errors.
Media inputs
Section titled “Media inputs”Media parameters are named for their role: first_frame, last_frame, references, source, audio, reference_videos, elements and keyframes. Each takes any of:
- an asset ID (
asset_…), from an upload, an import or an earlier output; - a generation ID (
gen_…): its first output; - a public HTTPS URL;
- a small
data:URI.
URLs and data URIs are imported as assets in the project first. If an import is still being checked after about 20 seconds, the answer is 409 media_not_ready with Retry-After: send the identical request again with the same Idempotency-Key, and it continues where it stopped. For local files, see Uploading media.
The generation
Section titled “The generation”| Field | Meaning |
|---|---|
status |
queued → processing → completed, failed or canceled. The last three are final. |
cost |
quoted_max is the binding maximum; charged is what was charged, final when final is true. |
outputs |
The output files, once completed. Each has asset, type, url and url_expires_at. |
error |
Why a failed or canceled generation did not complete. Failed work is never charged. |
input |
The parameters as applied, defaults included. Media inputs are listed by asset ID. |
poll_after_seconds |
While not final, a sensible wait before reading it again. |
Output URLs need no credentials and expire after one hour (url_expires_at). Read the generation or the asset again for a fresh URL. Outputs are assets in the project, so pass outputs[0].asset (or the generation ID) as the input of the next generation.
The generation ID never changes, also when a failed attempt is retried automatically.
Waiting for the result
Section titled “Waiting for the result”Prefer: wait=60 holds the response until the generation is final or 60 seconds pass. For longer work, poll or use webhooks: see Waiting and polling and Webhooks.
Cancelling
Section titled “Cancelling”POST /v1/generations/{id}/cancel cancels a generation. Work not yet sent to a model host is cancelled and its tokens are released. Work already running may still finish, and is then charged within its quote.
# Cancels a generation. Work not yet sent to a model host is released; running work may still finish within its quote.set -euo pipefailAPI="${HL_API_BASE:-https://api.halationlab.ai/v1}"
curl -sS --fail-with-body -X POST "$API/generations/$HL_GENERATION_ID/cancel" \ -H "Authorization: Bearer $HALATIONLAB_API_KEY" \ -H "Idempotency-Key: $(uuidgen)"Listing
Section titled “Listing”GET /v1/generations lists generations in the projects the credential can see, newest first, including work started in the app. Filter with ?project= and ?status=.