OpenRouter Video Generator Tool for OpenWebUI

https://i.redd.it/ztizvtw1ildh1.gif

https://github.com/spawnofsociety2/openwebui-openrouter-video

A fully autonomous, "agentic" video generation tool for OpenWebUI powered by OpenRouter. This tool empowers your LLM assistant to dynamically discover available video models, submit generation jobs, securely poll for completion, and directly embed the resulting HD videos inside your OpenWebUI chat stream.

🚀 Features

  • Agentic Model Discovery: The LLM can dynamically pull the live catalog of OpenRouter's video models (Sora, Veo, Kling, Seedance, Hailuo, Wan, Grok, etc.) and check their capabilities (supported resolutions, aspect ratios, max durations, audio support) in real time.
  • Background Polling & Auto-Download: Handles OpenRouter's asynchronous polling endpoints autonomously. Downloads completed .mp4 assets to your local OpenWebUI static server to prevent broken links or expired signed URLs.
  • Rich HTML5 Embedding: Injects a beautiful, responsive HTML5 video player natively inside the chat interface with a direct download link.
  • Advanced Model Features: Supports audio generation toggling, image references for style consistency, and provider-specific passthrough options (e.g. negativePrompt for the Google models).

🎬 Supported Models

The tool reads OpenRouter's catalog live at request time, so this list is a snapshot — new models appear automatically as OpenRouter adds them, and your assistant will always report the current lineup. As of this writing:

Model Max Resolution Durations Aspect Ratios Audio controllable?
openai/sora-2-pro 1080p 4, 8, 12, 16, 20s 16:9, 9:16
google/veo-3.1 4K 4, 6, 8s 16:9, 9:16
google/veo-3.1-fast 4K 4, 6, 8s 16:9, 9:16
google/veo-3.1-lite 1080p 4, 6, 8s 16:9, 9:16
kwaivgi/kling-v3.0-pro 720p 3–15s 16:9, 9:16, 1:1
kwaivgi/kling-v3.0-std 720p 3–15s 16:9, 9:16, 1:1
kwaivgi/kling-video-o1 720p 5 or 10s 16:9, 9:16, 1:1
bytedance/seedance-2.0 4K 4–15s 1:1, 3:4, 9:16, 4:3, 16:9, 21:9, 9:21
bytedance/seedance-2.0-fast 720p 4–15s 1:1, 3:4, 9:16, 4:3, 16:9, 21:9, 9:21
bytedance/seedance-1-5-pro 1080p 4–12s 1:1, 3:4, 9:16, 9:21, 4:3, 16:9, 21:9
alibaba/wan-2.7 1080p 2–10s 16:9, 9:16, 1:1, 4:3, 3:4
alibaba/wan-2.6 1080p 5 or 10s 16:9, 9:16
alibaba/happyhorse-1.1 1080p 3–15s 16:9, 9:16, 1:1, 4:3, 3:4, 21:9, 9:21
alibaba/happyhorse-1.0 1080p 3–15s 16:9, 9:16, 1:1, 4:3, 3:4, 21:9, 9:21
minimax/hailuo-2.3 1080p 6 or 10s 16:9
x-ai/grok-imagine-video 720p 1–15s 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3

>Note on audio: The column above means "is audio controllable via the generate_audio parameter", not "does this model have sound". The catalog reports three distinct states:
>
>
>
>So if you need a guaranteed-silent result, pick a ✅ model and pass generate_audio=false, or strip the audio track yourself afterwards.
>
>Note on 4K: Only veo-3.1, veo-3.1-fast, and seedance-2.0 currently support 4K output.

📦 Installation

  1. Open your OpenWebUI instance.
  2. Navigate to Workspace -> Tools.
  3. Click + Add Tool.
  4. Give it a name (e.g., OpenRouter Video).
  5. Copy the entire contents of openrouter_video_tool.py and paste it into the code editor.
  6. Click Save.

⚙️ Configuration

Once installed, you must provide your OpenRouter API key:

  1. Go to the tool's settings (the small equalizer icon next to the tool name, or inside the tool configuration page under Valves).
  2. Set your OPENROUTER_API_KEY. Get one at openrouter.ai/keys.
  3. Ensure the tool is Enabled in your chat window.

