Video Generation


AI Gateway provides models that generate video from a text prompt or an image. Use them to create clips for apps, ads, social media, and other projects.

Video models work only through the API with an AI Gateway API key. They are not available in AI agents or chat.

Generation is asynchronous and can take several minutes. You create a task, then check its status with separate requests.

Choose a Model
Copy link

To see the available video models and their minimum prices per second:

  1. Go to AI Services → AI Gateway.
  2. In the Models tab, filter the list by model type: Video.

The price in the list is the minimum price per second. The final price can be higher depending on the model and the request parameters, as described below.

Video cost is calculated by clip duration. The prompt text is not billed separately. If personal discounts are enabled for your account, they apply to the model price.

Pricing Differences Between Models
Copy link

The final cost is calculated as follows:

cost = price per second × video duration in seconds

For most models, the price per second is fixed. The following models have additional pricing rules:

  • Audio: Kling 3.0 Standard, Kling 3.0 Pro, Veo 3.1 Fast, and Veo 3.1 have different prices per second with and without audio.
  • Resolution: Hailuo H3 Max, Hailuo 3, Wan 3, Wan 3 Prime, Seedance 2.0, and Seedance 2.5 are priced per second based on the selected resolution.
  • Minimum cost: Seedance 2.0 Mini and Seedance 2.5 clips have a minimum cost.
  • Reference images: Hailuo 3 charges extra for each reference image.

Limitations
Copy link

  • Generation can end with the failed status if the request does not pass content moderation.
  • Runway Gen-4 Turbo generates video from an image only. Include input_reference in the request.
  • For Kling models, the resolution is determined by the model variant: Standard produces 720p, Pro produces 1080p, and 4K produces 2160p.

Generate a Video
Copy link

To work with video models, you need an AI Gateway API key.

Each model has a ready-to-use request example in the dashboard:

  1. Go to AI Services → AI Gateway.
  2. In the Models tab, click the model you want to use.
  3. Scroll down to the API section. The First request example is available in cURL, Python, and Node.js.
  4. To see the connection details, such as the base URL and ready-to-use code for your tool, click Connect via API. This opens the Connection page.

Video generation is asynchronous, so a request consists of three steps:

  1. Create a task with POST /v1/videos. The response contains the task ID.
  2. Check the task status with GET /v1/videos/{id}. The statuses queued and in_progress mean that the task is waiting in the queue or being processed. The status failed means that the video could not be generated.
  3. When the task completes successfully, download the clip with GET /v1/videos/{id}/content.

How Billing Works
Copy link

Before generation starts, AI Gateway reserves an amount on your balance, with a margin. The reserve is calculated from the request parameters:

  • If seconds is not set, the calculation uses a duration of 10 seconds.
  • If size is not set, the reserve is calculated for the most expensive available resolution.
  • If the model supports audio and the audio parameter is not set, the calculation assumes that audio is enabled.

To keep the reserve close to the final cost, set the duration, resolution, and audio explicitly when the selected model supports them.

If your balance is insufficient, the API returns a 402 error and generation does not start.

When the video is ready, AI Gateway charges the actual cost and returns the unused part of the reserve to your available balance.

Requests that check the task status or download a finished clip are free.

Error Codes
Copy link

Code

Cause

What to do

400

Invalid request parameters

Check the required fields, allowed values, and request format for the selected model

402

Insufficient funds

Top up your balance or reduce the video duration or resolution

404

Model or task not found

Check the task ID and the model name (case-sensitive)

405

Method or model not supported

Check the endpoint and make sure the selected model supports video generation

5xx

Provider-side error

Retry the request later. If several requests in a row fail, contact support

When to Contact Support
Copy link

Contact support if:

  • A task stays in queued or in_progress for more than an hour.
  • A reserve is not returned for more than six hours.
  • The charged amount does not match the pricing.

Include the API key name, model, request time, video ID, request parameters, and the full error text. Do not send the API key itself.