BlockRun

Video Generation API

Generate short AI videos with xAI's Grok Imagine or ByteDance's Seedance. Text or image prompt in, MP4 URL out.

Endpoint

POST https://blockrun.ai/api/v1/videos/generations

Request

{
  "model": "xai/grok-imagine-video",
  "prompt": "a red apple slowly spinning on a wooden table, daylight",
  "image_url": "https://example.com/seed.jpg"
}

Parameters

ParameterTypeRequiredDescription
modelstringYesVideo model ID (see below)
promptstringYesText description of the video to generate
image_urlstringNoOptional seed image URL for image-to-video
duration_secondsintegerNoDuration billed for (defaults to model's default)

Available Models

Model IDProviderDefault / MaxBilling
xai/grok-imagine-videoxAI8s / 8s MP4$0.050/second (default 8s = $0.42 with margin)
bytedance/seedance-1.5-proByteDance5s / 10s MP4$0.030/second (default 5s = $0.158 with margin)
bytedance/seedance-2.0-fastByteDance5s / 10s MP4$0.150/second (default 5s = $0.788 with margin)
bytedance/seedance-2.0ByteDance5s / 10s MP4$0.300/second (default 5s = $1.575 with margin)

All models accept text prompts and an optional image_url for image-to-video. Output is 720p MP4. seedance-2.0-fast generates in ~60–80 s; seedance-2.0 (Pro) may take longer and can occasionally hit the 85 s timeout — in that case the request returns 504 and no payment is taken.

Response

{
  "created": 1776443975,
  "model": "xai/grok-imagine-video",
  "data": [
    {
      "url": "https://blockrun.ai/api/media/media/videos/2026/04/17/<id>.mp4",
      "source_url": "https://vidgen.x.ai/xai-vidgen-bucket/xai-video-<id>.mp4",
      "duration_seconds": 8,
      "request_id": "<xai-request-id>",
      "backed_up": true
    }
  ]
}

Response Fields

FieldTypeDescription
createdintegerUnix timestamp
data[].urlstringPermanent URL. When GCS backup succeeds, this is a blockrun-hosted proxy URL; otherwise the upstream URL
data[].source_urlstringOriginal upstream URL from xAI (temporary — may expire)
data[].duration_secondsintegerDuration of the generated video
data[].request_idstringxAI request ID for debugging / deduplication
data[].backed_upbooleantrue when the video was mirrored to BlockRun's GCS bucket

Why both url and source_url? xAI's vidgen.x.ai URLs are temporary. BlockRun mirrors each generated video to Google Cloud Storage and returns the permanent proxy URL as url. source_url is kept for debugging. If the backup step fails, url falls back to the upstream URL and backed_up is false.

Timing

Video generation is asynchronous upstream. This endpoint handles the full polling loop so you only need to make a single request.

PhaseTypical latency
Request → xAI job submitted~1s
Polling until video ready15–60s (typically under 30s)
GCS backup + settle payment1–3s
Total~20–60s

The connection stays open until the video is ready. Make sure your HTTP client allows at least 180s.

Examples

Via ClawRouter (recommended for local use)

ClawRouter handles x402 payments automatically.

curl -X POST http://localhost:8402/v1/videos/generations \
  -H "Content-Type: application/json" \
  -d '{
    "model": "xai/grok-imagine-video",
    "prompt": "a neon-lit cyberpunk street at night, camera slowly dollying forward"
  }'

Direct API (cURL)

curl -X POST https://blockrun.ai/api/v1/videos/generations \
  -H "Content-Type: application/json" \
  -H "X-Payment: $PAYMENT_HEADER" \
  -d '{
    "model": "xai/grok-imagine-video",
    "prompt": "a hummingbird hovering in front of a red flower, ultra slow motion"
  }'

Image-to-video

curl -X POST http://localhost:8402/v1/videos/generations \
  -H "Content-Type: application/json" \
  -d '{
    "model": "xai/grok-imagine-video",
    "prompt": "the subject turns its head and smiles",
    "image_url": "https://example.com/portrait.jpg"
  }'

Pricing

ModelUnitPriceMarginDefault billed
xai/grok-imagine-videoper second$0.0505%8s = $0.420
bytedance/seedance-1.5-proper second$0.0305%5s = $0.158
bytedance/seedance-2.0-fastper second$0.1505%5s = $0.788
bytedance/seedance-2.0per second$0.3005%5s = $1.575

Error Codes

CodeDescription
400Invalid request (bad prompt, parameters, or duration_seconds above model max)
402Payment required or payment verification/settlement failed
403Content policy violation
429Rate limit exceeded (xAI caps at 60 RPM)
500Server error
504Video generation timed out (upstream job did not finish within the 85s cap). No payment is taken.

Links