Speech synthesis, transcription and music generation

One key and OpenAI-compatible requests: text in, an audio file out; a recording in, a transcript out; a description in, a finished track out. Parameters, examples in three languages and the billing rules are collected here.

Endpoints and authentication

Audio lives on the OpenAI-compatible entry point and uses the same key as text models: only the path changes. Text to speech (TTS) turns text into a file, speech to text (STT) turns a recording into text, and music generation creates a track from a description.

MethodPathPurpose
POSThttps://api.tokenator.top/v1/audio/speechText to speech: JSON with text in, an audio file out.
POST/v1/audio/transcriptionsSpeech to text: a file in multipart/form-data, text or JSON out.
POST/v1/audio/translationsLike transcription, with the transcript translated where the model supports it.
POST/v1/audio/generationsMusic generation: a description in, a finished track out.
GET/v1/audio/models?task=tts|stt|musicThe catalog of audio models available to this key, with voices, formats and pricing.

The key goes in Authorization: Bearer sk-your-tokenator-key. Audio models are absent from /v1/models, and chat endpoints refuse them — they have a catalog of their own.

Your first request

Synthesizing speech
curl https://api.tokenator.top/v1/audio/speech \
  -H "Authorization: Bearer sk-your-tokenator-key" \
  -H "Content-Type: application/json" \
  --output speech.wav \
  -d '{
  "input": "Hello!",
  "model": "gemini-3.8-flash-tts",
  "response_format": "wav",
  "voice": "Zephyr"
}'

A successful answer is the audio file itself, not JSON: --output speech.mp3 saves it to disk. The X-Tokenator-Input-Tokens, X-Tokenator-Output-Tokens and X-Tokenator-Total-Tokens headers carry the request's tokens, which token billing is based on.

Which models handle audio

ModelAPI IDTaskVoicesFormatsBilling
Gemini 3.8 Flash TTSgemini-3.8-flash-ttsText to speechZephyr, Puck, Charon, Kore, Fenrir, Leda, Orus, Aoede, Callirrhoe, Autonoe, Enceladus, Iapetus, Umbriel, Algieba, Despina, Erinome, Algenib, Rasalgethi, Laomedeia, Achernar, Alnilam, Schedar, Gacrux, Pulcherrima, Achird, Zubenelgenubi, Vindemiatrix, Sadachbia, Sadaltager, Sulafatwav, mp3, flac, pcmPer token
Gemini 3.8 Flash Lite TTSgemini-3.8-flash-lite-ttsText to speechZephyr, Puck, Charon, Kore, Fenrir, Leda, Orus, Aoede, Callirrhoe, Autonoe, Enceladus, Iapetus, Umbriel, Algieba, Despina, Erinome, Algenib, Rasalgethi, Laomedeia, Achernar, Alnilam, Schedar, Gacrux, Pulcherrima, Achird, Zubenelgenubi, Vindemiatrix, Sadachbia, Sadaltager, Sulafat.wav, mp3, flac, pcmPer token
Gemini 3.5 Transcribegemini-3.5-transcribeSpeech to text—jsonPer token
Lyria 3 Clip Previewlyria-3-clip-previewMusic generation—mp3, wavPer generation
Lyria 3 Pro Previewlyria-3-pro-previewMusic generation—mp3, wavPer generation
Grok STT 1.0grok-stt-1.0Speech to text—jsonPer token
MAI-Transcribe 2mai-transcribe-2Speech to text—jsonPer audio second
Nemotron 3.5 Transcribenemotron-3.5-transcribeSpeech to text—jsonPer audio second
Grok STT 2.0grok-stt-2.0Speech to text—jsonPer audio second

The API returns the same list — with the task, voices, formats and pricing of every model. That is safer than hard-coding values: the list changes together with the catalog.

The audio model catalog
curl "https://api.tokenator.top/v1/audio/models?task=tts" \
  -H "Authorization: Bearer sk-your-tokenator-key"
Response
{
  "object": "list",
  "data": [
    {
      "id": "gemini-3.8-flash-tts",
      "object": "audio_model",
      "audio_options": {
        "task": "tts",
        "voices": ["Kore", "Puck"],
        "default_voice": "Kore",
        "formats": ["mp3", "wav"],
        "default_format": "mp3",
        "billing_unit": "characters",
        "tokens_per_million": 120
      }
    }
  ]
}

Text to speech

