Generate videos through the NanoPhoto.AI Sora 2 API.
NANOPHOTO_API_KEY before using the skill.Preferred OpenClaw setup:
NANOPHOTO_API_KEYEquivalent config shape:
{
"skills": {
"entries": {
"sora-2-generate": {
"enabled": true,
"env": {
"NANOPHOTO_API_KEY": "your_api_key_here"
}
}
}
}
}
Other valid ways to provide the key:
export NANOPHOTO_API_KEY="your_api_key_here"NANOPHOTO_API_KEY~/.openclaw/openclaw.json at skills.entries.sora-2-generate.env.NANOPHOTO_API_KEYCredential declaration summary:
NANOPHOTO_API_KEY--api-key → NANOPHOTO_API_KEY environment variable → ~/.openclaw/openclaw.json skill envtextToVideo when the user gives only a prompt.imageToVideo when the user provides one or more public image URLs.imageUrls.mode: textToVideo or imageToVideo.modelTier, aspectRatio, and videoDuration.sora2.sora2-pro-standard or sora2-pro-high only if the user explicitly wants the pro tier or higher resolution output.submit --follow.completed or failed.videoUrl, generation time, and credits used when available.Use the single bundled script with subcommands.
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
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 \
--follow
python3 scripts/sora2_generate.py status --task-id task_abc123
python3 scripts/sora2_generate.py submit \
--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
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 existing taskIdCross-platform note:
python3 on macOS/Linux.python on Windows unless python3 is available.curl.--json-only when another script/tool needs raw JSON output.--initial-status-delay to override the default 120-second wait before the first status check.--status-check-interval to override the default 20-second interval between progress checks.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"
}'
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"}'
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 requestedaspectRatioportrait: vertical/defaultlandscape: horizontalvideoDuration1015| 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 |
scripts/sora2_generate.py: single entry point for submit, status, and optional in-process polling.references/api.md: condensed API reference, costs, and response shapes.共 1 个版本