Generate AI videos and images programmatically via our REST API.
All API requests require a Bearer token. Create an API key in your Developer Options page.
Authorization: Bearer okpk_your_api_key_here
| Model ID | Label | Pricing | Duration | Ratios |
|---|---|---|---|---|
| jimeng-video-seedance-2.0 | Seedance 2.0 | $0.12/s ($0.24/s with video ref) | 4–15s | 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9 |
| jimeng-video-seedance-2.0-fast | Seedance 2.0 Fast | $0.08/s ($0.16/s with video ref) | 4–15s | 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9 |
| grok-video-3 | Grok Video 3 | $0.02/s | 5/10/15s | 2:3, 3:2, 1:1 |
| veo3.1 | Veo 3.1 | See variants below | — | 16:9, 9:16 |
| Variant ID | Label | Cost | Max Images |
|---|---|---|---|
| veo3.1-fast | Fast | $0.10 | 2 |
| veo3.1-components | Components | $0.15 | 3 |
| veo3.1-pro | Pro | $0.30 | 2 |
| Model ID | Label | Cost | Ratios | Resolutions |
|---|---|---|---|---|
| jimeng-5.0 | Jimeng 5.0 | $0.20 | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9 | 1k, 2k, 4k |
/api/video/generateSubmit a video generation task.
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Video model ID (see models table) |
| prompt | string | Yes | Text description of the video to generate |
| duration | number | No | Video duration in seconds (model-dependent range) |
| ratio | string | No | Aspect ratio (e.g. "16:9", "9:16", "1:1") |
| variant | string | No | For Veo 3.1 only: variant ID (see variants table) |
| ref_mode | string | No | Seedance only: "omni" or "first-last". Required when media is provided. See below. |
| media | array | No | Reference media array. Each item: {type: "image"|"video"|"audio", url: "..."}. Constraints depend on model and ref_mode. |
Seedance 2.0 / 2.0 Fast require ref_mode when media is provided.
| ref_mode | Description | Media Constraints |
|---|---|---|
| "omni" | Omni Reference — images, video, or audio | 0–9 items total, max 1 video. Types: image, video, audio |
| "first-last" | First & Last Frame — image-only keyframes | 0–2 images only. First item = first frame, second = last frame |
Cost note: using a video as reference doubles the per-second rate.
{
"generationId": "uuid",
"taskId": "backend-task-id",
"status": "pending"
}/api/video/tasks/{taskId}Poll a task for its current status and results.
{
"status": "completed",
"resultUrls": ["https://cdn.example.com/video.mp4"],
"type": "video"
}{
"status": "processing",
"progress": 50,
"type": "video"
}{
"status": "failed",
"errorMessage": "Generation failed",
"type": "video"
}# 1. Submit a video generation task (text-only)
curl -X POST https://okaypic.com/api/video/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "jimeng-video-seedance-2.0",
"prompt": "A cat playing piano in a jazz club",
"duration": 5,
"ratio": "16:9"
}'
# With reference images (omni mode — images/video/audio, up to 9)
curl -X POST https://okaypic.com/api/video/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "jimeng-video-seedance-2.0",
"prompt": "Make this cat dance",
"duration": 5,
"ratio": "16:9",
"ref_mode": "omni",
"media": [{"type": "image", "url": "https://example.com/cat.jpg"}]
}'
# With first & last frames (image-only, 0–2 images)
curl -X POST https://okaypic.com/api/video/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "jimeng-video-seedance-2.0",
"prompt": "Smooth transition",
"duration": 5,
"ratio": "16:9",
"ref_mode": "first-last",
"media": [
{"type": "image", "url": "https://example.com/frame1.jpg"},
{"type": "image", "url": "https://example.com/frame2.jpg"}
]
}'
# 2. Poll for task completion
curl https://okaypic.com/api/video/tasks/TASK_ID \
-H "Authorization: Bearer YOUR_API_KEY"
# Response: { "status": "completed", "resultUrls": ["https://..."], "type": "video" }| Status | Meaning |
|---|---|
| 400 | Bad request — invalid model, missing parameters, or non-video model |
| 401 | Unauthorized — invalid or missing API key |
| 402 | Insufficient balance |
| 429 | Too many concurrent tasks (max 3) |
| 500 | Internal server error — backend generation failed |