Images, speech and video
Generate and edit images, text to speech, transcription, translation and video, billed per unit.
Five endpoints generate media rather than read it. They bill per unit, per image, per character, per minute of audio, per video, instead of per token, at the unit price shown in the catalog. As with tokens, nothing is added per request; our fee is charged when you buy credits. Media models never appear in GET /models; GET /api/v1/media/models lists them with their kind (image, tts, stt, translate, video). Responses use the { "ok": true, "data": ... } envelope, and every call reports its billed cost. A failed generation bills nothing.
curl https://rapidrouter.ai/api/v1/images/generations \
-H "Authorization: Bearer $RAPIDROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-2.5-flash-image",
"prompt": "a watercolour hornbill",
"n": 2
}'
# -> { "ok": true, "data": { "created": 1756...,
# "model": "google/gemini-2.5-flash-image",
# "data": [{ "b64_json": "..." }, { "b64_json": "..." }],
# "cost": 0.0832 } }
# n is 1 to 4; you are billed per image actually returned.Voices
Each speech family has its own voice names; send voice to pick one, or send none and the model's default is used (ritu for Sarvam, alloy for openai/tts-1, tara for Orpheus, af_bella for Kokoro). Sarvam also takes language, defaulting to hi-IN.
Transcription billing
Duration-priced models bill the minutes the provider reports; when no duration comes back, the WAV header is read, and an unreadable header bills one full minute, never less. sarvam/saarika-v2 bills a flat price per request instead.
Video billing
Flat per video, debited when the render starts, because the provider commits the cost at that point. Duration and resolution are pinned per model so the flat price is exact; polling is free. An unknown model answers 404, a disconnected provider 503, and an upstream failure 502 with nothing billed.