Overview
The NanoGPT API provides advanced video generation capabilities using state-of-the-art models. This guide covers how to use our video generation endpoints.API Authentication
1. API Key Authentication
Making a Video Generation Request
Endpoint
Request Headers
Request Body
Basic Text-to-Video Request
Image-to-Video Request
Image-conditioned models accept eitherimageDataUrl (base64) or imageUrl (a public HTTPS link). The platform always uses the explicit field you send before falling back to any library attachments.
Uploads sent via the API must be 4 MB or smaller. For larger assets, host them externally and provide an imageUrl.
Base64 input
Public URL input
Model-Specific Parameters
Veo Models
Kling Models
Hunyuan Models
Wan Image-to-Video
Accepts base64 viaimageDataUrlor a public URL viaimageUrl.
Seedance Models
Accepts base64 viaimageDataUrlor a public URL viaimageUrl. Ensure URLs are directly fetchable by the provider.
Response Format
Initial Response (202 Accepted)
Response Fields
runId: Unique identifier for polling statusstatus: Always “pending” for initial responsemodel: The model used for generationcost: Cost in USD or XNOpaymentSource: “USD” or “XNO”remainingBalance: Account balance after deduction
Polling for Status
After receiving arunId, poll the status endpoint until completion.
Status Endpoint
Polling Example
Status Response States
In Progress
Completed
Failed
Status Values
IN_QUEUE: Request is queuedIN_PROGRESS: Video is being generatedCOMPLETED: Video ready for downloadFAILED: Generation failedCANCELLED: Request was cancelled
Complete Examples
The submit + poll flow works the same regardless of how you supply the image: image-conditioned models accept eitherimageDataUrl (base64) or a public imageUrl, and the platform prefers whichever field you send before checking library attachments.
Example 1: Text-to-Video with cURL
Example 2: Image-to-Video with cURL
Base64 input
Public URL input
Example 3: Image-to-Video with JavaScript
Using a public image URL directly
Example 4: Image-to-Video with Python
Example 5: Batch Processing
Error Handling
Common Error Responses
Insufficient Balance
Invalid Session
Rate Limit Exceeded
Content Policy Violation
Model-Specific Errors
Error Handling Best Practices
Rate Limits
- Default: 50 requests per minute per IP address
- API Key: Same as default
- Internal Auth: No rate limit
/api/generate-video). Status polling endpoints have no rate limits.
Best Practices
-
Choose the Right Model
- Use text-to-video for creative generation
- Use image-to-video for animating existing content
- Consider cost vs quality tradeoffs
-
Optimize Prompts
- Be specific and descriptive
- Include motion and camera directions
- Avoid content policy violations
-
Handle Async Operations
- Implement proper polling with delays
- Set reasonable timeouts (5-10 minutes)
- Show progress to users
-
Error Recovery
- Implement retry logic for transient failures
- Handle rate limits with exponential backoff
- Provide clear error messages to users
-
Cost Management
- Check balance before submitting
- Estimate costs before generation
- Use shorter durations for testing