openrouter-video-generator
GitHub封装OpenRouter异步视频生成API,通过轮询状态并下载MP4文件,为AwesomeWebpageMetaSkill提供浏览器可播放的视频资产,支持失败标签返回。
Trigger Scenarios
Install
npx skills add opensquilla/opensquilla --skill openrouter-video-generator -g -y
SKILL.md
Frontmatter
{
"name": "openrouter-video-generator",
"homepage": "",
"metadata": {
"opensquilla": {
"risk": "high",
"requires": {
"env": [],
"config": [
"awesome_webpage.openrouter.models.video_generation",
"awesome_webpage.output_dir"
]
},
"capabilities": [
"network-write",
"filesystem-read",
"filesystem-write"
]
}
},
"entrypoint": {
"env": {
"OPENSQUILLA_META_CAPABILITY_LEASE_REQUIRED": "1"
},
"args": [
"--model",
"{{ with.model | default('bytedance\/seedance-2.0-fast') }}",
"--output-dir",
"{{ with.output_dir }}",
"--filename",
"{{ with.filename | default('intro.mp4') }}",
"--duration",
"{{ with.duration | default(10) }}",
"--aspect-ratio",
"{{ with.aspect_ratio | default('16:9') }}"
],
"parse": "text",
"stdin": "{{ with.prompt | default(inputs.user_message) }}",
"command": "python {baseDir}\/scripts\/openrouter_video.py",
"timeout": 420
},
"provenance": {
"origin": "opensquilla-original",
"license": "Apache-2.0",
"maintained_by": "OpenSquilla"
},
"description": "Generate or declare an OpenRouter video asset for AwesomeWebpageMetaSkill using a parent-leased Provider Settings connection and configured non-secret model\/output values.",
"description_zh": "使用父级租用的 Provider Settings 连接及已配置的非敏感模型\/输出参数,为 AwesomeWebpageMetaSkill 生成或声明 OpenRouter 视频资产。",
"user-invocable": false,
"disable-model-invocation": true
}
OpenRouter Video Generator
Create a short browser-playable video asset for AwesomeWebpageMetaSkill.
This is an adapter around the configured OpenRouter video model, not a place to
choose providers or invent model ids.
Meta-Skill Entrypoint
Meta-skills should run this skill as skill_exec. The entrypoint is a
deterministic Python adapter around OpenRouter's async video endpoint. During a
MetaSkill run it receives a short-lived connection from ordinary Provider
Settings in the child process only; the credential, endpoint, and proxy never
enter with, argv, the plan, or persisted run data. It writes the MP4 under
the supplied output directory and prints either VIDEO_READY: or a failure
label. Do not spawn an LLM sub-agent just to generate video.
Contract
- Use the code-owned OpenRouter capability candidate and the volatile provider lease resolved from ordinary Provider Settings after explicit approval.
- Use only
awesome_webpage.openrouter.models.video_generationas the model. - Use only
awesome_webpage.output_diras the output root. - Save generated files under
project/assets/video/. - Return a media manifest with local path, MIME type, duration if known, provenance, and replacement notes.
OpenRouter Video API Contract (hard rule)
OpenRouter video models are exposed through an async job endpoint, not
the chat-completions endpoint. Hitting /chat/completions with a video
model id returns HTTP 500 and burns the full per-attempt budget. Do not
attempt it.
- Submit:
POST {base_url}/videoswith JSON body{"model": "<video_generation>", "prompt": "<text>", "duration": <int>}. Optional fields:resolution,aspect_ratio,frame_images,input_references,provider,callback_url. Do NOT sendmessagesormodalities— those are chat-only and will be rejected. - Response (immediate):
{"id": "...", "polling_url": "...", "status": "pending"}. - Poll: GET the
polling_urlwith the sameAuthorization: Bearer ...header every 8-15 seconds untilstatusbecomes one ofcompleted | failed | cancelled | expired. Cap the loop at ~5 minutes per clip; treat anything beyond that asVIDEO_GENERATION_FAILED. - Download (only on
completed): take the first URL fromunsigned_urls, GET it with the same bearer token, and save the body to<output_dir>/project/assets/video/<slug>.mp4. Set MIME tovideo/mp4. - Terminal-failure statuses map to
VIDEO_GENERATION_FAILED; include the jobidand a replacement-slot path so the page can render a clean placeholder.
Typical successful job completes in 60-120 s for short clips; do not abort before that window.
Failure Labels
Return one of these labels instead of silently skipping video:
VIDEO_CONFIG_NEEDED: model, API key, base URL, or output directory is missing.VIDEO_MODEL_UNSUPPORTED: the configured model cannot return a local browser-playable asset in this environment.VIDEO_GENERATION_FAILED: the provider call failed after a concrete attempt.
A missing/invalid required MetaSkill lease emits VIDEO_CONFIG_NEEDED and exits
78 before submit. Failures after a concrete submit stay an exit-0 degradation
so downstream packaging can bind a replacement slot without automatic replay.
When returning a failure label, also return a replacement slot such as
project/assets/video/replace-with-topic-intro.mp4 and enough prompt/context
for a later repair pass.
Output Requirements
- Prefer
.mp4withvideo/mp4;.webmis acceptable when browser playable. - Keep clips short, usually 8-20 seconds.
- Do not use remote embeds unless config explicitly allows them.
- Do not hardcode OpenRouter model names, API keys, or output directories.
On success: VIDEO_READY manifest line (required)
After every successful download, end your reply with one single-line JSON
record per file so AwesomeWebpageMetaSkill can collect and bind the asset:
VIDEO_READY: {"local_path": "project/assets/video/<slug>.mp4", "mime": "video/mp4", "duration_s": <int_or_null>, "resolution": "<WxH_or_null>", "prompt_preview": "<first 80 chars>"}
- One
VIDEO_READY:line per video file. No trailing prose on that line. local_pathMUST be the relative pathproject/assets/video/.... Do NOT emit an absolute path here.- On failure, emit one of
VIDEO_CONFIG_NEEDED,VIDEO_MODEL_UNSUPPORTED, orVIDEO_GENERATION_FAILEDas a single-line label with the replacement-slot path so the page can render a placeholder.
Version History
-
95673be
Current 2026-08-07 00:58
改进凭证传递机制,从环境变量注入改为短生命周期连接租赁;新增对多种终端失败状态的明确处理与标签返回。
- f662be3 2026-07-31 11:48
- 7f72a32 2026-07-05 18:39


