Skip to content
Book a callStart free

Your first video, in five minutes

Check the price for free, make the video, and get told when it is ready. Use a test key while you build: results are fake and nothing is charged.

View as Markdown

Open Developers in the app (https://app.diffusr.ai/developers) and make a test key. It starts with dfsr_test_. Keep it in an environment variable. Never put it in code you publish.

export DIFFUSR_KEY=dfsr_test_...

For TypeScript run npm install diffusr. For Python run pip install diffusr. cURL needs nothing.

Add "dry_run": true to any call. Nothing is made and nothing is spent. The price holds for an hour.

curl -X POST https://app.diffusr.ai/api/v2/make_video \
-H "Authorization: Bearer $DIFFUSR_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"prompt": "A woman turns to camera on a sunny street, smiles",
"model": "seedance-2-0-fast",
"resolution": "720p",
"duration_sec": 5,
"aspect_ratio": "9:16",
"dry_run": true
}'

The answer has price.credits (and credits_estimated, the same number), price.usd, and price.expires_at.

Send the same call without dry_run. Always send an Idempotency-Key: if the connection drops, repeat the same request with the same key and you get the first job back instead of paying twice. Add a callback_url if you would rather be told than ask.

curl -X POST https://app.diffusr.ai/api/v2/make_video \
-H "Authorization: Bearer $DIFFUSR_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"prompt": "A woman turns to camera on a sunny street, smiles",
"model": "seedance-2-0-fast",
"resolution": "720p",
"duration_sec": 5,
"aspect_ratio": "9:16"
}'

You are charged when the video is delivered, never more than the price you saw. A failed video costs nothing.

The answer is 202 with an id. The work runs in the background.

Ask for the result by its id every 15 to 30 seconds until status is SUCCEEDED, FAILED or CANCELED. Or wait for the signed callback.

curl "https://app.diffusr.ai/api/v2/results/run_8Hk2xxxxxxxx" \
-H "Authorization: Bearer $DIFFUSR_KEY"

When it succeeds, output.url is the file and charge says what was charged. Videos take 1 to 10 minutes, images 10 to 30 seconds.

  • Dry run first, show the user the price, and ask before spending.
  • One Idempotency-Key per intended job. A new key is a new job and a new charge.
  • Read code in an error, not the message. See Errors.
  • Stop when you get INSUFFICIENT_CREDITS or BUDGET_EXCEEDED and tell the user.

Next: Test keys, Prices, Callbacks.