使用 NanoPhoto.AI Veo 3.1 API 生成视频。使用场景:(1) 用户需要 Veo 3.1 文生视频,(2) 用户需要 Veo 3.1 参考...
Generate videos through the NanoPhoto.AI Veo 3.1 API.
NANOPHOTO_API_KEY before using the skill.Preferred OpenClaw setup:
NANOPHOTO_API_KEYEquivalent config shape:
json
{
"skills": {
"entries": {
"veo-3-1": {
"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.veo-3-1.env.NANOPHOTO_API_KEYCredential declaration summary:
NANOPHOTO_API_KEY--api-key → NANOPHOTO_API_KEY environment variable → ~/.openclaw/openclaw.json skill envBuild a shots array.
For each shot, set id, prompt, generationType, and aspectRatio.
Add public imageUrls only when the generation type requires them.
Choose resolution.
720p by default.1080p or 4k only for single-shot jobs.Submit the generation request.
If the user wants synchronous progress output in the same process, use submit --follow.
Poll every 5-10 seconds until completed or failed.
Return final shot-level videoUrl values and timing information when available.
TEXT_2_VIDEO
imageUrlsFIRST_AND_LAST_FRAMES_2_VIDEO
imageUrlsREFERENCE_2_VIDEO
imageUrlsUse the single bundled script with subcommands.
bash
python3 scripts/veo_3_1.py submit \
--shots-json '[{"id":"shot-1","prompt":"A golden retriever running on a beach at sunset, cinematic lighting","generationType":"TEXT_2_VIDEO","aspectRatio":"16:9"}]' \
--resolution 720p
bash
python3 scripts/veo_3_1.py submit \
--shots-json '[{"id":"shot-1","prompt":"The character comes alive, walking through a magical forest","generationType":"REFERENCE_2_VIDEO","aspectRatio":"16:9","imageUrls":["https://static.nanophoto.ai/demo/nano-banana-pro.webp"]}]' \
--resolution 720p \
--follow
bash
python3 scripts/veo_3_1.py status \
--task-ids-json '[{"shotId":"shot-1","taskId":"task_abc123"}]' \
--resolution 720p
The bundled script resolves credentials in this order: --api-key, then NANOPHOTO_API_KEY from the environment, then ~/.openclaw/openclaw.json at skills.entries.veo-3-1.env.NANOPHOTO_API_KEY.
Subcommands:
submit: submit a generation tasksubmit --follow: submit and keep polling in the same processstatus: check an existing Veo generationCross-platform note:
python3 on macOS/Linux.python on Windows unless python3 is available.curl.--json-only when another script/tool needs raw JSON output.--poll-interval to override the default 8-second polling interval.bash
curl -X POST "https://nanophoto.ai/api/veo-3/generate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $NANOPHOTO_API_KEY" \
--data-raw '{
"shots": [
{
"id": "shot-1",
"prompt": "A golden retriever running on a beach at sunset, cinematic lighting",
"generationType": "TEXT_2_VIDEO",
"aspectRatio": "16:9"
}
],
"resolution": "720p"
}'
bash
curl -X POST "https://nanophoto.ai/api/veo-3/check-status" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $NANOPHOTO_API_KEY" \
--data-raw '{
"taskIds": [
{"shotId": "shot-1", "taskId": "task_abc123"}
],
"resolution": "720p"
}'
errorCodeCauseActionLOGIN_REQUIREDInvalid or missing API keyVerify key at https://nanophoto.ai/settings/apikeysAPI_KEY_RATE_LIMIT_EXCEEDEDRate limit exceededWait and retryINSUFFICIENT_CREDITSNot enough creditsTop up creditsSHOTS_REQUIREDMissing shots arrayBuild a valid shots payloadPROMPT_REQUIREDMissing prompt in a shotAdd prompts to every shotINVALID_IMAGE_COUNTWrong image count for generation typeFix imageUrls for that shot typeIMAGE_URLS_REQUIREDAPI needs public image URLsDo not send local files or base64GENERATION_FAILEDServer-side generation errorRetry or simplify the shot promptsTASK_IDS_REQUIREDMissing task IDsPass valid {shotId, taskId} pairsTASK_NOT_FOUNDTask not found or not owned by callerRe-submit or verify ownershipINTERNAL_ERRORServer-side failureRetry later
scripts/veo_3_1.py: single entry point for submit, status, and optional in-process pollingreferences/api.md: condensed API reference, shot rules, and error behavior