Skip to main content
POST
/
v1
/
videos
/
generations
curl --request POST \
  --url https://api.apimart.ai/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "kling-3.0-turbo",
    "prompt": "A corgi running on the beach, cinematic, golden-hour light",
    "aspect_ratio": "16:9",
    "resolution": "1080p",
    "duration": 5
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_xxxxxxxxxx"
    }
  ]
}
curl --request POST \
  --url https://api.apimart.ai/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "kling-3.0-turbo",
    "prompt": "A corgi running on the beach, cinematic, golden-hour light",
    "aspect_ratio": "16:9",
    "resolution": "1080p",
    "duration": 5
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_xxxxxxxxxx"
    }
  ]
}

Authentication

Authorization
string
required
All endpoints require authentication using a Bearer TokenGet an API Key:Visit the API Key management page to obtain your API KeyAdd it to the request header when using it:
Authorization: Bearer YOUR_API_KEY

Request Parameters

model
string
required
Video generation model nameSupported models:
  • kling-3.0-turbo - Kling 3.0 Turbo
prompt
string
required
Text promptThe upstream limit is no more than 3072 characters; we recommend no more than 2500 characters.Example: "A corgi running on the beach, cinematic, golden-hour light"
first_frame_image
string
Supports an image URL or Base64.
Upstream limits for the first-frame image:
  • Format: .jpg / .jpeg / .png
  • Size: ≤ 50MB
  • Width/height: ≥ 300px
  • Aspect ratio: 1:2.5 ~ 2.5:1
aspect_ratio
string
default:"16:9"
Video aspect ratioAvailable values:
  • 16:9 - Landscape
  • 9:16 - Portrait
  • 1:1 - Square
Default value: 16:9
Only effective for text-to-video. This field has no effect for image-to-video; the video ratio is determined by the first-frame image.
resolution
string
default:"720p"
Video resolutionAvailable values:
  • 720p
  • 1080p
Default value: 720p
duration
integer
default:"5"
Video duration (seconds)Value range: 3-15 (minimum 3 seconds, maximum 15 seconds)Default value: 5⚠️ Note: You must enter a plain number (e.g. 6); do not add quotes, otherwise it will cause an error
watermark
boolean
Whether to add a watermarkOnly passed to the upstream when explicitly provided; if omitted, no watermark is added.

Text-to-Video vs Image-to-Video

The system automatically determines the generation mode based on whether first_frame_image is provided: with a first-frame image it uses image-to-video, without one it uses text-to-video. Users do not need to declare it explicitly.
ParameterText-to-VideoImage-to-Video
prompt✅ Required✅ Optional (if empty, generated purely from the first-frame image)
first_frame_image❌ Not passed✅ Required
aspect_ratio✅ Optional❌ No effect (ratio determined by the first-frame image)
resolution✅ Optional✅ Optional
duration✅ Optional (3-15)✅ Optional (3-15)
watermark✅ Optional✅ Optional

Response

code
integer
Response status code, 200 on success
data
array
Returned data array

Use Cases

Scenario 1: Text-to-Video (1080P)

{
  "model": "kling-3.0-turbo",
  "prompt": "A corgi running on the beach, cinematic, golden-hour light",
  "aspect_ratio": "16:9",
  "resolution": "1080p",
  "duration": 5
}

Scenario 2: Text-to-Video (Portrait 720P)

{
  "model": "kling-3.0-turbo",
  "prompt": "Shibuya crossing in Tokyo, neon lights on a rainy night reflecting on the wet ground, pedestrians walking through with umbrellas",
  "aspect_ratio": "9:16",
  "resolution": "720p",
  "duration": 10
}

Scenario 3: Image-to-Video (First-Frame Image)

{
  "model": "kling-3.0-turbo",
  "prompt": "The camera slowly pushes in, the character smiles",
  "first_frame_image": "https://cdn.example.com/first.jpg",
  "resolution": "720p",
  "duration": 5
}

Scenario 4: Image-to-Video from First Frame Only (No Prompt)

{
  "model": "kling-3.0-turbo",
  "first_frame_image": "https://cdn.example.com/first.jpg",
  "resolution": "1080p",
  "duration": 5
}

Scenario 5: Multi-Shot Storyboard (Text-to-Video)

{
  "model": "kling-3.0-turbo",
  "prompt": "Shot 1,2,a corgi running on the beach;Shot 2,3,the camera pushes in on the character smiling;",
  "aspect_ratio": "16:9",
  "resolution": "1080p",
  "duration": 5
}
Querying the Task ResultVideo generation is an asynchronous task; after submission a task_id is returned. Use the Get Task Status endpoint to query the generation progress and result.