curl --request POST \
--url https://api.poyo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "magi-2",
"input": {
"prompt": "In a rainy neon-lit Tokyo alley at night, an elderly street musician plays a slow saxophone melody. The camera slowly pushes in. He lowers the saxophone, smiles at the camera and says: \"Thanks for staying till the last song.\" Rain patters on the wet pavement.",
"duration": 5,
"aspect_ratio": "16:9"
}
}
'
{
"code": 200,
"data": {
"task_id": "<string>",
"status": "not_started",
"created_time": "2023-11-07T05:31:56Z"
}
}{
"code": 400,
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"code": 400,
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}Sand AI
MAGI-2
The MAGI-2 API generates a 4–30 second 1080p video with synchronized audio from text, first and last frames, or image, video and audio references.
POST
/
api
/
generate
/
submit
curl --request POST \
--url https://api.poyo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "magi-2",
"input": {
"prompt": "In a rainy neon-lit Tokyo alley at night, an elderly street musician plays a slow saxophone melody. The camera slowly pushes in. He lowers the saxophone, smiles at the camera and says: \"Thanks for staying till the last song.\" Rain patters on the wet pavement.",
"duration": 5,
"aspect_ratio": "16:9"
}
}
'
{
"code": 200,
"data": {
"task_id": "<string>",
"status": "not_started",
"created_time": "2023-11-07T05:31:56Z"
}
}{
"code": 400,
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"code": 400,
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}- After submission, a
task_idwill be returned. If you provided acallback_url, when the task status becomesfinishedorfailed, a POST request will be sent to thecallback_url. - Regardless of whether
callback_urlis provided, you can retrieve the response result through the unified Query Task Status endpoint.
Models
- magi-2 - Text-to-video, first/last-frame and multimodal reference-to-video with synchronized audio
Features
- 1080p video from 4 to 30 seconds in one generation
- Synchronized dialogue, sound effects and ambience
- Six aspect ratios: 16:9, 9:16, 1:1, 4:3, 3:4 and 21:9
- First-frame and first-and-last-frame control
- Up to 10 reference images, 5 reference videos and 5 reference audio clips in one task
- Prompts up to 15,000 characters for detailed scripts and shot lists
Input modes
- Text to video: send
promptwith the scene, motion, camera and sound. - First and last frames: send one image in
image_urlsas the opening frame, or two images for the opening and closing frames. The video follows the aspect ratio of the first frame. - Reference to video: send any combination of
reference_image_urls,reference_video_urlsandreference_audio_urls, including reference audio on its own, and describe inprompthow each reference is used.
Required parameters
prompt(string): Scene, subjects, motion, camera and sound, up to 15,000 characters. Put spoken lines in quotes.
Optional parameters
duration(integer): Length in whole seconds from4to30. Default5.resolution(string):1080p.aspect_ratio(string):16:9(default),9:16,1:1,4:3,3:4or21:9for text-to-video and reference-to-video;autofor first and last frames.image_urls(string[]): One or two images: the opening frame and an optional closing frame. JPG, PNG or WEBP.reference_image_urls(string[]): Up to 10 reference images.reference_video_urls(string[]): Up to 5 MP4 or MOV videos, each 2–30 seconds and up to 30 seconds in total.reference_audio_urls(string[]): Up to 5 MP3 or WAV clips, each 2–30 seconds and up to 30 seconds in total.generate_audio(boolean):true(default) generates synchronized audio;falsereturns a video-only file.seed(integer): Random seed from0to2147483647.
Resolution
Every video is 1080p-class. The frame size follows the aspect ratio, for example 1920×1080 at 16:9, 1080×1920 at 9:16 and 2182×950 at 21:9.Output
A finished task returns one MP4 file: H.264 video at 25 fps with an AAC stereo audio track whengenerate_audio is true.
Examples
- Text to video with dialogue: describe the scene and put the spoken line in quotes; the character speaks it in the generated audio.
- First and last frames: send the opening frame in
image_urls, or add a second image to set the closing frame. - Reference to video: send a character image and a music clip, then describe the new scene in
prompt; the same character appears in the new setting and plays along with the music.
Notes
- Use
image_urlsfor first and last frames, or thereference_*fields for references; each task uses one of these two modes. - All media URLs must be publicly accessible and directly downloadable.
Authorizations
All API endpoints require Bearer Token authentication.
Create an API key: sign in to PoYo, open Dashboard → API Key at poyo.ai/dashboard/api-key, and click to create a key.
Add it to the request header:
Authorization: Bearer YOUR_API_KEY
Body
application/json
Response
Task submitted successfully
Business status code. 200 means success; any other value means the request failed. Always check this field: some validation errors return HTTP 200 with code: 400 in the body.
200: Success400: Invalid request parameters401: Missing or invalid API key402: Insufficient credits403: Permission denied404: Resource not found408: Request timeout429: Rate limit exceeded500: Internal server error502: Upstream service error503: Service unavailable
See Error Codes for details.
Available options:
200, 400, 401, 402, 403, 404, 408, 429, 500, 502, 503 Example:
200