Models speech create
post/models/v1/audio/speech
Text spoken in a voice of the voice catalogue (the voices live sessions use), through a speech route: 16-bit 24 kHz PCM, a WAV file, 8 kHz mu-law for a telephone line, or Ogg Opus where the deployment has the encoder. Spoken a sentence at a time: stream to hear the first sentence before the rest is made, or ask for the sentences apart with their text to cache and reorder them. Each sentence is a call under the project's limits.
Before you call
- Credential
Authorization: Bearer $KEY- Scope
models:write- Sdk
models.speech.create- Cli
models speech create
Request bodyapplication/json, required
- modelstringrequiredA speech route this project can call (GET /models/v1/models, kind speech) Pattern: ^[a-z][a-z0-9._-]{0,39}$.
- inputstringrequiredAt most 5000 characters.
- voicestringrequiredA voice id from GET /voice/catalogue, the same voices live sessions use At most 40 characters.
- languagestringPattern: ^[a-z]{2,3}(-[A-Za-z0-9]{2,8})?$.
- stylestringHow to say it, in words: "warmly", "slowly and clearly" At most 200 characters.
- formatstringpcm: 16-bit 24 kHz mono; wav: the same in a WAV file; mulaw: 8 kHz for a telephone line; opus: Ogg Opus One of: pcm, wav, mulaw, opus. Default: wav.
- streambooleanSend the sound as each sentence is spoken Default: false.
- sentencesbooleanAnswer each sentence apart, as JSON with its text and its sound, so it can be cached and reordered Default: false.
- purposestring or null
Responses
- 200text/event-streamSuccess
string - 400application/jsonThe request was malformed
- errorstringrequired
- messagestring
- 401application/jsonNo valid credential
- errorstringrequired
- messagestring
- 403application/jsonThe credential lacks the scope, origin or address
- errorstringrequired
- messagestring
- 429application/jsonOver the key's rate limit; see Retry-After
- errorstringrequired
- messagestring