FieldTypeWhat it does
modelstring, requiredThe API ID of a TTS model from /v1/audio/models?task=tts.
inputstring, requiredThe text to speak. An empty string is refused with a 400.
voicestringA voice from voices. When omitted, default_voice is used; a model without one requires the field. A voice outside the list gets a 400 that lists the allowed ones.
response_formatstringThe file format from formats: mp3, wav or others the model declares. Defaults to default_format.
speed, instructions, language, sample_rateper modelPassed to the provider as they are: pace, speaking style, language, sample rate. The effect depends on the model.
Python — requests
import requests

response = requests.post(
    "https://api.tokenator.top/v1/audio/speech",
    headers={"Authorization": "Bearer sk-your-tokenator-key"},
    json={"model": "gemini-3.8-flash-tts", "input": "Hello! This is a speech synthesis check.", "voice": "Zephyr", "response_format": "mp3"},
    timeout=300,
)
response.raise_for_status()
with open("speech.mp3", "wb") as f:
    f.write(response.content)
Python — openai
from openai import OpenAI

client = OpenAI(api_key="sk-your-tokenator-key", base_url="https://api.tokenator.top/v1", timeout=300)

with client.audio.speech.with_streaming_response.create(
    model="gemini-3.8-flash-tts",
    voice="Zephyr",
    input="Hello! This is a speech synthesis check.",
    response_format="mp3",
) as response:
    response.stream_to_file("speech.mp3")
Node.js — fetch
import { writeFile } from "node:fs/promises"

const response = await fetch("https://api.tokenator.top/v1/audio/speech", {
  method: "POST",
  headers: {
    Authorization: "Bearer sk-your-tokenator-key",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ model: "gemini-3.8-flash-tts", input: "Hello! This is a speech synthesis check.", voice: "Zephyr" }),
  signal: AbortSignal.timeout(300_000),
})
if (!response.ok) throw new Error(await response.text())
await writeFile("speech.mp3", Buffer.from(await response.arrayBuffer()))

There is no streamed answer: the file arrives whole, and a request with stream: true or stream_format: "sse" gets a 400.

Speech to text

FieldTypeWhat it does
modelstring, requiredThe API ID of an STT model from /v1/audio/models?task=stt.
filefile, requiredOne non-empty audio file up to 25 MB — the file itself, not a link.
response_formatstringjson (default) — an object with a text field; text — plain text; verbose_json — JSON with extra fields when the model returns them.
language, prompt, temperatureper modelThe recording language, a hint with terms, the temperature — passed to the provider as they are.
curl
curl https://api.tokenator.top/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-your-tokenator-key" \
  -F 'model=gemini-3.5-transcribe' \
  -F 'file=@recording.wav' \
  -F 'response_format=json'
Response
{
  "text": "Hello! This is a transcription check.",
  "usage": { "prompt_tokens": 96, "completion_tokens": 9, "total_tokens": 105 }
}
Python — openai
from openai import OpenAI

client = OpenAI(api_key="sk-your-tokenator-key", base_url="https://api.tokenator.top/v1", timeout=300)

with open("recording.wav", "rb") as audio:
    result = client.audio.transcriptions.create(
        model="gemini-3.5-transcribe",
        file=audio,
        response_format="json",
    )

print(result.text)

Do not set Content-Type by hand: the client adds the multipart boundary itself. The proxy adds a usage field with the request's tokens to the JSON answer. An empty transcript is a valid answer when the recording holds no speech.

Music generation

FieldTypeWhat it does
modelstring, requiredThe API ID of a music model from /v1/audio/models?task=music.
promptstring, requiredGenre, mood, instruments, tempo — whatever describes the track. Up to 10,000 characters.
lyricsstringThe lyrics, when the model sings. Up to 10,000 characters; not accepted together with instrumental: true.
instrumentalbooleantrue — music without vocals.
durationnumber, secondsThe target length, above 0 and up to 600. It is a hint to the model: short-clip models always produce a clip of their own length.
response_formatstringThe file format from the model's formats.
seedintegerA generation seed from 0 to 2,147,483,647, when the model supports it.
temperature, top_pnumbertemperature from 0 to 2, top_p from 0 to 1.
max_tokensintegerFrom 1 to 1,000,000.
userstringYour end-user identifier, up to 256 characters.
n, streaminteger, booleanOnly n: 1 and stream: false — one request makes one finished file.

No other fields are accepted: a request with an unknown field gets a 400 listing the supported ones, before the model is called and without a charge. The Content-Type of the answer names the file's real format: if the model returned a different format from the one requested, it shows there.

curl
curl https://api.tokenator.top/v1/audio/generations \
  -H "Authorization: Bearer sk-your-tokenator-key" \
  -H "Content-Type: application/json" \
  --output music.mp3 \
  -d '{
    "model": "lyria-3-clip-preview",
    "prompt": "a calm piano melody with a warm mood",
    "instrumental": true,
    "duration": 30
  }'
