Create speech
/v1/audio/speechCreate speech.
Compatible with OpenAI's create-speech endpoint: send model, input (the text) and voice and get the audio back as a binary body. Its content type follows response_format: mp3 (the default, audio/mpeg), opus, aac, flac, wav or pcm. Sarvam always answers in WAV. The body is forwarded to OpenAI and OpenAI-compatible providers as sent, and translated for Sarvam and ElevenLabs.
Authenticate with a BYOK virtual key or with x-provider and x-api-key; a PLATFORM virtual key is a 400. The key's checks, the plan's limits and the organization's approved-provider policy (403) apply. The call is priced on the length of input and the cost is in the x-operation-cost-usd response header. This call is not retried.
Authorization
AuthorizationBearer <slug>.<secret>A virtual key's API key (
vk-....<secret>), asAuthorization: Bearer. What the OpenAI SDK sends from itsapi_key. Used by the inference endpoints.- or
x-virtual-keyheaderA virtual key's API key in the
x-virtual-keyheader, for clients that keepAuthorizationfor something else. - or
x-api-keyheaderDirect credentials: the provider's own API key in
x-api-key, with the provider named inx-provider(for exampleopenai). On/v1/messagesa virtual key is accepted inx-api-keytoo, which is what the Claude SDK sends.
Headers
x-providerstringWith direct credentials: the provider
x-api-keybelongs to, for exampleopenaioranthropic(case and dashes are normalised). Not used with a virtual key.
Responses
The generated audio, in the requested format