Skip to content

Quickstart

You need a HalationLab.ai account with tokens in it and a terminal with curl.

  1. In the HalationLab.ai app, open Account → Developers and create a key.
  2. Choose the projects it can use (all by default) and its spending limit (on by default, resets monthly).
  3. Copy the key. It starts with hl_live_ and is shown only once.

Put it in an environment variable for the commands below:

Terminal window
export HALATIONLAB_API_KEY="hl_live_..."
generate.sh
# Generates a 5-second video and waits up to 60 seconds for it. Spends at most 400 tokens.
set -euo pipefail
API="${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
}'

What this request does:

  • model and input say what to make. input follows the model’s parameters; see Seedance 2.5.
  • max_cost is the most you will pay, in tokens. If the quoted price is higher, nothing is created or charged and the answer is 402 max_cost_exceeded with the quote.
  • Idempotency-Key makes a retry safe: sending the same request again with the same key never starts a second video. See Idempotency.
  • Prefer: wait=60 holds the response for up to 60 seconds until the video is ready.

The answer is a generation (201). When it has finished, status is completed and outputs[0].url is the video:

{
"id": "gen_01JD3Y5RJ6M3XW6J8K2N4P7Q9T",
"object": "generation",
"status": "completed",
"model": "seedance-2.5",
"cost": { "quoted_max": 380, "charged": 372, "final": true },
"outputs": [
{ "asset": "asset_01JD3Y7M2K8P4W6R0T3V5X9Z1B", "type": "video", "url": "https://app.halationlab.ai/media/d/…", "url_expires_at": "2026-11-28T11:41:12Z" }
],
"poll_after_seconds": null
}

If the video is not ready within 60 seconds, status is still queued or processing: read the generation again with GET /v1/generations/{id} (it accepts Prefer: wait=60 too), waiting poll_after_seconds between reads. See Waiting and polling.

The download URL needs no credentials and expires after an hour; read the generation again for a fresh one.

TypeScript (npm install @halationlab/sdk):

generate.ts
// Generates a 5-second video with the TypeScript SDK and prints its download URL. Spends at most 400 tokens.
import { HalationLab } from '@halationlab/sdk';
const hl = new HalationLab({ apiKey: process.env.HALATIONLAB_API_KEY });
// run() starts the generation and waits until it is completed, failed or canceled.
const generation = await hl.generations.run({
model: 'seedance-2.5',
input: { prompt: 'A red fox running through snow', duration: 5, aspect_ratio: '16:9' },
max_cost: 400,
});
console.log(generation.status, generation.cost.charged, generation.outputs[0]?.url);

Python (pip install halationlab):

generate.py
# Generates a 5-second video with the Python SDK and prints its download URL. Spends at most 400 tokens.
import os
from halationlab import HalationLab
client = HalationLab(api_key=os.environ["HALATIONLAB_API_KEY"])
# run() starts the generation and waits until it is completed, failed or canceled.
generation = client.generations.run(
model="seedance-2.5",
input={"prompt": "A red fox running through snow", "duration": 5, "aspect_ratio": "16:9"},
max_cost=400,
)
print(generation["status"], generation["cost"]["charged"], generation["outputs"][0]["url"] if generation["outputs"] else None)

run() starts the generation and waits for a final status, so you do not write the polling loop yourself.