Veo 3.1 API Reference

Overview

PropertyValue
Model IDveo-3-1
TypeText-to-Video, Image-to-Video
PricingFast: $0.2/video ยท Quality: $1.5/video
Average Time120 seconds

Authentication

All API requests require authentication using a Bearer token in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Endpoints

1. Submit Generation Task

POST https://api.apixo.ai/api/v1/generateTask/veo-3-1

2. Query Task Status

GET https://api.apixo.ai/api/v1/statusTask/veo-3-1?taskId={taskId}

Request Parameters

Request Body Structure

{
  "request_type": "async",
  "callback_url": "https://your-server.com/callback",
  "input": {
    "mode": "quality",
    "prompt": "Your video description",
    "generationType": "TEXT_2_VIDEO",
    ...
  }
}

Top-Level Parameters

ParameterTypeRequiredDescription
request_typestringYesRequest mode: async (poll results) or callback (webhook notification)
callback_urlstringNoWebhook URL for callback mode. Must be publicly accessible
inputobjectYesGeneration parameters (see below)

Input Parameters

ParameterTypeRequiredDefaultDescription
modestringYesqualityQuality mode: quality ($1.5, high quality) or fast ($0.2, cost-effective)
promptstringYes-Video description (max 10,000 characters)
generationTypestringYes-Generation type: TEXT_2_VIDEO, FIRST_AND_LAST_FRAMES_2_VIDEO, or REFERENCE_2_VIDEO
image_urlsstring[]No-1-3 images for image-to-video (max 10MB, JPG/PNG). Count depends on generationType
aspect_ratiostringNo16:9Aspect ratio: 16:9, 9:16, or auto
enableTranslationbooleanNotrueAuto-translate non-English prompts
watermarkstringNo-Custom watermark text
seedintegerNo-Random seed for reproducibility

Generation Types:

  • TEXT_2_VIDEO: Text-only, no images
  • FIRST_AND_LAST_FRAMES_2_VIDEO: 1 image (base frame) or 2 images (first & last frame transition)
  • REFERENCE_2_VIDEO: Up to 3 reference images (fast mode & 16:9 only)

Response Format

Task Submission Response

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}

Status Query Response

Processing:

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing",
    "createTime": 1698765400000
  }
}

Success:

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://example.com/video.mp4\"]}",
    "costTime": 125000,
    "createTime": 1698765400000,
    "completeTime": 1698765525000
  }
}

Failed:

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "CONTENT_VIOLATION",
    "failMsg": "Content does not meet safety guidelines",
    "createTime": 1698765400000,
    "completeTime": 1698765525000
  }
}

Response Fields:

FieldTypeDescription
codeintegerHTTP status code (200 = success)
data.taskIdstringUnique task identifier
data.statestringTask state: pending, processing, success, failed
data.resultJsonstringJSON string with resultUrls array (on success)
data.costTimeintegerGeneration time in milliseconds
data.failCodestringError code (on failure)
data.failMsgstringError message (on failure)

Callback Response

When the task is completed, the system will send a POST request to your callBackUrl in the following format:

Success Callback

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://example.com/result.mp4\"]}",
    "completeTime": 1698765525000,
    "createTime": 1698765400000,
    "costTime": 125000
  }
}

Failure Callback

{
  "code": 400,
  "message": "failed",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "CONTENT_VIOLATION",
    "failMsg": "Content does not meet safety guidelines",
    "completeTime": 1698765525000,
    "createTime": 1698765400000,
    "costTime": 125000
  }
}

Quick Start

1. Text-to-Video Generation

curl -X POST https://api.apixo.ai/api/v1/generateTask/veo-3-1 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "fast",
      "prompt": "A dog playing in a park",
      "generationType": "TEXT_2_VIDEO",
      "aspect_ratio": "16:9"
    }
  }'

Response:

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}

2. Check Task Status

curl -X GET "https://api.apixo.ai/api/v1/statusTask/veo-3-1?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response (Success):

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://example.com/video.mp4\"]}"
  }
}

3. Image-to-Video with Frame Transition

curl -X POST https://api.apixo.ai/api/v1/generateTask/veo-3-1 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "quality",
      "prompt": "Smooth transition between the two landscapes",
      "generationType": "FIRST_AND_LAST_FRAMES_2_VIDEO",
      "image_urls": [
        "https://example.com/first-frame.jpg",
        "https://example.com/last-frame.jpg"
      ],
      "aspect_ratio": "16:9"
    }
  }'

Best Practices

Request Mode Selection

ModeUse When
CallbackProduction environments with public server endpoints
AsyncClient-side apps or when webhook setup is not feasible

Performance Tips

  • Async Mode: Wait 120 seconds before first poll, then poll every 10 seconds
  • Timeout: Set maximum wait time to 10 minutes
  • Rate Limiting: Avoid excessive concurrent requests
  • Error Handling: Always check state field and handle failures gracefully

Resource Management

  • Video URLs may be temporary - download and store important results
  • Clean up failed tasks appropriately
  • Log taskId for debugging and support
  • REFERENCE_2_VIDEO mode only supports fast mode and 16:9 aspect ratio