Developer API
Music Generation
Generate music from text descriptions using the Kolbo API.
Generate music tracks with vocals or instrumentals using AI models like Suno.
Endpoint
POST /api/v1/generate/musicRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Description of the music (e.g., "upbeat pop song about summer") |
model | string | No | Model identifier (default: "chirp-v4") |
style | string | No | Music style (e.g., "pop", "rock", "electronic", "jazz") |
instrumental | boolean | No | Instrumental only, no vocals (default: false) |
lyrics | string | No | Custom lyrics for the song |
vocal_gender | string | No | "m" or "f" for vocal gender preference |
enhance_prompt | boolean | No | Enhance the prompt (default: true) |
Examples
Simple
curl -X POST https://api.kolbo.ai/api/v1/generate/music \
-H "X-API-Key: kolbo_live_..." \
-H "Content-Type: application/json" \
-d '{"prompt": "Relaxing lo-fi hip hop beat for studying"}'With Style and Lyrics
curl -X POST https://api.kolbo.ai/api/v1/generate/music \
-H "X-API-Key: kolbo_live_..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "Emotional ballad",
"style": "pop",
"lyrics": "Walking through the rain\nThinking of you again",
"vocal_gender": "f"
}'Instrumental
curl -X POST https://api.kolbo.ai/api/v1/generate/music \
-H "X-API-Key: kolbo_live_..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "Epic orchestral trailer music",
"instrumental": true,
"style": "cinematic"
}'Response
Generation Started
{
"success": true,
"generation_id": "mus123",
"type": "music",
"model": "chirp-v4",
"credits_charged": 10,
"poll_url": "/api/v1/generate/mus123/status",
"poll_interval_hint": 8
}Completed Status
{
"success": true,
"generation_id": "mus123",
"state": "completed",
"progress": 100,
"result": {
"urls": ["https://cdn.kolbo.ai/audio/..."],
"model": "chirp-v4",
"title": "Summer Vibes",
"duration": 120,
"lyrics": "Generated or provided lyrics..."
}
}JavaScript Example
const response = await fetch('https://api.kolbo.ai/api/v1/generate/music', {
method: 'POST',
headers: {
'X-API-Key': process.env.KOLBO_API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: 'Upbeat pop song about summer adventures',
style: 'pop',
instrumental: false
})
});
const { generation_id, poll_url } = await response.json();
// Poll for result
let result;
do {
await new Promise(r => setTimeout(r, 8000));
const status = await fetch(`https://api.kolbo.ai/api${poll_url}`, {
headers: { 'X-API-Key': process.env.KOLBO_API_KEY }
});
result = await status.json();
} while (result.state === 'processing');
console.log('Music URLs:', result.result.urls);Python Example
import requests
import time
API_KEY = "kolbo_live_..."
BASE = "https://api.kolbo.ai/api"
r = requests.post(f"{BASE}/v1/generate/music",
headers={"X-API-Key": API_KEY},
json={
"prompt": "Cinematic orchestral theme",
"instrumental": True,
"style": "cinematic"
})
gen = r.json()
while True:
time.sleep(8)
s = requests.get(f"{BASE}{gen['poll_url']}",
headers={"X-API-Key": API_KEY}).json()
if s["state"] != "processing":
break
print("URLs:", s["result"]["urls"])Tips
- Music generation typically takes 30 seconds to 2 minutes
- Suno generates two track variations per request
- Use descriptive prompts for better results: include genre, mood, tempo, and instruments