Skip navigation
Contents

API

Speech & transcription

Text to speech (POST /v1/audio/speech) and speech to text (POST /v1/audio/transcriptions), compatible with the OpenAI audio API. They share the wallet, API keys and rate limits with chat.

Text to speech#

Use a model of type Speech (see the pricing table). The response body is the audio file itself, not JSON.

Create speech
curl https://<host>/v1/audio/speech \
  -H "Authorization: Bearer sk-runtide-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "hexgrad/Kokoro-82M",
    "input": "Xin chào, đây là Runtide.",
    "voice": "af_bella",
    "response_format": "mp3"
  }' \
  --output hello.mp3
  • model
    Rule
    Required. A speech model.
  • input
    Rule
    Required. The text, at most 20,000 characters.
  • voice
    Rule
    Voice name; the available voices depend on the model.
  • response_format
    Rule
    mp3 (default), opus, aac, flac, wav or pcm.
  • speed
    Rule
    Optional number from 0.25 to 4.0.

Speech to text#

Use a model of type Transcription. Send the audio as multipart/form-data (the OpenAI SDKs do this for you).

Transcribe a file
curl https://<host>/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-runtide-YOUR_API_KEY" \
  -F model="openai/whisper-large-v3" \
  -F file=@meeting.mp3 \
  -F response_format=json
Response (response_format=json)
{
  "text": "Xin chào mọi người, hôm nay chúng ta bàn về kế hoạch quý bốn."
}
  • model
    Rule
    Required. A transcription model.
  • file
    Rule
    Required. mp3, mp4, m4a, wav, flac or ogg, at most 25 MB and 4 hours. The duration is read from the file header; unreadable files are rejected with 400.
  • response_format
    Rule
    json (default), text, srt, verbose_json or vtt.
  • language, prompt, temperature
    Rule
    Optional; passed to the model when it supports them.

Billing#

  • Speech is billed per input character (USD / 1M characters), counted exactly before the call.
  • Transcription is billed per second of audio, rounded up (shown as USD per minute), using the duration read from the file.
  • The exact amount is held before the call; not enough balance → 402 insufficient_balance and nothing is sent upstream.
  • Provider errors are not billed. General details: Billing.

Common errors#

400 model_type_mismatch
HTTP/1.1 400 Bad Request

{"error": {"message": "The model `gpt-4o-mini` is a chat model; use /v1/chat/completions instead.",
           "type": "invalid_request_error", "code": "model_type_mismatch"}}
  • 400 model_type_mismatch
    Cause
    The model is of another type (e.g. a chat model on /v1/audio/speech). The message names the correct endpoint.
  • 400 invalid_request
    Cause
    input empty or too long, bad response_format or speed, missing / unreadable / too long audio file.
  • 404 model_not_found
    Cause
    Unknown model name, or the model is disabled.
  • 402 insufficient_balance
    Cause
    Not enough balance for the hold — top up or send less.

All error codes: Error codes. A file above 25 MB is rejected with 413 request_too_large.