Python — requests
import requests

response = requests.post(
    "https://api.tokenator.top/v1/audio/generations",
    headers={"Authorization": "Bearer sk-your-tokenator-key"},
    json={"model": "lyria-3-clip-preview", "prompt": "a calm piano melody with a warm mood", "instrumental": True, "duration": 30},
    timeout=600,
)
response.raise_for_status()
with open("music.mp3", "wb") as f:
    f.write(response.content)

One request, one track; the answer is a finished file up to 64 MB. Generation can take several minutes: keep the client timeout at 10 minutes or more and do not retry on timeout — a repeat request starts a second generation.

How audio is billed

Audio spends the key's regular token balance — there are no separate bundles. The billing method is set per provider of the model and shown in the catalog's Billing column:

  • Per token — (input tokens × multiplier) + (output tokens × multiplier), like text models. When the provider reports no tokens, they are estimated from the text and audio length.
  • Per character or per UTF-8 byte — characters (bytes) of text × price per million / 1,000,000 × multiplier. Spaces count.
  • Per audio second — for transcription: recording length × price per second × multiplier.
  • Per generation — for music: a fixed price per successful track × multiplier.

The total is rounded up to a whole token, at least 1. A failed request costs nothing. When a request falls over to a backup provider, that provider's method applies.

Remaining tokens
curl https://api.tokenator.top/v1/tokens \
  -H "Authorization: Bearer sk-your-tokenator-key"

Limits

  • Transcription: one non-empty file up to 25 MB per request.
  • Music: one track per request, a file up to 64 MB.
  • Synthesis and music answer with a finished file — there is no SSE stream.
  • The voice and format must be in the model's lists; otherwise a 400 before the provider is contacted.
  • Each model does one task: TTS, STT or music. A request to the wrong endpoint gets a 400.

Errors

SymptomCauseFix
400 model and non-empty input are requiredThe synthesis request has no model or text, or the body is not JSON.Send Content-Type: application/json, model and a non-empty input.
400 This model is not a TTS model / not an STT modelA model of another task, for example an STT model sent to synthesis.Pick a model with the right task from /v1/audio/models?task=….
400 Unsupported voice / Unsupported response_formatThe voice or format is not in the model's list.The message lists the allowed values; the catalog's audio_options returns the same.
400 SSE is not supportedA streamed synthesis response was requested.Drop stream and stream_format: the answer is one file.
400 one non-empty audio file is requiredTranscription got no file, several files or an empty one.Send exactly one file in the file field of a multipart/form-data form.
400 Cannot determine the uploaded audio durationThe model is billed per audio second and the file's duration cannot be read.Send WAV, MP3, FLAC, OGG or WebM with valid duration metadata.
413 Audio file is larger than 25 MBThe file for transcription is over 25 MB.Split the recording and send the parts as separate requests.
429The key has run out of its limit, or the request rate is exceeded.The balance is in /v1/tokens; top up in your account.
400 Unsupported field … for music generationThe music request carries a field the endpoint does not know, or lyrics together with instrumental: true.Keep only the fields from the parameter table; drop instrumental for a song and lyrics for an instrumental.
400 Sensitive words detectedThe model refused the request because of its content. Nothing is charged.Rephrase the description: for example, do not name real artists or protected works.
503 Provider errorThe provider failed or returned a broken file. Its text is not passed to the client, and nothing is charged.Retry — Tokenator fails over to the model's next provider on its own. If it persists, contact support.

FAQ

Do I need a separate key for audio?

No. The same key as for chat works, with access to the chosen audio model. Only the request path changes.

What is the difference between TTS and STT?

TTS speaks text: JSON to /v1/audio/speech, an audio file back. STT transcribes a recording: a file to /v1/audio/transcriptions, text back.

Why is the model absent from /v1/models?

Audio models have a separate catalog: GET /v1/audio/models. ?task=tts selects synthesis, ?task=stt transcription, ?task=music music.

How do I choose a voice and format?

Check the model's audio_options: voices, formats, default_voice and default_format. Pass the voice in voice and the format in response_format.

Why can't I read a synthesis answer as JSON?

A successful answer is a binary file. Use --output speech.mp3 with curl, or write response.content to a file in wb mode in Python.

What about a recording over 25 MB?

Split it and transcribe the parts as separate requests — say, ten minutes each.

Are tokens charged when a request fails?

No. A provider error, a refused parameter or a timeout costs nothing.

Why did transcription return empty text?

It happens when the model finds no speech in the recording. Check that the voice is audible, the language is right and the model supports the file format.