简介
Sora 2 Generate
原始描述
Generate videos with the NanoPhoto.AI Sora 2 API in text-to-video or image-to-video mode. Use when: (1) User wants to create a Sora 2 video from a prompt, (2...
通过你的 Agent 添加
点「快速安装」复制一段指令,粘给你正在用的 Agent(Claude Code、Codex、OpenClaw 等),它会自己完成安装。
或者手动安装
包里是 SKILL.md 加作者附带的文件,解压后目录名就是技能名。
技能申请的权限由作者决定,装之前请确认它能读什么、能执行什么。
技能正文
name: sora-2-generate description: "Generate videos with the NanoPhoto.AI Sora 2 API in text-to-video or image-to-video mode. Use when: (1) User wants to create a Sora 2 video from a prompt, (2) User provides one or more public image URLs and wants image-to-video generation, (3) User mentions Sora 2, NanoPhoto video generation, text to video, image to video, cinematic prompt generation, or checking Sora generation status. Supports automatic polling, status checks, and Feishu progress reporting from a single bundled script. Prerequisite: Obtain an API key at https://nanophoto.ai/settings/apikeys and configure env.NANOPHOTO_API_KEY." homepage: https://nanophoto.ai metadata: {"openclaw":{"homepage":"https://nanophoto.ai","requires":{"env":["NANOPHOTO_API_KEY"]},"primaryEnv":"NANOPHOTO_API_KEY"}}
Sora 2 Generate
Generate videos through the NanoPhoto.AI Sora 2 API.
Prerequisites
- Obtain an API key at: https://nanophoto.ai/settings/apikeys
- Configure
NANOPHOTO_API_KEYbefore using the skill. - Do not paste the API key into chat; store it in the platform's secure env setting for this skill.
Preferred OpenClaw setup:
- Open the skill settings for this skill
- Add an environment variable named
NANOPHOTO_API_KEY - Paste the API key as its value
Equivalent config shape:
{
"skills": {
"entries": {
"sora-2-generate": {
"enabled": true,
"env": {
"NANOPHOTO_API_KEY": "your_api_key_here"
}
}
}
}
}
Other valid ways to provide the key:
- Shell:
export NANOPHOTO_API_KEY="your_api_key_here" - Tool-specific env config: any runtime that injects
NANOPHOTO_API_KEY - OpenClaw config fallback: the bundled script also falls back to
~/.openclaw/openclaw.jsonatskills.entries.sora-2-generate.env.NANOPHOTO_API_KEY
Credential declaration summary:
- Primary credential:
NANOPHOTO_API_KEY - Resolution order in the bundled script:
--api-key→NANOPHOTO_API_KEYenvironment variable →~/.openclaw/openclaw.jsonskill env - No unrelated credentials are required
Choose the mode
- Use
textToVideowhen the user gives only a prompt. - Use
imageToVideowhen the user provides one or more public image URLs. - Do not use local image files or base64 images for the API. The API only accepts public
imageUrls.
Recommended workflow
- Collect the prompt.
- Decide
mode:textToVideoorimageToVideo. - Choose
modelTier,aspectRatio, andvideoDuration.- Default to
sora2. - Use
sora2-pro-standardorsora2-pro-highonly if the user explicitly wants the pro tier or higher resolution output.
- Default to
- Prefer the single-script
submit-and-watchflow when the user wants automatic progress reports. - Wait 120 seconds before the first status check, then check every 20 seconds until
completedorfailed. - Report progress on each status check and return the final
videoUrl, generation time, and credits used when available. - Expect real-world wait time to vary from roughly 120 seconds to 480 seconds depending on queue/load, model tier, and prompt complexity; avoid short timeouts.
Preferred commands
Use the single bundled script with subcommands.
Submit and auto-watch progress
macOS / Linux:
python3 scripts/sora2_generate.py submit-and-watch \
--prompt "A golden retriever running on a beach at sunset, cinematic lighting" \
--mode textToVideo \
--model-tier sora2 \
--aspect-ratio landscape \
--video-duration 10
Windows (cmd.exe):
python scripts/sora2_generate.py submit-and-watch ^
--prompt "A golden retriever running on a beach at sunset, cinematic lighting" ^
--mode textToVideo ^
--model-tier sora2 ^
--aspect-ratio landscape ^
--video-duration 10
This mode submits the task, extracts the returned taskId, and starts an independent watcher automatically. The watcher then reports progress after 120 seconds and every 20 seconds after that.
Submit only
python3 scripts/sora2_generate.py submit \
--prompt "A golden retriever running on a beach at sunset, cinematic lighting" \
--mode textToVideo \
--model-tier sora2 \
--aspect-ratio landscape \
--video-duration 10
Use --follow if you want the same process to keep polling after submission.
Check status of an existing task
python3 scripts/sora2_generate.py status --task-id task_abc123
Watch an existing task and send Feishu updates
python3 scripts/sora2_generate.py watch --task-id task_abc123
Image to video
python3 scripts/sora2_generate.py submit-and-watch \
--prompt "The person in the painting comes alive, moving naturally and reciting poetry" \
--mode imageToVideo \
--image-url https://static.nanophoto.ai/demo/nano-banana-pro.webp \
--model-tier sora2 \
--aspect-ratio landscape \
--video-duration 10
Script behavior
The bundled script resolves credentials in this order: --api-key, then NANOPHOTO_API_KEY from the environment, then ~/.openclaw/openclaw.json at skills.entries.sora-2-generate.env.NANOPHOTO_API_KEY.
Subcommands:
submit: submit a tasksubmit --follow: submit and keep polling in the same processstatus: check an existingtaskIdwatch: watch an existingtaskIdand send Feishu progress updatessubmit-and-watch: submit first, then spawn an independent watcher so progress reporting survives the original process
Cross-platform note:
- Use
python3on macOS/Linux. - Use
pythonon Windows unlesspython3is available. - The script uses Python's standard HTTP client and is designed to work on Windows without requiring
curlfor NanoPhoto calls. - Use
--json-onlywhen another script/tool needs raw JSON output. - Use
--initial-status-delayto override the default 120-second wait before the first progress check. - Use
--status-check-intervalto override the default 20-second interval between progress checks. - Default max wait is 1200 seconds.
- Use
--open-idto change the Feishu recipient for watcher messages. - Use
--detach-watcherinsubmit-and-watchto fully detach the watcher process.
Manual API calls
Submit generation
curl -X POST "https://nanophoto.ai/api/sora-2/generate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $NANOPHOTO_API_KEY" \
--data-raw '{
"prompt": "A golden retriever running on a beach at sunset, cinematic lighting",
"mode": "textToVideo",
"modelTier": "sora2",
"aspectRatio": "landscape",
"videoDuration": "10"
}'
Check status
curl -X POST "https://nanophoto.ai/api/sora-2/check-status" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $NANOPHOTO_API_KEY" \
--data-raw '{"taskId": "task_abc123"}'
Parameter guidance
modelTiersora2: default; lowest cost and fastest turnaroundsora2-pro-standard: 720p pro tier; use only when explicitly requestedsora2-pro-high: 1080p pro tier; use only when explicitly requested
aspectRatioportrait: vertical/defaultlandscape: horizontal
videoDuration1015
Error handling
| errorCode | Cause | Action |
|---|---|---|
LOGIN_REQUIRED |
Invalid or missing API key | Verify key at https://nanophoto.ai/settings/apikeys |
API_KEY_RATE_LIMIT_EXCEEDED |
Rate limit exceeded | Wait and retry |
INSUFFICIENT_CREDITS |
Not enough credits | Top up credits |
PROMPT_REQUIRED |
Missing prompt | Ask user for a prompt |
IMAGE_REQUIRED |
Missing image for image-to-video | Ask for public image URLs |
IMAGE_URLS_REQUIRED |
API needs imageUrls |
Do not send base64 or local file paths |
TASK_NOT_FOUND |
Invalid or expired task ID | Re-submit or verify ownership |
GENERATION_FAILED |
Server-side failure | Retry or try a simpler prompt |
Bundled files
scripts/sora2_generate.py: single entry point for submit, status, watch, and submit-and-watch workflows.references/api.md: condensed API reference, costs, and response shapes.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。