Spiral gives your agent every tool with one account. Browse the tools →

Codex · AudioReleased 2025-08-05

How to Use Eleven Music in Codex

Eleven Music turns written briefs into songs with vocals or instrumental scores for videos, podcasts, and games. Use composition plans for arrangements that need specific sections and lyric timing.

Prompts to try with Eleven Music in Codex

Copy an example into Codex, or ask in your own words.

Read the game's scene descriptions and use Eleven Music to generate a 60-second instrumental exploration cue: subdued fantasy folk, 80 BPM, acoustic guitar, flute, and soft strings. Save it with the game's audio assets.

Eleven MusicCodex
Try asking
  • Read the product demo script and use Eleven Music to create a 45-second instrumental backing track: warm electronic pop, 100 BPM, soft synth chords, muted bass, and light percussion. Keep the arrangement sparse.

  • Use the podcast brief in this project to generate a 15-second opening with Eleven Music: instrumental jazz, 110 BPM, upright bass, brushed drums, and piano, with a relaxed late-night mood.

  • Read the trailer shot list and create a composition plan for a 60-second instrumental score with Eleven Music. Divide it into a 15-second quiet opening, a 30-second build, and a 15-second finale using strings and percussion.

  • Read the project's Spanish campaign copy and write a short original chorus based on its message. Use Eleven Music to generate a 30-second Spanish-language acoustic pop song with clear vocals, guitar, and light percussion.

How to set up Eleven Music in Codex

Pick the way that suits you. Each takes about two minutes.

Use Spiral's MCP server

  1. Add the hosted server
    codex mcp add spiral --url https://api.spiral.ai/mcp
  2. Sign in

    Codex opens the browser: sign in to Spiral and click Authorize. No API key. codex mcp list then shows Spiral.

    codex mcp login spiral

Use the Spiral skill

  1. Send Codex this message

    Your agent reads Spiral's skill and sets itself up.

    set up https://spiral.ai/SKILL.md
  2. Sign in or paste a key

    Approve Spiral in the browser, or give the agent a key from the console.

Use the Spiral CLI

  1. Install and sign in

    Installs the Spiral CLI, signs you in and adds its skill to your coding agents.

    npx -y spiral-cli@latest init

Call the Spiral API

  1. Create an API key

    In the console, under API keys.

  2. Run Eleven Music

    One request; the result comes back by polling or a webhook.

    curl https://api.spiral.ai/v1/runs \
      -H "Authorization: Bearer $SPIRAL_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: $(uuidgen)" \
      -d '{
        "provider": "fal",
        "model": "fal-ai/elevenlabs/music",
        "input": {
          "prompt": "Mysterious original soundtrack, themes of jungle, rainforest, nature, woodwinds, busy rhythmic tribal percussion."
        }
      }'

Then paste one of the prompts above: Codex finds Eleven Music on Spiral, shows the price and runs it.

Eleven Music providers and prices

Spiral runs Eleven Music through fal. Open a card for today's price, with every fee included.

falAudio
Elevenlabs Music
fal-ai/elevenlabs/music

Settings you can ask for

Eleven Music works from your prompt. Ask Codex for any of these in your prompt.

SettingAllowed valuesDefaultDescription
Music length ms3000 to 600000

The length of the song to generate in milliseconds. Used only in conjunction with prompt. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt.

Force instrumentalon or offoff

If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the prompt. Can only be used with prompt.

Respect sections durationson or offon

Controls how strictly section durations in the composition_plan are enforced. It will only have an effect if it is used with composition_plan. When set to true, the model will precisely respect each section's duration_ms from the plan. When set to false, the model may adjust individual section durations which will generally lead to better generation quality and improved latency, while always preserving the total song duration from the plan.

Output formatmp3_22050_32, mp3_44100_32, mp3_44100_64, mp3_44100_96, mp3_44100_128, mp3_44100_192, pcm_8000, pcm_16000 and 11 moremp3_44100_128

Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs.

Every API field of Elevenlabs Music is on its tool page: open its card above.

What can you do with Eleven Music in Codex?

Create music assets that match a project's scenes, scripts, and running times. A coding agent can turn those files into briefs for Eleven Music and organize the resulting cues alongside the project.

Podcast opening music

Create a short instrumental opening with a clear musical identity, such as brushed drums, upright bass, and a restrained piano melody.

Product demonstration soundtracks

Generate a 60-second instrumental cue with a steady tempo and sparse instrumentation for a narrated product demonstration.

Short ad music

Compose a 30-second track around an ad's mood, instruments, and intended audience, with a quieter opening and a stronger finish.

Game scene cues

Describe a game's setting and emotional tone to create music for exploration, a tense encounter, or a victory scene.

Songs in different languages

Develop original vocal songs in English, Spanish, German, or Japanese, with a stated genre and vocal direction.

Film scene score drafts

Explore how piano, strings, or electronic instrumentation changes the mood of a scene before choosing a scoring direction.

Music for social videos

Create a 15-second musical cue around a video's mood, with a specific tempo and a small set of instruments.

Song arrangement sketches

Use a composition plan to explore an introduction, verse, chorus, and ending with deliberate section lengths.

Questions about Eleven Music in Codex

Can Codex use Eleven Music?

Yes. Add Spiral to Codex as an MCP server, and Codex can find and run Eleven Music like any built-in tool.

How much does Eleven Music cost in Codex?

$0.78 per 60,000 seconds. Billed on `music_length_ms`, default 600,000. You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your Codex plan is separate.

Do I need a fal account to use Eleven Music in Codex?

No. Spiral runs Eleven Music on its own fal account. You sign in to Spiral once and never paste a key.

How long does it take to set up Eleven Music in Codex?

About two minutes: add the hosted server, then sign in.

Does Codex wait while Eleven Music runs?

Eleven Music runs in the background. Codex starts the run, checks on it and gives you the audio when it's ready.

What is Eleven Music useful for?

Use it for original songs, instrumental scores, and music shaped around a scene or mood. Practical starting points include video soundtracks, ad music, and game cues.

How long can an Eleven Music track be?

For generation from a text prompt, the documented range is 3 seconds to 10 minutes. Choose a length that matches the intended cue.

Which languages can Eleven Music sing in?

Documented examples include English, Spanish, German, and Japanese. State the vocal language explicitly in your brief.

What should I include in a music prompt?

Specify genre, mood, instruments, tempo, and production era. Add the scene or purpose so the musical choices serve the project.

Can I request a specific tempo and key?

Yes. ElevenLabs reports that BPM instructions are followed accurately, while the intended key is captured often; check the result before combining it with an existing recording.

Get started

Start using Eleven Music in Codex

One Spiral account for every tool your agent needs. No subscription; you pay per run.

Paste this into Codex:

Set up Codex

set up https://spiral.ai/SKILL.md
Are you an AI agent? See setup options