Basic Information
Endpoint:
https://api.laozhang.ai/v1/chat/completionsWith Watermark Endpoint: https://api.laozhang.ai/v1/chat/completions?watermark=trueMethod: POSTAuthentication: Bearer Token (API Key)Content Type: application/json10/18 New Feature: Watermark OptionBy default, generated videos have no watermark. To generate videos with Sora native watermark, add the parameter
?watermark=true to the URL.Authentication
Include your API key in the request header:Request Format
Basic Structure
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | ✓ | Model name, see Supported Models |
messages | array | ✓ | Message array |
stream | boolean | ✗ | Whether to enable streaming output, default false |
Messages Array
Each message object contains:| Field | Type | Required | Description |
|---|---|---|---|
role | string | ✓ | Fixed as "user" |
content | array | ✓ | Content array, containing text or images |
Content Array
Supports two types of content:Text Content
| Field | Type | Required | Description |
|---|---|---|---|
type | string | ✓ | Fixed as "text" |
text | string | ✓ | Video generation prompt |
Image Content (Optional)
| Field | Type | Required | Description |
|---|---|---|---|
type | string | ✓ | Fixed as "image_url" |
image_url.url | string | ✓ | Image URL or Base64 |
Image Restrictions
- Maximum 1 image
- Supports URL or Base64 format
- Recommended resolution not exceeding 2048×2048
- Real person photos not supported
Supported Models
| Model Name | Resolution | Duration | Price |
|---|---|---|---|
sora_video2 | 704×1280 (Portrait) | 10s | $0.15 |
sora_video2-landscape | 1280×704 (Landscape) | 10s | $0.15 |
Due to official OpenAI computing power limitations, -hd and -15s versions are temporarily unavailable.
Response Format
Non-streaming Response
Response Field Description
| Field | Type | Description |
|---|---|---|
id | string | Request unique identifier |
object | string | Object type |
created | integer | Creation timestamp |
model | string | Model used |
choices[].message.content | string | Content containing video link |
choices[].finish_reason | string | Completion reason, "stop" indicates success |
usage | object | Token usage statistics |
Streaming Response (SSE)
When"stream": true is enabled, returns Server-Sent Events format:
Streaming Response Fields
| Field | Type | Description |
|---|---|---|
choices[].delta.role | string | Role, only included in first message |
choices[].delta.content | string | Incremental content (progress or video link) |
choices[].finish_reason | string | When "stop", indicates completion |
usage | object | Last message contains usage statistics |
Complete Examples
Text-to-Video
Image-to-Video (URL)
Image-to-Video (Base64)
Streaming Output
Error Codes
| HTTP Status Code | Error Type | Description |
|---|---|---|
| 400 | Bad Request | Invalid request parameters |
| 401 | Unauthorized | Invalid or missing API Key |
| 402 | Payment Required | Insufficient balance |
| 429 | Too Many Requests | Too many requests |
| 500 | Internal Server Error | Internal server error |
| 503 | Service Unavailable | Service temporarily unavailable |
Error Response Format
Rate Limits
Currently no strict rate limits, but recommended:
- Control concurrency when batch generating (recommended 2-3)
- Avoid large number of requests in short time
- Set reasonable retry intervals
Best Practices
Timeout Settings
Timeout Settings
Video generation takes 2-4 minutes, recommend setting timeout to 5-10 minutes.
Error Handling
Error Handling
Add retry logic to handle temporary errors:
Video Download
Video Download
Download immediately after generation (valid for 1 day):
Streaming Output Monitoring
Streaming Output Monitoring
Use streaming output to view progress in real-time:
SDK Support
Official SDK
- Python:
openai>= 1.0.0 - Node.js:
openai>= 4.0.0
Third-party SDK
Any SDK compatible with OpenAI API format can be used, just modifybase_url.
Technical Specifications
| Specification | Value |
|---|---|
| Video Encoding | H.264 |
| Audio Encoding | AAC |
| Frame Rate | 24 fps |
| Format | MP4 |
| Watermark | None |
| Audio | Supported |
| Max File Size | ~50MB (depends on duration and quality) |