OpenReels
API Reference

REST API

Complete reference for the OpenReels HTTP API — job management, health checks, and artifact serving.

The OpenReels API server is a Fastify application that manages video generation jobs via a BullMQ queue backed by Redis. All endpoints are prefixed with /api/v1.

Base URL

http://localhost:3000/api/v1

The host and port are configurable via the HOST and PORT environment variables (defaults: 0.0.0.0:3000).


Health Check

GET /api/v1/health

Returns the server health status, Redis connectivity, and which API keys are configured.

Response

{
  "status": "healthy",
  "redis": "connected",
  "jobsDir": "exists",
  "keys": {
    "ANTHROPIC_API_KEY": true,
    "OPENAI_API_KEY": false,
    "GOOGLE_API_KEY": true,
    "ELEVENLABS_API_KEY": true,
    "INWORLD_TTS_API_KEY": false,
    "PEXELS_API_KEY": true,
    "PIXABAY_API_KEY": false
  }
}

The status field is "healthy" when Redis is connected, "degraded" otherwise. The keys object shows which API keys are present in the environment (values are booleans, not the actual keys).


Aggregate Stats

GET /api/v1/stats

Returns aggregate statistics across all jobs.

Response

{
  "totalJobs": 42,
  "completedJobs": 38,
  "failedJobs": 2,
  "activeJobs": 2,
  "totalCost": 4.57
}

totalCost is the sum of actual costs (or estimated costs as fallback) for all completed jobs, rounded to two decimal places.


Jobs

POST /api/v1/jobs

Creates a new video generation job and adds it to the processing queue.

Request Body

{
  "topic": "The history of the Roman Colosseum",
  "archetype": "editorial_caricature",
  "pacing": "standard",
  "platform": "youtube",
  "dryRun": false,
  "noMusic": false,
  "noVideo": false,
  "providers": {
    "llm": "anthropic",
    "tts": "elevenlabs",
    "image": "gemini",
    "stock": "pexels",
    "video": "gemini",
    "videoModel": "veo-3.0-generate-preview",
    "music": "bundled"
  },
  "keys": {
    "ANTHROPIC_API_KEY": "sk-ant-...",
    "ELEVENLABS_API_KEY": "..."
  }
}
FieldTypeRequiredDefaultDescription
topicstringYes-The video topic (max 500 characters)
archetypestringNoauto-selectedVisual style archetype
pacingstringNoauto-selectedPacing tier (slow, standard, fast)
platformstringNo"youtube"Target platform
dryRunbooleanNofalseSkip rendering, produce only the DirectorScore
noMusicbooleanNofalseSkip music generation/selection
noVideobooleanNofalseSkip AI video generation for scenes
directionstringNoCreative direction text (free-form markdown, max 10KB). Guides the AI's DirectorScore generation.
scoreobjectNoA previous DirectorScore JSON for replay. Skips research, director, and critic stages. Must be a valid DirectorScore schema.
providersobjectNosee defaultsProvider selection per category
keysobjectNo{}BYOK (Bring Your Own Key) API keys

Provider defaults: llm: "anthropic", tts: "elevenlabs", image: "gemini", stock: "pexels", music: "bundled".

Response 201 Created

{
  "id": "1",
  "topic": "The history of the Roman Colosseum",
  "archetype": "editorial_caricature",
  "status": "queued"
}

Errors

StatusCondition
400Missing or empty topic
400topic exceeds 500 characters
400Unknown archetype
400Unknown pacing tier
400Unknown platform
400direction exceeds 10KB
400direction is not a string
400score is not a valid DirectorScore schema

GET /api/v1/jobs

Lists all jobs, sorted by creation time (newest first).

Query Parameters

ParameterTypeDefaultDescription
limitnumber20Max jobs to return (capped at 100)
offsetnumber0Number of jobs to skip

Response

{
  "jobs": [
    {
      "id": "3",
      "topic": "Black holes explained",
      "status": "completed",
      "createdAt": "2025-01-15T10:30:00.000Z",
      "completedAt": "2025-01-15T10:35:00.000Z",
      "stages": { ... }
    }
  ],
  "total": 42
}

GET /api/v1/jobs/:id

Returns full metadata for a single job including stage statuses, cost estimates, research data, the DirectorScore, and critic review.

Response

