fb-pixel

MAGI-2

Generate a 4–30 second 1080p video from a prompt, a pair of frames, or image, video and audio references.

text-to-videoimage-to-videoreference-to-video1080p

API access

Get your API key

Use a Kaze API key and USD API balance to generate videos.

Get API Key

API Balance

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.

Resolution
Duration
Or

magi-2

MAGI-2

Per Second (Starter/Enterprise)$0.18/$0.12
Starter Total$0.90
Enterprise Total -30%$0.60

3. Quick start

API access

Get your API key

Use a Kaze API key and USD API balance to generate videos.

Get API Key

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.

StatusWhat to do
pending, processingWait and check again.
completedDownload task.outputs[0].
failedRead 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.

MediaRoleLimit per request
Imagereference_image10 images
Videoreference_video5 clips, 2–30 seconds each, 30 seconds total
Audioreference_audio5 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

ActionMethodPath
Submit a videoPOST/api/ext/v1/video/generate
Get a task and its videoGET/api/ext/v1/video/tasks/{task_id}
List this account’s MAGI-2 tasksGET/api/ext/v1/video/tasks?model=magi-2&page=1&page_size=10
Check API balancePOST/api/ext/v1/get_quota
Read the OpenAPI schemaGET/api/ext/v1/model_schema
ParameterAccepted valuesDefault
modelmagi-2Required
content1–21 items, including at least one text item. The combined prompt can contain up to 15,000 characters, including user-written reference names.Required
durationWhole seconds from 4 to 305
resolution1080p1080p
ratio16:9, 9:16, 1:1, 4:3, 3:4. Text and reference-media requests also accept 21:9.16:9
generate_audiotrue or falsefalse

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.