|

Voice API

Text-to-speech and speech-to-text across OpenAI, Deepgram, Cartesia, ElevenLabs, AssemblyAI, and Spitch — one API, provider inferred from the model.

Turn text into speech and speech into text through a single billable, logged, PII-redacted gateway. Pick a model and the gateway routes to the right provider — OpenAI, Deepgram, Cartesia, ElevenLabs, AssemblyAI, or Spitch — with BYOK, spend caps, and cost tracking applied the same way as the rest of the platform.

Endpoints

PathPurpose
POST /api/ai/audio/speechText-to-speech (TTS)
POST /api/ai/audio/transcriptionsSpeech-to-text (STT)
GET /api/ai/audio/speechList TTS models
GET /api/ai/audio/transcriptionsList STT models

The provider is inferred from model — you never pass a provider name. Both endpoints default to OpenAI for backward compatibility.

Text-to-Speech

const { audio } = await cencori.voice.speak({
  input: 'Hello, welcome to Cencori.',
  model: 'aura-asteria-en',   // Deepgram — provider inferred
});
 
// audio is an ArrayBuffer
await fs.writeFile('hello.mp3', Buffer.from(audio));

Parameters

ParameterTypeRequiredDescription
inputstringYesText to synthesize (max 4096 chars)
modelstringNoTTS model. Default tts-1. See the table below
voicestringNoVoice id/name; provider-specific, falls back to the model default
responseFormatstringNomp3 (default), opus, aac, flac, wav, pcm (support varies by provider)
speednumberNo0.25–4.0 (OpenAI only)
languagestringNoLanguage code — Spitch: en, yo, ha, ig, am

TTS models

ModelProviderNotes
tts-1, tts-1-hdOpenAI6 built-in voices
aura-asteria-en, aura-luna-en, aura-stella-en, aura-orion-en, aura-arcas-enDeepgramSub-200ms, great for agents
sonic-2CartesiaSub-100ms, purpose-built for realtime
spitch-ttsSpitchAfrican languages — Yoruba, Hausa, Igbo, English, Amharic
eleven_turbo_v2_5, eleven_flash_v2_5, eleven_multilingual_v2ElevenLabsBest voice quality (paid ElevenLabs plan required)

Speech-to-Text

const { text } = await cencori.voice.transcribe({
  audio: fileBytes,           // Blob, ArrayBuffer, or Uint8Array
  model: 'nova-3',            // Deepgram — provider inferred
});

Parameters

ParameterTypeRequiredDescription
audioBlob | ArrayBuffer | Uint8ArrayYesAudio to transcribe (max 25MB)
modelstringNoSTT model. Default whisper-1
languagestringNoLanguage hint (Spitch: target language)
diarizebooleanNoSpeaker labels (diarization-capable models)
responseFormatstringNojson (default), text, srt, vtt, verbose_json
promptstringNoContext hint (OpenAI only)

STT models

ModelProviderDiarizationNotes
whisper-1OpenAIGeneral purpose
nova-3DeepgramFast, cheap, word timestamps
assemblyai-universalAssemblyAIStrong long-form + speaker labels
spitch-sttSpitchAfrican languages

Speaker diarization

Use diarize() (or diarize: true + responseFormat: 'verbose_json') with a diarization-capable model to get speaker-attributed segments:

const { segments } = await cencori.voice.diarize({
  audio: meetingBytes,
  model: 'assemblyai-universal',
});
 
for (const s of segments) {
  console.log(`${s.speaker}: ${s.text}`);
}

Subtitles (SRT / VTT)

Set responseFormat to srt or vtt to get ready-to-use subtitles with timestamps:

const { text: srt } = await cencori.voice.transcribe({
  audio: videoAudio,
  model: 'nova-3',
  responseFormat: 'srt',
});

African languages with Spitch

Spitch is the only provider here doing native Yoruba, Hausa, Igbo, and Amharic — both TTS and STT. Ideal for WhatsApp voice notes and West-African products:

// Speak Yoruba
const { audio } = await cencori.voice.speak({
  input: 'Bawo ni, e ku aaro.',
  model: 'spitch-tts',
  voice: 'sade',
  language: 'yo',
});
 
// Transcribe a Yoruba voice note
const { text } = await cencori.voice.transcribe({
  audio: voiceNote,
  model: 'spitch-stt',
  language: 'yo',
});

SDKs

The same surface exists in every SDK — TypeScript, Python, Go, PHP, and Rust.

# Python
audio = cencori.voice.speak("Hello from Cencori.", model="aura-asteria-en")
open("hello.mp3", "wb").write(audio)
 
result = cencori.voice.transcribe("hello.mp3", model="nova-3")
print(result["text"])
// Go
out, _ := c.Voice.Speak(ctx, &cencori.SpeakParams{Input: "Hello.", Model: "aura-asteria-en"})
os.WriteFile("hello.mp3", out.Audio, 0644)
 
tr, _ := c.Voice.Transcribe(ctx, out.Audio, &cencori.TranscribeParams{Model: "nova-3"})
fmt.Println(tr.Text)

Drop-in React components

import { VoiceRecorder, SpeakButton } from 'cencori/react';
 
// Record from the mic and get the transcript
<VoiceRecorder model="nova-3" apiKey={key} onTranscript={(text) => console.log(text)} />
 
// Play any text as speech
<SpeakButton text="Hello from Cencori." model="aura-asteria-en" apiKey={key} />

HTTP API

Speech (TTS)

curl -X POST https://cencori.com/api/ai/audio/speech \
  -H "CENCORI_API_KEY: csk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "input": "Hello world",
    "model": "aura-asteria-en"
  }' \
  --output speech.mp3

The response carries an X-Provider header telling you which provider served the request.

Transcription (STT)

curl -X POST https://cencori.com/api/ai/audio/transcriptions \
  -H "CENCORI_API_KEY: csk_..." \
  -F file=@audio.mp3 \
  -F model=nova-3 \
  -F diarize=true \
  -F response_format=verbose_json

Pricing & billing

TTS bills per 1,000 characters; STT bills per minute of audio. Every request is logged to ai_requests with the provider, model, provider cost, and your Cencori charge (provider cost + markup) — visible in the dashboard alongside chat and vision usage. BYOK keys are used when configured; otherwise the platform key is used.