Docs
Audio
Text to speech (an audio file back) and speech to text (a multipart upload).
Text to speech
POST
https://iranrouter.com/v1/audio/speechbash
curl https://iranrouter.com/v1/audio/speech \
-H "Authorization: Bearer ir-..." \
-H "Content-Type: application/json" \
-d '{"model": "openai/tts-1", "input": "سلام، این یک تست است", "voice": "alloy"}' \
--output out.mp3The response is an audio file, not JSON, so the cost and request id arrive as headers:
x-cost-rial and x-request-id. You are billed for the text you sent, because a TTS response carries no usage of its own.Speech to text
POST
https://iranrouter.com/v1/audio/transcriptionsPOST
https://iranrouter.com/v1/audio/translationsbash
curl https://iranrouter.com/v1/audio/transcriptions \
-H "Authorization: Bearer ir-..." \
-F file=@voice.mp3 \
-F model=openai/whisper-1 \
-F language=fa- The request is
multipart/form-data, and your file reaches the provider untouched — only the model name is rewritten to the one the provider knows. - The model field is required — a 400 otherwise — and must come before the file in the form, which is what every SDK does.
- The wallet hold is estimated from the file size and settled against the real duration once the provider answers.
Both surfaces honour Idempotency-Key — see the note on Embeddings.