OkayPic API Documentation

Generate AI videos and images programmatically via our REST API.

Authentication

All API requests require a Bearer token. Create an API key in your Developer Options page.

Authorization: Bearer okpk_your_api_key_here

Available Models

Video Models

Model IDLabelPricingDurationRatios
jimeng-video-seedance-2.0Seedance 2.0$0.12/s ($0.24/s with video ref)4–15s16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9
jimeng-video-seedance-2.0-fastSeedance 2.0 Fast$0.08/s ($0.16/s with video ref)4–15s16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9
grok-video-3Grok Video 3$0.02/s5/10/15s2:3, 3:2, 1:1
veo3.1Veo 3.1See variants below16:9, 9:16

Veo 3.1 Variants

Variant IDLabelCostMax Images
veo3.1-fastFast$0.102
veo3.1-componentsComponents$0.153
veo3.1-proPro$0.302

Image Models

Model IDLabelCostRatiosResolutions
jimeng-5.0Jimeng 5.0$0.201:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:91k, 2k, 4k

Endpoints

POST/api/video/generate

Submit a video generation task.

Request Body

ParameterTypeRequiredDescription
modelstringYesVideo model ID (see models table)
promptstringYesText description of the video to generate
durationnumberNoVideo duration in seconds (model-dependent range)
ratiostringNoAspect ratio (e.g. "16:9", "9:16", "1:1")
variantstringNoFor Veo 3.1 only: variant ID (see variants table)
ref_modestringNoSeedance only: "omni" or "first-last". Required when media is provided. See below.
mediaarrayNoReference media array. Each item: {type: "image"|"video"|"audio", url: "..."}. Constraints depend on model and ref_mode.

Seedance Reference Modes

Seedance 2.0 / 2.0 Fast require ref_mode when media is provided.

ref_modeDescriptionMedia Constraints
"omni"Omni Reference — images, video, or audio0–9 items total, max 1 video. Types: image, video, audio
"first-last"First & Last Frame — image-only keyframes0–2 images only. First item = first frame, second = last frame

Cost note: using a video as reference doubles the per-second rate.

Other Models — Media Reference

  • Grok Video 3: 0–1 reference image. No ref_mode needed.
  • Veo 3.1: 0–3 reference images (depends on variant, see table). No ref_mode needed.

Response

{
  "generationId": "uuid",
  "taskId": "backend-task-id",
  "status": "pending"
}
GET/api/video/tasks/{taskId}

Poll a task for its current status and results.

Response (completed)

{
  "status": "completed",
  "resultUrls": ["https://cdn.example.com/video.mp4"],
  "type": "video"
}

Response (processing)

{
  "status": "processing",
  "progress": 50,
  "type": "video"
}

Response (failed)

{
  "status": "failed",
  "errorMessage": "Generation failed",
  "type": "video"
}

Code Examples

# 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" }

Error Codes

StatusMeaning
400Bad request — invalid model, missing parameters, or non-video model
401Unauthorized — invalid or missing API key
402Insufficient balance
429Too many concurrent tasks (max 3)
500Internal server error — backend generation failed