Example Usage
import { STTRequest } from "@openrouter/sdk/models";
let value: STTRequest = {
inputAudio: {
data: "UklGRiQA...",
format: "wav",
},
model: "openai/whisper-large-v3",
};
Fields
| Field | Type | Required | Description | Example |
|---|---|---|---|---|
inputAudio | models.STTInputAudio | :heavy_check_mark: | Base64-encoded audio to transcribe | { “data”: “UklGRiQA…”, “format”: “wav” } |
language | string | :heavy_minus_sign: | ISO-639-1 language code (e.g., “en”, “ja”). Auto-detected if omitted. | en |
model | string | :heavy_check_mark: | STT model identifier | openai/whisper-large-v3 |
provider | models.STTRequestProvider | :heavy_minus_sign: | Provider-specific passthrough configuration | |
responseFormat | models.STTRequestResponseFormat | :heavy_minus_sign: | Output format. “json” (default) returns { text, usage }. “verbose_json” additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. | json |
sessionId | string | :heavy_minus_sign: | 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. | session-1234 |
temperature | number | :heavy_minus_sign: | Sampling temperature for transcription | 0 |
timestampGranularities | models.STTTimestampGranularity[] | :heavy_minus_sign: | 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”. | [ “segment” ] |
trace | models.TraceConfig | :heavy_minus_sign: | 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. | { “trace_id”: “trace-abc123”, “trace_name”: “my-app-trace” } |
user | string | :heavy_minus_sign: | A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider. | user-1234 |