Audio

Three endpoints in OpenAI's shape. The model is <provider>/<model>, for example openai/tts-1, openai/whisper-1 or openrouter/openai/whisper-large-v3-turbo.

EndpointUnitProviders
POST /v1/audio/speech1,000 input charactersopenai, openrouter, together, nanogpt, pollinations
POST /v1/audio/transcriptionsminute of audioopenai, groq, openrouter
POST /v1/audio/translationsminute of audioopenai, groq
cURLcurl
1curl https://api.aile.sh/v1/audio/speech \
2-H "Authorization: Bearer $AILE_KEY" \
3-H "Content-Type: application/json" \
4-d '{ "model": "openai/tts-1", "voice": "alloy", "input": "Hello from Aile." }' \
5--output hello.mp3
6
7curl https://api.aile.sh/v1/audio/transcriptions \
8-H "Authorization: Bearer $AILE_KEY" \
9-F model=openai/whisper-1 \

Speech

  • input is up to 4,096 characters.
  • stream_format: "audio" streams the audio as it is made. stream_format: "sse" answers one speech.audio.delta and a speech.audio.done once the audio is finished.
  • stream: true is a 400. Use stream_format.
  • OpenRouter speech models take response_format mp3 (the default) or pcm.

Transcription and translation

  • Upload is multipart/form-data, up to 25 MB. OpenRouter's JSON body (input_audio: { data, format }) is accepted too.
  • response_format is json (the default), text, verbose_json, srt or vtt. A model that returns only json still answers verbose_json, with no segments, and refuses timestamp_granularities[]=word.
  • stream: true returns the finished transcript as transcript.text.delta and transcript.text.done events.
  • A JSON answer's usage is { "type": "duration", "seconds": … }, the reported length.

Billing

  • Speech bills its input characters. A stream is billed in full once any audio reaches you, and not at all if the provider fails mid-stream.
  • Transcription holds an estimate from the upload's size and bills the duration the provider reports, up to the hold.
  • A response with no audio, or a transcript with no duration, is a 502 and is not charged.
  • A call with no answer by the deployment's buffered deadline (at most 120 seconds) is voided with a 504. For transcription, the upload's time counts.
  • A 502 or 504 arrives as 503 with the real code in x-aile-status.
  • A provider refusal you can fix (400, 404, 413, 422 …) passes through. One about the lender's account is a 502 saying you were not charged.
  • A key's pins and the routing headers choose the lender here too. x-aile-provider must match the model's prefix, and x-aile-max-price does not apply to a per-character or per-minute price.
  • Where the deployment enables it, speech also takes keyless x402, buffered only (stream_format: "audio" needs a key). Transcription and translation need an API key.
  • Audio is sent to the provider as uploaded. Aile does not inspect it.