From cc815afe701e91a8317c18355d422ec2126aed24 Mon Sep 17 00:00:00 2001 From: OpenRouter SDK Bot Date: Thu, 3 Dec 2026 20:28:41 +0000 Subject: [PATCH] chore: update OpenAPI spec [sdk-bot] --- .speakeasy/in.openapi.yaml | 151 ++++++++++++++++++++++++++++++++++++- 1 file changed, 147 insertions(+), 4 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 4b3c2294..efd49ed9 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -1,5 +1,18 @@ components: parameters: {} + responses: + SpeechTimedAudio: + content: + application/json: + schema: + $ref: '#/components/schemas/SpeechTimedAudioResponse' + description: 'Speech request with `timestamp_granularities`: base64 audio plus the requested timings.' + SpeechTimedUrl: + content: + application/json: + schema: + $ref: '#/components/schemas/SpeechTimedUrlResponse' + description: 'Speech request with `timestamp_granularities` and `output_delivery: url`: the signed download URL plus the requested timings.' schemas: AABenchmarkEntry: description: 'Benchmark index scores published by Artificial Analysis (artificialanalysis.ai), one field per index. Each score is the model''s best on that index across the configurations Artificial Analysis evaluated (for example reasoning levels), so two indexes of one model can come from different configurations. The deprecated Coding Index and Agentic Index fields are null for every model: Artificial Analysis has retired those indexes. Attribute Artificial Analysis when you republish them. Omitted when Artificial Analysis has scored the model on none of them.' @@ -19157,7 +19170,7 @@ components: - 'string' - 'null' guardrail_id: - description: 'ID of the budget that applies at this layer: a guardrail policy ID (look it up with `GET /api/v1/guardrails/policies`) or, for accounts still on v1 guardrails, a guardrail ID. Null for the `workspace` and `key_limit` scopes.' + description: 'ID of the guardrail policy whose budget applies at this layer. A budget still managed through v1 guardrails reports its synced policy ID, not its guardrail ID. Null for the `workspace` and `key_limit` scopes. Look up a policy ID with a management key that has guardrail read access (for a Custom key, select the `guardrails:read` grant): `GET /api/v1/guardrails/policies/budget/{id}` (an organization-wide key must add `?workspace_id=`, for example the `workspace_id` this endpoint returns), or find an account-level policy in `GET /api/v1/guardrails/policies/account` (organization-wide key only). A workspace-scoped key can read only policies its workspace owns, so it gets 404 for an account-level policy, such as an inherited account default or a policy synced from a v1 guardrail assigned only to members or API keys; look those up with an organization-wide key and `?workspace_id=`. Policies synced from v1 guardrails assigned only to members or API keys can be missing from the account-level list.' example: '0df9e665-d932-5740-b2c7-b52af166bc11' type: - 'string' @@ -35126,7 +35139,7 @@ components: - 'policy_type' type: 'object' ScimGroupPolicyAssignment: - description: 'Guardrail policy attached to a SCIM group mapping for each policy type, or `null` when none. Members receive the group policy unless they have a manual assignment or opted out; when a member is in several mapped groups, the least restrictive policy of each type applies. `rate_limit` is `null` unless capacity policies are enabled for the account (Enterprise-only feature with a custom plan).' + description: 'Guardrail policy attached to a SCIM group mapping for each policy type, or `null` when none. Members receive the group policy unless they have a manual assignment or opted out; when a member is in several mapped groups, the most restrictive policy of each type applies, and when policies cannot be ranked against each other (for example, a daily and a monthly budget), the policy from the newest mapping applies. `rate_limit` is `null` unless capacity policies are enabled for the account (Enterprise-only feature with a custom plan).' example: budget: '6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f' model_availability: null @@ -36522,7 +36535,7 @@ components: example: 'mistralai/voxtral-mini-tts-2603' type: 'string' output_delivery: - description: '`stream` (default) streams the audio bytes directly in the response body. `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type`. The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. Falls back to streaming raw audio bytes when a URL cannot be issued because zero-data-retention applies (account settings, guardrails, `provider.zdr`, or a ZDR endpoint) or the request has no workspace.' + description: '`stream` (default) streams the audio bytes directly in the response body (or returns inline base64 JSON when `timestamp_granularities` is nonempty). `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type` (plus `words` and/or `characters` when `timestamp_granularities` is nonempty). The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. When a URL cannot be issued (zero-data-retention via account settings, guardrails, `provider.zdr`, or a ZDR endpoint; no workspace; or storage failure), untimed requests fall back to streaming raw audio bytes (except on a storage failure for responses larger than 10 MiB, which returns an error), and timed requests fall back to inline base64 JSON (`{audio, media_type, words?, characters?}`) with no `url`.' enum: - 'stream' - 'url' @@ -36611,6 +36624,16 @@ components: example: 1 format: 'double' type: 'number' + timestamp_granularities: + description: 'Timings to return with the audio. When nonempty, the response is JSON instead of raw audio bytes: `{audio, media_type, words?, characters?}` with base64 audio, or `{url, expires_at, media_type, words?, characters?}` when `output_delivery` is `url`. If a signed URL cannot be issued (ZDR, no workspace, or storage failure), timed `url` requests fall back to the inline `{audio, media_type, ...}` envelope with no `url`. Each timing entry is `{text, start, end}` in seconds. Only routed to endpoints that support every requested granularity (`supported_parameters.timestamp_granularities` on the speech models list). A timed response is sent once the whole audio is generated, not streamed, and is capped at 10 MiB of decoded audio for both inline and `url` delivery (the provider timed response, including its alignment data, is capped too); longer outputs return an error, so use a shorter input or a smaller audio format. Generated SDKs still type the 200 response as binary audio for compatibility; call the HTTP endpoint directly and parse the JSON response when using `timestamp_granularities`. An empty array is treated as no timings.' + example: + - 'word' + items: + enum: + - 'word' + - 'character' + type: 'string' + type: 'array' trace: $ref: '#/components/schemas/TraceConfig' user: @@ -36627,6 +36650,30 @@ components: - 'model' - 'input' type: 'object' + SpeechSignedUrlResponse: + description: 'JSON response containing a signed download URL for generated speech audio.' + example: + expires_at: 1748458800 + media_type: 'audio/mpeg' + url: 'https://openrouter.ai/api/v1/audio/speech/media/abcdefghijklmnopqrstuvwxyz0123456789abcdefg' + properties: + expires_at: + description: 'Unix timestamp (seconds) when the signed download URL expires.' + example: 1748458800 + type: 'integer' + media_type: + description: 'MIME type of the generated audio (for example `audio/mpeg` for mp3 or `audio/pcm;rate=24000;channels=1` for pcm).' + example: 'audio/mpeg' + type: 'string' + url: + description: 'Signed download URL for the generated audio, valid until `expires_at` (up to 24 hours).' + example: 'https://openrouter.ai/api/v1/audio/speech/media/abcdefghijklmnopqrstuvwxyz0123456789abcdefg' + type: 'string' + required: + - 'url' + - 'expires_at' + - 'media_type' + type: 'object' SpeechSupportedParameters: example: instructions: @@ -36640,6 +36687,11 @@ components: max: 4 min: 0.25 type: 'range' + timestamp_granularities: + type: 'enum' + values: + - 'word' + - 'character' voice: type: 'enum' values: @@ -36652,9 +36704,90 @@ components: $ref: '#/components/schemas/SpeechEnumParameter' speed: $ref: '#/components/schemas/SpeechRangeParameter' + timestamp_granularities: + allOf: + - $ref: '#/components/schemas/SpeechEnumParameter' + - description: 'The `timestamp_granularities` values the endpoint can return (`word`, `character`). Absent: timings are not supported.' voice: $ref: '#/components/schemas/SpeechVoiceParameter' type: 'object' + SpeechTimedAudioResponse: + description: 'JSON response for a request with `timestamp_granularities`: the audio as base64 plus the requested timings.' + example: + audio: 'SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjYw' + media_type: 'audio/mpeg' + words: + - end: 0.42 + start: 0 + text: 'Hello' + properties: + audio: + description: 'Base64-encoded audio in the format named by `media_type`.' + example: 'SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjYw' + type: 'string' + characters: + description: 'Character timings, present when `timestamp_granularities` includes `character`.' + items: + $ref: '#/components/schemas/SpeechTimestamp' + type: 'array' + media_type: + description: 'MIME type of the generated audio (for example `audio/mpeg` for mp3 or `audio/pcm;rate=24000;channels=1` for pcm).' + example: 'audio/mpeg' + type: 'string' + words: + description: 'Word timings, present when `timestamp_granularities` includes `word`. Grouped from character timings by splitting on whitespace, so unspaced scripts (such as Japanese or Chinese) may return one span per unspaced run.' + items: + $ref: '#/components/schemas/SpeechTimestamp' + type: 'array' + required: + - 'audio' + - 'media_type' + type: 'object' + SpeechTimedUrlResponse: + allOf: + - $ref: '#/components/schemas/SpeechSignedUrlResponse' + - properties: + characters: + description: 'Character timings, present when `timestamp_granularities` includes `character`.' + items: + $ref: '#/components/schemas/SpeechTimestamp' + type: 'array' + words: + description: 'Word timings, present when `timestamp_granularities` includes `word`. Grouped from character timings by splitting on whitespace, so unspaced scripts (such as Japanese or Chinese) may return one span per unspaced run.' + items: + $ref: '#/components/schemas/SpeechTimestamp' + type: 'array' + type: 'object' + description: 'Signed download URL response for a request with `timestamp_granularities`, plus the requested timings.' + example: + characters: + - end: 0.064 + start: 0 + text: 'H' + expires_at: 1748458800 + media_type: 'audio/mpeg' + url: 'https://openrouter.ai/api/v1/audio/speech/media/abcdefghijklmnopqrstuvwxyz0123456789abcdefg' + SpeechTimestamp: + properties: + end: + description: 'End time in seconds from the beginning of the audio' + example: 0.42 + format: 'double' + type: 'number' + start: + description: 'Start time in seconds from the beginning of the audio' + example: 0 + format: 'double' + type: 'number' + text: + description: 'The aligned input word or character (follows the input text, not normalized spoken text)' + example: 'Hello' + type: 'string' + required: + - 'text' + - 'start' + - 'end' + type: 'object' SpeechTurn: properties: instructions: @@ -43490,7 +43623,7 @@ paths: example: '' format: 'binary' type: 'string' - description: 'Raw audio bytes stream (`audio/*`) by default. When `output_delivery` is `"url"`, returns `application/json` with `{ url, expires_at, media_type }` (a 24-hour signed download URL) unless zero-data-retention or missing workspace causes fallback to raw audio streaming.' + description: 'Raw audio bytes stream (`audio/*`) by default. When `output_delivery` is `"url"`, returns `application/json` with `{ url, expires_at, media_type }` (a 24-hour signed download URL) unless zero-data-retention or missing workspace causes fallback to raw audio streaming. When `timestamp_granularities` is nonempty, always returns `application/json`: `{ audio, media_type }` with base64 audio (`SpeechTimedAudioResponse`), or `{ url, expires_at, media_type }` with URL delivery (`SpeechTimedUrlResponse`), each with the requested `words` and/or `characters` timings. A timed `url` request that cannot get a signed URL (zero-data-retention, missing workspace, or storage failure) returns the inline `{ audio, media_type }` envelope with no `url`.' '400': content: application/json: @@ -43591,6 +43724,16 @@ paths: schema: $ref: '#/components/schemas/ServiceUnavailableResponse' description: 'Service Unavailable - Service temporarily unavailable' + '504': + content: + application/json: + example: + error: + code: 504 + message: 'The operation was aborted due to timeout' + schema: + $ref: '#/components/schemas/GatewayTimeoutResponse' + description: 'Gateway Timeout - Provider did not respond before the upstream deadline' '524': content: application/json: