### Example Request Body for Create Music Source: https://docs.aimusicapi.ai/api-32136922 This example demonstrates the JSON payload for creating music. It specifies the model version, a song prompt, and whether to use custom mode. ```json { "mv": "FUZZ-1.1 Pro", "prompt": "r&b pop song", "custom_mode": false } ``` -------------------------------- ### Starts Source: https://docs.aimusicapi.ai/api-32136925 This endpoint is used to start a music generation or replacement task. It allows for specifying song lyrics, title, sound style, and clip replacement parameters. ```APIDOC ## POST /v1/starts ### Description Starts a music generation or replacement task with specified parameters. ### Method POST ### Endpoint /v1/starts ### Parameters #### Request Body - **title** (string) - Required - The title of the song. - **sound** (string) - Required - The sound style of the music (e.g., pop). - **replace_start_time** (integer) - Optional - The start time in seconds for replacing a clip. - **replace_end_time** (integer) - Optional - The end time in seconds for replacing a clip. - **continue_clip_id** (string) - Optional - The ID of a clip to continue from. - **task_type** (string) - Required - The type of task to perform (e.g., replace_music). - **mv** (string) - Optional - The music video model to use. ### Request Example { "title": "Starts", "sound": "pop", "replace_start_time": 20, "replace_end_time": 120, "continue_clip_id": "f524dd12-cb7a-4eb6-b2fb-780f0ed07d9c", "task_type": "replace_music", "mv": "FUZZ-1.1 Pro" } ### Response #### Success Response (200) - **message** (string) - Indicates the success of the operation. - **task_id** (string) - The unique identifier for the initiated task. #### Response Example { "message": "success", "task_id": "6d7253ac-916e-49a8-b288-91ffa7f8a8cd" } ``` -------------------------------- ### Example Response Body for Create Music Source: https://docs.aimusicapi.ai/api-32136922 This example shows a successful response from the create music API. It includes a success message and a task ID for tracking the music generation process. ```json { "message": "success", "task_id": "6d7253ac-916e-49a8-b288-91ffa7f8a8cd" } ``` -------------------------------- ### Example API Response Source: https://docs.aimusicapi.ai/api-32136915 This is an example of a successful response from the API, indicating the task ID for a generated task. ```json { "message": "success", "task_id": "81ed9f60-56ae-48c1-9c46-33a8220dfca7" } ``` -------------------------------- ### Concat Music Response Example Source: https://docs.aimusicapi.ai/api-32136911 Example of a successful response for the concat music operation. Returns a message and a task_id. ```yaml message: success task_id: 51bc6dd0-508a-414d-9ef3-71f7bad81cf7 ``` -------------------------------- ### Add Vocal Request Example Source: https://docs.aimusicapi.ai/api-32136916 This example demonstrates how to structure a request to the 'add vocal' endpoint. Ensure the 'continue_clip_id' is a recently generated clip ID. ```json { "task_type": "add_vocals", "continue_clip_id": "2dc3b5a1-7a03-4bba-9d70-420555814864", //please replace this clip id to a new uploaded clip id "mv": "chirp-v5", "custom_mode": true, "prompt": "[Verse 1] I've been running in circles Chasing my doubts Trying to quiet the silence That's been too loud Every street light flickers With a memory But none of them shine like you did to me [Chorus] And I know we said goodbye But it never felt right Every step I take Just pulls me back in time I keep coming back to you Like the ocean to the moon Every night I try to move But the stars still spell your name I keep falling into you No matter what I do There's a gravity, a truth That I can't escape", "tags": "pop", //"gpt_description_prompt":"description of the vocal and lyrics", } ``` -------------------------------- ### Example Music Generation Request (v1.0) Source: https://docs.aimusicapi.ai/api-32136935 Example of a request to generate background music (bgm) using version 1.0 of the API. It specifies various parameters like description, genre, mood, instruments, theme, and duration. ```json //v1.0 // { // "type": "bgm", // "description": "Intense and tense game battle background music with epic momentum", // "genre": ["video game", "electronic", "epic", "cinematic"], // "mood": ["powerful", "energetic", "intense", "aggressive"], // "instrument": ["drums", "synth", "brass", "strings"], // "theme": ["achievement", "fantasy", "drama"], // "duration": 35 // } ``` -------------------------------- ### Example API Response (Success) Source: https://docs.aimusicapi.ai/api-32136935 Example of a successful API response, indicating the task status and providing a unique task ID for further reference. ```json { "message": "success", "task_id": "b1eac403-06cb-4e58-971d-835d3b321508" } ``` -------------------------------- ### Remaster Request Example Source: https://docs.aimusicapi.ai/api-32136914 Example JSON payload for remastering music. It includes the music model, task type, continue clip ID, and variation category. Ensure the continue_clip_id is generated within 24 hours. ```json { "mv":"chirp-v5", "task_type":"remaster", "continue_clip_id":"87a5e80c-00bd-4448-998d-a669e77d8ef4",//new clip id in 24h "variation_category":"subtle" } ``` -------------------------------- ### Concat Music Request Example Source: https://docs.aimusicapi.ai/api-32136911 Example of a request body for the concat_music task type. Requires a task_type and continue_clip_id. ```yaml task_type: concat_music continue_clip_id: a533515b-56c9-4eb2-8cb8-7f3dfa165eb8 ``` -------------------------------- ### Custom Lyrics Music Generation Example Source: https://docs.aimusicapi.ai/api-32136904 Use this example to generate music with custom lyrics. The 'prompt' field should contain your lyrics, and 'auto_lyrics' should be set to false (or omitted if false by default). ```json { "mashup_clip_ids": [ "abc123-def456", "xyz789-ghi012" ], "custom_mode": true, "mv": "chirp-v4-5-plus", "prompt": "[Verse 1]\nMixing beats together\nCreating something new" } ``` -------------------------------- ### Example Music Generation Request (v2.0) Source: https://docs.aimusicapi.ai/api-32136935 Example of a request to generate background music (bgm) using version 2.0 of the API. This version supports custom music segments with specified durations. ```json //v2.0 { "description": "cinematic background score", "type": "bgm", "version": "v2.0", "duration": 90, "segments": [ {"name": "intro", "duration": 20}, {"name": "verse", "duration": 25}, {"name": "chorus", "duration": 30}, {"name": "outro", "duration": 15} ] } ``` -------------------------------- ### Starts Source: https://docs.aimusicapi.ai/api-32136924 This endpoint generates music based on provided parameters. It supports pop music and can extend existing music clips. ```APIDOC ## POST /Starts ### Description Generates music based on provided parameters, including genre, continuation, and task type. ### Method POST ### Endpoint /Starts ### Parameters #### Query Parameters - **sound** (string) - Optional - The genre of music to generate (e.g., pop). - **continue_at** (integer) - Optional - The timestamp to continue music generation from. - **continue_clip_id** (string) - Optional - The ID of the clip to continue generation from. - **task_type** (string) - Optional - The type of task, e.g., `extend_music`. - **mv** (string) - Optional - The music video model to use. ### Request Example ```json { "message": "success", "task_id": "6d7253ac-916e-49a8-b288-91ffa7f8a8cd" } ``` ### Response #### Success Response (200) - **message** (string) - Indicates the success of the operation. - **task_id** (string) - The unique identifier for the music generation task. #### Response Example ```json { "message": "success", "task_id": "6d7253ac-916e-49a8-b288-91ffa7f8a8cd" } ``` ``` -------------------------------- ### Music Generation Request Example Source: https://docs.aimusicapi.ai/api-32136923 Example of a request to generate music with custom lyrics, title, sound, and vocal variation. This endpoint is deprecated. ```yaml custom_mode: true lyrics: | [Verse] Stars they shine above me Moonlight softly glows Whispers in the night sky Dreams that only grow [Verse 2] Midnight winds are calling Carrying a tune Heartbeats echo softly Dancing with the moon [Chorus] Starry night starry night Let your light ignite ignite Bright as day bright as day Guide my way guide my way [Verse 3] Shadows move and twinkle Nighttime come alive Mystery in the heavens Stories that survive [Bridge] Magic fills the darkness Wonder in the air Every star a secret In the sky I stare [Chorus] Starry night starry night Let your light ignite ignite Bright as day bright as day Guide my way guide my way title: Starts sound: pop vocal_variation: 0.5 continue_clip_id: f524dd12-cb7a-4eb6-b2fb-780f0ed07d9c task_type: cover_music mv: FUZZ-1.1 Pro ``` -------------------------------- ### Add Instrumental Request Example Source: https://docs.aimusicapi.ai/api-32136917 Example JSON payload for the add instrumental API. Replace 'continue_clip_id' with a valid clip ID generated within the last 24 hours. Use either 'prompt' with 'tags' or 'gpt_description_prompt' for song customization. ```json { "task_type": "add_instrumental", "continue_clip_id": "2dc3b5a1-7a03-4bba-9d70-420555814864", "mv": "chirp-v5", "custom_mode": false, "gpt_description_prompt": "happy song", "overpainting_start_s": 0, "overpainting_end_s": 20 } ``` -------------------------------- ### Get Credits Source: https://docs.aimusicapi.ai/doc-2058743 Check your remaining credits on the AIMusicAPI. This is essential for managing your usage and understanding costs. ```APIDOC ## Get Credits ### Description Check your remaining credits on the AIMusicAPI. This is essential for managing your usage and understanding costs. ### Method GET ### Endpoint https://api.aimusicapi.ai/api/v1/get-credits ### Parameters #### Headers - **Authorization** (string) - Required - Bearer token authentication (e.g., `Bearer YOUR_API_KEY`). ### Request Example ```bash curl -X GET https://api.aimusicapi.ai/api/v1/get-credits \ -H "Authorization: Bearer YOUR_API_KEY" ``` ### Response (Success response details not provided in source) ### Error Handling (Error handling details not provided in source) ``` -------------------------------- ### Starts Source: https://docs.aimusicapi.ai/api-32136921 Generates a musical piece based on provided lyrics and parameters. This endpoint is deprecated and will be removed in future versions. ```APIDOC ## POST /v1/starts ### Description Generates a musical piece based on provided lyrics and parameters. This endpoint is deprecated and will be removed in future versions. ### Method POST ### Endpoint /v1/starts ### Parameters #### Query Parameters - **custom_mode** (boolean) - Optional - If true, custom parameters are used. - **title** (string) - Optional - The title of the generated music. - **sound** (string) - Optional - The sound style for the music (e.g., 'pop'). - **make_instrumental** (boolean) - Optional - If true, generates an instrumental version. ### Request Body - **lyrics** (string) - Required - The lyrics for the song. ### Request Example ```json { "lyrics": "Starry night starry night\nLet your light ignite ignite\nBright as day bright as day\nGuide my way guide my way" } ``` ### Response #### Success Response (200) - **message** (string) - Indicates the success of the operation. - **task_id** (string) - The unique identifier for the generated task. #### Response Example ```json { "message": "success", "task_id": "6d7253ac-916e-49a8-b288-91ffa7f8a8cd" } ``` ``` -------------------------------- ### Instrumental Music Creation Request Source: https://docs.aimusicapi.ai/api-34286414 Generate instrumental music by setting `make_instrumental` to true. This example also includes a title for the track. ```json { "task_type": "create_music", "sound": "uplifting orchestral strings, no vocals", "make_instrumental": true, "title": "Sunrise Theme" } ``` -------------------------------- ### Generate Music - With Webhook Callback Source: https://docs.aimusicapi.ai/doc-2058752 This example demonstrates how to set up a webhook to receive a notification when the music generation task is complete. Provide a `webhook_url` and optionally a `webhook_secret` for payload signing. ```bash curl -X POST https://api.aimusicapi.ai/api/v1/producer/create \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "task_type": "create_music", "sound": "lo-fi hip hop beat for studying", "webhook_url": "https://your-server.com/webhooks/music", "webhook_secret": "your-shared-secret" }' ``` -------------------------------- ### OpenAPI Specification for Get BPM Source: https://docs.aimusicapi.ai/api-32136905 This OpenAPI specification defines the endpoint for retrieving BPM information. It includes request body schema, example request, and response schema with example data. ```yaml openapi: 3.0.1 info: title: '' description: '' version: 1.0.0 paths: /api/v1/sonic/bpm: post: summary: get BPM deprecated: false description: >- Get the BPM (Beats Per Minute) information of a song. Returns average, maximum and minimum BPM values. **Credits cost: 1** Other details: 1. The clip ID must be created through our service. 2. The clip ID should ideally have been created within the last 24 hours. tags: - sonic parameters: [] requestBody: content: application/json: schema: type: object properties: clip_id: type: string description: The clip_id of the song to analyze required: - clip_id x-apidog-orders: - clip_id example: clip_id: 26c9c592-0566-46cf-bb71-91ac1deaa7b5 responses: '200': description: Success content: application/json: schema: type: object properties: code: type: integer message: type: string data: type: object properties: avg_bpm: type: number description: Average BPM of the song max_bpm: type: number description: Maximum BPM detected in the song min_bpm: type: number description: Minimum BPM detected in the song required: - avg_bpm - max_bpm - min_bpm x-apidog-orders: - avg_bpm - max_bpm - min_bpm required: - code - message - data x-apidog-orders: - code - message - data example: code: 200 message: success data: avg_bpm: 120 max_bpm: 125 min_bpm: 115 headers: {} x-apidog-name: OK security: - bearer: [] x-apidog: schemeGroups: - id: PxffdcILwvaPYY8rHKIrI schemeIds: - bearer required: true use: id: PxffdcILwvaPYY8rHKIrI scopes: PxffdcILwvaPYY8rHKIrI: bearer: [] x-apidog-folder: sonic x-apidog-status: released x-run-in-apidog: https://app.apidog.com/web/project/1243895/apis/api-32136905-run components: schemas: {} securitySchemes: bearer: type: bearer scheme: bearer apikey-header-TT-API-KEY: type: apikey in: header name: TT-API-KEY bearerAuth: type: bearer scheme: bearer description: 'MusicAPI key passed as `Authorization: Bearer `' BearerAuth: type: bearer scheme: bearer description: 'Bearer API key. Send as `Authorization: Bearer `.' servers: - url: https://api.aimusicapi.ai description: Prod Env security: [] ``` -------------------------------- ### OpenAPI Specification for Get WAV Source: https://docs.aimusicapi.ai/api-32136907 This OpenAPI 3.0.1 specification defines the POST endpoint /api/v1/sonic/wav for retrieving a WAV URL by song ID. It includes request body schema, example, and response schema with an example WAV URL. ```yaml openapi: 3.0.1 info: title: '' description: '' version: 1.0.0 paths: /api/v1/sonic/wav: post: summary: get wav deprecated: false description: get wav url by song id tags: - sonic parameters: [] requestBody: content: application/json: schema: type: object properties: clip_id: type: string description: ths song id you want to get wav url required: - clip_id x-apidog-orders: - clip_id example: clip_id: 8ce9770b-ec3b-4029-a3e3-4b8db20da7d1 responses: '200': description: '' content: application/json: schema: type: object properties: message: type: string data: type: object properties: wav_url: type: string required: - wav_url x-apidog-orders: - wav_url required: - message - data x-apidog-orders: - message - data example: message: success data: wav_url: >- https://cdn1.suno.ai/8ce9770b-ec3b-4029-a3e3-4b8db20da7d1.wav headers: {} x-apidog-name: Success security: - bearer: [] x-apidog-folder: sonic x-apidog-status: released x-run-in-apidog: https://app.apidog.com/web/project/1243895/apis/api-32136907-run components: schemas: {} securitySchemes: bearer: type: http scheme: bearer apikey-header-TT-API-KEY: type: apikey in: header name: TT-API-KEY bearerAuth: type: bearer scheme: bearer description: 'MusicAPI key passed as `Authorization: Bearer `' BearerAuth: type: bearer scheme: bearer description: 'Bearer API key. Send as `Authorization: Bearer `.' servers: - url: https://api.aimusicapi.ai description: Prod Env security: [] ``` -------------------------------- ### Generate Music - Minimum Request (Sound Prompt Only) Source: https://docs.aimusicapi.ai/doc-2058752 This example shows the simplest way to generate music using only a sound prompt. It uses the `create_music` task type. ```bash curl -X POST https://api.aimusicapi.ai/api/v1/producer/create \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "task_type": "create_music", "sound": "warm cinematic ambient pad with light percussion" }' ``` ```json { "message": "success", "task_id": "6d7253ac-916e-49a8-b288-91ffa7f8a8cd" } ``` -------------------------------- ### get lyrics timeline Source: https://docs.aimusicapi.ai/api-32136909 Retrieves the lyric timeline for a specified clip_id, providing word-by-word alignment with start and end times. ```APIDOC ## POST /api/v1/sonic/aligned-lyrics ### Description Get the lyric timeline for the specified clip_id. ### Method POST ### Endpoint /api/v1/sonic/aligned-lyrics ### Parameters #### Request Body - **clip_id** (string) - Required - song id ### Request Example { "clip_id": "45021de5-2142-4ebb-9e46-6f3e345f7486" } ### Response #### Success Response (200) - **code** (integer) - **data** (object) - **alignment** (array) - **word** (string) - **end_s** (number) - **p_align** (integer) - **start_s** (number) - **success** (boolean) - **message** (string) #### Response Example { "code": 200, "data": { "alignment": [ { "word": "[Verse 1]\n\n[Acoustic Guitar][Emotional Melody][Powerful Vocals]\nHard", "end_s": 1.2766, "p_align": 1, "start_s": 0.87766, "success": true }, { "word": "-luck", "end_s": 1.59574, "p_align": 1, "start_s": 1.2766, "success": true }, { "word": " town", "end_s": 1.99468, "p_align": 1, "start_s": 1.59574, "success": true }, { "word": ", you", "end_s": 2.79255, "p_align": 1, "start_s": 2.39362, "success": true }, { "word": " learned", "end_s": 3.75, "p_align": 1, "start_s": 3.1117, "success": true }, { "word": " to", "end_s": 4.06915, "p_align": 1, "start_s": 3.82979, "success": true }, { "word": " run", "end_s": 4.62766, "p_align": 1, "start_s": 4.30851, "success": true }, { "word": ",\nBr", "end_s": 7.10106, "p_align": 1, "start_s": 7.02128, "success": true }, { "word": "uis", "end_s": 7.5, "p_align": 1, "start_s": 7.18085, "success": true }, { "word": "ed", "end_s": 7.5, "p_align": 1, "start_s": 7.18085, "success": true }, { "word": " knees", "end_s": 8.05851, "p_align": 1, "start_s": 7.57979, "success": true }, { "word": " brave", "end_s": 8.93617, "p_align": 1, "start_s": 8.53723, "success": true } ] }, "message": "" } ``` -------------------------------- ### OpenAPI Specification for Lyrics Timeline Source: https://docs.aimusicapi.ai/api-32136909 This OpenAPI 3.0.1 specification defines the request and response structure for the 'get lyrics timeline' API endpoint. It includes details on the request body, expected response format, and example data. ```yaml openapi: 3.0.1 info: title: '' description: '' version: 1.0.0 paths: /api/v1/sonic/aligned-lyrics: post: summary: get lyrics timeline deprecated: false description: Get the lyric timeline for the specified clip_id. tags: - sonic parameters: [] requestBody: content: application/json: schema: type: object properties: clip_id: type: string description: song id required: - clip_id x-apidog-orders: - clip_id example: clip_id: 45021de5-2142-4ebb-9e46-6f3e345f7486 responses: '200': description: '' content: application/json: schema: type: object properties: code: type: integer data: type: object properties: alignment: type: array items: type: object properties: word: type: string end_s: type: number p_align: type: integer start_s: type: number success: type: boolean required: - word - end_s - p_align - start_s - success x-apidog-orders: - word - end_s - p_align - start_s - success required: - alignment x-apidog-orders: - alignment message: type: string required: - code - data - message x-apidog-orders: - code - data - message example: code: 200 data: alignment: - word: |- [Verse 1] [Acoustic Guitar][Emotional Melody][Powerful Vocals] Hard end_s: 1.2766 p_align: 1 start_s: 0.87766 success: true - word: '-luck' end_s: 1.59574 p_align: 1 start_s: 1.2766 success: true - word: ' town' end_s: 1.99468 p_align: 1 start_s: 1.59574 success: true - word: ' you' end_s: 2.79255 p_align: 1 start_s: 2.39362 success: true - word: ' learned' end_s: 3.75 p_align: 1 start_s: 3.1117 success: true - word: ' to' end_s: 4.06915 p_align: 1 start_s: 3.82979 success: true - word: ' run' end_s: 4.62766 p_align: 1 start_s: 4.30851 success: true - word: |- , Br end_s: 7.10106 p_align: 1 start_s: 7.02128 success: true - word: ' u' end_s: 7.18085 p_align: 1 start_s: 7.10106 success: true - word: 'ised' end_s: 7.5 p_align: 1 start_s: 7.18085 success: true - word: ' knees' end_s: 8.05851 p_align: 1 start_s: 7.57979 success: true - word: ' brave' end_s: 8.93617 p_align: 1 start_s: 8.53723 success: true ``` -------------------------------- ### Generate Music - Lyrics and Sound Prompt with Title and Seed Source: https://docs.aimusicapi.ai/doc-2058752 This example demonstrates generating music with both lyrics and a sound prompt, including a specific title and a seed for reproducibility. The `mv` parameter specifies the model version. ```bash curl -X POST https://api.aimusicapi.ai/api/v1/producer/create \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "task_type": "create_music", "mv": "FUZZ-2.0 Pro", "title": "Back to You", "sound": "emotional pop with gentle piano and warm synths", "lyrics": "[Verse 1]\nLate night drives across the city\n...", "seed": "12345" }' ``` -------------------------------- ### Get Lyrics Timeline Source: https://docs.aimusicapi.ai/llms.txt Get the lyric timeline for the specified clip_id. ```APIDOC ## GET /sonic/get_lyrics_timeline ### Description Retrieves the lyric timeline for a specified clip ID. ### Method GET ### Endpoint /sonic/get_lyrics_timeline ### Parameters #### Query Parameters - **clip_id** (string) - Required - The ID of the clip. ### Response #### Success Response (200) - **lyrics_timeline** (array) - An array of objects, each containing lyric text and timestamps. #### Error Response [Details about potential error responses] ``` -------------------------------- ### Minimum Music Creation Request Source: https://docs.aimusicapi.ai/api-34286414 Use this example for the simplest music creation request, providing only the sound prompt. It utilizes default model settings. ```json { "task_type": "create_music", "sound": "warm cinematic ambient pad with light percussion" } ``` -------------------------------- ### Music Creation with Lyrics, Title, and Seed Source: https://docs.aimusicapi.ai/api-34286414 This example demonstrates a more advanced music creation request, including a sound prompt, title, lyrics, and a seed for reproducibility. It also specifies the 'FUZZ-2.0 Pro' model. ```json { "task_type": "create_music", "mv": "FUZZ-2.0 Pro", "title": "Back to You", "sound": "emotional pop with gentle piano and warm synths", "lyrics": "[Verse 1]\nLate night drives across the city\n...", "seed": "12345" } ``` -------------------------------- ### Get MIDI JSON Data Source: https://docs.aimusicapi.ai/llms.txt Get the MIDI JSON data of the specified clip ID, and the online URL of the MIDI format we processed. ```APIDOC ## GET /sonic/get_midi ### Description Retrieves the MIDI JSON data and the processed MIDI format URL for a given clip ID. ### Method GET ### Endpoint /sonic/get_midi ### Parameters #### Query Parameters - **clip_id** (string) - Required - The ID of the clip. ### Response #### Success Response (200) - **midi_json_url** (string) - The URL to the MIDI JSON data. - **midi_format_url** (string) - The URL to the processed MIDI file. #### Error Response [Details about potential error responses] ``` -------------------------------- ### Quick Start: Create Music with Sonic API Source: https://docs.aimusicapi.ai/doc-2058749 Use this cURL command to make a POST request to create music using the Sonic API. Ensure you replace YOUR_API_KEY with your actual API key. ```bash curl -X POST https://api.aimusicapi.ai/api/v1/sonic/create \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "custom_mode": true, "mv": "sonic-v4-5", "title": "My First Song", "tags": "pop, upbeat", "prompt": "[Verse]\nHello world, this is my song\n\n[Chorus]\nSinging all day long" }' ``` -------------------------------- ### Get BPM Information Source: https://docs.aimusicapi.ai/llms.txt Get the BPM (Beats Per Minute) information of a song. Returns average, maximum, and minimum BPM values. ```APIDOC ## GET /sonic/get_bpm ### Description Retrieves the BPM (Beats Per Minute) information for a given song. ### Method GET ### Endpoint /sonic/get_bpm ### Parameters #### Query Parameters - **clip_id** (string) - Required - The ID of the song to analyze. ### Response #### Success Response (200) - **average_bpm** (number) - The average BPM of the song. - **max_bpm** (number) - The maximum BPM detected. - **min_bpm** (number) - The minimum BPM detected. #### Error Response [Details about potential error responses] ``` -------------------------------- ### Music Creation with Webhook Callback Source: https://docs.aimusicapi.ai/api-34286414 This example shows how to configure a webhook URL and secret for receiving asynchronous task completion notifications. The `task_type` is set to `create_music`. ```json { "task_type": "create_music", "sound": "lo-fi hip hop beat for studying", "webhook_url": "https://your-server.com/webhooks/music", "webhook_secret": "your-shared-secret" } ``` -------------------------------- ### Create a Persona Source: https://docs.aimusicapi.ai/doc-2058745 Create a virtual singer profile from an existing song clip. ```json POST /api/v1/sonic/persona { "name": "My Singer", "clip_id": "source-clip-id", "describe": "Smooth jazz vocal with warm tone", "styles": "jazz, smooth, warm" } ``` -------------------------------- ### POST /api/v1/producer/create Source: https://docs.aimusicapi.ai/doc-2058751 Creates a music clip from a sound prompt and/or lyrics. The task_type must be set to 'create_music'. ```APIDOC ## POST /api/v1/producer/create ### Description Generates a music clip from a sound prompt and/or lyrics. ### Method POST ### Endpoint /api/v1/producer/create ### Parameters #### Request Body - **task_type** (string) - Required - Must be set to `create_music`. - **prompt** (string) - Optional - Sound prompt for music generation. - **lyrics** (string) - Optional - Lyrics text for music generation. ``` -------------------------------- ### Generate Music - Instrumental (Skip Vocals) Source: https://docs.aimusicapi.ai/doc-2058752 This example shows how to generate an instrumental track by setting `make_instrumental` to `true`. This suppresses vocals even if lyrics are provided. ```bash curl -X POST https://api.aimusicapi.ai/api/v1/producer/create \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "task_type": "create_music", "sound": "uplifting orchestral strings, no vocals", "make_instrumental": true, "title": "Sunrise Theme" }' ``` -------------------------------- ### Generate Music with Custom Lyrics Source: https://docs.aimusicapi.ai/api-32136903 This example demonstrates how to generate music using custom lyrics provided in the 'prompt' field. It utilizes a sample clip ID and specifies various generation parameters. ```APIDOC ## POST /generate/music ### Description Generates music based on provided parameters, including custom lyrics or AI-generated lyrics. ### Method POST ### Endpoint /generate/music ### Parameters #### Request Body - **sample_clip_id** (string) - Optional - ID of a sample clip to use as a basis. - **chop_sample_start_s** (integer) - Required - Start time in seconds for sampling. - **chop_sample_end_s** (integer) - Required - End time in seconds for sampling. - **custom_mode** (boolean) - Required - If true, uses custom lyrics provided in 'prompt'. - **mv** (string) - Required - The music model to use (e.g., 'chirp-v4-5-plus'). - **make_instrumental** (boolean) - Required - Set to true for instrumental music, false for vocals. - **prompt** (string) - Optional - Custom lyrics for the song. Required when custom_mode is true. Maximum 3000 characters. - **gpt_description_prompt** (string) - Optional - Description for AI to generate lyrics. Required when custom_mode is false. Maximum 200 characters. - **title** (string) - Optional - Song title. Maximum 80 characters. - **tags** (string) - Optional - Style tags (comma-separated). Maximum 200 characters. - **negative_tags** (string) - Optional - Tags to avoid in the generated music. - **style_weight** (number) - Optional - Controls how strongly style tags influence the output (0 to 1). - **weirdness_constraint** (number) - Optional - Controls creativity/randomness level (0 to 1). - **audio_weight** (number) - Optional - Audio weight parameter (0 to 1). - **vocal_gender** (string) - Optional - Vocal gender: 'f' for female, 'm' for male. Only supported for specific models. - **auto_lyrics** (boolean) - Optional - Automatically generate lyrics. If true, 'prompt' is used as a song description. - **webhook_url** (string) - Optional - HTTPS URL to receive webhook notifications. - **webhook_secret** (string) - Optional - Secret key for webhook signature verification. ### Request Example ```json { "sample_clip_id": "abc123-def456-sample", "chop_sample_start_s": 0, "chop_sample_end_s": 30, "custom_mode": true, "mv": "chirp-v4-5-plus", "make_instrumental": false, "prompt": "[Verse 1]\nInspired by this melody\nCreating something beautiful\n\n[Chorus]\nFrom a simple hum\nA full song has come", "title": "Melody Dreams", "tags": "pop, melodic, uplifting", "style_weight": 0.7 } ``` ### Response #### Success Response (200) - **task_id** (string) - The ID of the music generation task. - **status** (string) - The current status of the task (e.g., 'processing', 'completed', 'failed'). #### Response Example ```json { "task_id": "task-xyz789", "status": "processing" } ``` ``` -------------------------------- ### OpenAPI Specification for Get Music Task Source: https://docs.aimusicapi.ai/api-32136936 This OpenAPI 3.0.1 specification defines the GET /api/v1/nuro/task/{task_id} endpoint. It outlines the parameters, responses, and data structures for retrieving music generation task information. ```yaml openapi: 3.0.1 info: title: '' description: '' version: 1.0.0 paths: /api/v1/nuro/task/{task_id}: get: summary: get music deprecated: false description: '' tags: - nuro parameters: - name: task_id in: path description: task id required: true schema: type: string responses: '200': description: '' content: application/json: schema: type: object properties: task_id: type: string description: task id status: type: string enum: - pending - running - succeeded x-apidog: enumDescriptions: pending: '' running: '' succeeded: '' description: >- task status, When "succeeded", it means the song is generated. progress: type: integer maximum: 100 description: >- The song generation progress, when it is 100, it means the song was generated successfully audio_url: type: string description: Online audio URL in wav format lyrics: type: string description: song lyrics duration: type: number description: song duration genre: type: string description: genre of the song mood: type: string description: mood of the song gender: type: string description: gender of the song timbre: type: string description: timbre of the song required: - task_id - status - progress - audio_url - lyrics - duration - genre - mood - gender - timbre x-apidog-orders: - task_id - status - progress - audio_url - lyrics - duration - genre - mood - gender - timbre example: task_id: 4c35433b-1649-433d-b513-8422af70fbaa status: succeeded progress: 100 audio_url: >- https://cdn.musicapi.ai/storage/v1/object/public/songs/song-4c35433b-1649-433d-b513-8422af70fbaa.wav lyrics: >- [intro] [verse] We were both young when I first saw you I close my eyes and the flashback starts I'm standin' there On a balcony in summer air See the lights see the party the ball gowns See you make your way through the crowd And say 'Hello' Little did I know [bridge] That you were Romeo you were throwin' pebbles And my daddy said 'Stay away from Juliet' And I was cryin' on the staircase Escape this town for a little while oh oh [chorus] And said 'Marry me Juliet You'll never have to be alone I love you and that's all I really know I talked to your dad go pick out a white dress It's a love story baby just say 'Yes'' [inst] [verse] Instrumental break [bridge] I got tired of waiting Wondering if you were ever coming around My faith in you was fading When I met you on the outskirts of town [chorus] And I said 'Romeo save me I've been feeling so alone I keep waiting for you but you never come Is this in my head I don't know what to think' [inst] [verse] I talked to your dad go pick out a white dress It's a love story baby just say 'Yes' Oh oh oh 'Cause we were both young when I first saw you ``` -------------------------------- ### Example Output URLs Source: https://docs.aimusicapi.ai/doc-2058751 These are the stable and cacheable URLs for generated media files hosted on the AI Music API's CDN. The host may change between releases, so do not rely on it. ```text https://musicapi-cdn.b-cdn.net/producer/{clip_id}.m4a https://musicapi-cdn.b-cdn.net/producer/{clip_id}-wav.wav https://musicapi-cdn.b-cdn.net/producer/{clip_id}-img.jpg https://musicapi-cdn.b-cdn.net/producer/{clip_id}-video.mp4 ```