Skip to main content
A video clip takes from half a minute to several minutes, so POST /v1/videos doesn’t wait for it. NagaAI answers 202 at once with a job id, you poll GET /v1/videos/{id} until status is completed or failed, and then you download the file from GET /v1/videos/{id}/content. The request and job fields follow the OpenRouter Videos API.

Generate a clip

The loop below submits a job, polls every ten seconds and saves the MP4. Choose a model whose operations include video_generation in GET /v1/models.
The first response is the queued job. Keep id, or poll the polling_url as the Python and Node.js examples do:
When the job completes, the same object gains completed_at, urls with the download link, and usage with the charge:

Choose the clip settings

NagaAI checks every value against the parameters of the model’s video_generation operation in GET /v1/models before the job starts. A value the model does not support fails with 400 and a message that lists the supported ones. NagaAI checks the prompt with its own moderation before it starts the job. A blocked prompt fails with 403 inappropriate_content.

Read the job status

GET /v1/videos/{id}/content answers 302 with the file’s address, or 409 while the job is not completed. NagaAI keeps the file for seven days after the job completes, so download it if you need it longer. A job of another account, or an unknown id, answers 404.

Billing

The price is per second of video and depends on the resolution and on sound. pricing in GET /v1/models has one output_video_second row for each pair the model sells, with the pair in conditions: {"resolution": "720p", "generate_audio": false}.
  • When the job starts, NagaAI holds its full price on the balance. If the balance minus the holds of your running jobs does not cover it, the request fails with 402. On a key with a credit limit, the rest of the limit has to cover it too, or the request fails with 403 credit_limit_exceeded.
  • NagaAI charges once, when the clip is ready, for the seconds you asked for. For a clip more than half a second shorter, NagaAI charges its real length, rounded up to whole seconds.
  • NagaAI does not charge a job that ends failed.

Troubleshooting

400 listing supported values

The message names the values the model accepts for the field you sent. Read the enum of that parameter in the model’s video_generation operation in GET /v1/models and send one of them.

402 or 403 credit_limit_exceeded when you start

NagaAI holds the full price of the clip before it starts the job. Top up the balance, or raise the key’s credit limit. Running jobs hold their price too, so wait for them to finish if the balance is just short.

403 inappropriate_content

NagaAI’s moderation blocked the prompt. Rewrite it and send the request again.

409 on the content URL

The job is not completed yet. Keep polling GET /v1/videos/{id} and download the file after the status changes.

Status failed

The job has no clip and costs nothing. error.type says why. moderation means the provider’s filter rejected the prompt or a frame image. timeout means the clip took too long. upstream_error means the provider could not produce it, so submit the job again or try another model.

404 on a job

The id is unknown, or the job belongs to another account.