Speech and embeddings
Text to speech
Section titled “Text to speech”POST /v1/audio/speech returns the whole audio file, synchronously.
speech = client.audio.speech.create( model="tts-1", voice="nova", input="Your order is packed and waiting at the pickup point.",)speech.write_to_file("out.mp3")const speech = await client.audio.speech.create({ model: 'tts-1', voice: 'nova', input: 'Your order is packed and waiting at the pickup point.',})await Bun.write('out.mp3', speech)curl https://api.mixen.ai/v1/audio/speech \ -H "Authorization: Bearer $MIXEN_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "tts-1", "voice": "nova", "input": "Your order is packed and waiting at the pickup point."}' \ -o out.mp3| Field | Description |
|---|---|
input |
The text, required |
model |
tts-1 is accepted for compatibility; you can also name a catalog model |
voice |
alloy, echo, fable, nova, shimmer and others — the full list is the voices field in the catalog. An unknown voice silently falls back to the default |
response_format |
Audio format |
speed |
Speech rate |
Billing is by the length of the input text, per 1000 characters. The duration of the resulting audio does not affect the price, so you can budget before you call.
Transcription
Section titled “Transcription”POST /v1/audio/transcriptions takes multipart/form-data.
curl https://api.mixen.ai/v1/audio/transcriptions \ -H "Authorization: Bearer $MIXEN_API_KEY" \ -F file=@meeting.m4a \ -F model=whisper-1 \ -F language=en| Field | Description |
|---|---|
file |
Audio file, required |
model |
whisper-1 for compatibility |
language |
Language code; detected automatically when omitted |
response_format |
json by default |
Billed per minute of audio.
Embeddings
Section titled “Embeddings”POST /v1/embeddings produces vectors for search, clustering and RAG.
vec = client.embeddings.create( model="text-embedding-3-small", input=["first document", "second document"],)print(len(vec.data), len(vec.data[0].embedding))Accepted models are text-embedding-3-small, text-embedding-3-large and text-embedding-ada-002. The input field takes a string or an array of strings — an array is cheaper and faster than looping one at a time.
Billed per million input tokens.
Scopes
Section titled “Scopes”Speech and transcription need the audio scope; embeddings need embeddings. A key without the right scope gets a 403.