---
title: "Create a speech"
method: POST
path: "/v1/audio/speech"
tags: ["Audio"]
---

# Create a speech

`POST /v1/audio/speech`

Generate speech audio from text. Returns an audio file, or a stream of raw PCM chunks when `stream` is `true`. The body may be JSON or `multipart/form-data` — the latter lets you upload `ref_audio` as a raw file instead of base64-encoding it.

## Request body

- CreateSpeechRequest
  - `input` string, required — Text to convert to speech. May contain inline tags. Inputs longer than 5000 characters return a 400 `input_too_long`.
  - `model` 'higgs-tts-3' — TTS model ID / public alias. Resolved to the served model server-side.
  - `voice` string — Preset voice name or custom voice ID. Mutually exclusive with `ref_audio` / `ref_text` when explicitly provided.
  - `response_format` 'mp3' | 'opus' | 'pcm' | 'wav' | 'aac' | 'flac' — Output audio format. Streaming requires `pcm`.
  - `stream` boolean — If true, stream raw PCM chunks as they are decoded. Requires `response_format` to be `pcm`. Speed adjustment is not supported when streaming.
  - `ref_audio` string, nullable — Inline reference audio for one-off cloning: an http(s) URL, data URI, or base64-encoded raw audio bytes. Supported formats: AAC, WAV, MP3, FLAC, OPUS. Inline (base64 / data-URI) payloads: max 10 MB.
  - `ref_text` string, nullable — Recommended transcript of `ref_audio`.

## Response `200`

Generated audio. The content type depends on `response_format`.

## Other responses

- `400` — Invalid request parameters (e.g. `input_too_long`).
- `401` — Missing or invalid API key.

---

[API](https://skmtc.dev/boson/apis/boson-ai-api.md) · [All operations](https://skmtc.dev/boson/apis/boson-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/boson/boson-ai-api/revisions/1f9baf8f56ce/schema)
