Skip to main content
Veo-3.1 legacy route incident noticeThe veo-3.1 series legacy route began experiencing failures on May 14, 2026 and is temporarily unavailable. Pause new Sync API calls from the examples on this page until recovery is announced on this site or in the console.
Looking for a more stable solution?This page covers the Sync API (suitable for quick testing). For a more stable production environment solution, we recommend using the Async API.

Before You Begin

1

Get API Key

Log in to LaoZhang API Console to create an API Key
Important: Veo-3.1 models require pay-per-use tokens, not pay-as-you-go tokens. Please select “pay-per-use” type when creating tokens.
2

Ensure Account Balance

Make sure your account has sufficient balance. Veo-3.1 models charge per request ($0.15-$0.25/request)

Your First Request

Text-to-Video Example

Use cURL to quickly test text-to-video functionality:
Parameter explanation:
  • model: Select veo-3.1 series model
  • stream: Set to true to enable streaming response
  • n: Number of results to generate, setting to 2 will generate 2 different videos

Image-to-Video Example

Use images as reference to generate videos:

Python Quick Example

Install OpenAI SDK

Text-to-Video Code

Image-to-Video Code

Node.js Quick Example

Install OpenAI SDK

Basic Usage

Streaming Response Handling

Veo-3.1 supports streaming responses for real-time generation progress and results:

Image Format Support

Veo-3.1 supports multiple image input formats:
Note: Sync API must use Base64 encoded images, http/https URLs are not supported. If you need to use URL links, please use the Async API.
Image Requirements:
  • Supported formats: JPEG, PNG, WebP
  • Maximum size: 10MB
  • Recommended resolution: 1024x1024 or higher
  • Maximum images: 2 (start frame + end frame)

Common Model Selection

Choose the appropriate model based on your needs:

Quick Testing

Recommended: veo-3.1-fastSuitable for quickly validating ideas, console price shown before request

Standard Quality

Recommended: veo-3.1Balances quality and cost, suitable for most scenarios ($0.25/request)

Image-to-Video

Recommended: veo-3.1-flGenerate videos or transition animations based on images ($0.25/request)

Landscape Video

Recommended: veo-3.1-landscapeProfessional landscape format, suitable for film production ($0.25/request)

Error Handling

Complete Examples

View Complete Code Examples

Includes complete example code in Python, Node.js, Go, Java and more

Next Steps

Async API (Recommended)

More stable task queue approach, billing follows console order status

Code Examples

View examples in more programming languages

Best Practices

Learn how to write better prompts

Troubleshooting

Having issues? Check solutions

Get Help

Technical Support

Having issues? Contact technical support

Telegram Community

Join the community for discussions