Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.samuraiapi.in/llms.txt

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

Video Generation

Create high-quality videos from text prompts using state-of-the-art video generation models. This is an asynchronous endpoint that returns a job ID for status polling.

Endpoint

POST https://api.samuraiapi.in/v1/videos/generations

Request Body

model
string
required
The model ID to use for video generation.Available models include:
  • veo-3.1 (Google’s latest)
  • sora-2 (OpenAI’s latest)
  • luma-ray-2 (Luma AI’s latest)
  • hailuo-2 (MiniMax’s latest)
  • pika-2.2 (Pika Labs’ latest)
  • kling-v1.5 (Kuaishou’s latest)
prompt
string
required
A text description of the desired video. The maximum length is 1000 characters.
aspect_ratio
string
default:"16:9"
The aspect ratio of the generated video. Options: 16:9, 9:16, 1:1.
duration
integer
default:5
The duration of the generated video in seconds. Options: 5, 10.
user
string
A unique identifier for the end-user, for abuse monitoring.

Response

job_id
string
Unique identifier for the generation job (e.g., vid-abc123)
status
string
Current status of the job. Always "pending" initially.
status_url
string
The URL to poll for the job status.

Polling for Status

Since video generation is an asynchronous process, you must poll the status endpoint until the job is completed.

Endpoint

GET https://api.samuraiapi.in/v1/videos/status/{job_id}

Response

job_id
string
Unique identifier for the generation job
status
string
Current status of the job. One of: "pending", "processing", "completed", "failed".
result
object
The result of the generation job (only present when status is "completed").
  • video_url (string): The URL of the generated video
  • thumbnail_url (string): The URL of the video thumbnail
error
object
Error details (only present when status is "failed").
  • message (string): Description of the error

Examples

Generate Video

curl https://api.samuraiapi.in/v1/videos/generations \
  -H "Authorization: Bearer sk-samurai-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "veo-3.1",
    "prompt": "A cinematic shot of a samurai walking through a cherry blossom forest at sunset",
    "aspect_ratio": "16:9",
    "duration": 5
  }'

Error Responses

StatusError TypeDescription
400invalid_request_errorMissing required field or invalid parameter
401authentication_errorInvalid API key
404not_found_errorModel not found
429rate_limit_errorRate limit exceeded
500server_errorInternal server error