diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 9e85ddb83..282e41fa0 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: "" id: "" management: - docChecksum: ee22093311cc0f37ed22037cfb77fcf3 + docChecksum: 0398b8e6329ef1de43f607a43c3279a7 docVersion: 1.0.0 speakeasyVersion: 1.808.1 generationVersion: 2.960.8 - releaseVersion: 1.5.179 - configChecksum: 1b7d457d4b504d3af05b2ade3c4b4e4b + releaseVersion: 1.5.180 + configChecksum: 155fe12ade558f31fea82c0c6b0bcf90 repoURL: https://github.com/OpenRouterTeam/typescript-sdk.git installationURL: https://github.com/OpenRouterTeam/typescript-sdk published: true @@ -24220,4 +24220,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Typescript SDK Changes:\n* `openrouter.tts.createSpeech()`: \n * `request.speechRequest.streamFormat` **Added**\n* `openrouter.tts.listModels()`: `response.data[].endpoints[].outputModalities[].supportedParameters.streamFormat` **Added**\n* `openrouter.tts.getModel()`: `response.endpoints[].outputModalities[].supportedParameters.streamFormat` **Added**\n" +releaseNotes: "## Typescript SDK Changes:\n* `openrouter.tts.createSpeech()`: \n * `request.speechRequest.separateTracks` **Added**\n* `openrouter.tts.listModels()`: `response.data[].endpoints[].outputModalities[].supportedParameters.separateTracks` **Added**\n* `openrouter.tts.getModel()`: `response.endpoints[].outputModalities[].supportedParameters.separateTracks` **Added**\n* `openrouter.images.listModels()`: `response.data[].supportedParameters.Map.union(range)` **Changed**\n* `openrouter.images.listModelEndpoints()`: `response.endpoints[].supportedParameters.Map.union(range)` **Changed**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index a2a8462c5..531309b4a 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -38,7 +38,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true typescript: - version: 1.5.179 + version: 1.5.180 acceptHeaderEnum: false additionalDependencies: dependencies: diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 2a4231f61..016a6f197 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -25,6 +25,12 @@ components: description: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings. responses: + SpeechSeparatedTracks: + content: + application/json: + schema: + $ref: '#/components/schemas/SpeechSeparatedTracksResponse' + description: 'Speech request with `separate_tracks`: one entry per separated track, each with base64 audio or a signed download URL.' SpeechTimedAudio: content: application/json: @@ -34211,9 +34217,15 @@ components: max: format: 'double' type: 'number' + max_pixels: + description: '`input_references` only: largest accepted pixel count (width x height) of each reference image. Absent when none is declared.' + type: 'integer' min: format: 'double' type: 'number' + min_edge: + description: '`input_references` only: smallest accepted shorter side of each reference image, in pixels. Absent when none is declared.' + type: 'integer' type: enum: - 'range' @@ -36525,6 +36537,82 @@ components: oneOf: - $ref: '#/components/schemas/ContainerAutoEnvironment' - $ref: '#/components/schemas/ContainerReferenceEnvironment' + SpeechAudioTrack: + description: 'One separated track with its audio as base64.' + example: + audio: 'SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjYw' + description: 'all speech' + media_type: 'audio/mpeg' + type: 'speaker' + properties: + audio: + description: 'Base64-encoded audio in the format named by `media_type`.' + example: 'SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjYw' + type: 'string' + description: + description: 'The provider''s short description of the track.' + example: 'all speech' + type: 'string' + 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' + type: + description: 'What the track holds: `speaker` (speech), `sfx` (sound effects), `bgm` (background music), or `composite` (several categories merged because the prompt asked for it).' + enum: + - 'speaker' + - 'sfx' + - 'bgm' + - 'composite' + example: 'speaker' + type: 'string' + x-speakeasy-unknown-values: allow + required: + - 'type' + - 'media_type' + - 'audio' + type: 'object' + SpeechAudioTrackUrl: + description: 'One separated track as a signed download URL.' + example: + description: 'background music' + expires_at: 1748458800 + media_type: 'audio/mpeg' + type: 'bgm' + url: 'https://openrouter.ai/api/v1/audio/speech/media/abcdefghijklmnopqrstuvwxyz0123456789abcdefg' + properties: + description: + description: 'The provider''s short description of the track.' + example: 'all speech' + type: 'string' + 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' + type: + description: 'What the track holds: `speaker` (speech), `sfx` (sound effects), `bgm` (background music), or `composite` (several categories merged because the prompt asked for it).' + enum: + - 'speaker' + - 'sfx' + - 'bgm' + - 'composite' + example: 'speaker' + type: 'string' + x-speakeasy-unknown-values: allow + 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: + - 'type' + - 'media_type' + - 'url' + - 'expires_at' + type: 'object' SpeechEnumParameter: example: type: 'enum' @@ -36554,7 +36642,7 @@ components: description: 'Text to synthesize, or a list of turns for multi-speaker input. Each turn has its own text, voice, and instructions. Multi-speaker input is supported by Gemini TTS models, by Fish Audio models other than S1, and by Speechify dialogue models.' example: 'Hello world' SpeechInputModality: - description: 'An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design; `video` is a reference video the generated audio is made for.' + description: 'An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design, and `audio` is also the clip `separate_tracks` splits; `video` is a reference video the generated audio is made for.' example: type: 'text' oneOf: @@ -36576,7 +36664,7 @@ components: type: 'object' - properties: supported_inputs: - description: '`references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder.' + description: '`references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder. An endpoint may accept a clip only for voice cloning, only for `separate_tracks`, or both: check `supported_parameters` for `separate_tracks` and `voice` before cloning a voice.' properties: references: $ref: '#/components/schemas/SpeechReferenceCount' @@ -37147,6 +37235,10 @@ components: example: 'pcm' type: 'string' x-speakeasy-unknown-values: allow + separate_tracks: + description: 'Split one existing audio clip into separate tracks (speech, sound effects, background music) instead of generating speech. Requires exactly one `input_audio` part in `input_references` and no other parts, `voice` or `timestamp_granularities`, and `speed` omitted or `1`; `input` describes how to split the clip (for example "all speech in one track, background music in one track, all sound effects in one track"). The response is always JSON (`SpeechSeparatedTracksResponse`): `{tracks: [{type, description, audio, media_type}]}` with base64 audio, or `url` and `expires_at` per track when `output_delivery` is `url`. The audio defaults to `mp3` unless `response_format` is set. The whole output is buffered and capped at 10 MiB of decoded audio across all tracks inline, or 32 MiB with `url` delivery. With `output_delivery: "url"`, tracks fall back to inline base64 `audio` (no `url`) under the 10 MiB inline cap when a signed URL cannot be issued (zero-data-retention, missing workspace, or storage failure), so the 32 MiB cap only applies when storage is available. Only routed to endpoints that price track separation (`supported_parameters.separate_tracks` on the speech models list). Generated SDKs type the 200 response as binary audio; call the HTTP endpoint directly and parse the JSON.' + example: true + type: 'boolean' session_id: description: '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.' example: 'session-1234' @@ -37192,6 +37284,25 @@ components: - 'model' - 'input' type: 'object' + SpeechSeparatedTracksResponse: + description: 'JSON response for a request with `separate_tracks`: one entry per separated track.' + example: + tracks: + - audio: 'SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjYw' + description: 'all speech' + media_type: 'audio/mpeg' + type: 'speaker' + properties: + tracks: + description: 'The separated tracks in provider order (up to six). Each carries base64 `audio`, or `url` and `expires_at` when `output_delivery` is `url` and a signed URL could be issued.' + items: + anyOf: + - $ref: '#/components/schemas/SpeechAudioTrack' + - $ref: '#/components/schemas/SpeechAudioTrackUrl' + type: 'array' + required: + - 'tracks' + type: 'object' SpeechSignedUrlResponse: description: 'JSON response containing a signed download URL for generated speech audio.' example: @@ -37249,6 +37360,10 @@ components: $ref: '#/components/schemas/SpeechUnknownParameter' response_format: $ref: '#/components/schemas/SpeechEnumParameter' + separate_tracks: + allOf: + - $ref: '#/components/schemas/SpeechUnknownParameter' + - description: 'Present when the endpoint accepts `separate_tracks` (split one audio clip into speech, sound effect and music tracks). Absent: track separation is not supported.' speed: $ref: '#/components/schemas/SpeechRangeParameter' stream_format: @@ -44256,7 +44371,7 @@ paths: example: '' format: 'binary' type: 'string' - description: 'Raw audio bytes stream (`audio/*`) by default. When `stream_format` is `"sse"`, returns `text/event-stream` with `X-Audio-Media-Type` set to the effective audio media type (exposed via `Access-Control-Expose-Headers`) and default SSE `data:` frames (no named `event:` field) carrying one JSON object per event discriminated by `type`: `{"type":"speech.audio.delta","audio":""}` (base64-encoded audio chunk; decode each delta separately before concatenating bytes), `{"type":"speech.timestamps.delta","words"?:[{"text","start","end"}],"characters"?:[{"text","start","end"}]}` (when `timestamp_granularities` is nonempty; times in float seconds from start of output), `{"type":"speech.audio.done","media_type":"","usage"?:{"input_characters"?:number}}`, and `{"type":"error","error":{"message":""}}` on mid-stream failure. 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 and `stream_format` is `"audio"` (default), 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`.' + description: 'Raw audio bytes stream (`audio/*`) by default. When `stream_format` is `"sse"`, returns `text/event-stream` with `X-Audio-Media-Type` set to the effective audio media type (exposed via `Access-Control-Expose-Headers`) and default SSE `data:` frames (no named `event:` field) carrying one JSON object per event discriminated by `type`: `{"type":"speech.audio.delta","audio":""}` (base64-encoded audio chunk; decode each delta separately before concatenating bytes), `{"type":"speech.timestamps.delta","words"?:[{"text","start","end"}],"characters"?:[{"text","start","end"}]}` (when `timestamp_granularities` is nonempty; times in float seconds from start of output), `{"type":"speech.audio.done","media_type":"","usage"?:{"input_characters"?:number}}`, and `{"type":"error","error":{"message":""}}` on mid-stream failure. 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 and `stream_format` is `"audio"` (default), 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`. When `separate_tracks` is true, always returns `application/json` `{ tracks }` (`SpeechSeparatedTracksResponse`), one entry per separated track with base64 `audio`, or `url` and `expires_at` with URL delivery. A separated-tracks `url` request that cannot get signed URLs (zero-data-retention, missing workspace, or storage failure) returns inline base64 `audio` per track under the inline size cap.' '400': content: application/json: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index bd1afa1ee..3e5813362 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.808.1 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:6305b1e258dadea08c306870d09be1979085a71760e3530a97d4f1bfa55a101d - sourceBlobDigest: sha256:4d2b5ecedb5c99dd9a244f73a9eeaf9c66a570b6567f30f1847a772f28bafff5 + sourceRevisionDigest: sha256:b34aa7b3ed4727e486f2f069451426a3d52bd90eab1ed8a5b2f1fc832e64921c + sourceBlobDigest: sha256:90e0429cda1e8ba99e8887f147cc6ca7b48e9e9e2243482c9eb8e265cad95136 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: openrouter: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:6305b1e258dadea08c306870d09be1979085a71760e3530a97d4f1bfa55a101d - sourceBlobDigest: sha256:4d2b5ecedb5c99dd9a244f73a9eeaf9c66a570b6567f30f1847a772f28bafff5 + sourceRevisionDigest: sha256:b34aa7b3ed4727e486f2f069451426a3d52bd90eab1ed8a5b2f1fc832e64921c + sourceBlobDigest: sha256:90e0429cda1e8ba99e8887f147cc6ca7b48e9e9e2243482c9eb8e265cad95136 codeSamplesNamespace: open-router-chat-completions-api-typescript-code-samples - codeSamplesRevisionDigest: sha256:e2af5a57a798f82aa0a975d32be7653157771d6f7729d4dc58fc2a9fd0b2c0c0 + codeSamplesRevisionDigest: sha256:4a2eda86744137ce867f6f7b53a38c89b180c64f479031675bf85e86be01c8b7 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.808.1 diff --git a/RELEASES.md b/RELEASES.md index 25becf988..fe3aaa347 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -6166,4 +6166,14 @@ Based on: ### Generated - [typescript v1.5.179] . ### Releases -- [NPM v1.5.179] https://www.npmjs.com/package/@openrouter/sdk/v/1.5.179 - . \ No newline at end of file +- [NPM v1.5.179] https://www.npmjs.com/package/@openrouter/sdk/v/1.5.179 - . + +## 2026-12-04 21:03:25 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.808.1 (2.960.8) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v1.5.180] . +### Releases +- [NPM v1.5.180] https://www.npmjs.com/package/@openrouter/sdk/v/1.5.180 - . \ No newline at end of file diff --git a/docs/models/rangecapability.mdx b/docs/models/rangecapability.mdx index 1a1906a7b..8ad860c62 100644 --- a/docs/models/rangecapability.mdx +++ b/docs/models/rangecapability.mdx @@ -18,8 +18,10 @@ let value: RangeCapability = { ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `max` | *number* | ✔️ | N/A | -| `min` | *number* | ✔️ | N/A | -| `type` | *"range"* | ✔️ | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | +| `max` | *number* | ✔️ | N/A | +| `maxPixels` | *number* | ➖ | `input_references` only: largest accepted pixel count (width x height) of each reference image. Absent when none is declared. | +| `min` | *number* | ✔️ | N/A | +| `minEdge` | *number* | ➖ | `input_references` only: smallest accepted shorter side of each reference image, in pixels. Absent when none is declared. | +| `type` | *"range"* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/speechinputmodality.mdx b/docs/models/speechinputmodality.mdx index 06c83a837..2681828f5 100644 --- a/docs/models/speechinputmodality.mdx +++ b/docs/models/speechinputmodality.mdx @@ -2,7 +2,7 @@ title: "SpeechInputModality" --- -An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design; `video` is a reference video the generated audio is made for. +An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design, and `audio` is also the clip `separate_tracks` splits; `video` is a reference video the generated audio is made for. ## Supported Types diff --git a/docs/models/speechinputmodalityaudio.mdx b/docs/models/speechinputmodalityaudio.mdx index 989d48bee..2a73eb0e8 100644 --- a/docs/models/speechinputmodalityaudio.mdx +++ b/docs/models/speechinputmodalityaudio.mdx @@ -20,7 +20,7 @@ let value: SpeechInputModalityAudio = { ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `supportedInputs` | [models.SpeechInputModalitySupportedInputs1](../models/speechinputmodalitysupportedinputs1.mdx) | ✔️ | `references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder. | -| `type` | *"audio"* | ✔️ | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `supportedInputs` | [models.SpeechInputModalitySupportedInputs1](../models/speechinputmodalitysupportedinputs1.mdx) | ✔️ | `references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder. An endpoint may accept a clip only for voice cloning, only for `separate_tracks`, or both: check `supported_parameters` for `separate_tracks` and `voice` before cloning a voice. | +| `type` | *"audio"* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/speechinputmodalitysupportedinputs1.mdx b/docs/models/speechinputmodalitysupportedinputs1.mdx index 40b4a8a7a..fbf1bcdee 100644 --- a/docs/models/speechinputmodalitysupportedinputs1.mdx +++ b/docs/models/speechinputmodalitysupportedinputs1.mdx @@ -2,7 +2,7 @@ title: "SpeechInputModalitySupportedInputs1" --- -`references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder. +`references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder. An endpoint may accept a clip only for voice cloning, only for `separate_tracks`, or both: check `supported_parameters` for `separate_tracks` and `voice` before cloning a voice. ## Example Usage diff --git a/docs/models/speechrequest.mdx b/docs/models/speechrequest.mdx index 5eb3ac3dc..f85ca2676 100644 --- a/docs/models/speechrequest.mdx +++ b/docs/models/speechrequest.mdx @@ -26,6 +26,7 @@ let value: SpeechRequest = { | `outputDelivery` | [models.OutputDelivery](../models/outputdelivery.mdx) | ➖ | `stream` (default) streams the audio bytes directly in the response body (returns inline base64 JSON when `timestamp_granularities` is nonempty and `stream_format` is `"audio"`, or `text/event-stream` events when `stream_format` is `"sse"`). `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`. | stream | | `provider` | [models.SpeechRequestProvider](../models/speechrequestprovider.mdx) | ➖ | Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options | | | `responseFormat` | [models.SpeechRequestResponseFormat](../models/speechrequestresponseformat.mdx) | ➖ | Audio output format. Defaults to `pcm`, or to `mp3` when `timestamp_granularities` is nonempty. | pcm | +| `separateTracks` | *boolean* | ➖ | Split one existing audio clip into separate tracks (speech, sound effects, background music) instead of generating speech. Requires exactly one `input_audio` part in `input_references` and no other parts, `voice` or `timestamp_granularities`, and `speed` omitted or `1`; `input` describes how to split the clip (for example "all speech in one track, background music in one track, all sound effects in one track"). The response is always JSON (`SpeechSeparatedTracksResponse`): `{tracks: [{type, description, audio, media_type}]}` with base64 audio, or `url` and `expires_at` per track when `output_delivery` is `url`. The audio defaults to `mp3` unless `response_format` is set. The whole output is buffered and capped at 10 MiB of decoded audio across all tracks inline, or 32 MiB with `url` delivery. With `output_delivery: "url"`, tracks fall back to inline base64 `audio` (no `url`) under the 10 MiB inline cap when a signed URL cannot be issued (zero-data-retention, missing workspace, or storage failure), so the 32 MiB cap only applies when storage is available. Only routed to endpoints that price track separation (`supported_parameters.separate_tracks` on the speech models list). Generated SDKs type the 200 response as binary audio; call the HTTP endpoint directly and parse the JSON. | true | | `sessionId` | *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. | session-1234 | | `speed` | *number* | ➖ | Playback speed multiplier. Honored by models that support it (e.g. OpenAI TTS). Other providers either ignore it or return a 400 for a non-default value when the model has no speed control. | 1 | | `streamFormat` | [models.StreamFormat](../models/streamformat.mdx) | ➖ | Wire framing for inline responses. `audio` (default) returns raw audio bytes (or a buffered JSON envelope when `timestamp_granularities` is nonempty). `sse` streams `text/event-stream` events (`speech.audio.delta`, `speech.timestamps.delta` when `timestamp_granularities` is nonempty, `speech.audio.done`, and `error` on mid-stream failure) with the effective audio media type in `X-Audio-Media-Type`. Cannot be combined with `output_delivery: "url"`. Only routed to endpoints that advertise `sse` in `supported_parameters.stream_format` (and every requested granularity when `timestamp_granularities` is nonempty). Generated SDKs still type the 200 response as binary audio for compatibility; when using `stream_format: "sse"`, call the HTTP endpoint directly and parse `text/event-stream`. | audio | diff --git a/docs/models/speechsupportedparameters.mdx b/docs/models/speechsupportedparameters.mdx index a1bcd0050..9031d6c4b 100644 --- a/docs/models/speechsupportedparameters.mdx +++ b/docs/models/speechsupportedparameters.mdx @@ -16,6 +16,7 @@ let value: SpeechSupportedParameters = {}; | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `instructions` | [models.SpeechUnknownParameter](../models/speechunknownparameter.mdx) | ➖ | N/A | \{
"type": "unknown"
} | | `responseFormat` | [models.SpeechEnumParameter](../models/speechenumparameter.mdx) | ➖ | N/A | \{
"type": "enum",
"values": [
"alloy",
"coral"
]
} | +| `separateTracks` | [models.SpeechUnknownParameter](../models/speechunknownparameter.mdx) | ➖ | N/A | \{
"type": "unknown"
} | | `speed` | [models.SpeechRangeParameter](../models/speechrangeparameter.mdx) | ➖ | The accepted `speed` range. Absent: the provider documents no range; some providers still forward `speed`. | \{
"max": 4,
"min": 0.25,
"type": "range"
} | | `streamFormat` | [models.SpeechEnumParameter](../models/speechenumparameter.mdx) | ➖ | N/A | \{
"type": "enum",
"values": [
"alloy",
"coral"
]
} | | `timestampGranularities` | [models.SpeechEnumParameter](../models/speechenumparameter.mdx) | ➖ | N/A | \{
"type": "enum",
"values": [
"alloy",
"coral"
]
} | diff --git a/jsr.json b/jsr.json index 1a1fa439b..695c88bc7 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "@openrouter/sdk", - "version": "1.5.179", + "version": "1.5.180", "exports": { ".": "./src/index.ts", "./models/errors": "./src/models/errors/index.ts", diff --git a/package.json b/package.json index 33b532533..65c2e84ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@openrouter/sdk", - "version": "1.5.179", + "version": "1.5.180", "author": "OpenRouter", "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.", "keywords": [ @@ -75,13 +75,13 @@ "prepublishOnly": "npm run build", "compile": "node --max-old-space-size=8192 ./node_modules/typescript/bin/tsc && node scripts/unbarrel-imports.js", "postinstall": "node scripts/check-types.js || true", - "prepare": "npm run build", - "test": "vitest --run --project unit", - "test:watch": "vitest --watch --project unit", - "typecheck": "tsc --noEmit", "test:e2e": "vitest --run --project e2e", "test:transit": "exit 0", - "typecheck:transit": "exit 0" + "test:watch": "vitest --watch --project unit", + "typecheck:transit": "exit 0", + "prepare": "npm run build", + "test": "vitest --run --project unit", + "typecheck": "tsc --noEmit" }, "peerDependencies": { diff --git a/src/lib/config.ts b/src/lib/config.ts index c9c26e960..48a5abb78 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -74,7 +74,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "1.0.0", - sdkVersion: "1.5.179", + sdkVersion: "1.5.180", genVersion: "2.960.8", - userAgent: "speakeasy-sdk/typescript 1.5.179 2.960.8 1.0.0 @openrouter/sdk", + userAgent: "speakeasy-sdk/typescript 1.5.180 2.960.8 1.0.0 @openrouter/sdk", } as const; diff --git a/src/models/rangecapability.ts b/src/models/rangecapability.ts index 56a393374..dba808101 100644 --- a/src/models/rangecapability.ts +++ b/src/models/rangecapability.ts @@ -3,6 +3,7 @@ */ import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; @@ -12,7 +13,15 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js"; */ export type RangeCapability = { max: number; + /** + * `input_references` only: largest accepted pixel count (width x height) of each reference image. Absent when none is declared. + */ + maxPixels?: number | undefined; min: number; + /** + * `input_references` only: smallest accepted shorter side of each reference image, in pixels. Absent when none is declared. + */ + minEdge?: number | undefined; type: "range"; }; @@ -22,8 +31,15 @@ export const RangeCapability$inboundSchema: z.ZodType< unknown > = z.object({ max: z.number(), + max_pixels: z.int().optional(), min: z.number(), + min_edge: z.int().optional(), type: z.literal("range"), +}).transform((v) => { + return remap$(v, { + "max_pixels": "maxPixels", + "min_edge": "minEdge", + }); }); export function rangeCapabilityFromJSON( diff --git a/src/models/speechinputmodality.ts b/src/models/speechinputmodality.ts index 4cb56202f..84c7a0c64 100644 --- a/src/models/speechinputmodality.ts +++ b/src/models/speechinputmodality.ts @@ -57,7 +57,7 @@ export type SpeechInputModalityImage = { }; /** - * `references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder. + * `references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder. An endpoint may accept a clip only for voice cloning, only for `separate_tracks`, or both: check `supported_parameters` for `separate_tracks` and `voice` before cloning a voice. */ export type SpeechInputModalitySupportedInputs1 = { references: SpeechReferenceCount; @@ -65,7 +65,7 @@ export type SpeechInputModalitySupportedInputs1 = { export type SpeechInputModalityAudio = { /** - * `references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder. + * `references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder. An endpoint may accept a clip only for voice cloning, only for `separate_tracks`, or both: check `supported_parameters` for `separate_tracks` and `voice` before cloning a voice. */ supportedInputs: SpeechInputModalitySupportedInputs1; type: "audio"; @@ -95,7 +95,7 @@ export type SpeechInputModalityText = { }; /** - * An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design; `video` is a reference video the generated audio is made for. + * An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design, and `audio` is also the clip `separate_tracks` splits; `video` is a reference video the generated audio is made for. */ export type SpeechInputModality = | SpeechInputModalityText diff --git a/src/models/speechrequest.ts b/src/models/speechrequest.ts index c113643ae..7b9f30cb3 100644 --- a/src/models/speechrequest.ts +++ b/src/models/speechrequest.ts @@ -178,6 +178,10 @@ export type SpeechRequest = { * Audio output format. Defaults to `pcm`, or to `mp3` when `timestamp_granularities` is nonempty. */ responseFormat?: SpeechRequestResponseFormat | undefined; + /** + * Split one existing audio clip into separate tracks (speech, sound effects, background music) instead of generating speech. Requires exactly one `input_audio` part in `input_references` and no other parts, `voice` or `timestamp_granularities`, and `speed` omitted or `1`; `input` describes how to split the clip (for example "all speech in one track, background music in one track, all sound effects in one track"). The response is always JSON (`SpeechSeparatedTracksResponse`): `{tracks: [{type, description, audio, media_type}]}` with base64 audio, or `url` and `expires_at` per track when `output_delivery` is `url`. The audio defaults to `mp3` unless `response_format` is set. The whole output is buffered and capped at 10 MiB of decoded audio across all tracks inline, or 32 MiB with `url` delivery. With `output_delivery: "url"`, tracks fall back to inline base64 `audio` (no `url`) under the 10 MiB inline cap when a signed URL cannot be issued (zero-data-retention, missing workspace, or storage failure), so the 32 MiB cap only applies when storage is available. Only routed to endpoints that price track separation (`supported_parameters.separate_tracks` on the speech models list). Generated SDKs type the 200 response as binary audio; call the HTTP endpoint directly and parse the JSON. + */ + separateTracks?: boolean | undefined; /** * 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. */ @@ -337,6 +341,7 @@ export type SpeechRequest$Outbound = { output_delivery?: string | undefined; provider?: SpeechRequestProvider$Outbound | undefined; response_format?: string | undefined; + separate_tracks?: boolean | undefined; session_id?: string | undefined; speed?: number | undefined; stream_format?: string | undefined; @@ -358,6 +363,7 @@ export const SpeechRequest$outboundSchema: z.ZodType< outputDelivery: OutputDelivery$outboundSchema.optional(), provider: z.lazy(() => SpeechRequestProvider$outboundSchema).optional(), responseFormat: SpeechRequestResponseFormat$outboundSchema.optional(), + separateTracks: z.boolean().optional(), sessionId: z.string().optional(), speed: z.number().optional(), streamFormat: StreamFormat$outboundSchema.optional(), @@ -371,6 +377,7 @@ export const SpeechRequest$outboundSchema: z.ZodType< inputReferences: "input_references", outputDelivery: "output_delivery", responseFormat: "response_format", + separateTracks: "separate_tracks", sessionId: "session_id", streamFormat: "stream_format", timestampGranularities: "timestamp_granularities", diff --git a/src/models/speechsupportedparameters.ts b/src/models/speechsupportedparameters.ts index 8dbe8b82d..f29fb10eb 100644 --- a/src/models/speechsupportedparameters.ts +++ b/src/models/speechsupportedparameters.ts @@ -27,6 +27,7 @@ import { export type SpeechSupportedParameters = { instructions?: SpeechUnknownParameter | undefined; responseFormat?: SpeechEnumParameter | undefined; + separateTracks?: SpeechUnknownParameter | undefined; /** * The accepted `speed` range. Absent: the provider documents no range; some providers still forward `speed`. */ @@ -46,6 +47,7 @@ export const SpeechSupportedParameters$inboundSchema: z.ZodType< > = z.object({ instructions: SpeechUnknownParameter$inboundSchema.optional(), response_format: SpeechEnumParameter$inboundSchema.optional(), + separate_tracks: SpeechUnknownParameter$inboundSchema.optional(), speed: SpeechRangeParameter$inboundSchema.optional(), stream_format: SpeechEnumParameter$inboundSchema.optional(), timestamp_granularities: SpeechEnumParameter$inboundSchema.optional(), @@ -53,6 +55,7 @@ export const SpeechSupportedParameters$inboundSchema: z.ZodType< }).transform((v) => { return remap$(v, { "response_format": "responseFormat", + "separate_tracks": "separateTracks", "stream_format": "streamFormat", "timestamp_granularities": "timestampGranularities", });