POST /generate
Generate music using AI with callback support. Supports both inspiration mode (text description) and custom mode (lyrics, style, title).
ヒント
This endpoint generates music and sends results to your callback URL when completed.
Callback URL Requirements:
- Must be publicly accessible (no localhost, internal IPs, or private networks)
- Must accept POST requests
- Will receive an array of generation results in the request body
Two Generation Modes:
- Inspiration Mode: Use
gpt_description_promptto generate music from a text description - Custom Mode: Use
prompt,style, andtitlefor detailed control
Callbacks are sent at each stage: text generation, first audio, and completion.
リクエストヘッダー
| 名前 | 必須 | 説明 |
|---|---|---|
| Authorization | はい | Bearer token for authentication |
| Content-Type | はい | application/json |
Bearer token for authentication
application/json
リクエストボディ
Request body supports two modes: Inspiration Mode or Custom Mode, plus callback URL
Inspiration Mode
Generate music from a text description
| パラメータ | 型 | 必須 | 説明 | 例 |
|---|---|---|---|---|
| gpt_description_prompt | string | はい | Text description of the music you want to generate. Max length: 3000 characters (longer input is truncated). Optional when image_urls is provided. | A upbeat pop song about summer vacation with catchy melody |
Custom Mode
Generate music with custom lyrics, style, and title
| パラメータ | 型 | 必須 | 説明 | 例 |
|---|---|---|---|---|
| prompt | string | はい | Custom lyrics or detailed prompt. Max length: 5000 characters for every model (longer input is truncated). | Verse 1: Walking down the street, feeling so free... |
| style | string | いいえ | Musical style/genre. Max length: 1000 characters for every model (longer input is truncated). | pop, upbeat, electronic, 120 bpm |
| title | string | いいえ | Song title. Max length: 80 characters (longer input is truncated). | Summer Dreams |
| tags | string | いいえ | Negative tags to avoid in generation | sad, slow |
共通パラメータ
| パラメータ | 型 | 必須 | 説明 | 例 |
|---|---|---|---|---|
| callback_url | string | はい | URL to receive generation results callbacks. Must be publicly accessible. | https://your-domain.com/api/callback |
| model | string | いいえ | Model to use. Current options: 'chirp-v6' (12 credits), 'chirp-v6-mini' (10 credits), 'chirp-v6-wild' (12 credits). Legacy identifiers 'chirp-v3-5' (5), 'chirp-v4-0' (8), 'chirp-v4-5' (10), 'chirp-v4-5-plus' (10), 'chirp-v5' (12) and 'chirp-v5-5' (12) keep their historical price and are served by chirp-v6 (chirp-v5 / chirp-v5-5) or chirp-v6-mini (all others). When omitted the request is billed at the 5-credit base tier and served by chirp-v6-mini. | chirp-v6 |
| image_urls | string[] | いいえ | Image to Music. Up to 5 publicly accessible image URLs (JPEG, JPG, PNG or WEBP, max 10MB each). Adds 1 credit per request. Inspiration Mode only; silently ignored in Custom Mode. | ["https://cdn.example.com/sunset-beach.jpg"] |
| make_instrumental | boolean | いいえ | Generate instrumental music without vocals | false |
| gender | string | いいえ | Vocal gender preference. Use 'male' or 'female' | female |
| style_weight | number | いいえ | Strength of adherence to style. Range 0–1, up to 2 decimals | 0.65 |
| weirdness_constraint | number | いいえ | Controls creative deviation. Range 0–1, up to 2 decimals | 0.65 |
| audio_weight | number | いいえ | Balance weight for audio features. Range 0–1, up to 2 decimals | 0.65 |
レスポンス
{
"code": 200,
"message": "success",
"workId": "gen2abc123def456bksv",
"data": {
"task_id": "gen2abc123def456bksv"
}
}コード例
curl -X POST "https://aimusicapi.org/api/generate" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"callback_url": "https://your-domain.com/api/callback",
"model": "chirp-v6-mini",
"gpt_description_prompt": "A upbeat pop song about summer vacation with catchy melody",
"make_instrumental": false,
"gender": "female",
"style_weight": 0.65,
"weirdness_constraint": 0.65,
"audio_weight": 0.65
}'POST /generate
Generate music using AI with callback support. Supports both inspiration mode (text description) and custom mode (lyrics, style, title).
ヒント
This endpoint generates music and sends results to your callback URL when completed.
Callback URL Requirements:
- Must be publicly accessible (no localhost, internal IPs, or private networks)
- Must accept POST requests
- Will receive an array of generation results in the request body
Two Generation Modes:
- Inspiration Mode: Use
gpt_description_promptto generate music from a text description - Custom Mode: Use
prompt,style, andtitlefor detailed control
Callbacks are sent at each stage: text generation, first audio, and completion.
リクエストヘッダー
| 名前 | 必須 | 説明 |
|---|---|---|
| Authorization | はい | Bearer token for authentication |
| Content-Type | はい | application/json |
Bearer token for authentication
application/json
リクエストボディ
Request body supports two modes: Inspiration Mode or Custom Mode, plus callback URL
Inspiration Mode
Generate music from a text description
| パラメータ | 型 | 必須 | 説明 | 例 |
|---|---|---|---|---|
| gpt_description_prompt | string | はい | Text description of the music you want to generate. Max length: 3000 characters (longer input is truncated). Optional when image_urls is provided. | A upbeat pop song about summer vacation with catchy melody |
Custom Mode
Generate music with custom lyrics, style, and title
| パラメータ | 型 | 必須 | 説明 | 例 |
|---|---|---|---|---|
| prompt | string | はい | Custom lyrics or detailed prompt. Max length: 5000 characters for every model (longer input is truncated). | Verse 1: Walking down the street, feeling so free... |
| style | string | いいえ | Musical style/genre. Max length: 1000 characters for every model (longer input is truncated). | pop, upbeat, electronic, 120 bpm |
| title | string | いいえ | Song title. Max length: 80 characters (longer input is truncated). | Summer Dreams |
| tags | string | いいえ | Negative tags to avoid in generation | sad, slow |
共通パラメータ
| パラメータ | 型 | 必須 | 説明 | 例 |
|---|---|---|---|---|
| callback_url | string | はい | URL to receive generation results callbacks. Must be publicly accessible. | https://your-domain.com/api/callback |
| model | string | いいえ | Model to use. Current options: 'chirp-v6' (12 credits), 'chirp-v6-mini' (10 credits), 'chirp-v6-wild' (12 credits). Legacy identifiers 'chirp-v3-5' (5), 'chirp-v4-0' (8), 'chirp-v4-5' (10), 'chirp-v4-5-plus' (10), 'chirp-v5' (12) and 'chirp-v5-5' (12) keep their historical price and are served by chirp-v6 (chirp-v5 / chirp-v5-5) or chirp-v6-mini (all others). When omitted the request is billed at the 5-credit base tier and served by chirp-v6-mini. | chirp-v6 |
| image_urls | string[] | いいえ | Image to Music. Up to 5 publicly accessible image URLs (JPEG, JPG, PNG or WEBP, max 10MB each). Adds 1 credit per request. Inspiration Mode only; silently ignored in Custom Mode. | ["https://cdn.example.com/sunset-beach.jpg"] |
| make_instrumental | boolean | いいえ | Generate instrumental music without vocals | false |
| gender | string | いいえ | Vocal gender preference. Use 'male' or 'female' | female |
| style_weight | number | いいえ | Strength of adherence to style. Range 0–1, up to 2 decimals | 0.65 |
| weirdness_constraint | number | いいえ | Controls creative deviation. Range 0–1, up to 2 decimals | 0.65 |
| audio_weight | number | いいえ | Balance weight for audio features. Range 0–1, up to 2 decimals | 0.65 |
レスポンス
{
"code": 200,
"message": "success",
"workId": "gen2abc123def456bksv",
"data": {
"task_id": "gen2abc123def456bksv"
}
}コード例
curl -X POST "https://aimusicapi.org/api/generate" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"callback_url": "https://your-domain.com/api/callback",
"model": "chirp-v6-mini",
"gpt_description_prompt": "A upbeat pop song about summer vacation with catchy melody",
"make_instrumental": false,
"gender": "female",
"style_weight": 0.65,
"weirdness_constraint": 0.65,
"audio_weight": 0.65
}'