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": "Omni-Flash-Ext",
    "prompt": "a girl is dancing happily in a sunny garden",
    "duration": 10,
    "resolution": "1080p",
    "aspect_ratio": "9:16"
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KS1H7ZYSJWH1N779S2FSHTKA"
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://docs.apimart.ai/llms.txt

Use this file to discover all available pages before exploring further.

curl --request POST \
  --url https://api.apimart.ai/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "Omni-Flash-Ext",
    "prompt": "a girl is dancing happily in a sunny garden",
    "duration": 10,
    "resolution": "1080p",
    "aspect_ratio": "9:16"
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KS1H7ZYSJWH1N779S2FSHTKA"
    }
  ]
}

Authentication

Authorization
string
required
All requests require Bearer Token authentication.Get an API key:Visit the API Key management page to get your API key.Add the following header when making requests:
Authorization: Bearer YOUR_API_KEY

Request Parameters

model
string
required
Video generation model name. Must be Omni-Flash-Ext.
prompt
string
required
Video content description. We recommend describing the scene, subject, action, environment, camera movement, visual style, and audio cues in detail.Example: "a girl is dancing happily in a sunny garden"
duration
integer
default:"6"
Video duration in seconds.Supported values: 4, 6, 8, 10.
Other values such as 5 or 7 will return an invalid_duration error.
resolution
string
default:"720p"
Video resolution. Values are case-insensitive.Supported values:
  • 720p
  • 1080p
  • 4k
Other resolutions will return an invalid_resolution error.
aspect_ratio
string
default:"16:9"
Video aspect ratio. Use it to control landscape or portrait output.Common values:
  • 16:9 - landscape
  • 9:16 - portrait
Default: 16:9
size
string
Compatibility field. It has the same meaning as aspect_ratio. If both are provided, keep them consistent.
image_urls
array<url>
Reference image URL array. You can omit it, provide 1 image, or provide 3 images:
  • Omitted or empty array: Text-to-Video
  • 1 image: single-image Image-to-Video
  • 3 images: reference image fusion
Publicly accessible image URLs are supported. Base64 images in the data:image/...;base64,... format are also supported.
The first-frame plus last-frame mode with 2 images is not supported. Passing 2 images returns an unsupported_image_count error. 4 or more images have not been fully verified and are not recommended.

Response

code
integer
Response status code. Successful requests return 200.
data
array
Returned task array.

Query Task Result

Video generation is asynchronous. After submission, the API returns a task_id. Use the Get task status endpoint to query progress and results.
cURL
curl --request GET \
  --url https://api.apimart.ai/v1/tasks/task_01KS1H7ZYSJWH1N779S2FSHTKA \
  --header 'Authorization: Bearer <token>'
We recommend waiting 5-10 seconds after submission before the first query, then polling every 5-10 seconds. A single task usually completes in about 3-5 minutes.

Successful Result Example

{
  "code": 200,
  "data": {
    "id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
    "status": "completed",
    "progress": 100,
    "created": 1779246294,
    "completed": 1779246534,
    "actual_time": 240,
    "estimated_time": 600,
    "cost": 0.4,
    "result": {
      "videos": [
        {
          "url": ["https://cdn.example.com/videos/abc.mp4"],
          "expires_at": 1779332760
        }
      ]
    }
  }
}

Failed Result Example

{
  "code": 200,
  "data": {
    "id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
    "status": "failed",
    "progress": 100,
    "created": 1779246294,
    "completed": 1779246534,
    "actual_time": 240,
    "estimated_time": 600,
    "cost": 0,
    "error": {
      "message": "invalid duration 7, must be one of 4/6/8/10",
      "code": "task_failed"
    }
  }
}

Use Cases

Scenario 1: Text-to-Video

{
  "model": "Omni-Flash-Ext",
  "prompt": "a beautiful sunset over the ocean with seagulls flying",
  "duration": 6,
  "resolution": "720p",
  "aspect_ratio": "16:9"
}

Scenario 2: Single-Image Video

{
  "model": "Omni-Flash-Ext",
  "prompt": "make the character smile and slowly turn around, cinematic camera motion",
  "duration": 6,
  "resolution": "1080p",
  "aspect_ratio": "9:16",
  "image_urls": ["https://example.com/character.jpg"]
}

Scenario 3: 3-Reference-Image Fusion

{
  "model": "Omni-Flash-Ext",
  "prompt": "a creative scene combining these elements with smooth camera motion",
  "duration": 10,
  "resolution": "1080p",
  "aspect_ratio": "9:16",
  "image_urls": [
    "https://example.com/scene.jpg",
    "https://example.com/character.jpg",
    "https://example.com/product.jpg"
  ]
}

Scenario 4: 4K Short Video

{
  "model": "Omni-Flash-Ext",
  "prompt": "close-up of a hummingbird hovering in front of a red flower",
  "duration": 4,
  "resolution": "4k",
  "aspect_ratio": "16:9"
}

Error Codes

HTTPError typeMeaningSuggested action
400invalid_request_errormodel is not Omni-Flash-Ext, prompt is empty, or the JSON format is invalidCheck the request body
400invalid_durationduration is not 4, 6, 8, or 10Use a supported duration
400invalid_resolutionresolution is not 720p, 1080p, or 4kUse a supported resolution
400unsupported_image_countThe number of image_urls is unsupported, commonly caused by passing 2 imagesUse 0, 1, or 3 images
401authentication_errorInvalid tokenCheck the Bearer Token
402payment_requiredInsufficient balanceRecharge and try again
429rate_limit_errorRate limit exceededReduce concurrency or try again later
When a task fails, the task status API returns the failure reason in data.error. Common causes include temporary upstream quota exhaustion, content moderation failure, or upstream timeout.