메인 콘텐츠로 건너뛰기
POST
/
v1
/
music
/
generations
curl --request POST \
  --url https://api.apimart.ai/v1/music/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "flowmusic",
    "title": "My Song",
    "sound_prompt": "upbeat pop music with piano",
    "bpm": "120",
    "length": 60
  }'
import requests

url = "https://api.apimart.ai/v1/music/generations"

payload = {
    "model": "flowmusic",
    "title": "My Song",
    "sound_prompt": "upbeat pop music with piano",
    "bpm": "120",
    "length": 60
}

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
const url = "https://api.apimart.ai/v1/music/generations";

const payload = {
  model: "flowmusic",
  title: "My Song",
  sound_prompt: "upbeat pop music with piano",
  bpm: "120",
  length: 60
};

const headers = {
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
};

fetch(url, {
  method: "POST",
  headers: headers,
  body: JSON.stringify(payload)
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01K8AYYM6R03TGZ3Q2P0TZVNPX"
    }
  ]
}
{
  "error": {
    "message": "sound_prompt and lyrics cannot both be empty",
    "type": "invalid_request",
    "param": "",
    "code": "invalid_request"
  }
}
{
  "error": {
    "message": "잔액이 부족합니다",
    "type": "invalid_request",
    "param": "",
    "code": "quota_not_enough"
  }
}
{
  "error": {
    "message": "현재 그룹 용량이 포화 상태입니다. 잠시 후 다시 시도해 주세요",
    "type": "rate_limit_error",
    "param": "",
    "code": "rate_limit_error"
  }
}
curl --request POST \
  --url https://api.apimart.ai/v1/music/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "flowmusic",
    "title": "My Song",
    "sound_prompt": "upbeat pop music with piano",
    "bpm": "120",
    "length": 60
  }'
import requests

url = "https://api.apimart.ai/v1/music/generations"

payload = {
    "model": "flowmusic",
    "title": "My Song",
    "sound_prompt": "upbeat pop music with piano",
    "bpm": "120",
    "length": 60
}

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
const url = "https://api.apimart.ai/v1/music/generations";

const payload = {
  model: "flowmusic",
  title: "My Song",
  sound_prompt: "upbeat pop music with piano",
  bpm: "120",
  length: 60
};

const headers = {
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
};

fetch(url, {
  method: "POST",
  headers: headers,
  body: JSON.stringify(payload)
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01K8AYYM6R03TGZ3Q2P0TZVNPX"
    }
  ]
}
{
  "error": {
    "message": "sound_prompt and lyrics cannot both be empty",
    "type": "invalid_request",
    "param": "",
    "code": "invalid_request"
  }
}
{
  "error": {
    "message": "잔액이 부족합니다",
    "type": "invalid_request",
    "param": "",
    "code": "quota_not_enough"
  }
}
{
  "error": {
    "message": "현재 그룹 용량이 포화 상태입니다. 잠시 후 다시 시도해 주세요",
    "type": "rate_limit_error",
    "param": "",
    "code": "rate_limit_error"
  }
}

인증

Authorization
string
필수
모든 API는 Bearer Token 인증이 필요합니다API Key 발급:API Key 관리 페이지에서 API Key를 발급받으세요사용 시 요청 헤더에 다음을 추가하세요:
Authorization: Bearer YOUR_API_KEY

요청 파라미터

model
string
필수
모델 이름, "flowmusic" 고정값(대소문자 구분 없음)
sound_prompt
string
음악 스타일 또는 사운드 설명 프롬프트예시: "upbeat pop music with piano"
sound_promptlyrics동시에 비어 있을 수 없습니다(최소 하나는 전달). 요청당 한 곡의 음악만 생성됩니다.
lyrics
string
가사 텍스트. 먼저 가사 생성 API로 가사를 생성한 후 이 필드에 넣을 수 있습니다예시: "[Verse 1]\n밤이 아무리 길어도 아침은 온다\n..."
title
string
생성할 음악 제목
bpm
string
BPM(분당 박자 수), 반드시 ≥ 1예시: "120"
length
integer
생성 길이(초)지원 범위: 1 ~ 240
seed
string
결과 재현에 사용하는 랜덤 시드
동일한 요청에 동일한 seed 값을 전달하면 유사한 결과가 생성되지만, 완전히 동일함을 보장하지는 않습니다.

응답

code
integer
응답 상태 코드, 성공 시 200
data
array
반환 데이터 배열

사용 시나리오

시나리오 1: 스타일 프롬프트만으로 생성

{
  "model": "flowmusic",
  "title": "My Song",
  "sound_prompt": "upbeat pop music with piano",
  "bpm": "120",
  "length": 60
}

시나리오 2: 가사 + 스타일로 곡 만들기

{
  "model": "flowmusic",
  "title": "끈기",
  "lyrics": "[Verse 1]\n밤이 아무리 길어도 아침은 온다\n...",
  "sound_prompt": "energetic rock with electric guitar",
  "length": 120
}
작업 결과 조회음악 생성은 비동기 작업으로, 제출 후 task_id가 반환됩니다. 작업 상태 조회 API로 생성 진행 상황과 결과를 확인하세요.

작업 완료 결과 예시

조회 응답 예시(GET /v1/music/tasks/{task_id}):
{
  "code": 200,
  "data": {
    "id": "task_01KWXVB61E28THHFBSYXWA4FAJ",
    "status": "completed",
    "progress": 100,
    "created": 1783413184,
    "completed": 1783413236,
    "actual_time": 52,
    "cost": 0.048,
    "credits_cost": 0.48,
    "result": {
      "music": [
        {
          "clip_id": "a41aade4-993e-4d28-b56f-d97e7ef7167c",
          "title": "Regression Song",
          "duration_seconds": "181.70666667",
          "create_time": "2026-07-07T08:33:32.854073Z",
          "lyrics": "[Verse 1]\nWaking up to the morning light,\n...",
          "lyrics_id": "c302d603-81b6-552f-8122-e512928d6aa1",
          "lyrics_timing_markers": [[10, 12], [212, 36]],
          "audio_url": "https://cdn.apimart.ai/audio/flowmusic_a41aade4.m4a",
          "wav_url": "https://cdn.apimart.ai/audio/flowmusic_a41aade4.wav",
          "image_url": "https://cdn.apimart.ai/image/flowmusic_a41aade4_cover.jpg"
        }
      ]
    }
  }
}