{
  "id": "1",
  "topic": "The history of the Roman Colosseum",
  "archetype": "editorial_caricature",
  "status": "completed",
  "createdAt": "2025-01-15T10:30:00.000Z",
  "completedAt": "2025-01-15T10:35:00.000Z",
  "stages": {
    "research": { "status": "done", "detail": "5 key facts", "durationSec": 4.2 },
    "director": { "status": "done", "detail": "8 scenes", "durationSec": 6.1 },
    "tts": { "status": "done", "detail": "42s audio", "durationSec": 8.3 },
    "visuals": { "status": "done", "detail": "8 assets", "durationSec": 25.7 },
    "assembly": { "status": "done", "detail": "final.mp4", "durationSec": 45.2 },
    "critic": { "status": "done", "detail": "Score: 8.5/10", "durationSec": 3.1 }
  },
  "costEstimate": { "totalCost": 0.12 },
  "actualCost": { "totalCost": 0.11 },
  "videoPath": "run-20250115-103000/final.mp4",
  "runDir": "run-20250115-103000",
  "researchData": {
    "summary": "...",
    "key_facts": ["..."],
    "mood": "epic_cinematic"
  },
  "score": { ... },
  "criticReview": {
    "score": 8.5,
    "strengths": ["..."],
    "weaknesses": ["..."]
  }
}

Stage statuses: "pending", "running", "done", "skipped", "error"

Job statuses: "queued", "running", "completed", "failed", "cancelled"

Errors

StatusCondition
400Invalid job ID format
404Job not found

GET /api/v1/jobs/:id/events

Opens a Server-Sent Events (SSE) stream for real-time job progress. See SSE Events for the full event reference.

Headers

Content-Type: text/event-stream
Cache-Control: no-cache
Connection: keep-alive

The connection sends a job:snapshot event immediately with the current job state, then streams progress events until the job completes or fails.

Errors

StatusCondition
400Invalid job ID format
404Job not found in queue or on disk

DELETE /api/v1/jobs/:id

Deletes a job and all its artifacts from disk. Active or queued jobs cannot be deleted.

Response

{ "status": "deleted" }

Errors

StatusCondition
400Invalid job ID format
404Job not found
409Job is active or waiting

POST /api/v1/jobs/:id/cancel

Requests cancellation of a running or queued job. The worker checks for the cancel flag between pipeline stages.

Response

{ "status": "cancelled" }

Errors

StatusCondition
400Invalid job ID format
404Job not found
409Job already completed or failed

Artifacts

GET /api/v1/jobs/:id/artifacts/*

Serves files from a job's output directory. Path traversal is prevented by validating the resolved path stays within the job directory.

Examples

GET /api/v1/jobs/1/artifacts/run-20250115-103000/final.mp4
GET /api/v1/jobs/1/artifacts/run-20250115-103000/scene-001.png

Errors

StatusCondition
400Invalid job ID format
403Path traversal attempt
404Artifact not found

Reference Data

GET /api/v1/archetypes

Returns the list of available visual style archetypes with their configuration.

[
  {
    "name": "editorial_caricature",
    "captionStyle": "glitch",
    "artStyle": "editorial caricature with bold outlines",
    "mood": "satirical",
    "colorPalette": "high contrast",
    "scenePacing": "standard",
    "motionIntensity": "medium"
  }
]

GET /api/v1/platforms

Returns available target platforms with their video specifications.

[
  {
    "name": "youtube",
    "width": 1080,
    "height": 1920,
    "fps": 30,
    "maxDurationSeconds": 60
  }
]

GET /api/v1/providers

Returns available providers grouped by category.

{
  "llm": [
    { "key": "anthropic", "label": "Anthropic (Claude)" },
    { "key": "openai", "label": "OpenAI (GPT)" },
    { "key": "gemini", "label": "Google Gemini" }
  ],
  "tts": [
    { "key": "elevenlabs", "label": "ElevenLabs" },
    { "key": "inworld", "label": "Inworld" },
    { "key": "kokoro", "label": "Kokoro (Local)" },
    { "key": "gemini-tts", "label": "Gemini TTS" },
    { "key": "openai-tts", "label": "OpenAI TTS" }
  ],
  "image": [
    { "key": "gemini", "label": "Google Gemini" },
    { "key": "openai", "label": "OpenAI (GPT Image)" }
  ],
  "video": [
    { "key": "gemini", "label": "Google Veo" },
    { "key": "fal", "label": "fal.ai (Kling, Wan, etc.)" }
  ]
}

Environment Variables

VariableDefaultDescription
REDIS_URLredis://localhost:6379Redis connection URL
PORT3000HTTP server port
HOST0.0.0.0HTTP server bind address
JOBS_DIR./jobsDirectory for job artifacts
MAX_JOBS0 (disabled)Auto-prune completed jobs when count exceeds this limit