From 28b408c6ac5a464366c11986f73f45f893b1cd6c Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Fri, 2 Oct 2026 13:02:45 +0000 Subject: [PATCH 1/2] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.787.0 --- .speakeasy/gen.lock | 20 ++++++++++---------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 2 +- .speakeasy/workflow.lock | 10 +++++----- RELEASES.md | 12 +++++++++++- chat.go | 14 ++++++++++++++ openrouter.go | 18 ++++++++++++++++-- 7 files changed, 58 insertions(+), 20 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 78df92cc..86a714f7 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: 1e710052958e02f0dcf0673f2a18a150 + docChecksum: e0679e5a284910df5d3e3ac0ee007f80 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.9.19 - configChecksum: 6b1f31b92c372d991ab35dd71836a6b4 + releaseVersion: 0.9.20 + configChecksum: 325a5d0965070972fc9bf176d389cc4c repoURL: https://github.com/OpenRouterTeam/go-sdk.git installationURL: https://github.com/OpenRouterTeam/go-sdk persistentEdits: - generation_id: cb39fe22-aae9-4468-b3c3-218ffc2db66d - pristine_commit_hash: c76773a21671361aef2077c85c63fc6a36ca8a57 - pristine_tree_hash: 05f134fe8c97a61dfddd29e5e21821d1c57555d0 + generation_id: 8ba0bdae-f657-4dc6-9d68-c5924aed81c1 + pristine_commit_hash: 50cb333124075eb2f2bd0f6791fdf7fbb6f46cab + pristine_tree_hash: 44a355f319846f0dc4e2b7cfcaa793662000ca15 features: go: acceptHeaders: 2.81.2 @@ -105,8 +105,8 @@ trackedFiles: pristine_git_object: 300f5ee15b73e7ecfd6b16e25d132ad1e4af8442 chat.go: id: 81535ccb3ff5 - last_write_checksum: sha1:3fe05c99a2a3f927bac689dc6dd9f0e6c51bc7b3 - pristine_git_object: fedc9b46b5d2a7a4fc521b1af68b563cf4e116d8 + last_write_checksum: sha1:bf12b147b40656ae0086e01601410f01ae94e039 + pristine_git_object: 3ec067932ab585739098c417f40010f895bed95e classifications.go: id: 711367120ab6 last_write_checksum: sha1:1503d324707d56ecefdc2ec29ada40857bbff956 @@ -13361,8 +13361,8 @@ trackedFiles: pristine_git_object: 5e3a2cdf8cb4ed4f5378b712293cba9c82074f16 openrouter.go: id: 207ad004b774 - last_write_checksum: sha1:192c8a66f4560a2853d4b596ef4233f3fed12c7f - pristine_git_object: edb55991440b48a25c1b08b0de5a9fc53294d3a9 + last_write_checksum: sha1:2c615e8da0b5eed45ba80d026fb0516dccac2ad5 + pristine_git_object: 302b1b8a7852a235c71e693f5987e175f565043d optionalnullable/optionalnullable.go: id: ce60f259ead3 last_write_checksum: sha1:d6aff1a420c31e025ea21d46cf056e305ae76fe8 diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 29aa5fe3..9d4399a4 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true go: - version: 0.9.19 + version: 0.9.20 additionalDependencies: {} baseErrorName: OpenRouterError clientServerStatusCodesAsErrors: true diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 3dd7ca3f..33196ee2 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -8831,7 +8831,7 @@ components: items: maxLength: 253 minLength: 1 - pattern: '^[a-z0-9*]([a-z0-9*-]{0,61}[a-z0-9*])?(\.[a-z0-9*]([a-z0-9*-]{0,61}[a-z0-9*])?)*$' + pattern: '^(?![-.])(?!.*[-.]$)(?!.*(?:\.\.|\.-|-\.))(?!.*[^.]{64})[a-z0-9*.-]+$' type: 'string' maxItems: 50 minItems: 1 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index b47647d0..d2926861 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:da24a30764520f9d081b7274222096914bccf90e13484b41e07ad7b3ec6ccf9c - sourceBlobDigest: sha256:3acb49e4b342ce1ce1deb505ab219ccae77035d8bd3f7e1aaa85c6c5641c84b1 + sourceRevisionDigest: sha256:0909671576c07e1a0bd2f2acc73f91ed68fc2e5932008c9167b22c4c231b54db + sourceBlobDigest: sha256:073568cfc022ee43c266b54e5e31372f20f801686f0587de4fe572cf431968be tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: openrouter: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:da24a30764520f9d081b7274222096914bccf90e13484b41e07ad7b3ec6ccf9c - sourceBlobDigest: sha256:3acb49e4b342ce1ce1deb505ab219ccae77035d8bd3f7e1aaa85c6c5641c84b1 + sourceRevisionDigest: sha256:0909671576c07e1a0bd2f2acc73f91ed68fc2e5932008c9167b22c4c231b54db + sourceBlobDigest: sha256:073568cfc022ee43c266b54e5e31372f20f801686f0587de4fe572cf431968be codeSamplesNamespace: open-router-chat-completions-api-go-code-samples - codeSamplesRevisionDigest: sha256:6f5fcc2173f5061857f4f64d11b0009625fea5010bfbce084e29fbb86b0b8b6f + codeSamplesRevisionDigest: sha256:d05e11a65b54001a21f135bffbf8bf474293acaf7ba39e6571dba47219d955af workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index f11cfa93..439d1b95 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2708,4 +2708,14 @@ Based on: ### Generated - [go v0.9.19] . ### Releases -- [Go v0.9.19] https://github.com/OpenRouterTeam/go-sdk/releases/tag/v0.9.19 - . \ No newline at end of file +- [Go v0.9.19] https://github.com/OpenRouterTeam/go-sdk/releases/tag/v0.9.19 - . + +## 2026-10-02 12:57:42 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.9.20] . +### Releases +- [Go v0.9.20] https://github.com/OpenRouterTeam/go-sdk/releases/tag/v0.9.20 - . \ No newline at end of file diff --git a/chat.go b/chat.go index fedc9b46..3ec06793 100644 --- a/chat.go +++ b/chat.go @@ -18,6 +18,20 @@ 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/openrouter.go b/openrouter.go index edb55991..302b1b8a 100644 --- a/openrouter.go +++ b/openrouter.go @@ -73,6 +73,20 @@ type OpenRouter struct { Benchmarks *Benchmarks // BYOK endpoints BYOK *BYOK + // 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`. Chat *Chat // Task classification market-share endpoints Classifications *Classifications @@ -220,9 +234,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.19", + SDKVersion: "0.9.20", sdkConfiguration: config.SDKConfiguration{ - UserAgent: "speakeasy-sdk/go 0.9.19 2.914.0 1.0.0 github.com/OpenRouterTeam/go-sdk", + UserAgent: "speakeasy-sdk/go 0.9.20 2.914.0 1.0.0 github.com/OpenRouterTeam/go-sdk", Globals: globals.Globals{}, ServerList: ServerList, }, From 517fdd2b9d474305fbbca4ff7e759749b1622a6f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 2 Oct 2026 13:05:18 +0000 Subject: [PATCH 2/2] docs: sync install snippets to v0.9.20 --- OVERVIEW.md | 2 +- README.md | 2 +- doc.go | 2 +- example_test.go | 2 +- examples/README.md | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OVERVIEW.md b/OVERVIEW.md index 5d42c885..b0016e49 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.19 +go get github.com/OpenRouterTeam/go-sdk@v0.9.20 ``` **Requirements:** Go 1.25 or higher diff --git a/README.md b/README.md index ca226741..31ef7082 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.19 +> go get github.com/OpenRouterTeam/go-sdk@v0.9.20 > ``` diff --git a/doc.go b/doc.go index a8472a93..4f34b2f3 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.19 + go get github.com/OpenRouterTeam/go-sdk@v0.9.20 For full API documentation, visit: https://openrouter.ai/docs/client-sdks/go/overview diff --git a/example_test.go b/example_test.go index bb91f281..4e273756 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.19 + // Output: 0.9.20 } // Example demonstrates basic usage of the OpenRouter SDK for chat completions. diff --git a/examples/README.md b/examples/README.md index f5ddd9dc..5f7181b1 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.19 +require github.com/OpenRouterTeam/go-sdk v0.9.20 ``` 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.19 +go get github.com/OpenRouterTeam/go-sdk@v0.9.20 go run . ```