Overview
MAGI-2 generates 4–30 seconds of 1080p video from text, a first frame, a first and last frame, or reference images, video and audio. You can generate a synchronized soundtrack with any input mode.
1. Before you begin
Use Get API Key to create a key and Add Balance to fund your USD API balance. Use the key from the same environment as the base URL. Keep it on your server.
Base URL
https://api-srv.kaze.ai
Use this host for the API paths below.
Authorization
Bearer <KAZE_API_KEY>
Send your key in the Authorization header.
Content type
application/json
Submit generation requests as JSON.
2. Pricing
MAGI-2 is billed per requested output second in every input mode, including audio. Starter is $0.18/s and Enterprise is $0.12/s (one-third less than Starter). A four-second video costs $0.72 on Starter or $0.48 on Enterprise. Any account-specific discount applies to the plan rate. Submission charges your API balance. Failed or timed-out tasks are refunded at the original charge.
magi-2
MAGI-2
3. Quick start
API access
Get your API key
Use a Kaze API key and USD API balance to generate videos.
Step 1. Set up your API key
Run these two exports in your terminal before using either language. The cURL download example uses jq. For Python, install Requests once with python -m pip install requests.
export API_BASE_URL="https://api-srv.kaze.ai"
export KAZE_API_KEY="<YOUR_API_KEY>"Step 2. Create a video
Choose cURL or Python to submit one four-second video with sound. This example costs $0.72 on Starter or $0.48 on Enterprise. Save the returned task.id.
curl --silent --show-error --fail-with-body --request POST "$API_BASE_URL/api/ext/v1/video/generate" \
--header "Authorization: Bearer $KAZE_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "magi-2",
"content": [
{"type": "text", "text": "Waves wash over a pebble beach at sunrise. Sound of the surf."}
],
"duration": 4,
"resolution": "1080p",
"ratio": "16:9",
"generate_audio": true
}'The response includes a task ID and its current status.
{
"task": {"id": "magi2_0123456789abcdef0123456789abcdef", "status": "processing"}
}Step 3. Check the task status
In your terminal, set TASK_ID to the ID from Step 2. Use the same account that submitted the task.
export TASK_ID="<TASK_ID_FROM_STEP_2>"curl --silent --show-error --fail-with-body "$API_BASE_URL/api/ext/v1/video/tasks/$TASK_ID" \
--header "Authorization: Bearer $KAZE_API_KEY"Repeat this GET every 10 seconds while the video is being generated.
| Status | What to do |
|---|---|
pending, processing | Wait and check again. |
completed | Download task.outputs[0]. |
failed | Read task.error. |
Step 4. Get the video
A completed task includes a video URL in task.outputs[0].
{
"task": {
"id": "magi2_0123456789abcdef0123456789abcdef",
"status": "completed",
"outputs": ["https://media.example.com/generated-video.mp4"]
}
}Download the MP4 to the current directory. Use the API key only on requests to the API host.
VIDEO_URL=$(curl --silent --show-error --fail-with-body "$API_BASE_URL/api/ext/v1/video/tasks/$TASK_ID" \
--header "Authorization: Bearer $KAZE_API_KEY" |
jq -er '.task | select(.status == "completed") | .outputs[0]') &&
curl --fail --location --output magi-2.mp4 "$VIDEO_URL"4. Frames and reference media
Replace the sample URLs with public HTTPS media URLs that remain accessible during generation. Use Step 3 to check the returned task ID and Step 4 to download the video.
First and last frames
Add one first_frame image to animate a still. To guide the ending as well, include a last_frame image in the same request.
curl --silent --show-error --fail-with-body --request POST "$API_BASE_URL/api/ext/v1/video/generate" \
--header "Authorization: Bearer $KAZE_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "magi-2",
"content": [
{"type": "text", "text": "Open the flower slowly as the light changes."},
{"type": "image_url", "role": "first_frame", "image_url": {"url": "https://media.example.com/bud.jpg"}},
{"type": "image_url", "role": "last_frame", "image_url": {"url": "https://media.example.com/bloom.jpg"}}
],
"duration": 5
}'Reference-to-video generation
Send reference images, videos or audio together with a text prompt. Frame guidance and reference media use separate requests.
| Media | Role | Limit per request |
|---|---|---|
| Image | reference_image | 10 images |
| Video | reference_video | 5 clips, 2–30 seconds each, 30 seconds total |
| Audio | reference_audio | 5 clips, 2–30 seconds each, 30 seconds total |
curl --silent --show-error --fail-with-body --request POST "$API_BASE_URL/api/ext/v1/video/generate" \
--header "Authorization: Bearer $KAZE_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "magi-2",
"content": [
{"type": "text", "text": "Make the subject in @Image1 follow the movement in @Video1 to the beat of @Audio1."},
{"type": "image_url", "role": "reference_image", "image_url": {"url": "https://media.example.com/subject.jpg"}},
{"type": "video_url", "role": "reference_video", "video_url": {"url": "https://media.example.com/dance.mp4"}},
{"type": "audio_url", "role": "reference_audio", "audio_url": {"url": "https://media.example.com/music.mp3"}}
],
"duration": 5,
"generate_audio": true
}'API Reference
| Action | Method | Path |
|---|---|---|
| Submit a video | POST | /api/ext/v1/video/generate |
| Get a task and its video | GET | /api/ext/v1/video/tasks/{task_id} |
| List this account’s MAGI-2 tasks | GET | /api/ext/v1/video/tasks?model=magi-2&page=1&page_size=10 |
| Check API balance | POST | /api/ext/v1/get_quota |
| Read the OpenAPI schema | GET | /api/ext/v1/model_schema |
| Parameter | Accepted values | Default |
|---|---|---|
model | magi-2 | Required |
content | 1–21 items, including at least one text item. The combined prompt can contain up to 15,000 characters, including user-written reference names. | Required |
duration | Whole seconds from 4 to 30 | 5 |
resolution | 1080p | 1080p |
ratio | 16:9, 9:16, 1:1, 4:3, 3:4. Text and reference-media requests also accept 21:9. | 16:9 |
generate_audio | true or false | false |
Check your API balance
curl --silent --show-error --fail-with-body --request POST "$API_BASE_URL/api/ext/v1/get_quota" \
--header "Authorization: Bearer $KAZE_API_KEY"Troubleshooting
The submit response was lost. Each new POST creates a separate billable task. Check your recent MAGI-2 tasks before submitting again.
curl --silent --show-error --fail-with-body "$API_BASE_URL/api/ext/v1/video/tasks?model=magi-2&page=1&page_size=10" \
--header "Authorization: Bearer $KAZE_API_KEY"The request was rejected. Check the API key, balance and the limits in the API reference. For media requests, verify that the files are accessible by URL and that the selected aspect ratio supports your input mode.