TokenLab

Core Guides

FAQ

What to change when a TokenLab request is rejected

Short answers for the failures that stop a first integration. Each answer names the field that was rejected and the page that documents the fix.

A video request returns 400

POST /v1/videos/generations rejects a duration, seconds, resolution, or operation value that the selected model does not support. The error body lists the values that work, so read it before changing the request:

  • allowed_durations: accepted duration and seconds values, in seconds.
  • allowed_resolutions: accepted resolution values.
  • supported_operations: accepted operation names.
  • recommended_request: one request that uses an allowed value; it is absent when the operation needs an input only you can supply, such as an image for image-to-video, and required_selectors names that input instead.

The lists belong to the selected model and to the operation you sent, so values from another model do not apply. See Video generation and Create Video.

A Gemini file upload does not work

Two paths need no upload step: send the bytes inline, as a data:image/png;base64,... data URL in the OpenAI-compatible image_url.url field or as raw Base64 (no data: prefix) in the Gemini native inlineData.data field, or send a public https URL in fileData.fileUri. When you need one file referenced by several requests, upload the bytes yourself to POST /upload/v1beta/files with your TokenLab key and use the returned file_uri. The Google Gen AI SDK's own upload helper is not served by the TokenLab host and returns 404, so retrying it cannot succeed. See Upload Gemini file and Gemini Files and cached content.

401 or 402

StatusCodeWhat to do
401invalid_api_keySend the key as Authorization: Bearer sk-.... A revoked or inactive key keeps failing until the Workspace creates a new one.
402insufficient_balanceThe balance does not cover the request: add funds, reduce the request, or choose a lower-priced model.

See Authentication, Billing and pricing, and Handle API errors.

Retry without creating two tasks

Send an Idempotency-Key with POST /v1/videos/generations. After a timeout, send the same request with the same key to get the original task instead of a second one. See Handle API errors.

On this page