Endpoints
The create endpoint accepts JSON or
multipart/form-data and follows OpenAI’s request and response format, with a few Base44 fields added. Authenticate with Authorization: Bearer {token}.
Generate a video
Send a prompt and a model toPOST /videos. Unlike the image endpoints, there’s no automatic option, so model is required.
Use asServiceRole for the connection. An app that restricts Core integrations rejects user-token gateway calls unless it’s shared privately or with your workspace, and most new apps have that restriction on from the start. A user-token call works while you’re building and then starts failing once you share the app publicly. The mode changes which token you get and nothing else, so guard the function with base44.auth.me() to control who can spend your credits.
Start a video job
id on an entity so you can check the job later, after the function that started it has returned.
Check the status
PollGET /videos/{video_id} until status is completed or failed. A completed job carries the finished video’s url and the credits it used.
Check a video job
queued, then in_progress, then either completed or failed. Poll from a scheduled function or from the browser on an interval, rather than looping inside the function that created the job.
The entity write also uses asServiceRole here, because a scheduled poll runs with no signed-in user and row-level security would otherwise block it. That bypasses your entity’s permissions, so write only the job’s own result, and keep the record’s id in the function’s own state rather than taking it from the caller.
The url points to a file in your app’s storage, so you can save it on an entity and play it back like any other file. GET /videos/{video_id}/content redirects to the same file, for clients that expect OpenAI’s download endpoint. It returns 409 while the video isn’t ready yet.
Start from an image
Theframe_images field pins the video’s first or last frame to a still image. Use it to animate an image your app already has, such as a product photo or a generated image.
Animate a still image
first_frame, last_frame, or both, and each frame_type may appear only once. On Veo models, a last_frame needs a first_frame alongside it. Grok Imagine Video accepts a first frame only.
The input_references field is the other way to supply media, and it guides the whole clip instead of a single frame. Each reference is an image_url, video_url, or audio_url, and you can pass up to 8.
Guide a video with reference media
Models
Setmodel to one of these IDs. Video models are separate from the chat models and the image models the gateway serves.
A pinned model is never swapped for another one. If the model doesn’t support an option you set, the request fails with an error that names the option.
Supported aspect ratios
Supported aspect ratios
Supported reference media
Supported reference media
Defaults
Veo models default to 8 seconds at720p, 16:9, with audio on. The other models have no gateway default, so leaving seconds, resolution, or aspect_ratio out lets the provider choose. Set them explicitly when the output needs a specific shape or length.
Request parameters
Any field that isn’t listed here is rejected rather than ignored.
Response
url and completed_at fields stay null until the job finishes, and usage appears once the credits are recorded. A failed job carries an error object with a code and message instead of a url.
Estimate the cost
Setdry_run to true to see what a request would cost, without generating a video or using credits.
Estimate the cost of a request
dry_run before you expose video generation to your app’s users.
Limits
Media is passed by URL, so the create endpoint doesn’t accept file uploads, and the request body stays small.
Errors
Errors use OpenAI’s format,{ "error": { "message", "type", "code", "param" } }, so client libraries report them like any other OpenAI error.
A job that fails after it’s accepted reports
status: "failed" with an error object, rather than an HTTP error, because the create request already succeeded.
See also
- ai-gateway: Get connection details and use chat models through the gateway.
- Generate images: Generate and edit images through the gateway.
- Backend functions: Write the server-side code that calls the gateway.