curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "magi-2",
"prompt": "비 내리는 밤, 빨간 종이배가 빗물 도랑을 따라 흐른다. 매크로 촬영과 빗소리",
"duration": 5,
"aspect_ratio": "9:16",
"generate_audio": true,
"nsfw_check": true
}'
import requests
payload = {
"model": "magi-2",
"prompt": "비 내리는 밤, 빨간 종이배가 빗물 도랑을 따라 흐른다. 매크로 촬영과 빗소리",
"duration": 5,
"aspect_ratio": "9:16",
"generate_audio": True,
"nsfw_check": True
}
response = requests.post(
"https://api.apimart.ai/v1/videos/generations",
headers={"Authorization": "Bearer <token>"},
json=payload,
timeout=60,
)
response.raise_for_status()
print(response.json())
const payload = {
"model": "magi-2",
"prompt": "비 내리는 밤, 빨간 종이배가 빗물 도랑을 따라 흐른다. 매크로 촬영과 빗소리",
"duration": 5,
"aspect_ratio": "9:16",
"generate_audio": true,
"nsfw_check": true
};
const response = await fetch("https://api.apimart.ai/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_example_magi2"
}
]
}
MAGI-2
MAGI-2 비디오 생성
텍스트, 시작·종료 프레임 또는 이미지·비디오·오디오 참조로 비디오를 생성합니다. 1080p 고정 출력, 4–30초, 기본적으로 오디오를 생성합니다.
POST
/
v1
/
videos
/
generations
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "magi-2",
"prompt": "비 내리는 밤, 빨간 종이배가 빗물 도랑을 따라 흐른다. 매크로 촬영과 빗소리",
"duration": 5,
"aspect_ratio": "9:16",
"generate_audio": true,
"nsfw_check": true
}'
import requests
payload = {
"model": "magi-2",
"prompt": "비 내리는 밤, 빨간 종이배가 빗물 도랑을 따라 흐른다. 매크로 촬영과 빗소리",
"duration": 5,
"aspect_ratio": "9:16",
"generate_audio": True,
"nsfw_check": True
}
response = requests.post(
"https://api.apimart.ai/v1/videos/generations",
headers={"Authorization": "Bearer <token>"},
json=payload,
timeout=60,
)
response.raise_for_status()
print(response.json())
const payload = {
"model": "magi-2",
"prompt": "비 내리는 밤, 빨간 종이배가 빗물 도랑을 따라 흐른다. 매크로 촬영과 빗소리",
"duration": 5,
"aspect_ratio": "9:16",
"generate_audio": true,
"nsfw_check": true
};
const response = await fetch("https://api.apimart.ai/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_example_magi2"
}
]
}
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "magi-2",
"prompt": "비 내리는 밤, 빨간 종이배가 빗물 도랑을 따라 흐른다. 매크로 촬영과 빗소리",
"duration": 5,
"aspect_ratio": "9:16",
"generate_audio": true,
"nsfw_check": true
}'
import requests
payload = {
"model": "magi-2",
"prompt": "비 내리는 밤, 빨간 종이배가 빗물 도랑을 따라 흐른다. 매크로 촬영과 빗소리",
"duration": 5,
"aspect_ratio": "9:16",
"generate_audio": True,
"nsfw_check": True
}
response = requests.post(
"https://api.apimart.ai/v1/videos/generations",
headers={"Authorization": "Bearer <token>"},
json=payload,
timeout=60,
)
response.raise_for_status()
print(response.json())
const payload = {
"model": "magi-2",
"prompt": "비 내리는 밤, 빨간 종이배가 빗물 도랑을 따라 흐른다. 매크로 촬영과 빗소리",
"duration": 5,
"aspect_ratio": "9:16",
"generate_audio": true,
"nsfw_check": true
};
const response = await fetch("https://api.apimart.ai/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_example_magi2"
}
]
}
POST /v1/videos/generations로 제출하고 data[0].task_id를 얻은 뒤 작업 조회 API로 결과를 확인합니다.
생성 모드
| 모드 | 제출 방법 |
|---|---|
| 텍스트 기반 비디오 | prompt를 제공하고 이미지·비디오·오디오 입력은 보내지 않습니다. |
| 이미지 기반 비디오 | image_urls로 시작 프레임과 선택적 종료 프레임을 보내거나 전용 프레임 필드를 사용합니다. |
| 참조 기반 비디오 | video_urls, audio_urls 또는 role: "reference_image" 이미지가 있으면 참조 모드로 자동 전환합니다. image_urls만 있는 경우 omni_reference_task_type: "reference"를 명시하세요. |
reference의 동작은 같습니다. 참조 모드에서는 모든 이미지를 참조로 처리하며, image_urls와 image_with_roles의 role: "reference_image" 이미지는 합계 최대 10장입니다.
참조 예제는 omni_reference_task_type: "reference"를 명시합니다. 프롬프트에 각 입력의 용도를 설명하세요. 입력은 생성을 유도하며 원본 비디오를 직접 이어 붙이거나 원본 오디오를 그대로 보존하지 않습니다.
요청 매개변수
비디오 작업을 제출하기 전에 콘텐츠 검토를 실행할지 여부를 지정합니다.
true:omni-moderation-latest로 프롬프트와 입력 이미지를 검토false또는 생략: 검토 요청을 보내지 않으며 검토 비용이나 지연이 추가되지 않음(기본값)
텍스트·참조 모드는
16:9(기본), 9:16, 1:1, 4:3, 3:4, 21:9를 지원합니다. 이미지 모드는 앞의 다섯 비율만 지원하며 21:9는 불가합니다. 생략하거나 auto를 보내면 시작 프레임 비율을 따르고 출력 해상도는 1080p로 유지됩니다.auto(기본)와 reference를 지원합니다. 여러 image_urls를 참조로 사용하려면 reference를 명시하세요. edit / extend는 지원하지 않습니다.각 항목은 공개 HTTP(S) 이미지 URL입니다. 최대 2장 제한은 시작 프레임과 선택적 종료 프레임을 사용하는 이미지 기반 비디오에만 적용됩니다. 이 모드는 이미지만 보내고 참조 비디오·오디오, 명시적
reference, reference_image 역할이 없을 때 적용됩니다. 참조 모드에서는 배열 전체가 참조이며 image_with_roles의 reference_image와 합계 최대 10장입니다. 자동 선택과 명시적 선택의 상한은 같습니다.각 항목은
url(공개 HTTP(S) 이미지 URL)과 role을 포함합니다. 역할은 first_frame, last_frame, reference_image입니다. 이미지 기반 모드의 시작·종료 프레임은 각각 최대 1장입니다. reference_image는 참조 모드를 활성화하며 해당 이미지와 image_urls 이미지는 합계 최대 10장입니다.최대 5개 참조 비디오, 각각 2–30초입니다. 합계는 30초 이내로 맞추세요. 초과분은 상위 서비스에서 잘릴 수 있습니다. 공개 HTTP(S) URL 배열을 사용하며 단수
video_url은 지원하지 않습니다.최대 5개 참조 오디오, 각각 2–30초입니다. 합계는 30초 이내로 맞추세요. 초과분은 상위 서비스에서 잘릴 수 있습니다. 공개 HTTP(S) URL을 사용하세요.
입력 요구 사항
모든 입력은 공개적으로 직접 접근할 수 있는 HTTP(S) URL이어야 합니다. 로그인, 외부 링크 차단, 다운로드 실패는 작업 실패를 일으킬 수 있습니다. 로컬 파일은 이미지, 비디오, 오디오 업로드 API로 URL을 얻으세요.요청 예제
시작 및 종료 프레임
{
"model": "magi-2",
"prompt": "소녀가 천천히 돌아보며 부드러운 조명 아래 종료 프레임의 자세로 전환한다",
"image_urls": [
"https://example.com/start.jpg",
"https://example.com/end.jpg"
],
"duration": 5
}
aspect_ratio를 생략하면 해당 비율을 따릅니다. image_urls 대신 first_frame_image와 last_frame_image도 사용할 수 있습니다.
이미지만 참조
{
"model": "magi-2",
"prompt": "두 참조 이미지의 인물이 각자의 외모를 유지하며 같은 정원에서 만난다",
"image_urls": [
"https://example.com/reference-1.jpg"
],
"image_with_roles": [
{
"url": "https://example.com/reference-2.jpg",
"role": "reference_image"
}
],
"omni_reference_task_type": "reference",
"aspect_ratio": "16:9",
"duration": 5
}
이미지·비디오·오디오 혼합 참조
{
"model": "magi-2",
"prompt": "참조 비디오의 카메라 움직임, 이미지 속 소녀의 외모와 오디오의 음악 스타일을 사용해 해질녘 해변을 걷는 장면을 생성",
"image_urls": [
"https://example.com/girl.jpg"
],
"video_urls": [
"https://example.com/camera.mp4"
],
"audio_urls": [
"https://example.com/bgm.mp3"
],
"omni_reference_task_type": "reference",
"aspect_ratio": "16:9",
"duration": 8
}
작업 조회 및 결과
작업 조회 API를completed 또는 failed까지 폴링하세요. 보통 몇 분이 걸리며 혼잡 시 더 오래 걸릴 수 있습니다. 일정 시간이 지났다는 이유만으로 실패로 판단하지 마세요. 조회를 멈춰도 작업은 취소되지 않습니다.
curl --request GET \
--url 'https://api.apimart.ai/v1/tasks/task_example_magi2' \
--header 'Authorization: Bearer <token>'
| 필드 | 설명 |
|---|---|
data.status | pending / processing: 진행 중, completed: 성공, failed: 실패. |
data.progress | 진행률 0–100. |
data.result.videos[0].url | 플랫폼 저장소로 전송된 결과 비디오 URL. 전체 구조는 작업 API를 참고하세요. |
data.error.message | 작업 실패 상세 정보. |
지원하지 않는 기능
다음 값을 제출하면 HTTP 400을 반환합니다:mode, negative_prompt, watermark: true, camera_control, multi_shot / multi_prompt, element_list, video_list, voice_list, audio_setting, keyframe, omni_reference_task_type: "edit" / "extend", video_url. resolution은 1080p만 가능합니다. 비디오 편집·연장 및 중간 프레임은 지원하지 않습니다.
자주 발생하는 오류
제출 실패는error.message, 작업 생성 후 실패는 조회 결과의 data.error.message를 확인하세요.
| 오류 메시지 또는 상황 | 처리 방법 |
|---|---|
duration must be between 4 and 30 whole seconds | 4–30의 정수 초를 사용하며 생략 시 5입니다. |
duration (5) and seconds (6) are aliases and must match | 시간 별칭 값을 같게 하거나 하나만 보내세요. |
requires prompt | 모든 모드에 프롬프트가 필요합니다. |
image_urls takes at most 2 images | 시작·종료는 최대 2장입니다. 이미지만 참조할 때는 reference를 명시하세요. |
image-to-video only supports aspect_ratio | 이미지 모드에서 21:9를 제거하세요. 생략 또는 auto는 시작 비율을 따릅니다. |
accepts at most 10 reference images / 5 videos / 5 audios | 참조 이미지 10장, 비디오 5개, 오디오 5개 이하로 맞추세요. |
has no video edit / extend / does not support keyframes | 편집·연장·중간 프레임을 제거하고 참조 비디오는 video_urls로 보내세요. |
always outputs 1080p | 1080p만 보내거나 resolution을 생략하세요. |
audio (true) and generate_audio (false) are aliases and must match | 오디오 스위치를 동일하게 하거나 하나만 보내세요. |
Could not download the input... | 직접 다운로드 가능한 공개 URL인지 확인한 뒤 다시 제출하세요. |