STT

Create transcription

Changed on

Transcribes audio into text. Accepts base64-encoded audio input as JSON, an OpenAI-style multipart/form-data file upload, or a URL the provider downloads directly, and returns the transcribed text.

post/audio/transcriptions

Request

  • Base URL
    https://openrouter.ai/api/v1
  • Auth
    HTTP bearer

Request body

STTRequest required

Speech-to-text request input. Accepts a JSON body with input_audio containing base64-encoded audio or a URL the provider downloads.

diarize, boolean

Label each word with the speaker who said it. Speaker labels are returned on the words array (speaker, speaker_label), so response_format must be "verbose_json" (a "json" request is rejected with a 400) and word timestamps are included even when timestamp_granularities omits "word". Only supported by some providers; the request is rejected with a 400 when the selected model cannot diarize. Providers may charge extra.

input_audio, union required

Audio to transcribe: inline base64 bytes, or a URL the provider downloads directly.

keyterms, string[]

Domain terms, names, or phrases to bias recognition toward. Only supported by some providers; the request is rejected with a 400 when the selected model cannot use keyterms. Providers may cap the number of terms or characters per term and may charge extra.

language, string

ISO-639-1 language code (e.g., "en", "ja"). Auto-detected if omitted.

model, string required

STT model identifier

prompt, string

Context to guide transcription, such as domain vocabulary or a previous segment. Honored by OpenAI (except gpt-4o-transcribe-diarize), Azure OpenAI, Groq, Together, Alibaba, and AssemblyAI endpoints with prompted pricing configured. Other providers ignore it; use keyterms for supported keyword boosting. Takes precedence over provider-specific prompt options, including when empty.

provider, object

Provider configuration: provider routing preferences (order, only, ignore, allow_fallbacks), data policy routing preferences (zdr, data_collection) and provider-specific passthrough options

response_format, 'json' | 'verbose_json'

Output format. "json" (default) returns { text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.

session_id, string

A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.

temperature, number double

Sampling temperature for transcription

timestamp_granularities, STTTimestampGranularity[]

Timestamp detail levels to include when response_format is "verbose_json". "segment" returns segment-level timestamps; "word" additionally returns word-level timestamps in the words array. Ignored unless response_format is "verbose_json".

trace, TraceConfig

Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.

user, string

A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider.

Example request

{
  "input_audio": {
    "data": "UklGRiQA...",
    "format": "wav"
  },
  "language": "en",
  "model": "openai/whisper-large-v3"
}

Response

Transcription result

STTResponse required

STT response containing transcribed text and optional usage statistics

confidence, number double

Provider confidence for the whole transcript from 0 to 1, present when response_format is verbose_json and the provider scores the full transcript

duration, number double

Duration of the input audio in seconds, present when response_format is verbose_json

entities, STTEntity[]

Detected entities with character offsets into text, present when the provider runs entity detection

language, string

Detected or forced language, present when response_format is verbose_json

language_confidence, number double

Provider confidence in the detected language from 0 to 1, present when response_format is verbose_json and the provider scores language detection

segments, STTSegment[]

Timestamped transcript segments, present when response_format is verbose_json

task, string

The task performed, present when response_format is verbose_json

text, string required

The transcribed text

usage, STTUsage

Aggregated usage statistics for the request

words, STTWord[]

Timestamped words, present when the provider returns word-level timestamps

Example response

{
  "text": "Hello, this is a test of OpenAI speech-to-text transcription.",
  "usage": {
    "cost": 0.000508,
    "input_tokens": 83,
    "output_tokens": 30,
    "seconds": 9.2,
    "total_tokens": 113
  }
}

Changes

    • info

      added the new optional request property provider/options/celeris

    • info

      added the new Celeris enum value to the request property provider/ignore/items/anyOf[#/components/schemas/ProviderName]

    • info

      added the new Celeris enum value to the request property provider/only/items/anyOf[#/components/schemas/ProviderName]

    1 more change in this revision