Skip to content

feat(video): add OpenRouter video provider - #971

Open
Stevesibilia wants to merge 2 commits into
OpenMontageInc:mainfrom
Stevesibilia:feat/openrouter-video
Open

Stevesibilia wants to merge 2 commits into
OpenMontageInc:mainfrom
Stevesibilia:feat/openrouter-video

Conversation

@Stevesibilia

Copy link
Copy Markdown

🤖 This was written by an AI agent on behalf of @Stevesibilia (claude-code/claude-opus-5-5).

Summary

Adds openrouter_video, a video generation provider for OpenRouter's video API. One prepaid OPENROUTER_API_KEY reaches Veo 3.1, Seedance 2.x, MiniMax Hailuo, Wan, Grok Imagine, Runway Gen-4.5 and the rest of OpenRouter's video catalog, often at a lower price than other hosts charge for the same models.

Related issue

None.

Changes

  • Catalog validation. Durations, resolutions, aspect ratios, frames, audio and seed are checked against OpenRouter's live model catalog before any paid call. A pinned snapshot is the fallback when the catalog is unreachable.
  • Local frames sent inline. First and last frames and reference images from local paths go as base64 data URIs, so nothing is uploaded to a third-party host and video_selector does not route them through fal.
  • Cost. Preflight estimates come from each model's pricing_skus. Results report the charged usage.cost.
  • Defaults. generate_audio is off unless requested. exclude_data_collection opts into provider.data_collection: deny. Paid submissions are never retried, and a polling timeout returns resume_job to keep waiting on the same job.
  • Clear failures. Safety-filtered or policy-blocked jobs, and catalog models with no available endpoint, get specific guidance.
  • Docs. New Layer 3 skill openrouter-video, plus PROVIDERS.md, .env.example and the ai-video-gen skill.

Testing

  • New contract tests with faked HTTP. The full suite passes in a Python 3.11 container, except five tests that fail the same way on main there (Remotion adapter, HyperFrames, fal resume webp).
  • Live runs: Veo 3.1 Lite image-to-video settled at the catalog rate ($0.12 for 4 s at 720p), directly and through video_selector. Seedance 2.0 Mini, Seedance 2.0, Grok Imagine 1.5 Lite and HeyGen Video 1 also completed. A violent keyframe blocked by Veo's filter produced the new filtered-job message.

Checklist

  • The change is focused on a single logical concern.
  • I ran the relevant tests locally (make test-contracts / make test) where applicable.
  • I updated docs/README if behavior or usage changed.
  • No unrelated files (build artifacts, local config) are included in the diff.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AdYM4hzKcmypBnbgdcmtW4

Stevesibilia and others added 2 commits November 21, 2026 16:42
Add openrouter_video (provider openrouter, env OPENROUTER_API_KEY), a
video_generation tool for OpenRouter's video API. One prepaid key reaches
Veo 3.1 (Lite, Fast, standard), Seedance 2.0 and 2.5, MiniMax Hailuo,
Wan 3.0, Grok Imagine, Runway Gen-4.5 and the rest of OpenRouter's catalog.

- Submit, poll and download from the authenticated content endpoint. The
  paid submission is never retried; a polling timeout returns resume_job,
  which polls the same job when passed back.
- Durations, resolutions, aspect ratios, frame support, audio, seed and
  passthrough parameters are validated against the live catalog before any
  paid call, with a pinned snapshot in
  tools/provider_contracts/openrouter_video_models.json as the fallback.
- Local first/last frames and reference images are sent inline as base64
  data URIs. The schema does not advertise image_url, so video_selector does
  not upload local frames to fal for this tool.
- Cost: the estimate comes from the model's pricing_skus (per second, cents
  per second, or Seedance video tokens with a 5% margin); unknown SKUs raise
  PriceQuoteRequired. cost_usd is usage.cost from the completed job.
- generate_audio defaults to false, since OpenRouter defaults it on and it
  costs more. exclude_data_collection opts into provider.data_collection=deny.
  negative_prompt maps to Veo's provider passthrough.
- Verified live: Veo 3.1 Lite 4 s 720p image-to-video settled at $0.12 (the
  catalog rate), also through video_selector with a negative prompt; Seedance
  2.0 Mini 4 s 480p settled at $0.142079, matching 864x496 x 97 frames of
  video tokens.
- Contract tests with faked HTTP, a Layer 3 skill, PROVIDERS.md,
  .env.example and the ai-video-gen skill.

Assisted-by: claude-code/claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AdYM4hzKcmypBnbgdcmtW4
When a job fails because the provider filtered the output or blocked the
prompt by content policy, report error_code "filtered" and tell the agent to
change the keyframe or the model family instead of rewording the prompt.
When OpenRouter answers "No endpoints found" for a catalog model, say that no
endpoint serves it right now or none matches the provider preferences.

Live tests on a violent keyframe: Veo 3.1 Lite filtered it twice, mischief-1
blocked the prompt, Hailuo 3 Max had no endpoint, while Seedance 2.0, Grok
Imagine 1.5 Lite and HeyGen Video 1 rendered it. The skill records the cases.

Assisted-by: claude-code/claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AdYM4hzKcmypBnbgdcmtW4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant