Magi 2
Generate 4–30 second 1080p videos with synchronized sound from text, a first and optional last frame, or up to 10 reference images, 5 reference videos and 5 audio clips.
- Asynchronous: the create call returns a task ID; the video arrives when the task succeeds.
- Three ways in: text only, a first frame with an optional last frame, or references: images, videos and audio.
- Output is always 1080p, 4 to 30 seconds long; there is no resolution to choose.
- Sound is generated by default and does not change the price.
- One price per second of video for every way in, with or without sound. A failed task costs nothing.
Opens this model in the API Explorer. Enter your BeatAPI API key to create a task: the call is real and is billed to your own balance.
Endpoint and authentication
POST https://api.beatapi.io/v1/videos/tasks
Authorization
string
Required
Your BeatAPI API key, sent as Bearer <BEATAPI_API_KEY>. Create keys in the Dashboard. Keep keys on your server; never ship them in a browser or mobile app.
Send the body as JSON with Content-Type: application/json. Idempotency-Key is optional: send a unique value (at most 255 characters) per logical request and reuse it only to retry that exact body. Within 24 hours a retry with the same key and body returns the first response again with Idempotent-Replayed: true; the same key with a different body returns 409 idempotency_conflict. Responses other than 2xx are not stored, so a retry after a 400 or 402 runs again.
How a request works
Create the task
POST the parameters below to the endpoint. A 201 means the task was accepted and its price reserved from your balance; the work runs in the background. Save data.id.
Wait for it to finish
Call GET /v1/tasks/{task_id} and wait data.poll_after_seconds between calls (5 s for images, 8 s for videos) until status is succeeded or failed. Or register a webhook for task.succeeded and task.failed; keep polling as the fallback, because a task stopped by the processing timeout sends no event.
Save the result
On succeeded, download every data.output.media[].url and store the files you need; BeatAPI does not promise how long result URLs stay available. On failed, read data.error_code and data.error_message: the reserved amount was returned to your balance, and data.retryable says whether sending the same request again can succeed.
Input modes
Request parameters
model
string
Required
The model to run.
Value: magi-2
If the value is wrong
- Missing:
"model" is required - An image model sent to this endpoint:
"model" nano-banana-2 is served by POST /v1/images/tasks, not this endpoint
prompt
string
Required
What happens in the video: subject, action, camera movement, style and sound. With references, say what each input is for.
Length: 1–5000 characters
- Length is counted in characters (a CJK character counts as one).
- Refer to inputs by position:
@image1is the first item inimagesorreference_images,@video1the first item inreference_videos, and@audio1the first item inreference_audios.
If the value is wrong
- Missing:
"prompt" is required - Empty or longer than the limit:
"prompt" has an unsupported length
images
string[]
Optional
A first frame, or a first and a last frame.
Items: 1–2
Each item is a public https:// URL. For a local file, upload it first with POST /v1/files and pass the returned data.url.
- One link: the video starts from this image. Two links:
images[0]is the first frame andimages[1]the last. - The video takes the aspect ratio of the first image; do not send
aspect_ratiowithimages. - For pictures that guide the video without being frames, use
reference_imagesinstead.
If the value is wrong
- More than two links:
"images" accepts at most 2 items - Combined with any reference_* field:
Cannot combine "images" with reference inputs in one task - Not an https:// link:
"images[0]" must be a public HTTPS URL
reference_images
string[]
Optional
Pictures that guide the content, characters, products or style of the video.
Items: 1–10
Each item is a public https:// URL. For a local file, upload it first with POST /v1/files and pass the returned data.url.
- Images are used in list order; refer to them in the prompt by position.
If the value is wrong
- More than the maximum:
"reference_images" accepts at most 10 items - Combined with
images:Cannot combine "images" with reference inputs in one task
reference_videos
string[]
Optional
Videos to take motion, camera work or content from.
Items: 1–5
Each item is a public https:// URL. For a local file, upload it first with POST /v1/files and pass the returned data.url.
- Send MP4 or MOV files at public HTTPS links.
- Refer to them in the prompt by position:
@video1is the first item inreference_videos. - Reference videos add nothing to the price.
If the value is wrong
- More than the maximum:
"reference_videos" accepts at most 5 items
reference_audios
string[]
Optional
Music, voice or sound to follow.
Items: 1–5
Each item is a public https:// URL. For a local file, upload it first with POST /v1/files and pass the returned data.url.
- Send MP3 or WAV files at public HTTPS links.
If the value is wrong
- More than the maximum:
"reference_audios" accepts at most 5 items
duration
integer
OptionalDefault: 5
Length of the video in seconds, a whole number.
Default: 5
Range: 4–30
- If you leave it out,
5is sent. - The price is this number of seconds times the per-second price.
If the value is wrong
- Outside the range or not a whole number:
"duration" is outside its supported range
aspect_ratio
string
OptionalDefault: 16:9
Shape of the video as width:height.
Allowed values: 16:9, 9:16, 1:1, 4:3, 3:4, 21:9
Default: 16:9
- Leave it out when
imagescarries a first frame: the video takes the frame’s aspect ratio. Withoutimagesit defaults to16:9.
If the value is wrong
- Sent together with
images:Magi 2 takes the first frame's shape; do not send aspect_ratio with images - A value not in the list:
"aspect_ratio" must be one of: [16:9 9:16 1:1 4:3 3:4 21:9]
resolution
string
OptionalDefault: 1080p
Output resolution. Only 1080p exists, so you can leave this out.
Value: 1080p
Default: 1080p
- Lower case only.
If the value is wrong
- A value not in the list (for example
720por1080P):"resolution" must be one of: [1080p]
generate_audio
boolean
OptionalDefault: true
Whether the video has a generated soundtrack. On by default; the price is the same either way.
Default: true
If the value is wrong
- Not true or false:
"generate_audio" must be a boolean
seed
integer
Optional
A fixed number makes results easier to repeat; leave it out for a random seed.
Range: 0–2147483647
- The same seed with the same request gives similar, not guaranteed identical, results.
If the value is wrong
- Outside the range:
"seed" is outside its supported range
The gateway also checks these combinations before creating the task:
- images cannot be combined with reference inputs
- images are frames: one is the first frame, two the first and last frame in that order
- with images the video takes the first frame’s shape, so aspect_ratio is not accepted with them; without images aspect_ratio defaults to 16:9
- reference videos and reference audio clips run 2-30 seconds each and 30 seconds together per kind
- billed per output second at one rate in every mode, with or without generate_audio
Input media limits
The gateway reads every input before the task is created and refuses one outside these limits with a 400 bad_request that names the input. Nothing is charged.
- Image size is checked when the host reports it. Use JPEG, PNG or WebP; a file the model cannot use fails the task after submission with
bad_request, and the task is refunded. - Reference videos must be MP4 or MOV and reference audio MP3 or WAV, each clip 2 to 30 seconds, and no more than 30 seconds in total per kind.
- Have a local file? Upload it with
POST /v1/filesand pass the returneddata.url.
Writing the prompt
Describe the shot: subject, action, camera movement, style and sound. With references, say what each one is for and refer to it by position: @image1 for the first reference image, @video1 for the first reference video, @audio1 for the first reference audio. With frames, @image1 is the first frame and @image2 the last.
Request examples
Text to video
A 5-second 1080p landscape clip with sound.
First and last frame
The video moves from the first image to the second.
Image and audio references
A performance that follows a character image and a music clip.
Image, video and audio references
Replace the video link with your own MP4 or MOV.
Responses
Create a task (201)
The task object. output is null until the task succeeds. Fields marked “while running” disappear once the task finishes.
Finished task
GET /v1/tasks/{task_id} returns HTTP 200 with status: "succeeded" and the result in data.output.
Output fields
Failed task
A failed task is still HTTP 200 on GET /v1/tasks/{task_id}: the failure is in the body. The reservation is returned in full, so nothing is charged.
Complete example
Create a task, wait for it with the server’s polling hint, and print the result URLs. Set BEATAPI_API_KEY in your environment and install requests.
Billing
- The price is the number of seconds you request (
duration, 5 if you leave it out) times the per-second price. The input route,aspect_ratio, sound,seedand the number of frames or references do not change it. - The table below lists the price of one second of video; the price of a clip is that rate times
duration. - The price is reserved when the task is created;
data.usage.billable_duration_secondsshows the seconds it is based on. - A failed task, including one refused by moderation after submission, is refunded in full.
Current list prices, the same as on Pricing. An account with a negotiated discount pays less; data.usage on the task always shows the amount actually charged.
Common errors
HTTP errors at a glance
Errors before a task exists arrive as a non-2xx response, and nothing is charged. Branch on error.code or error.retryable; message names the problem. The full list and retry policy are on Errors.
Authentication
Send your API key as Authorization: Bearer <BEATAPI_API_KEY>.
Headers
Send the body as JSON with Content-Type: application/json. Idempotency-Key is optional: send a unique value (at most 255 characters) per logical request and reuse it only to retry that exact body. Within 24 hours a retry with the same key and body returns the first response again with Idempotent-Replayed: true; the same key with a different body returns 409 idempotency_conflict. Responses other than 2xx are not stored, so a retry after a 400 or 402 runs again.
Request
The model to run.
Value: magi-2
If the value is wrong
- Missing:
"model" is required - An image model sent to this endpoint:
"model" nano-banana-2 is served by POST /v1/images/tasks, not this endpoint
What happens in the video: subject, action, camera movement, style and sound. With references, say what each input is for.
Length: 1–5000 characters
- Length is counted in characters (a CJK character counts as one).
- Refer to inputs by position:
@image1is the first item inimagesorreference_images,@video1the first item inreference_videos, and@audio1the first item inreference_audios.
If the value is wrong
- Missing:
"prompt" is required - Empty or longer than the limit:
"prompt" has an unsupported length
Shape of the video as width:height.
Allowed values: 16:9, 9:16, 1:1, 4:3, 3:4, 21:9
Default: 16:9
- Leave it out when
imagescarries a first frame: the video takes the frame’s aspect ratio. Withoutimagesit defaults to16:9.
If the value is wrong
- Sent together with
images:Magi 2 takes the first frame's shape; do not send aspect_ratio with images - A value not in the list:
"aspect_ratio" must be one of: [16:9 9:16 1:1 4:3 3:4 21:9]
Length of the video in seconds, a whole number.
Default: 5
Range: 4–30
- If you leave it out,
5is sent. - The price is this number of seconds times the per-second price.
If the value is wrong
- Outside the range or not a whole number:
"duration" is outside its supported range
Whether the video has a generated soundtrack. On by default; the price is the same either way.
Default: true
If the value is wrong
- Not true or false:
"generate_audio" must be a boolean
A first frame, or a first and a last frame.
Items: 1–2
Each item is a public https:// URL. For a local file, upload it first with POST /v1/files and pass the returned data.url.
- One link: the video starts from this image. Two links:
images[0]is the first frame andimages[1]the last. - The video takes the aspect ratio of the first image; do not send
aspect_ratiowithimages. - For pictures that guide the video without being frames, use
reference_imagesinstead.
If the value is wrong
- More than two links:
"images" accepts at most 2 items - Combined with any reference_* field:
Cannot combine "images" with reference inputs in one task - Not an https:// link:
"images[0]" must be a public HTTPS URL
Music, voice or sound to follow.
Items: 1–5
Each item is a public https:// URL. For a local file, upload it first with POST /v1/files and pass the returned data.url.
- Send MP3 or WAV files at public HTTPS links.
If the value is wrong
- More than the maximum:
"reference_audios" accepts at most 5 items
Pictures that guide the content, characters, products or style of the video.
Items: 1–10
Each item is a public https:// URL. For a local file, upload it first with POST /v1/files and pass the returned data.url.
- Images are used in list order; refer to them in the prompt by position.
If the value is wrong
- More than the maximum:
"reference_images" accepts at most 10 items - Combined with
images:Cannot combine "images" with reference inputs in one task
Videos to take motion, camera work or content from.
Items: 1–5
Each item is a public https:// URL. For a local file, upload it first with POST /v1/files and pass the returned data.url.
- Send MP4 or MOV files at public HTTPS links.
- Refer to them in the prompt by position:
@video1is the first item inreference_videos. - Reference videos add nothing to the price.
If the value is wrong
- More than the maximum:
"reference_videos" accepts at most 5 items
Output resolution. Only 1080p exists, so you can leave this out.
Value: 1080p
Default: 1080p
- Lower case only.
If the value is wrong
- A value not in the list (for example
720por1080P):"resolution" must be one of: [1080p]
A fixed number makes results easier to repeat; leave it out for a random seed.
Range: 0–2147483647
- The same seed with the same request gives similar, not guaranteed identical, results.
If the value is wrong
- Outside the range:
"seed" is outside its supported range
Response
The task object. output is null until the task succeeds. Fields marked “while running” disappear once the task finishes.

