Skip to main content

What you will build

You will create one Veo video task with multipart form data, store the returned task ID, poll the retrieve endpoint, and save the final asset URL or file in your own system.

Prerequisites

  • A CometAPI API key stored in COMETAPI_KEY
  • Python 3.10+ with requests, or Node.js 18+
  • A server-side job runner for polling

API key, base URL, authentication

Create Veo tasks with:
POST https://api.cometapi.com/v1/videos
Poll Veo task status with:
GET https://api.cometapi.com/v1/videos/<task_id>
Authenticate with a Bearer token:
Authorization: Bearer $COMETAPI_KEY

Code examples

Use the tabs below for copyable examples in cURL, Python, and Node.js.
curl https://api.cometapi.com/v1/videos \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -F model=veo3.1-fast \
  -F "prompt=A paper kite floats above a field." \
  -F seconds=4 \
  -F size=1280x720

curl "https://api.cometapi.com/v1/videos/<task_id>" \
  -H "Authorization: Bearer $COMETAPI_KEY"

Flow explanation

Veo video generation is asynchronous. The create endpoint accepts multipart form data and returns a task ID immediately. Poll the retrieve endpoint until the task reaches a terminal status, then persist the final video URL or file details from the completed response. Use short durations and the smallest useful size for first tests. Move completed assets into your own storage when your application needs retention.

Common parameters

ParameterUse
modelVeo model ID. The API reference example uses veo3.1-fast.
promptText prompt for the video job.
secondsDuration form field. The reference documents 4, 6, and 8.
sizeExact WxH size, such as 1280x720.
input_referenceOptional first-frame image file for image-to-video.

Troubleshooting / FAQ

Send multipart form data. Do not send Veo create requests as JSON.
Use a bounded polling loop, store the task ID, and surface a pending state in your application instead of blocking a web request.
Start with a short duration, one task, and the smallest acceptable size. Use account quotas and cost estimation before scaling task count.

Next steps