Audio (TTS & STT)
LLM API provides text-to-speech (TTS) and speech-to-text (STT) capabilities through a unified, OpenAI-compatible interface. Audio requests are routed to the best-fit provider — Cartesia, ElevenLabs, or AssemblyAI — based on the model you choose.
Capabilities
| Capability |
Endpoint |
Description |
| Text-to-Speech |
POST /v1/audio/speech |
Generate audio from text |
| Speech-to-Text |
POST /v1/audio/transcriptions |
Transcribe audio files |
| Streaming TTS |
GET /v1/audio/speech/ws |
Real-time audio generation via WebSocket |
| Streaming STT |
GET /v1/audio/transcriptions/ws |
Real-time transcription via WebSocket |
Quick Start
Generate Speech
curl -X POST "https://api.llmapi.ai/v1/audio/speech" \
-H "Authorization: Bearer $LLM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sonic-3",
"input": "Welcome to our platform. We are glad to have you here.",
"voice": "Sarah"
}' \
--output welcome.mp3
Transcribe Audio
curl -X POST "https://api.llmapi.ai/v1/audio/transcriptions" \
-H "Authorization: Bearer $LLM_API_KEY" \
-F model=ink-whisper \
-F file=@recording.mp3
Response:
{ "text": "Welcome to our platform. We are glad to have you here." }
Choosing a Model
Text-to-Speech
| Need |
Recommended Model |
Price |
| Lowest latency |
sonic-turbo (Cartesia) |
$0.045/1K chars |
| Most languages (74) |
eleven_v3 (ElevenLabs) |
$0.12/1K chars |
| Cheapest |
sonic-turbo (Cartesia) |
$0.045/1K chars |
| General purpose |
sonic-3 (Cartesia) |
$0.065/1K chars |
| WebSocket streaming |
sonic-3 (Cartesia) |
$0.065/1K chars |
| Fine voice control |
eleven_flash_v2_5 (ElevenLabs) |
$0.06/1K chars |
Speech-to-Text (Batch)
| Need |
Recommended Model |
Price |
| Cheapest |
ink-whisper (Cartesia) |
$0.13/hr |
| Highest accuracy |
universal-3-pro (AssemblyAI) |
$0.21/hr |
| Longest audio (4h) |
universal-3-pro (AssemblyAI) |
$0.21/hr |
| Fastest turnaround |
ink-whisper (Cartesia) |
$0.13/hr |
Speech-to-Text (Streaming)
| Need |
Recommended Model |
Price |
| Lowest latency (66ms) |
ink-whisper (Cartesia) |
$0.26/hr |
| Cheapest English |
universal-streaming-english (AssemblyAI) |
$0.0025/min |
| Most languages (99+) |
whisper-rt (AssemblyAI) |
$0.005/min |
| Highest accuracy |
u3-rt-pro (AssemblyAI) |
$0.0075/min |
See Audio Models for full details, and Audio Streaming for WebSocket guides.
OpenAI SDK Compatibility
The audio endpoints are compatible with the OpenAI SDK:
from openai import OpenAI
client = OpenAI(base_url="https://api.llmapi.ai/v1", api_key="YOUR_KEY")
# Text-to-Speech
response = client.audio.speech.create(
model="sonic-3",
input="Hello world",
voice="Sarah",
)
response.stream_to_file("speech.mp3")
# Speech-to-Text
with open("recording.mp3", "rb") as f:
transcript = client.audio.transcriptions.create(model="ink-whisper", file=f)
print(transcript.text)
Billing
- TTS is billed per 1,000 characters of input text
- STT (batch) is billed per minute of audio transcribed
- STT (streaming) billing depends on the provider:
- AssemblyAI models bill by session wall-clock time (silence counts)
- Cartesia models bill by audio duration actually sent
- Streaming sessions include budget protection — sessions terminate automatically when estimated cost reaches 90% of remaining credits