diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 433467b1..ebd33166 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: f6287b44eec441ca9cbf10af1348f07e + docChecksum: ea28f73445d5aaf00200db46ac3c5ef3 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.9.8 - configChecksum: bfcebb1c4851823b945f667a6850f7b8 + releaseVersion: 0.9.9 + configChecksum: 04ef64a6bd1d23c094ab865366d391fa repoURL: https://github.com/OpenRouterTeam/go-sdk.git installationURL: https://github.com/OpenRouterTeam/go-sdk persistentEdits: - generation_id: 296c36d4-1b9c-4cb1-8686-ecdad7684599 - pristine_commit_hash: 587aa4716843881bc29e0a2067a0f71e8870ff92 - pristine_tree_hash: 63e694cfcf5ab707e1dd72787004f73f147fc19b + generation_id: cb3c1aa0-de9a-4ff1-a35a-71e0ddf12487 + pristine_commit_hash: eae091031016319c6a968f48dfe6afdfe3cf1e09 + pristine_tree_hash: 04c580c54522d695b17f24fbe1987c415878f579 features: go: acceptHeaders: 2.81.2 @@ -105,8 +105,8 @@ trackedFiles: pristine_git_object: 300f5ee15b73e7ecfd6b16e25d132ad1e4af8442 chat.go: id: 81535ccb3ff5 - last_write_checksum: sha1:bf12b147b40656ae0086e01601410f01ae94e039 - pristine_git_object: 3ec067932ab585739098c417f40010f895bed95e + last_write_checksum: sha1:3fe05c99a2a3f927bac689dc6dd9f0e6c51bc7b3 + pristine_git_object: fedc9b46b5d2a7a4fc521b1af68b563cf4e116d8 classifications.go: id: 711367120ab6 last_write_checksum: sha1:1503d324707d56ecefdc2ec29ada40857bbff956 @@ -6581,8 +6581,8 @@ trackedFiles: pristine_git_object: d11bcca08713060dd9e5b41ad311978fcabddfbf docs/models/components/speechrequest.mdx: id: 572bb1b07290 - last_write_checksum: sha1:d0111ebee077afcc88e88c106b10d0ffd7efe56e - pristine_git_object: 03bd63abed61b9e03665702d75c3d29b164af47d + last_write_checksum: sha1:cbef1f055fd6db8bd56d21b8bc5de3ccb6aa9420 + pristine_git_object: 22cc6b16ecf2e9673820f3fbfdad32ffc1020207 docs/models/components/speechrequestprovider.mdx: id: 70ddc64fe615 last_write_checksum: sha1:0b345acd1029103dca5e9dbe7e3480cad15266d7 @@ -11833,8 +11833,8 @@ trackedFiles: pristine_git_object: 282892fcabc303c6f383535c88d640ecd1bf35be models/components/speechrequest.go: id: c5f83d3285eb - last_write_checksum: sha1:599dbe517a8be002f7ae7a12c911aaffd6ae254b - pristine_git_object: e50e827a82fd4fe04967bf53fbda14d27764b94c + last_write_checksum: sha1:84c62bd8941851aad6b3f2bd3fdc6ddc93540543 + pristine_git_object: a0609b62ced0f9cdb40fae551206c6266ee35a73 models/components/stopservertoolswhencondition.go: id: 6c12d61377dc last_write_checksum: sha1:600037f2c92bb83b31cc6469a5ce9a169ee82b09 @@ -12913,8 +12913,8 @@ trackedFiles: pristine_git_object: 5e3a2cdf8cb4ed4f5378b712293cba9c82074f16 openrouter.go: id: 207ad004b774 - last_write_checksum: sha1:b850529c36cacc083c65d841d8abd21bc594f8b0 - pristine_git_object: ef00634cbed3b5a1c57fa2950a862eff826e6781 + last_write_checksum: sha1:06474f4f87f7096780907fdb3dafc13f2841bb5f + pristine_git_object: eda1b766ba47965f651ae75830245513c88d6a98 optionalnullable/optionalnullable.go: id: ce60f259ead3 last_write_checksum: sha1:d6aff1a420c31e025ea21d46cf056e305ae76fe8 @@ -16798,7 +16798,3 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: | - ## Go SDK Changes: - * `OpenRouter.Tools.ListTools()`: **Added** - * `OpenRouter.Tools.GetTool()`: **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 4b370045..86fc992c 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true go: - version: 0.9.8 + version: 0.9.9 additionalDependencies: {} baseErrorName: OpenRouterError clientServerStatusCodesAsErrors: true diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 032c1370..05a92bbf 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -28405,7 +28405,7 @@ components: maxLength: 256 type: 'string' speed: - description: 'Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers.' + description: '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.' example: 1 format: 'double' type: 'number' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 8f0e708d..42d95b40 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:db2283c5cdc8d6469924f497c85210ea2ac9060b28c79fba996852a0926ab9ce - sourceBlobDigest: sha256:ba113aff532fbcc75a71f9dcf99d3b4e88c5dce39d7331f9e806a59d946b442a + sourceRevisionDigest: sha256:8a427f5d7fc1e0ef614462d1fdcbda3eb601e25cb6a63c9f419224de83b15d47 + sourceBlobDigest: sha256:ce7769e5f691b863f0c923c61a1bce14276837303a8b2392030410e09c7b6375 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: openrouter: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:db2283c5cdc8d6469924f497c85210ea2ac9060b28c79fba996852a0926ab9ce - sourceBlobDigest: sha256:ba113aff532fbcc75a71f9dcf99d3b4e88c5dce39d7331f9e806a59d946b442a + sourceRevisionDigest: sha256:8a427f5d7fc1e0ef614462d1fdcbda3eb601e25cb6a63c9f419224de83b15d47 + sourceBlobDigest: sha256:ce7769e5f691b863f0c923c61a1bce14276837303a8b2392030410e09c7b6375 codeSamplesNamespace: open-router-chat-completions-api-go-code-samples - codeSamplesRevisionDigest: sha256:22269985c136aa58cfea5c13f05342d3bb6db3db3acebac7bcd2da81f0f380e6 + codeSamplesRevisionDigest: sha256:e57d80e08cf6a69c8b00ba70c4674fe199c2220f22f4ff5ca419abc7782bc40a workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/OVERVIEW.md b/OVERVIEW.md index a1b7e509..863c1c3f 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.8 +go get github.com/OpenRouterTeam/go-sdk@v0.9.9 ``` **Requirements:** Go 1.25 or higher diff --git a/README.md b/README.md index 7274be45..27146366 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.8 +> go get github.com/OpenRouterTeam/go-sdk@v0.9.9 > ``` diff --git a/RELEASES.md b/RELEASES.md index 7bcb0bc0..07314df4 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2598,4 +2598,14 @@ Based on: ### Generated - [go v0.9.8] . ### Releases -- [Go v0.9.8] https://github.com/OpenRouterTeam/go-sdk/releases/tag/v0.9.8 - . \ No newline at end of file +- [Go v0.9.8] https://github.com/OpenRouterTeam/go-sdk/releases/tag/v0.9.8 - . + +## 2026-09-30 00:01:37 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.9.9] . +### Releases +- [Go v0.9.9] https://github.com/OpenRouterTeam/go-sdk/releases/tag/v0.9.9 - . \ No newline at end of file diff --git a/chat.go b/chat.go index 3ec06793..fedc9b46 100644 --- a/chat.go +++ b/chat.go @@ -18,20 +18,6 @@ import ( "net/url" ) -// Chat - Stream a chat completion with an intern -// Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern. -// -// Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk. -// -// To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline. -// -// Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The stream writes a `: keepalive` comment whenever nothing else has been written for 30 seconds, so a disconnect is noticed within that interval even while the intern is silent. -// -// A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event. -// -// Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts. -// -// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`. type Chat struct { rootSDK *OpenRouter sdkConfiguration config.SDKConfiguration diff --git a/doc.go b/doc.go index 3ad9e44a..11550f45 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.8 + go get github.com/OpenRouterTeam/go-sdk@v0.9.9 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 03bd63ab..22cc6b16 100644 --- a/docs/models/components/speechrequest.mdx +++ b/docs/models/components/speechrequest.mdx @@ -15,7 +15,7 @@ Text-to-speech request input | `Provider` | [*components.SpeechRequestProvider](../../models/components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | | `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. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. | 1 | +| `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 | | `Trace` | [*components.TraceConfig](../../models/components/traceconfig.mdx) | :heavy_minus_sign: | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | \{
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
} | | `User` | `*string` | :heavy_minus_sign: | A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider. | user-1234 | | `Voice` | `*string` | :heavy_minus_sign: | Voice identifier (provider-specific). | en_paul_neutral | \ No newline at end of file diff --git a/example_test.go b/example_test.go index b3408852..5ff84ca4 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.8 + // Output: 0.9.9 } // Example demonstrates basic usage of the OpenRouter SDK for chat completions. diff --git a/examples/README.md b/examples/README.md index 63c91175..59f3969e 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.8 +require github.com/OpenRouterTeam/go-sdk v0.9.9 ``` 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.8 +go get github.com/OpenRouterTeam/go-sdk@v0.9.9 go run . ``` diff --git a/models/components/speechrequest.go b/models/components/speechrequest.go index e50e827a..a0609b62 100644 --- a/models/components/speechrequest.go +++ b/models/components/speechrequest.go @@ -67,7 +67,7 @@ type SpeechRequest struct { ResponseFormat *SpeechRequestResponseFormat `default:"pcm" json:"response_format"` // 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. SessionID *string `json:"session_id,omitzero"` - // Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. + // 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. Speed *float64 `json:"speed,omitzero"` // Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. Trace *TraceConfig `json:"trace,omitzero"` diff --git a/openrouter.go b/openrouter.go index ef00634c..eda1b766 100644 --- a/openrouter.go +++ b/openrouter.go @@ -232,9 +232,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.8", + SDKVersion: "0.9.9", sdkConfiguration: config.SDKConfiguration{ - UserAgent: "speakeasy-sdk/go 0.9.8 2.914.0 1.0.0 github.com/OpenRouterTeam/go-sdk", + UserAgent: "speakeasy-sdk/go 0.9.9 2.914.0 1.0.0 github.com/OpenRouterTeam/go-sdk", Globals: globals.Globals{}, ServerList: ServerList, },