Sora 2 Generate
Generate videos with the NanoPhoto.AI Sora 2 API in text-to-video or image-to-video mode via OpenClaw.
Generate videos through the NanoPhoto.AI Sora 2 API.
Install: npx clawhub@latest install sora-2-generate
ClawHub: clawhub.ai/u/nanophotohq
Prerequisites
- Obtain an API key at nanophoto.ai/settings/apikeys
- Configure
NANOPHOTO_API_KEYin your OpenClaw skill settings
{
"skills": {
"entries": {
"sora-2-generate": {
"enabled": true,
"env": {
"NANOPHOTO_API_KEY": "your_api_key_here"
}
}
}
}
}Modes
- textToVideo — Generate video from a text prompt
- imageToVideo — Generate video from public image URLs + prompt
Important
The API only accepts public image URLs. Do not send local files or base64 images.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Video generation prompt |
mode | string | Yes | textToVideo or imageToVideo |
modelTier | string | No | sora2 (default), sora2-pro-standard, sora2-pro-high |
aspectRatio | string | No | portrait (default) or landscape |
videoDuration | string | No | 10 or 15 seconds |
imageUrls | string[] | Conditional | Required for imageToVideo mode |
Usage
Text to Video
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 10Image to Video
python3 scripts/sora2_generate.py submit \
--prompt "The person in the painting comes alive, moving naturally" \
--mode imageToVideo \
--image-url https://example.com/image.webp \
--model-tier sora2 \
--aspect-ratio landscape \
--video-duration 10Submit and Auto-Poll
Add --follow to poll until completion:
python3 scripts/sora2_generate.py submit \
--prompt "A futuristic city at night" \
--mode textToVideo \
--followCheck Status
python3 scripts/sora2_generate.py status --task-id task_abc123Error Codes
| Code | Cause | Action |
|---|---|---|
LOGIN_REQUIRED | Invalid API key | Verify at settings/apikeys |
API_KEY_RATE_LIMIT_EXCEEDED | Rate limit | Wait and retry |
INSUFFICIENT_CREDITS | Not enough credits | Top up |
PROMPT_REQUIRED | Missing prompt | Provide a prompt |
IMAGE_REQUIRED | Missing image for imageToVideo | Provide public image URLs |
GENERATION_FAILED | Server error | Retry or simplify prompt |
Documentação NanoPhoto.AI