Sonic-Generation
Price
chirp-auk $0.055 per generation
others $0.04 per generation
API1 Generate Music
This endpoint is for custom creation mode, corresponding to "custom mode". This endpoint only submits music generation tasks, and its response contains two audio IDs.
Path: /gateway/generate/music
Method: POST
Content-Type: application/json
Parameters:
Parameter Name | Type | Description | Notes |
---|---|---|---|
title | String | Music title | |
tags | String | Music styles, separated by commas | |
generation_type | String | Generation type | Default is TEXT |
prompt | String | Music creation prompt, including but not limited to lyrics | |
negative_tags | String | Unwanted styles | Can be empty string |
mv | string | Model | Default is chirp-v4, chirp-auk, (chipr-auk is v4.5), chirp-v3-5, chirp-v3-0, can also be chirp-v2-xxl-alpha, optional parameter. Use chirp-v3-5-upload when extending uploaded audio files |
continue_at | float | Optional parameter, used when continuing creation. Indicates the second from which to continue creation, e.g., 120.00 or 61.59 | |
continue_clip_id | string | Optional parameter, used when continuing creation. Indicates the ID of the song to continue creating |
Response example:
{
"code": 0,
"msg": "success",
"data": [{
"user_id": "xxx",
"song_id": "71540f19-d335-4938-95e7-52b3d524d17c",
"status": "submitted",
"title": "Happy dog Song",
"image_large_url": null,
"image_url": null,
"model_name": "chirp-v3",
"video_url": "",
"audio_url": "",
"meta_tags": "happy, rock",
"meta_prompt": "A happy song about dogs",
"meta_duration": null,
"meta_error_msg": null,
"meta_error_type": null
}, {
"user_id": "xxx",
"song_id": "afdcb554-249d-4d67-90e3-917f7b4f8bfe",
"status": "submitted",
"title": "Happy dog Song",
"image_large_url": null,
"image_url": null,
"model_name": "chirp-v3",
"video_url": "",
"audio_url": "",
"meta_tags": "happy, rock",
"meta_prompt": "A happy song about dogs",
"meta_duration": null,
"meta_error_msg": null,
"meta_error_type": null
}]
}
Key Parameter Description:
Parameter Name | Type | Description | Notes |
---|---|---|---|
song_id | String | Audio ID | Can be used to query generation results |
API2 Generate Music Based on Prompt Only
Description: This endpoint corresponds to xxxx AI's Custom Mode when it's turned off. It generates songs through descriptions of the music.
Path: /gateway/generate/gpt_desc
Method: POST
Content-Type: application/json
Parameters:
Parameter Name | Type | Description | Notes |
---|---|---|---|
gpt_description_prompt | String | Description of the music | |
make_instrumental | Bool | If true, indicates no lyrics | |
mv | string | Model | Default is chirp-v4, no need to pass |
prompt | string | Optional parameter |
For response results, please refer to API1.
Similarly, you need to query generation results using song_id
.
API6
This endpoint is used to query the status of audio generation tasks.
Path: /gateway/query
Method: GET
Content-Type: application/json
URL parameter ids
:
Can be 1 ID, e.g., /gateway/query?ids=song_id1
Or 2 IDs, e.g., /gateway/query?ids=song_id1,song_id2
The song_id1 and song_id2 must be returned from the same creation task request.
For example, if request A returned id1 and id2, and request B returned id3 and id4. Valid queries would be query?ids=id1,id2, or query?ids=id3,id4. But query?ids=id1,id3 would not be valid.
Generation Failure
If generation fails, check the meta_data
field, the error_type
and error_message
fields will tell you the reason for the failure.
[{
'model_name': 'chirp-v3',
'meta_data': {
'tags': None,
'prompt': '',
'gpt_description_prompt': '写一首歌,朗朗,朗朗上口,朗朗的钢琴。',
'audio_prompt_id': None,
'history': None,
'concat_history': None,
'type': 'gen',
'duration': None,
'refund_credits': None,
'stream': True,
'error_type': 'moderation_failure',
'error_message': 'Song Description contained artist name: lang lang'
},
'reaction': None,
'id': '5cef2a0d-84b2-4390-ad13-82e4fa1c9003',
'is_liked': False,
'created_at': '2024-05-16T08:40:16',
'video_url': '',
'user_id': 'a86b15d2-97be-4cd4-abdc-8e6936225e7b',
'status': 'error',
'audio_url': 'https://cdn1.xxxx.ai/None.mp3',
'display_name': 'GalvanizingWhiteNoise784',
'title': '',
'image_url': None,
'handle': 'galvanizingwhitenoise784',
'play_count': 0,
'image_large_url': None,
'is_handle_updated': False,
'upvote_count': 0,
'is_video_pending': False,
'is_trashed': False,
'is_public': False,
'major_model_version': 'v3'
}
]
Generating
At this point, the status
is streaming
, and you can use the address provided in audio_url
to start playback.
Generation Complete
If the generation is successful, the returned result is as follows:
[{
'model_name': 'chirp-v3',
'meta_data': {
'tags': 'happy, rock',
'prompt': 'A happy song about cats',
'gpt_description_prompt': None,
'audio_prompt_id': None,
'history': None,
'concat_history': None,
'type': 'gen',
'duration': 120.0,
'refund_credits': False,
'stream': True,
'error_type': None,
'error_message': None
},
'reaction': None,
'id': 'd2755e7c-d4fa-4d4b-adb1-cec25cc69bda',
'is_liked': False,
'created_at': '2024-04-05T18:37:39',
'video_url': 'https://cdn1.xxxx.ai/d2755e7c-d4fa-4d4b-adb1-cec25cc69bda.mp4',
'user_id': 'a86b15d2-97be-4cd4-abdc-8e6936225e7b',
'status': 'complete',
'audio_url': 'https://cdn1.xxxx.ai/d2755e7c-d4fa-4d4b-adb1-cec25cc69bda.mp3',
'display_name': 'GalvanizingWhiteNoise784',
'title': 'Happy Cat Song',
'image_url': 'https://cdn1.xxxx.ai/image_d2755e7c-d4fa-4d4b-adb1-cec25cc69bda.png',
'handle': 'galvanizingwhitenoise784',
'play_count': 0,
'image_large_url': 'https://cdn1.xxxx.ai/image_large_d2755e7c-d4fa-4d4b-adb1-cec25cc69bda.png',
'is_handle_updated': False,
'upvote_count': 0,
'is_video_pending': False,
'is_trashed': False,
'is_public': False,
'major_model_version': 'v3'
}]
Explanation of the Status Field
The possible values for status
are submitted
, queued
, streaming
, complete
, and error
.
aligned lyrics
Path: /gateway/aligned_lyrics Method: POST
Heraders
Content-Type: application/json
api-key: {{api_key}}
Body:
{
"clip_id": "08dc0252-5249-4ded-8e2b-2a054849b955"
}