API Reference
POST/v1/audio/speech

Text-to-Speech

Converts text into spoken audio. Shape matches the OpenAI Speech API (client.audio.speech.create()) — the response body is the raw audio file, not JSON.

Request body

modelstringRequired

The TTS model id. deepgram/aura-2:free is free (shares the same daily credit pool as free chat models). hexgrad/kokoro-82m is a paid model billed per character. See Models.

inputstringRequired

The text to speak. Up to 5,000 characters — longer input is truncated.

voicestringOptional

A voice preset name for the chosen model, sent through to the provider as-is. Call Models (GET /v1/models) and check the voices array on the TTS entry for the exact ids and languages available per model.

response_formatstringOptional · default mp3

Requested audio container, e.g. "mp3", "wav", "opus" — passed through to the provider.

curl https://api.dravenai.lat/v1/audio/speech \
  -H "Authorization: Bearer sk-drv-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepgram/aura-2:free",
    "input": "Draven AI now supports text to speech.",
    "response_format": "mp3"
  }' \
  --output speech.mp3
response = client.audio.speech.create(
    model="deepgram/aura-2:free",
    input="Draven AI now supports text to speech.",
    response_format="mp3",
)
response.stream_to_file("speech.mp3")
const response = await client.audio.speech.create({
  model: "deepgram/aura-2:free",
  input: "Draven AI now supports text to speech.",
  response_format: "mp3",
});
const buffer = Buffer.from(await response.arrayBuffer());
fs.writeFileSync("speech.mp3", buffer);

Response

On success, the response body is the audio file itself (binary, Content-Type: audio/mpeg or similar) — not a JSON envelope. Pricing/usage info comes back in headers instead:

HeaderMeaning
X-Draven-ModelModel id that was used.
X-Draven-CharactersCharacter count of the input actually sent.
X-Draven-Usd-Per-McharPrice per 1M characters for this model (0 for free models).
X-Draven-Cost-UsdReal cost of this request in USD.
X-Draven-Credits-UsedFree-tier credits consumed (only present on :free models).
deepgram/aura-2:free shares the same daily credit pool (10,000 credits/day) as free chat models — see the Free Plan page.

For error responses, see Errors. To generate spoken audio inside a chat conversation (e.g. a model that talks back), see Chat Completions — audio-capable chat models like openai/gpt-audio-mini and the dedicated /v1/audio/generations endpoint work differently from this one.