Skip to main content

ElevenLabs on AI Gateway

By Steven Van ·

Vercel's AI Gateway now carries 14 ElevenLabs speech, music and sound effect models, at half price through November 9th.

Vercel has added 14 ElevenLabs models to AI Gateway, and all of them are 50% off for the first 14 days, through November 9th. They are reachable with the same gateway API key as other models, and requests appear in the same usage, cost and trace views as other Vercel AI Gateway traffic.

Model types

AI Gateway supports six types of ElevenLabs audio model:

  • Speech to text: elevenlabs/scribe-v2 and elevenlabs/scribe-v2-realtime, for transcribing recordings or captioning live audio.
  • Streaming text to speech: elevenlabs/eleven-flash-v2.5, eleven-flash-v2, eleven-multilingual-v2 and eleven-v3-conversational, which start playing audio while a language model is still writing its reply.
  • Realtime voice agents: elevenlabs/eleven-realtime-v1-max and eleven-realtime-v1-mini, for talking to an app and hearing it answer in one live session.
  • Music: elevenlabs/music-v2.5 and music-v2, which generate a song or instrumental from a text description.
  • Sound effects: elevenlabs/sound-effects-v2, for game and interface sounds or ambience that loops cleanly.
  • Multi-voice dialogue: elevenlabs/eleven-v4, eleven-v4-turbo and eleven-v3, which voice a conversation with a different voice per speaker.

How it works in the AI SDK

Speech models are called with gateway.speechModel() and generateSpeech, passing an ElevenLabs voice ID and an output format such as mp3. For streaming, experimental_streamSpeech returns audio chunks as they are generated, and its text input accepts a string or a stream of text deltas.

Flash v2, Flash v2.5 and Multilingual v2 stream one voice per connection. To stream v3, v3 Conversational, v4 or v4 Turbo with several voices, set providerOptions.elevenlabs.dialogue.voices, and each text part's voice must appear in that list. v3 Conversational accepts exactly one voice.

Eleven v4 and v3 read audio tags in square brackets as delivery directions rather than words to say. Tags can set emotion (such as [whispers]), reactions (such as [laughs]) or sound cues (such as [footsteps]).

Music and sound effects

Music models also use generateSpeech, with no voice and no streaming. They need AI SDK v7 with @ai-sdk/gateway@4. Length is set with musicLengthMs, and music accepts forceInstrumental to leave out vocals or compositionPlan to set the style and length of each section. Sound effects take durationSeconds, loop for a clip that repeats without a gap, and promptInfluence (0 to 1) for how closely the result follows the description.

Vercel
Vercel
The platform for frontend developers — deploy, preview, and scale web apps and AI agents with zero config.
View Vercel →
Sources

Original source

Read ElevenLabs on AI Gateway on Creators Toolbox