# Mureka O2 API Complete API reference for the Mureka O2 song generation model. ## Model Variant | Model | Description | | ------------------------- | --------------------------------------------------------------------------- | | `mureka-o2-generate-song` | Generate a song from lyrics with optional style guidance and a cloned voice | ## Endpoints ```text POST /api/v1/music/task GET /api/v1/music/{task_id} ``` ## Mureka O2 Generate Song ### Required Parameters | Parameter | Type | Description | | ------------ | ------ | --------------------------------- | | `model_name` | string | Must be `mureka-o2-generate-song` | | `lyrics` | string | Lyrics for the song to generate. Maximum 3000 characters | ### Optional Parameters | Parameter | Type | Description | | --------------- | ------ | ------------------------------------------------------------------------------------------------------ | | `prompt` | string | Style guidance for the song, such as genre, mood, instruments, rhythm, vocals, or production direction. Maximum 1024 characters | | `output_format` | string | Generated audio format: `mp3`, `wav`, or `flac`. Defaults to `mp3` | | `vocal_id` | string | Existing Mureka voice ID for the desired vocal tone | ### Example Request ```javascript const response = await fetch('https://api.flaq.ai/api/v1/music/task', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ model_name: 'mureka-o2-generate-song', lyrics: 'The sky turns gold above the road,\nWe sing the chorus back home.', prompt: 'Cinematic folk-pop with piano, acoustic guitar, and an expressive lead vocal', output_format: 'mp3', vocal_id: 'YOUR_VOCAL_ID', }), }); const { data } = await response.json(); const taskId = data.task_id; ``` ## Response Format ### Task Submission ```json { "code": 0, "message": "success", "data": { "task_id": "{task_id}", "response_url": "https://api.flaq.ai/api/v1/music/{task_id}", "task_status": "submitted" } } ``` ### Completed Task ```json { "code": 0, "message": "success", "data": { "task_id": "{task_id}", "response_url": "https://api.flaq.ai/api/v1/music/{task_id}", "task_status": "succeed", "task_status_msg": null, "task_result": { "credit": 0.2, "audios": [{ "url": "https://example.com/generated-audio.mp3" }] } } } ```