Open AI Image API

Quickstart

Create a Seedance video task, track its status, and retrieve the finished video.

Use the Open AI Image API to create videos from text, images, or reference media. Generation runs asynchronously. Use https://openaiimage.com as the base URL for every request.

  1. 01POST
    /v1/videos/generations
  2. 02READ
    task_id
  3. 03GET
    /v1/tasks/{task_id}
  4. 04DONE
    success + outputs

1. Create an API key

Create a key in Settings → API keys. You can view the full secret only once. Copy it immediately and store it in a secret manager on your server.

2. Start a generation

cURL

curl -X POST "https://openaiimage.com/v1/videos/generations" \
  -H "Authorization: Bearer sk_sd_example" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "seedance_2_0_fast",
  "prompt": "A paper boat crossing a rain-soaked neon street, cinematic camera movement",
  "parameters": {
    "duration": 5,
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "generate_audio": true
  },
  "request_id": "72c1ca71-5e68-4a76-9c3b-bbc036261e30",
  "max_credits": 65
}'
Response
{
  "task_id": "d3a7b249c28a1e05f9210d16af47c86809a58cad92a36fc91138da677be03245",
  "status": "processing",
  "credits_used": 5,
  "outputs": []
}

JavaScript

const response = await fetch('https://openaiimage.com/v1/videos/generations', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer sk_sd_example',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "model": "seedance_2_0_fast",
    "prompt": "A paper boat crossing a rain-soaked neon street, cinematic camera movement",
    "parameters": {
      "duration": 5,
      "resolution": "720p",
      "aspect_ratio": "16:9",
      "generate_audio": true
    },
    "request_id": "72c1ca71-5e68-4a76-9c3b-bbc036261e30",
    "max_credits": 65
  }),
});
if (!response.ok) throw new Error(await response.text());
const task = await response.json();
console.log(task.task_id);

Python

import requests

response = requests.post(
    "https://openaiimage.com/v1/videos/generations",
    headers={"Authorization": "Bearer sk_sd_example"},
    json={
      "model": "seedance_2_0_fast",
      "prompt": "A paper boat crossing a rain-soaked neon street, cinematic camera movement",
      "parameters": {
        "duration": 5,
        "resolution": "720p",
        "aspect_ratio": "16:9",
        "generate_audio": True
      },
      "request_id": "72c1ca71-5e68-4a76-9c3b-bbc036261e30",
      "max_credits": 65
    },
    timeout=30,
)
response.raise_for_status()
task_id = response.json()["task_id"]
print(task_id)

3. Poll the task

While the status is pending or processing, poll every 5 to 10 seconds and increase the interval with exponential backoff.

curl "https://openaiimage.com/v1/tasks/d3a7b249c28a1e05f9210d16af47c86809a58cad92a36fc91138da677be03245" \
  -H "Authorization: Bearer sk_sd_example"

When status changes to success, read the video URL from outputs[0].url. Stop polling if the task changes to failed.

Completed task
{
  "task_id": "d3a7b249c28a1e05f9210d16af47c86809a58cad92a36fc91138da677be03245",
  "status": "success",
  "credits_used": 5,
  "outputs": [
    {
      "url": "https://media.example.com/video.mp4"
    }
  ]
}

4. Check available credits

curl "https://openaiimage.com/v1/credits" \
  -H "Authorization: Bearer sk_sd_example"

credits shows how many credits a new generation can use. Credits are deducted when a task is created and returned automatically if generation fails.