Skip to content

Video Generation API

Video generation always uses asynchronous tasks: submit POST /v1/videos, then poll GET /v1/videos/{task_id} for status and video URLs.

Images / Videos

This page documents video generation. For image generation, see Image Generation API. You can also compare against the online goswitch API docs.

Base Variables

All examples use BASE_URL as the site root. Do not include /v1 in this value. When you switch to another site, only change this variable.

bash
BASE_URL="https://goswitcher.com"
API_KEY="YOUR_API_KEY"

Which Endpoint To Use

ScenarioModeModelEndpointResult
Omni text-to-video / image-to-video / video editAsyncomni_flash-10s and other Omni modelsPOST /v1/videosReturns a task ID, then use task query
Veo text-to-video / reference images / first-last frameAsyncveo_3_1-fast, veo_3_1-fast-fl, veo_3_1-lite-fl, and other Veo modelsPOST /v1/videosReturns a task ID, then use task query
Task queryShared queryTask IDGET /v1/videos/{task_id}Read video results from url, video_url, content_url, or data[].video_url

Current Implementation

/v1/videos is an asynchronous task endpoint. This page only documents Omni / Veo video models. Model availability follows site configuration and the online Apifox directory.

Authentication

HeaderRequiredNotes
AuthorizationYesBearer YOUR_API_KEY
Content-TypeYesUse application/json for JSON requests; use multipart/form-data for file upload requests

Base URL

BASE_URL is the site root, for example https://goswitcher.com. Do not set it to https://goswitcher.com/v1 and then append /v1/videos, or the path will contain /v1 twice.

Endpoint Details

Omni Async Video

ItemValue
MethodPOST
Path/v1/videos
Content-Typeapplication/json or multipart/form-data
ResultTask object. Continue with task query

Request Parameters

ParameterTypeRequiredNotes
modelstringYesFor example omni_flash-10s; check Apifox for more tiers
promptstringYesVideo prompt
sizestringNoVideo size, such as 1280x720 or 720x1280
imagesstring[]NoFor JSON requests. Use URL / Data URL references for image-to-video or video edit, up to 7 items. Do not use input_reference in JSON
input_referencefile or string, repeatableNoFor multipart requests. Use local image, local video, image URL, video URL, or Data URL references, up to 7 items
nintegerNoVideo models only support 1 or omitted; n > 1 returns an error

Call Examples

bash
curl -X POST "$BASE_URL/v1/videos" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "omni_flash-10s",
    "prompt": "Create a 10-second product advertising video with a slow push-in camera move and clean background",
    "size": "1280x720",
    "images": [
      "https://example.com/reference-1.jpg"
    ]
  }'
Omni multipart reference / video edit
bash
curl -X POST "$BASE_URL/v1/videos" \
  -H "Authorization: Bearer $API_KEY" \
  --form 'model="omni_flash-10s"' \
  --form 'prompt="Create a product advertising video using the reference asset"' \
  --form 'size="1280x720"' \
  --form 'input_reference=@"/path/to/reference.jpg"'

The input_reference field can be repeated. For video edit, submit a local video with input_reference=@"/path/to/input.mp4" and describe the edit in prompt.

Task Query

ItemValue
MethodGET
Path/v1/videos/{task_id}
UseQuery video asynchronous tasks

Path Parameters

ParameterTypeRequiredNotes
task_idstringYesThe id returned by the submit endpoint; some upstreams may return task_id

Status Fields

statusClient behavior
queuedThe task is queued. Continue polling
processingThe task is processing. Continue polling
in_progressThe task is processing. Continue polling
runningThe task is processing. Continue polling
completedThe task is complete. Read video result URLs
failedThe task failed. Read error or error.message

Poll every 5 seconds or so. Video tasks usually take longer than image tasks, so clients should use a longer timeout.

Result Fields

After completion, read video URLs from these fields first: video_url, url, content_url, metadata.video_url, metadata.url, data[].video_url, data[].url, videos[].url.

Call Examples

bash
TASK_ID="task_xxxxxxxxxxxxx"

curl -X GET "$BASE_URL/v1/videos/$TASK_ID" \
  -H "Authorization: Bearer $API_KEY"
Video task response examples
json
{
  "id": "task_xxxxxxxxxxxxx",
  "object": "video",
  "model": "omni_flash-10s",
  "status": "queued",
  "progress": 0,
  "created_at": 1709876543,
  "size": "1280x720"
}
json
{
  "id": "task_xxxxxxxxxxxxx",
  "object": "video",
  "model": "veo_3_1-lite-fl",
  "status": "completed",
  "progress": 100,
  "created_at": 1709876543,
  "completed_at": 1709876600,
  "size": "1280x720",
  "video_url": "https://example.com/output.mp4"
}
json
{
  "id": "task_xxxxxxxxxxxxx",
  "object": "video",
  "model": "veo_3_1-lite-fl",
  "status": "failed",
  "progress": 100,
  "error": {
    "message": "Upstream task failed",
    "code": "upstream_error"
  }
}

Common Notes

  • Video generation is always asynchronous. It does not return the final asset directly like the synchronous image2 image endpoint.
  • Video models do not support local batch n > 1; submit multiple tasks from the client if you need multiple videos.
  • JSON requests use images for reference URLs / Data URLs; multipart requests use repeatable input_reference fields for files or text references.
  • Reference image and video URLs must be directly reachable by the server. Login-only pages, intranet URLs, and local file paths usually cannot be fetched by the server.
  • Model availability can change with site configuration, upstream capacity, and safety controls. Production integrations should implement fallback logic for unavailable models.
  • Generated result URLs may expire, so download and store results soon after task completion.

GoSwitcher documentation site.