diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 4b71c857..ab02d0d9 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,18 +1,18 @@ lockVersion: 2.0.0 id: 9eea3e30-2722-4060-973b-57b7f1f75dc0 management: - docChecksum: feb609f21537ad0b6504ffa3655b1430 + docChecksum: e1f8f2e5c0101fe5dda20e0917815b41 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.9.21 - configChecksum: 573d31ce7c09eae86ccdbc8e13c02fba + releaseVersion: 0.9.22 + configChecksum: 7b659088c00a57d1e797fcdffbecefc0 repoURL: https://github.com/OpenRouterTeam/go-sdk.git installationURL: https://github.com/OpenRouterTeam/go-sdk persistentEdits: - generation_id: e2dbd12b-4789-43eb-bc59-e2d5c25bf61f - pristine_commit_hash: d7a7b469cea1b0f861cb6b90fbcd5b48f2de9acb - pristine_tree_hash: d3065cd36818b6d61d0d0483ba63c0c2c39713df + generation_id: a27e8874-d8c2-4511-af14-6845dd51a789 + pristine_commit_hash: c4266efcaf607e2620f074061de1a88881466034 + pristine_tree_hash: 4f68b3d06d2b7f3a6ec87bee27e1dadf24b10a5b features: go: acceptHeaders: 2.81.2 @@ -6857,12 +6857,16 @@ trackedFiles: pristine_git_object: d11bcca08713060dd9e5b41ad311978fcabddfbf docs/models/components/speechrequest.mdx: id: 572bb1b07290 - last_write_checksum: sha1:cbef1f055fd6db8bd56d21b8bc5de3ccb6aa9420 - pristine_git_object: 22cc6b16ecf2e9673820f3fbfdad32ffc1020207 + last_write_checksum: sha1:6f0c68c37f374cdf9ebaa5aeb10230b1cbc83ce6 + pristine_git_object: 2b380195bff45a1e54735bf1aceb750c7b67d98c + docs/models/components/speechrequestdatacollection.mdx: + id: 1f570d6a226b + last_write_checksum: sha1:f20c151f90a4b462e1ae8911b96c41c72b4cbcb0 + pristine_git_object: 4aa3133356239f3e40d917eef343e7d8d386e295 docs/models/components/speechrequestprovider.mdx: id: 70ddc64fe615 - last_write_checksum: sha1:0b345acd1029103dca5e9dbe7e3480cad15266d7 - pristine_git_object: 09a7d13cce923f1676ec366411151ad84ab9d5d7 + last_write_checksum: sha1:0b8f86514c952ef83de8c1a3599b0a079a525ba6 + pristine_git_object: 23f0bc0c4be00ab2ab419eecf5d07944153ab0ea docs/models/components/speechrequestresponseformat.mdx: id: 9109b6973bc4 last_write_checksum: sha1:255e2f95fce29649de7b55892e1554112634caca @@ -7001,12 +7005,16 @@ trackedFiles: pristine_git_object: bb1d120bea69304cb2a12a530d738b2ca42a51b7 docs/models/components/sttrequest.mdx: id: 1e6ea423fbb6 - last_write_checksum: sha1:c1b4c70d6ad1e4ce22b168222188cd15615c3dad - pristine_git_object: 854a9a9e55be989699556355f80f9db8bd694dd2 + last_write_checksum: sha1:6be35c8705edf21cc8229ef62344956b4e0e9d74 + pristine_git_object: 3989cdd989643a828fdd49de312c352f8c26a13c + docs/models/components/sttrequestdatacollection.mdx: + id: 4f136a402e39 + last_write_checksum: sha1:d06c3e97a3c53e6e80ad0988e2baff471c1f39b2 + pristine_git_object: cefa0c0a04b891e1763aa985f0e5b2f6f9dce190 docs/models/components/sttrequestprovider.mdx: id: e3b3b2e853a8 - last_write_checksum: sha1:cfb623d230d5cd9401438b4cd159bef535e7e738 - pristine_git_object: 658722a69dbc7c5a6682a6a5e25c284c20897afc + last_write_checksum: sha1:c4b0d58bc8d4f78852efb084927a68217182a596 + pristine_git_object: 6d5dd6175d10927b6beb3c881d58da234d588861 docs/models/components/sttrequestresponseformat.mdx: id: ab22a1088bc4 last_write_checksum: sha1:201141e5a99570f1ef962ca2a180fbcc3df925f4 @@ -7993,8 +8001,8 @@ trackedFiles: pristine_git_object: 94daa49e560d724454710a59bbd1d7b6c0a24f4c docs/models/operations/createaudiotranscriptionsmultipartrequest.mdx: id: 063ada7c42d4 - last_write_checksum: sha1:5829adaa547e68cc908150c807232f41efff1344 - pristine_git_object: a8f41bb416d0f32696e0844cb3ea6900aa87ae53 + last_write_checksum: sha1:9e9525ee6a5e84985530aff95d557144813d4216 + pristine_git_object: 490eee09002dafc26e6b216e364cf57a93c94cad docs/models/operations/createauthkeyscodecodechallengemethod.mdx: id: 57aefdf3bb42 last_write_checksum: sha1:fe52a741a4e0bd95106fe2993895f3846f1d87a6 @@ -12249,8 +12257,8 @@ trackedFiles: pristine_git_object: 282892fcabc303c6f383535c88d640ecd1bf35be models/components/speechrequest.go: id: c5f83d3285eb - last_write_checksum: sha1:84c62bd8941851aad6b3f2bd3fdc6ddc93540543 - pristine_git_object: a0609b62ced0f9cdb40fae551206c6266ee35a73 + last_write_checksum: sha1:f5c8fadd25763d0437f48671790713e455115490 + pristine_git_object: 0fc50cef635f92b30cf0ba3a2432b6f2667aad34 models/components/stopservertoolswhencondition.go: id: 6c12d61377dc last_write_checksum: sha1:600037f2c92bb83b31cc6469a5ce9a169ee82b09 @@ -12325,8 +12333,8 @@ trackedFiles: pristine_git_object: a8fb0f1eea4a6fae51eb8d81c86e564e3c8bccb3 models/components/sttrequest.go: id: 307b6fe641a4 - last_write_checksum: sha1:96e7ccf39ccac38ba0a05d863d2b0fd473ad7621 - pristine_git_object: de5bac046b39ce610d600e55f96f7991f0abddae + last_write_checksum: sha1:7d731a2c47076ee5752a44bf33f3c4a876155a5e + pristine_git_object: d680497ca963ee4beda31a98b85135145a3cefe7 models/components/sttresponse.go: id: 7af2c26acdda last_write_checksum: sha1:18e10b264189ea341e617377fd36608c9cac518c @@ -12761,8 +12769,8 @@ trackedFiles: pristine_git_object: a7f4f92401f5a8771f49e181605e3a485495aefd models/operations/createaudiotranscriptionsmultipart.go: id: 01ede35bc595 - last_write_checksum: sha1:0471e4c7bc7d4699409abdd23e4998f215660f94 - pristine_git_object: 30a0c49dc789e544a28e2d2fcf74d97c89dcdcea + last_write_checksum: sha1:073454d0b9862a1811bebd5dc8f82ba9135f2b62 + pristine_git_object: 70ab2f548ff154591438013703eaec5fb9bb374c models/operations/createauthkeyscode.go: id: ae6ada25c1c9 last_write_checksum: sha1:58db7c2aad4e7b1b9c9dad71bcb1c7cd6acc471a @@ -13361,8 +13369,8 @@ trackedFiles: pristine_git_object: 5e3a2cdf8cb4ed4f5378b712293cba9c82074f16 openrouter.go: id: 207ad004b774 - last_write_checksum: sha1:34f0b746a28dbbd03cbf1df984690eb9cd675f26 - pristine_git_object: 980318b4c216e29e4d6126c15ce32af250f5e146 + last_write_checksum: sha1:b841561f66ce8ec445a5a700eec713c9780d88c7 + pristine_git_object: 29cbbde1618da5cc0972806fb19389d5e2668988 optionalnullable/optionalnullable.go: id: ce60f259ead3 last_write_checksum: sha1:d6aff1a420c31e025ea21d46cf056e305ae76fe8 @@ -17377,9 +17385,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: | - ## Go SDK Changes: - * `OpenRouter.Observability.List()`: `response.Data[]` **Changed** - * `OpenRouter.Observability.Create()`: `response.Data` **Changed** - * `OpenRouter.Observability.Get()`: `response.Data` **Changed** - * `OpenRouter.Observability.Update()`: `response.Data` **Changed** +releaseNotes: "## Go SDK Changes:\n* `OpenRouter.Tts.CreateSpeech()`: \n * `request.Request.Provider` **Changed**\n* `OpenRouter.Stt.CreateTranscription()`: \n * `request.Request.Provider` **Changed**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index f4e74831..64313527 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true go: - version: 0.9.21 + version: 0.9.22 additionalDependencies: {} baseErrorName: OpenRouterError clientServerStatusCodesAsErrors: true diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 2962417e..66946f93 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -28898,10 +28898,28 @@ components: example: 'mistralai/voxtral-mini-tts-2603' type: 'string' provider: - description: 'Provider-specific passthrough configuration' + description: 'Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options' properties: + data_collection: + description: "Data collection setting. If no available model provider meets the requirement, your request will return an error.\n- allow: (default) allow providers which store user data non-transiently and may train on it\n\n- deny: use only providers which do not collect user data." + enum: + - 'deny' + - 'allow' + - null + example: 'allow' + title: 'SpeechRequestDataCollection' + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow options: $ref: '#/components/schemas/ProviderOptions' + zdr: + description: 'Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.' + example: true + type: + - 'boolean' + - 'null' type: 'object' response_format: default: 'pcm' @@ -29455,10 +29473,28 @@ components: example: 'openai/whisper-large-v3' type: 'string' provider: - description: 'Provider-specific passthrough configuration' + description: 'Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options' properties: + data_collection: + description: "Data collection setting. If no available model provider meets the requirement, your request will return an error.\n- allow: (default) allow providers which store user data non-transiently and may train on it\n\n- deny: use only providers which do not collect user data." + enum: + - 'deny' + - 'allow' + - null + example: 'allow' + title: 'STTRequestDataCollection' + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow options: $ref: '#/components/schemas/ProviderOptions' + zdr: + description: 'Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.' + example: true + type: + - 'boolean' + - 'null' type: 'object' response_format: description: 'Output format. "json" (default) returns { text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.' @@ -34196,7 +34232,7 @@ paths: description: 'The model to use for transcription.' type: 'string' provider: - description: 'JSON-encoded provider preferences object, the same shape as the JSON body field: { "options": { "": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object.' + description: 'JSON-encoded provider preferences object, the same shape as the JSON body field: { "zdr": true, "data_collection": "deny", "options": { "": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object.' type: 'string' response_format: description: 'The response format. "json" (default) returns { text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only).' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 0b2d0798..9b7f543c 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.787.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:948b494092910f6dc539f79e4dfe1787cf9f16c8daf65cfbca84a1b07d4ff923 - sourceBlobDigest: sha256:169e0874624deb9182c48a4d88979a4ff2497a29150121dc8f69eb7e14b02f49 + sourceRevisionDigest: sha256:b82a9b8be9cf76f3485983144371bf5ac255ef4c78a2ff4bd4adcdf37c1d3da3 + sourceBlobDigest: sha256:56ffbeb230c36f059f1da8f765eca1e2081711c776e1646030f6a10e6ad2e4e6 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: openrouter: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:948b494092910f6dc539f79e4dfe1787cf9f16c8daf65cfbca84a1b07d4ff923 - sourceBlobDigest: sha256:169e0874624deb9182c48a4d88979a4ff2497a29150121dc8f69eb7e14b02f49 + sourceRevisionDigest: sha256:b82a9b8be9cf76f3485983144371bf5ac255ef4c78a2ff4bd4adcdf37c1d3da3 + sourceBlobDigest: sha256:56ffbeb230c36f059f1da8f765eca1e2081711c776e1646030f6a10e6ad2e4e6 codeSamplesNamespace: open-router-chat-completions-api-go-code-samples - codeSamplesRevisionDigest: sha256:2004d04dabfb814596c8653896d79ca0d6385ba3edbfa73c288c34c2688e2564 + codeSamplesRevisionDigest: sha256:4a0b6ee4fd9a8a339574a59829398cccdc97c55b816be16dfb2c84027ba5028f workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/OVERVIEW.md b/OVERVIEW.md index 6d4e6fb2..8c3830cd 100644 --- a/OVERVIEW.md +++ b/OVERVIEW.md @@ -117,7 +117,7 @@ go get github.com/OpenRouterTeam/go-sdk For beta releases, pin an explicit version: ```bash -go get github.com/OpenRouterTeam/go-sdk@v0.9.21 +go get github.com/OpenRouterTeam/go-sdk@v0.9.22 ``` **Requirements:** Go 1.25 or higher diff --git a/README.md b/README.md index f4d8bee3..4a843ce5 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ To learn more, see the [API Reference](https://openrouter.ai/docs/sdks/go/api-re > This SDK is in **beta**. Pin to a specific version to avoid unexpected breaking changes: > > ```bash -> go get github.com/OpenRouterTeam/go-sdk@v0.9.21 +> go get github.com/OpenRouterTeam/go-sdk@v0.9.22 > ``` diff --git a/RELEASES.md b/RELEASES.md index bbcf6850..7c2006ea 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2728,4 +2728,14 @@ Based on: ### Generated - [go v0.9.21] . ### Releases -- [Go v0.9.21] https://github.com/OpenRouterTeam/go-sdk/releases/tag/v0.9.21 - . \ No newline at end of file +- [Go v0.9.21] https://github.com/OpenRouterTeam/go-sdk/releases/tag/v0.9.21 - . + +## 2026-10-02 21:43:36 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.9.22] . +### Releases +- [Go v0.9.22] https://github.com/OpenRouterTeam/go-sdk/releases/tag/v0.9.22 - . \ No newline at end of file diff --git a/doc.go b/doc.go index 1d7340ad..be83f9c7 100644 --- a/doc.go +++ b/doc.go @@ -6,7 +6,7 @@ provider selection, and unified billing. This SDK is in beta. Pin to a specific module version to avoid unexpected breaking changes: - go get github.com/OpenRouterTeam/go-sdk@v0.9.21 + go get github.com/OpenRouterTeam/go-sdk@v0.9.22 For full API documentation, visit: https://openrouter.ai/docs/client-sdks/go/overview diff --git a/docs/models/components/speechrequest.mdx b/docs/models/components/speechrequest.mdx index 22cc6b16..2b380195 100644 --- a/docs/models/components/speechrequest.mdx +++ b/docs/models/components/speechrequest.mdx @@ -12,7 +12,7 @@ Text-to-speech request input | `Input` | `string` | :heavy_check_mark: | Text to synthesize | Hello world | | `InputReferences` | [][components.SpeechInputReference](../../models/components/speechinputreference.mdx) | :heavy_minus_sign: | Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip); only routed to endpoints that support voice cloning (and multiple references when more than one part is sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. The two modes cannot be mixed. An empty array is treated as no reference. | [
\{
"input_audio": \{
"data": "data:audio/wav;base64,UklGRuQXDABXQVZF..."
},
"type": "input_audio"
},
\{
"text": "I used to rule the world.",
"type": "text"
}
] | | `Model` | `string` | :heavy_check_mark: | TTS model identifier | mistralai/voxtral-mini-tts-2603 | -| `Provider` | [*components.SpeechRequestProvider](../../models/components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `Provider` | [*components.SpeechRequestProvider](../../models/components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options | | | `ResponseFormat` | [*components.SpeechRequestResponseFormat](../../models/components/speechrequestresponseformat.mdx) | :heavy_minus_sign: | Audio output format | pcm | | `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 | | `Speed` | `*float64` | :heavy_minus_sign: | 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 | diff --git a/docs/models/components/speechrequestdatacollection.mdx b/docs/models/components/speechrequestdatacollection.mdx new file mode 100644 index 00000000..4aa31333 --- /dev/null +++ b/docs/models/components/speechrequestdatacollection.mdx @@ -0,0 +1,29 @@ +--- +title: "SpeechRequestDataCollection" +--- + +Data collection setting. If no available model provider meets the requirement, your request will return an error. +- allow: (default) allow providers which store user data non-transiently and may train on it + +- deny: use only providers which do not collect user data. + +## Example Usage + +```go +import ( + "github.com/OpenRouterTeam/go-sdk/models/components" +) + +value := components.SpeechRequestDataCollectionDeny + +// Open enum: custom values can be created with a direct type cast +custom := components.SpeechRequestDataCollection("custom_value") +``` + + +## Values + +| Name | Value | +| ---------------------------------- | ---------------------------------- | +| `SpeechRequestDataCollectionDeny` | deny | +| `SpeechRequestDataCollectionAllow` | allow | \ No newline at end of file diff --git a/docs/models/components/speechrequestprovider.mdx b/docs/models/components/speechrequestprovider.mdx index 09a7d13c..23f0bc0c 100644 --- a/docs/models/components/speechrequestprovider.mdx +++ b/docs/models/components/speechrequestprovider.mdx @@ -2,11 +2,13 @@ title: "SpeechRequestProvider" --- -Provider-specific passthrough configuration +Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Options` | [*components.ProviderOptions](../../models/components/provideroptions.mdx) | :heavy_minus_sign: | Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped. | \{
"openai": \{
"max_tokens": 1000
}
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `DataCollection` | optionalnullable.OptionalNullable[[components.SpeechRequestDataCollection](../../models/components/speechrequestdatacollection.mdx)] | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it

- deny: use only providers which do not collect user data. | allow | +| `Options` | [*components.ProviderOptions](../../models/components/provideroptions.mdx) | :heavy_minus_sign: | Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped. | \{
"openai": \{
"max_tokens": 1000
}
} | +| `Zdr` | optionalnullable.OptionalNullable[`bool`] | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true | \ No newline at end of file diff --git a/docs/models/components/sttrequest.mdx b/docs/models/components/sttrequest.mdx index 854a9a9e..3989cdd9 100644 --- a/docs/models/components/sttrequest.mdx +++ b/docs/models/components/sttrequest.mdx @@ -14,7 +14,7 @@ Speech-to-text request input. Accepts a JSON body with input_audio containing ba | `Keyterms` | []`string` | :heavy_minus_sign: | 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. | [
"OpenRouter",
"Scribe"
] | | `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` | [*components.STTRequestProvider](../../models/components/sttrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `Provider` | [*components.STTRequestProvider](../../models/components/sttrequestprovider.mdx) | :heavy_minus_sign: | Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options | | | `ResponseFormat` | [*components.STTRequestResponseFormat](../../models/components/sttrequestresponseformat.mdx) | :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` | `*float64` | :heavy_minus_sign: | Sampling temperature for transcription | 0 | diff --git a/docs/models/components/sttrequestdatacollection.mdx b/docs/models/components/sttrequestdatacollection.mdx new file mode 100644 index 00000000..cefa0c0a --- /dev/null +++ b/docs/models/components/sttrequestdatacollection.mdx @@ -0,0 +1,29 @@ +--- +title: "STTRequestDataCollection" +--- + +Data collection setting. If no available model provider meets the requirement, your request will return an error. +- allow: (default) allow providers which store user data non-transiently and may train on it + +- deny: use only providers which do not collect user data. + +## Example Usage + +```go +import ( + "github.com/OpenRouterTeam/go-sdk/models/components" +) + +value := components.STTRequestDataCollectionDeny + +// Open enum: custom values can be created with a direct type cast +custom := components.STTRequestDataCollection("custom_value") +``` + + +## Values + +| Name | Value | +| ------------------------------- | ------------------------------- | +| `STTRequestDataCollectionDeny` | deny | +| `STTRequestDataCollectionAllow` | allow | \ No newline at end of file diff --git a/docs/models/components/sttrequestprovider.mdx b/docs/models/components/sttrequestprovider.mdx index 658722a6..6d5dd617 100644 --- a/docs/models/components/sttrequestprovider.mdx +++ b/docs/models/components/sttrequestprovider.mdx @@ -2,11 +2,13 @@ title: "STTRequestProvider" --- -Provider-specific passthrough configuration +Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Options` | [*components.ProviderOptions](../../models/components/provideroptions.mdx) | :heavy_minus_sign: | Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped. | \{
"openai": \{
"max_tokens": 1000
}
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `DataCollection` | optionalnullable.OptionalNullable[[components.STTRequestDataCollection](../../models/components/sttrequestdatacollection.mdx)] | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it

- deny: use only providers which do not collect user data. | allow | +| `Options` | [*components.ProviderOptions](../../models/components/provideroptions.mdx) | :heavy_minus_sign: | Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped. | \{
"openai": \{
"max_tokens": 1000
}
} | +| `Zdr` | optionalnullable.OptionalNullable[`bool`] | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true | \ No newline at end of file diff --git a/docs/models/operations/createaudiotranscriptionsmultipartrequest.mdx b/docs/models/operations/createaudiotranscriptionsmultipartrequest.mdx index a8f41bb4..490eee09 100644 --- a/docs/models/operations/createaudiotranscriptionsmultipartrequest.mdx +++ b/docs/models/operations/createaudiotranscriptionsmultipartrequest.mdx @@ -11,7 +11,7 @@ title: "CreateAudioTranscriptionsMultipartRequest" | `Keyterms` | []`string` | :heavy_minus_sign: | Domain terms, names, or phrases to bias recognition toward; repeat the part once per term (keyterms=... is also accepted). Only supported by some providers; 400 when the selected model cannot use keyterms. | | `Language` | `*string` | :heavy_minus_sign: | The language of the input audio (ISO-639-1). | | `Model` | `string` | :heavy_check_mark: | The model to use for transcription. | -| `Provider` | `*string` | :heavy_minus_sign: | JSON-encoded provider preferences object, the same shape as the JSON body field: \{ "options": \{ "\": \{ ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. | +| `Provider` | `*string` | :heavy_minus_sign: | JSON-encoded provider preferences object, the same shape as the JSON body field: \{ "zdr": true, "data_collection": "deny", "options": \{ "\": \{ ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. | | `ResponseFormat` | [*operations.ResponseFormat](../../models/operations/responseformat.mdx) | :heavy_minus_sign: | The response format. "json" (default) returns \{ text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). | | `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. | | `SourceURL` | `*string` | :heavy_minus_sign: | Publicly reachable http(s) URL of the audio file, downloaded by the provider directly (no size limit on our side). The format is derived from the URL path extension. Only supported by some providers; exactly one of file or source_url is required. | diff --git a/example_test.go b/example_test.go index bde009f8..04a37ee0 100644 --- a/example_test.go +++ b/example_test.go @@ -18,7 +18,7 @@ func ExampleNew() { openrouter.WithSecurity("your-api-key"), ) fmt.Println(sdk.SDKVersion) - // Output: 0.9.21 + // Output: 0.9.22 } // Example demonstrates basic usage of the OpenRouter SDK for chat completions. diff --git a/examples/README.md b/examples/README.md index c08b72a6..00bd1c02 100644 --- a/examples/README.md +++ b/examples/README.md @@ -43,7 +43,7 @@ cd ../generation && go run . Each example pins a released SDK version in `go.mod`: ```go -require github.com/OpenRouterTeam/go-sdk v0.9.21 +require github.com/OpenRouterTeam/go-sdk v0.9.22 ``` This should match the version in [README.md](../README.md) and `.speakeasy/gen.lock` `releaseVersion`. CI runs `scripts/bump-examples.sh` after releases to keep these in sync. @@ -51,7 +51,7 @@ This should match the version in [README.md](../README.md) and `.speakeasy/gen.l To use a different version: ```bash -go get github.com/OpenRouterTeam/go-sdk@v0.9.21 +go get github.com/OpenRouterTeam/go-sdk@v0.9.22 go run . ``` diff --git a/models/components/speechrequest.go b/models/components/speechrequest.go index a0609b62..0fc50cef 100644 --- a/models/components/speechrequest.go +++ b/models/components/speechrequest.go @@ -4,12 +4,46 @@ package components import ( "github.com/OpenRouterTeam/go-sdk/internal/utils" + "github.com/OpenRouterTeam/go-sdk/optionalnullable" ) -// SpeechRequestProvider - Provider-specific passthrough configuration +// SpeechRequestDataCollection - Data collection setting. If no available model provider meets the requirement, your request will return an error. +// - allow: (default) allow providers which store user data non-transiently and may train on it +// +// - deny: use only providers which do not collect user data. +type SpeechRequestDataCollection string + +const ( + SpeechRequestDataCollectionDeny SpeechRequestDataCollection = "deny" + SpeechRequestDataCollectionAllow SpeechRequestDataCollection = "allow" +) + +func (e SpeechRequestDataCollection) ToPointer() *SpeechRequestDataCollection { + return &e +} + +// IsExact returns true if the value matches a known enum value, false otherwise. +func (e *SpeechRequestDataCollection) IsExact() bool { + if e != nil { + switch *e { + case "deny", "allow": + return true + } + } + return false +} + +// SpeechRequestProvider - Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options type SpeechRequestProvider struct { + // Data collection setting. If no available model provider meets the requirement, your request will return an error. + // - allow: (default) allow providers which store user data non-transiently and may train on it + // + // - deny: use only providers which do not collect user data. + DataCollection optionalnullable.OptionalNullable[SpeechRequestDataCollection] `json:"data_collection,omitzero"` // Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped. Options *ProviderOptions `json:"options,omitzero"` + // Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. + Zdr optionalnullable.OptionalNullable[bool] `json:"zdr,omitzero"` } func (s SpeechRequestProvider) MarshalJSON() ([]byte, error) { @@ -23,6 +57,13 @@ func (s *SpeechRequestProvider) UnmarshalJSON(data []byte) error { return nil } +func (s *SpeechRequestProvider) GetDataCollection() optionalnullable.OptionalNullable[SpeechRequestDataCollection] { + if s == nil { + return nil + } + return s.DataCollection +} + func (s *SpeechRequestProvider) GetOptions() *ProviderOptions { if s == nil { return nil @@ -30,6 +71,13 @@ func (s *SpeechRequestProvider) GetOptions() *ProviderOptions { return s.Options } +func (s *SpeechRequestProvider) GetZdr() optionalnullable.OptionalNullable[bool] { + if s == nil { + return nil + } + return s.Zdr +} + // SpeechRequestResponseFormat - Audio output format type SpeechRequestResponseFormat string @@ -61,7 +109,7 @@ type SpeechRequest struct { InputReferences []SpeechInputReference `json:"input_references,omitzero"` // TTS model identifier Model string `json:"model"` - // Provider-specific passthrough configuration + // Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options Provider *SpeechRequestProvider `json:"provider,omitzero"` // Audio output format ResponseFormat *SpeechRequestResponseFormat `default:"pcm" json:"response_format"` diff --git a/models/components/sttrequest.go b/models/components/sttrequest.go index de5bac04..d680497c 100644 --- a/models/components/sttrequest.go +++ b/models/components/sttrequest.go @@ -4,12 +4,46 @@ package components import ( "github.com/OpenRouterTeam/go-sdk/internal/utils" + "github.com/OpenRouterTeam/go-sdk/optionalnullable" ) -// STTRequestProvider - Provider-specific passthrough configuration +// STTRequestDataCollection - Data collection setting. If no available model provider meets the requirement, your request will return an error. +// - allow: (default) allow providers which store user data non-transiently and may train on it +// +// - deny: use only providers which do not collect user data. +type STTRequestDataCollection string + +const ( + STTRequestDataCollectionDeny STTRequestDataCollection = "deny" + STTRequestDataCollectionAllow STTRequestDataCollection = "allow" +) + +func (e STTRequestDataCollection) ToPointer() *STTRequestDataCollection { + return &e +} + +// IsExact returns true if the value matches a known enum value, false otherwise. +func (e *STTRequestDataCollection) IsExact() bool { + if e != nil { + switch *e { + case "deny", "allow": + return true + } + } + return false +} + +// STTRequestProvider - Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options type STTRequestProvider struct { + // Data collection setting. If no available model provider meets the requirement, your request will return an error. + // - allow: (default) allow providers which store user data non-transiently and may train on it + // + // - deny: use only providers which do not collect user data. + DataCollection optionalnullable.OptionalNullable[STTRequestDataCollection] `json:"data_collection,omitzero"` // Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped. Options *ProviderOptions `json:"options,omitzero"` + // Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. + Zdr optionalnullable.OptionalNullable[bool] `json:"zdr,omitzero"` } func (s STTRequestProvider) MarshalJSON() ([]byte, error) { @@ -23,6 +57,13 @@ func (s *STTRequestProvider) UnmarshalJSON(data []byte) error { return nil } +func (s *STTRequestProvider) GetDataCollection() optionalnullable.OptionalNullable[STTRequestDataCollection] { + if s == nil { + return nil + } + return s.DataCollection +} + func (s *STTRequestProvider) GetOptions() *ProviderOptions { if s == nil { return nil @@ -30,6 +71,13 @@ func (s *STTRequestProvider) GetOptions() *ProviderOptions { return s.Options } +func (s *STTRequestProvider) GetZdr() optionalnullable.OptionalNullable[bool] { + if s == nil { + return nil + } + return s.Zdr +} + // STTRequestResponseFormat - Output format. "json" (default) returns { text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. type STTRequestResponseFormat string @@ -65,7 +113,7 @@ type STTRequest struct { Language *string `json:"language,omitzero"` // STT model identifier Model string `json:"model"` - // Provider-specific passthrough configuration + // Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options Provider *STTRequestProvider `json:"provider,omitzero"` // Output format. "json" (default) returns { text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. ResponseFormat *STTRequestResponseFormat `json:"response_format,omitzero"` diff --git a/models/operations/createaudiotranscriptionsmultipart.go b/models/operations/createaudiotranscriptionsmultipart.go index 30a0c49d..70ab2f54 100644 --- a/models/operations/createaudiotranscriptionsmultipart.go +++ b/models/operations/createaudiotranscriptionsmultipart.go @@ -82,7 +82,7 @@ type CreateAudioTranscriptionsMultipartRequest struct { Language *string `multipartForm:"name=language"` // The model to use for transcription. Model string `multipartForm:"name=model"` - // JSON-encoded provider preferences object, the same shape as the JSON body field: { "options": { "": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. + // JSON-encoded provider preferences object, the same shape as the JSON body field: { "zdr": true, "data_collection": "deny", "options": { "": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. Provider *string `multipartForm:"name=provider"` // The response format. "json" (default) returns { text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). ResponseFormat *ResponseFormat `multipartForm:"name=response_format"` diff --git a/openrouter.go b/openrouter.go index 980318b4..29cbbde1 100644 --- a/openrouter.go +++ b/openrouter.go @@ -220,9 +220,9 @@ func WithTimeout(timeout time.Duration) SDKOption { // New creates a new instance of the SDK with the provided options func New(opts ...SDKOption) *OpenRouter { sdk := &OpenRouter{ - SDKVersion: "0.9.21", + SDKVersion: "0.9.22", sdkConfiguration: config.SDKConfiguration{ - UserAgent: "speakeasy-sdk/go 0.9.21 2.914.0 1.0.0 github.com/OpenRouterTeam/go-sdk", + UserAgent: "speakeasy-sdk/go 0.9.22 2.914.0 1.0.0 github.com/OpenRouterTeam/go-sdk", Globals: globals.Globals{}, ServerList: ServerList, },