v172

latestOpenAPI 3.1.0raw.githubusercontent.com2026-08-0826148911.7 MB
Audio

Create speech

Generates audio from the input text.

post/v2/router/audio/speech

Request body

inputstring required

The text to generate audio for. The maximum length is 4096 characters

modelstring required

ID of the model to use

voicestring required

The voice to use.

Available voices for OpenAI

alloy, echo, fable, onyx, nova, and shimmer

Available voices for ElevenLabs

aria, roger, sarah, laura, charlie, george, callum, river, liam, charlotte, alice, matilda, will, jessica, eric, chris, brian, daniel, lily, bill

response_format'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm'

The format to audio in. Supported formats are mp3, opus, aac, flac, wav, and pcm. If a format is provided but not supported by the provider, the response will be in the default format. When the provided format is not supported by the provider, the response will be in the default format.

speednumber

The speed of the generated audio.

namestring

The name to display on the trace. If not specified, the default system name will be used.

Example request

{
  "retry": {
    "count": 3,
    "on_codes": [
      429,
      500,
      502,
      503,
      504
    ]
  },
  "load_balancer": {
    "models": [
      {
        "model": "openai/gpt-4o",
        "weight": 0.7
      }
    ]
  },
  "timeout": {
    "call_timeout": 30000
  },
  "orq": {
    "retry": {
      "count": 3,
      "on_codes": [
        429,
        500,
        502,
        503,
        504
      ]
    },
    "fallbacks": [
      {
        "model": "openai/gpt-4o-mini"
      }
    ],
    "identity": {
      "id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
      "display_name": "Jane Doe",
      "email": "jane.doe@example.com",
      "metadata": [
        {
          "department": "Engineering",
          "role": "Senior Developer"
        }
      ],
      "logo_url": "https://example.com/avatars/jane-doe.jpg",
      "tags": [
        "hr",
        "engineering"
      ]
    },
    "contact": {
      "id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
      "display_name": "Jane Doe",
      "email": "jane.doe@example.com",
      "metadata": [
        {
          "department": "Engineering",
          "role": "Senior Developer"
        }
      ],
      "logo_url": "https://example.com/avatars/jane-doe.jpg",
      "tags": [
        "hr",
        "engineering"
      ]
    },
    "thread": {
      "id": "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
      "tags": [
        "customer-support",
        "priority-high"
      ]
    },
    "load_balancer": {
      "type": "weight_based",
      "models": [
        {
          "model": "openai/gpt-4o",
          "weight": 0.7
        },
        {
          "model": "anthropic/claude-3-5-sonnet",
          "weight": 0.3
        }
      ]
    },
    "timeout": {
      "call_timeout": 30000
    }
  }
}

Response

The audio file content.