OpenAI compatibility

Create speech

Generates audio from text with POST /v1/audio/speech.

Same request as OpenAI's speech endpoint. The response body is the audio file, with its Content-Type. It is billed like POST /v1/text-to-speech with the same model. The job id is in the X-Pascal-Job-Id header.

Request parameters

FieldTypeDescription
modelRequiredstringA Pascal text-to-speech model id from GET /v1/audio/models, for example kokoro, gemini-3.8-flash-tts, deepgram-aura-2, or sarvam-bulbul-v3. OpenAI names such as tts-1 return 400.
inputRequiredstringThe text to speak. The length limit is the model’s own.
voicestringOne of the model’s voices, from GET /v1/audio/voices?model=... (af_heart on Kokoro, Kore on Gemini, aura-2-asteria-en on Deepgram, priya on Sarvam). Omit it for the model default. A voice the model does not have returns 400 invalid_voice with the list.
response_format
Default mp3
stringmp3, opus (in Ogg), aac, flac, wav, or pcm (raw 24 kHz 16-bit mono, as OpenAI sends it).
speed
Default 1.0
number0.25 to 4.0. Used on models with a speed setting (Kokoro, Gemini, Google, Sarvam pace). Each model may accept a narrower range.
instructionsstringHow to speak. Used by qwen3-tts-1.7b. Other models ignore it.

Code examples

curl https://api.pascalai.co/v1/audio/speech \
  -H "Authorization: Bearer $PASCAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kokoro",
    "input": "Hello world from Pascal AI!",
    "voice": "af_heart",
    "response_format": "mp3"
  }' \
  --output speech.mp3