Optional valves: POLL_INTERVAL_SECONDS (how often to check for completion), MAX_TIMEOUT_SECONDS (overall wait before giving up), and REQUEST_TIMEOUT_SECONDS (ceiling for any single HTTP request — raise it if you're on a slow connection and large downloads time out).

>Note on disk usage: Generated videos are downloaded to {STATIC_DIR}/videos/ and are never cleaned up automatically. On a long-lived self-hosted instance this directory grows without bound, so if you generate often, prune it periodically (e.g. a scheduled job deleting .mp4 files older than N days).

🗣️ Usage Examples

Because this tool is entirely LLM-driven, you don't need to fiddle with drop-down menus before generating. Just ask your assistant naturally!

Ask about available models:

>"What video models can I use right now, and which ones support audio?"

Generate a video with specific constraints:

>"Use Grok to generate a 5-second video of a fluffy ginger cat watching the rain. Aspect ratio 16:9."

Generate at 4K:

>"Use Veo 3.1 to make an 8-second 4K cinematic drone shot over a misty mountain range."

Provide styling references:

>"Make a cinematic panning shot of a cyberpunk city. I've attached an image to use as a style reference, but don't use it as the exact first frame."

🛠️ Requirements

  • aiohttp (Automatically parsed by OpenWebUI)
  • An active OpenWebUI instance.

🧪 Tests

python -m unittest discover -s tests -v

No network, API key, or OpenWebUI install required — aiohttp is mocked and the two runtime imports are stubbed. The suite guards the bugs that were live in 1.4 and cost real money to find: the API key being sent to non-OpenRouter download hosts, completed jobs being dropped when they return no unsigned_urls, and generate_audio=false never reaching the API. If you change the download loop or the payload builder, run these first.

📜 License

MIT License. Feel free to fork and modify!

https://i.redd.it/oferfrf4ildh1.gif

reddit.com
u/SpawnofSociety2 — 1 month ago

[Tool] One OpenWebUI tool, every OpenRouter video model — Sora/Veo/Kling/Seedance/Grok, one API key

I've posted a couple of single-provider video tools here before (Veo, Gemini Omni), and the main friction was always the setup — each one needs its own cloud project and IAM auth. So I built the opposite: one tool that routes through OpenRouter, so a single API key gets you Sora, Veo, Kling, Seedance, Hailuo, Wan, and Grok. Free and on GitHub.

The twist is it's agentic — you don't pick the model from a dropdown before generating. The LLM does it in conversation:

  • Model discovery on the fly — the assistant pulls OpenRouter's live catalog and checks each model's real capabilities (resolution, aspect ratio, max duration, audio support) at request time, so you're never stuck with a hardcoded list that goes stale. Current lineup spans OpenAI Sora 2, Google Veo 3.1 (+ Fast/Lite), Kling v3, ByteDance Seedance, MiniMax Hailuo, Alibaba Wan, and xAI Grok. Ask "what can I use right now, and which support audio?" and it answers from the actual API — handy, since audio support genuinely varies (Grok, Hailuo, and HappyHorse are video-only) and only Veo 3.1 and Seedance 2.0 hit 4K.
  • Natural-language generation — "Use Grok to generate a 5-second 16:9 clip of a ginger cat watching the rain" just works. The LLM maps your request to the right model slug and parameters — and it knows the constraints, so if you ask Grok for audio it'll tell you that model's video-only and point you to one that isn't.
  • Background polling + auto-download — it handles OpenRouter's async polling itself, then downloads the finished .mp4 to your OpenWebUI static server so you don't end up with broken links when the signed URLs expire.
  • Inline HTML5 player — videos embed natively in the chat with a download link underneath.
  • Image references + audio toggle + provider passthrough — style-reference images, audio on/off, and provider-specific options (e.g. negativePrompt for the Google models) all supported.

Setup is genuinely just: paste the tool into Workspace → Tools, drop in your OpenRouter API key, done. Only dep is aiohttp, which OpenWebUI pulls in automatically.

Repo: https://github.com/spawnofsociety2/openwebui-openrouter-video

Fair warning: video models on OpenRouter are pay-per-generation, so keep an eye on credits — the premium models (Sora, Veo) add up fast. But being able to A/B the same prompt across providers without juggling seven separate accounts has been worth it for me.

Feedback and PRs welcome — happy to answer setup questions in the comments.

https://preview.redd.it/zxqi4kpp6idh1.jpg?width=1694&format=pjpg&auto=webp&s=ae10bb743563a46990559a65eba5fcdba67f578a

reddit.com
u/SpawnofSociety2 — 1 month ago

Veo 3.1 & Gemini Omni video generation from OpenWebUI (Python tools, ADC + service-account auth)

I've been integrating Google's video models into OpenWebUI (a self-hosted LLM front-end) and wanted to share the two tools plus some notes on the auth side, since that's the part that trips people up when they're used to OpenAI-style API keys.

These run on the Gemini Enterprise Agent Platform (formerly Vertex AI). If you haven't touched it since the Cloud Next rebrand: the console entry moved, but the API surface didn't — still aiplatform.googleapis.com, same model IDs, same google-genai SDK — so nothing changed at the code level.

What they do: two Python tools that generate video from a text prompt (with image-to-video and video-editing support), then embed the result inline in the chat. One targets Veo 3.1, the other Gemini Omni Flash.

The auth angle (the reason I'm posting here specifically): unlike a lot of AI integrations that just take a bearer key, these use proper IAM auth. I documented three paths so it works regardless of how the host app is deployed:

  • Local (pip/uv): Application Default Credentials via gcloud auth application-default login — the SDK picks up the creds automatically on restart.
  • Docker: service account with the Vertex AI User role, JSON key mounted into the container, pointed at via GOOGLE_APPLICATION_CREDENTIALS.
  • Kubernetes/Helm: same key as a namespace secret, mounted through extraVolumes/extraVolumeMounts with the env var set in values.yaml.

One heads-up if you're setting this up fresh: some IAM role names shifted in the console with the rebrand, so the role you're granting may show under a slightly different label than "Vertex AI User" — the underlying permission is the same.

A few implementation details that might be useful if you're doing something similar:

  • Long-running operations: Veo 3.1 generation (especially 4K/8s) runs as an LRO. The tool uses an async polling loop so a multi-minute render doesn't block the app — worth knowing if you're wiring Veo into anything synchronous.
  • Payload limits: for video-editing, inline bytes hit the payload ceiling fast, so both tools accept a gs:// GCS URI and hand the object off directly instead of inlining it. Cleaner for anything large.
  • SDK deps: google-genai, google-auth, and google-cloud-storage — the Omni tool auto-installs them on import.

Repos:

Standard caveat for anyone spinning this up: these are billed API calls, so keep an eye on cost per generation — 4K/long-duration renders aren't cheap. Region/Location ID matters for model availability too.

Happy to compare notes if anyone's done LRO handling or GCS hand-off for the video models differently.

reddit.com
u/SpawnofSociety2 — 1 month ago
▲ 13 r/GoogleGeminiAI+1 crossposts

[Tool] Gemini Omni video generation inside OpenWebUI — with audio, text rendering, and timed events

Following up on the Veo tool I posted — I built the same kind of thing for Google's Gemini Omni Flash model, since it handles a few things Veo doesn't. Free and on GitHub, and it's also up on the OpenWebUI Hub for one-click import.

What it does:

  • Inline playback — videos embed directly in the chat as responsive HTML5 players. There's a postMessage bridge that talks to OpenWebUI's iframe sandbox so the player snaps to 16:9 without scrollbars or getting cut off.
  • Native audio — Omni generates an audio track by default, and you can prompt for specific music or sound ("high energy techno beat," "calm background music").
  • Image-to-video — attach a reference image (or paste a URL) to use as a starting frame or style reference. Supports <FIRST_FRAME> and <IMAGE_REF_0> tags if you want fine control over how multiple images are used.
  • Video editing — feed it an existing video (upload or gs:// GCS URI) and describe the change ("replace the background," "make it a cartoon").
  • Timed events & on-screen text — you can prompt with timecodes like [0-3s] a person is walking and it'll render readable text in the frame.
  • Zero-touch install — the google-genai, google-auth, and google-cloud-storage SDKs auto-install when you import the tool.

Same caveat as before: this runs on Vertex AI, so you need a Google Cloud project with the Vertex AI API enabled, and auth is IAM-based (ADC for pip/uv, or a service-account JSON for Docker/K8s). Generations cost money per video — not free inference. Full auth walkthrough for all three install methods is in the README.

Repo: https://github.com/spawnofsociety2/openwebui-gemini-omni-video
OpenWebUI Hub: https://openwebui.com/posts/3be427d9-766d-4e67-93e4-fab208b9340e

Happy to answer setup questions in the comments — feedback and PRs welcome.

https://preview.redd.it/hlyd3y3j0fdh1.jpg?width=1726&format=pjpg&auto=webp&s=a383b56fb5a4a8b1eef8d1f97776bd04f9f50c61

reddit.com
u/SpawnofSociety2 — 1 month ago
▲ 36 r/GoogleGeminiAI+1 crossposts

[Tool] Veo 3.1 video generation inside OpenWebUI — image-to-video, editing, and native inline players

I got tired of jumping out to a separate tab every time I wanted to generate video, so I created a tool that runs Veo 3.1 through Google Vertex AI directly inside OpenWebUI. Sharing it in case anyone else wants it — it's free and on GitHub.

What it does:

  • Inline playback — generated videos render right in the chat as native HTML5 players, with download links underneath. No leaving the interface.
  • Image-to-video — attach a reference image in chat to use as a starting frame or style reference.
  • Video editing — feed it an existing video (direct upload or a gs:// GCS URI) to edit.
  • Per-user settings via UserValves — each user picks their own aspect ratio (16:9 / 9:16), duration (4/6/8s), and resolution (720p / 1080p / 4K).
  • Batch generation — up to 4 videos per prompt, stacked in the chat.
  • Non-blocking — it uses async polling for the long-running jobs, so kicking off a 4K render doesn't freeze your chat.

Fair warning on setup: this runs on Vertex AI, so it's not a plug-in-an-API-key deal. You need a Google Cloud project with the Vertex AI API enabled, and auth is IAM-based (ADC for pip/uv installs, or a service-account JSON for Docker/K8s). And since it's Vertex, generations cost money per video — this isn't free inference. The README walks through auth for all three install methods.

Repo: https://github.com/spawnofsociety2/openwebui-veo-video

OpenWebUI Hub:https://openwebui.com/posts/gemini\_veo\_31\_video\_generator\_with\_custom\_ui\_optio\_012572a4

Feedback and PRs welcome — happy to answer setup questions in the comments.

u/SpawnofSociety2 — 1 month ago