> ## Documentation Index
> Fetch the complete documentation index at: https://docs.snapgen.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Eleven v4

> ElevenLabs Eleven v4 text to speech through the OpenAI-compatible speech endpoint. $0.12 per 1,000 characters.

`eleven-v4` runs ElevenLabs Eleven v4 text to speech on the OpenAI-compatible speech endpoint. Send up to 10,000 characters with one of 21 premade voices and receive the audio file in the response. Use it with the official OpenAI SDKs by changing only the base URL, the model, and the voice.

| Property | Value |
| - | - |
| Model ID | `eleven-v4` |
| Endpoint | `POST /v1/audio/speech` (synchronous) |
| Output | Audio bytes: MP3 (default), Opus, PCM, or WAV |
| Voices | 21 ElevenLabs premade voices, by ID or first name |
| Limits | Up to 10,000 characters per request |
| Billed on | Characters of `input` |
| Price | \$0.12 per 1,000 characters (12 credits) |

Confirm live rates on the [SnapGen models page](https://snapgen.org/models). Failed requests are not charged.

## Choose a speech model

All four speech models share the endpoint, the fields, and the voices. They
differ in the upstream model, the character limit, and the price.

| Model | Characters per request | Price per 1,000 characters |
| - | - | - |
| `eleven-v4` | 10,000 | \$0.12 |
| [`eleven-v3`](/api-manual/audio/eleven-v3) | 5,000 | \$0.12 |
| [`eleven-multilingual-v2`](/api-manual/audio/eleven-multilingual-v2) | 10,000 | \$0.12 |
| [`eleven-flash-v2.5`](/api-manual/audio/eleven-flash-v2-5) | 40,000 | \$0.06 |

For several speakers in one file, use [`eleven-v4-dialogue`](/api-manual/audio/eleven-v4-dialogue).

<ParamField body="model" type="string" required>
  Set to `eleven-v4`.
</ParamField>

<ParamField body="input" type="string" required>
  The text to speak, up to 10,000 characters. Newlines are allowed; blank text
  and other control characters are rejected. Each character is billed.
</ParamField>

<ParamField body="voice" type="string" required>
  A voice ID or first name from the
  [voice list](/api-reference/audio-speech#voices), for example
  `JBFqnCBsd6RMkjVDRZzb` or `George`. Names are case-insensitive.
</ParamField>

<ParamField body="response_format" type="string" default="mp3">
  `mp3`, `opus`, `pcm`, or `wav`. See
  [Output formats](/api-reference/audio-speech#output-formats).
</ParamField>

<ParamField body="speed" type="number">
  Speaking speed, from `0.7` to `1.2`.
</ParamField>

<ParamField body="language" type="string">
  An ISO 639 language code of two or three lowercase letters, such as `en` or
  `de`. The provider rejects a code the model doesn't support.
</ParamField>

<ParamField body="stability" type="number">
  From `0` to `1`. Lower values give a broader emotional range; higher values
  sound more consistent.
</ParamField>

<ParamField body="similarity_boost" type="number">
  From `0` to `1`. How closely the output follows the original voice.
</ParamField>

<ParamField body="style" type="number">
  From `0` to `1`. Exaggerates the voice's speaking style.
</ParamField>

<ParamField body="use_speaker_boost" type="boolean">
  Boosts similarity to the original speaker.
</ParamField>

<ParamField body="seed" type="integer">
  From `0` to `4294967295`. Makes repeated requests more repeatable, without
  guaranteeing identical audio.
</ParamField>

<ParamField body="previous_text" type="string">
  Up to 5,000 characters that come before `input`, for continuity across
  requests. Not billed.
</ParamField>

<ParamField body="next_text" type="string">
  Up to 5,000 characters that follow `input`, for continuity across requests.
  Not billed.
</ParamField>

<ParamField body="apply_text_normalization" type="string">
  `auto`, `on`, or `off`: whether numbers, dates, and similar text are spelled
  out before speaking.
</ParamField>

## Request

```bash theme={null}
curl https://api.snapgen.org/v1/audio/speech \
  -H "Authorization: Bearer $SNAPGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "eleven-v4",
    "input": "Welcome back! Today we explore the northern lights.",
    "voice": "JBFqnCBsd6RMkjVDRZzb",
    "response_format": "mp3"
  }' \
  --output speech.mp3
```

The response body is the audio file, with a `Content-Type` that matches
`response_format` (`audio/mpeg` for MP3).

<CodeGroup>
  ```python Python theme={null}
  import os

  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ["SNAPGEN_API_KEY"],
      base_url="https://api.snapgen.org/v1",
  )

  with client.audio.speech.with_streaming_response.create(
      model="eleven-v4",
      voice="George",
      input="Welcome back! Today we explore the northern lights.",
      response_format="mp3",
  ) as response:
      response.stream_to_file("speech.mp3")
  ```

  ```javascript Node.js theme={null}
  const fs = require("node:fs");
  const OpenAI = require("openai");

  async function main() {
    const client = new OpenAI({
      apiKey: process.env.SNAPGEN_API_KEY,
      baseURL: "https://api.snapgen.org/v1",
    });

    const response = await client.audio.speech.create({
      model: "eleven-v4",
      voice: "George",
      input: "Welcome back! Today we explore the northern lights.",
      response_format: "mp3",
    });

    fs.writeFileSync("speech.mp3", Buffer.from(await response.arrayBuffer()));
  }

  main();
  ```
</CodeGroup>

## Longer text

A request takes up to 10,000 characters. For a longer script, split it at
sentence or paragraph boundaries and send one request per part. Pass the
neighboring text as `previous_text` and `next_text` so each part flows into
the next; that context isn't billed. Keep `voice`, `seed`, and the voice
settings the same for every part.

## Price examples

| Text | Price |
| - | - |
| 100 characters | \$0.012 |
| 1,000 characters | \$0.12 |
| 10,000 characters | \$1.20 |

<Note>
  Synchronous audio endpoints reject `Idempotency-Key`. If a request times
  out, check your Console request logs before you retry. See
  [Text to speech](/api-reference/audio-speech) for the response headers and
  errors.
</Note>
