Skip to main content
POST
/
v1
/
audio
/
music
Audio Music
curl --request POST \
  --url https://kymaapi.com/v1/audio/music \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "prompt": "<string>",
  "music_length_ms": 123,
  "response_format": "<string>"
}
'

Documentation Index

Fetch the complete documentation index at: https://docs.kymaapi.com/llms.txt

Use this file to discover all available pages before exploring further.

Synchronous endpoint. Describe the music you want; get back an MP3 of the requested length. Lyrics support is automatic — instrumental beds and vocal tracks come from the same endpoint.
curl -X POST https://kymaapi.com/v1/audio/music \
  -H "Authorization: Bearer $KYMA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "warm lo-fi hip-hop, jazz piano, soft snare, late evening city ambience",
    "music_length_ms": 30000
  }' \
  --output bed.mp3

Request

application/json body.
model
string
default:"elevenlabs-music"
Music model. Currently only elevenlabs-music is shipped.
prompt
string
required
Description of the music. Max 2000 characters. Genre, instrumentation, mood, lyrics, references — the model accepts plain English.
music_length_ms
integer
default:"30000"
Output duration in milliseconds. Range: 1000 (1 second) to 300000 (5 minutes). Also accepts duration_ms as an alias.
response_format
string
default:"mp3_44100_128"
Audio format. Same options as audio/speech.

Response

200 OK with audio bytes. Pricing is per second of requested duration, locked at submit time — what you ask for is what you pay.
HeaderWhat
X-Kyma-Modelelevenlabs-music
X-Kyma-Duration-Secclip duration used for billing
X-Kyma-Cost-USDactual cost charged
X-Kyma-Balance-USDremaining balance
Cost: $0.135/sec. A 30-second clip costs $4.05; a 5-minute clip costs $40.50.

Errors

Statuserror.codeWhen
400not_a_music_modelmodel is not a music SKU
400prompt_too_longprompt > 2000 chars
400invalid_durationmusic_length_ms outside [1000, 300000]
401auth_errormissing or invalid API key
402billing_errorbalance too low
502provider_errorupstream provider failure

See also