Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
lockVersion: 2.0.0
id: 9eea3e30-2722-4060-973b-57b7f1f75dc0
management:
docChecksum: 3d5ada548d4f46175e971e318342a856
docChecksum: 152801ba65a086577f0868a7157e824f
docVersion: 1.0.0
speakeasyVersion: 1.787.0
generationVersion: 2.914.0
releaseVersion: 0.9.39
configChecksum: 822e38092ee4090725a96fbe6b60d0aa
releaseVersion: 0.9.40
configChecksum: 16681185d66ee22c4ea535985ddb0fff
repoURL: https://github.com/OpenRouterTeam/go-sdk.git
installationURL: https://github.com/OpenRouterTeam/go-sdk
persistentEdits:
generation_id: 8b8d2c82-b892-4488-8c68-a271483fd28e
pristine_commit_hash: b47cd5df18ec0830f5d3e30f7f52552e90f15b2e
pristine_tree_hash: ffa988c274b1cc5b7ea18c368d397cbc2aabd2ea
generation_id: b8386591-bbe1-4f48-8f1c-f02332b78ee9
pristine_commit_hash: 3f5b756b412557e6f1d5646e052958c6802369a5
pristine_tree_hash: c7572ffa741a927ce28eb269661809030309183b
features:
go:
acceptHeaders: 2.81.2
Expand Down Expand Up @@ -81,8 +81,8 @@ trackedFiles:
pristine_git_object: 19cafdf94c8623199653cce8f3d90e2dceec2348
apikeys.go:
id: 8baafe5dc76e
last_write_checksum: sha1:d285e2245720832622d899c9dcf76727ac695365
pristine_git_object: add418e98163433ad044968d604c1d656d015a1a
last_write_checksum: sha1:5997710d0d25a8497b7e8c45be2bfa8b696e1cfa
pristine_git_object: ac5d82bd7ba64e8df5647615af36a21fce09d4ff
batch.go:
id: f0580a64f821
last_write_checksum: sha1:e665d74307f94d032221149976b1d0c7850f3e24
Expand All @@ -105,8 +105,8 @@ trackedFiles:
pristine_git_object: a2e44316e3d85259a78edd2f1f8443abb967892c
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
Expand Down Expand Up @@ -9229,8 +9229,8 @@ trackedFiles:
pristine_git_object: 84d83302a14fcf3cfda0caff3b3d2d5d5028bc71
docs/sdks/apikeys/README.mdx:
id: 27fcaae1c346
last_write_checksum: sha1:5366a46528638b28fb4aceb7b5de872fdd873b2c
pristine_git_object: f2d671a76d5e8defce6bc68eefbefe186d2cb53b
last_write_checksum: sha1:991161b72115b14ac37a0edfe5eb0c70116664f0
pristine_git_object: 82741de770e0e8b724e060212b47875bde68e602
docs/sdks/batch/README.mdx:
id: e367aa4f4295
last_write_checksum: sha1:3c3f1d13862f80193d7d2a3e984df38a9c906d91
Expand Down Expand Up @@ -13509,8 +13509,8 @@ trackedFiles:
pristine_git_object: 5e3a2cdf8cb4ed4f5378b712293cba9c82074f16
openrouter.go:
id: 207ad004b774
last_write_checksum: sha1:de8d47cdaea09f7fadcb0ca083560ee10cf6721b
pristine_git_object: 9a5419707442ca5d29b9ad3d2e7bbf388ba2c656
last_write_checksum: sha1:74b74a7dcf6d3151895ceddde35eaaa08cdd627c
pristine_git_object: df2f98ff45fa57acfd0639fa58b2ece90d57b66d
optionalnullable/optionalnullable.go:
id: ce60f259ead3
last_write_checksum: sha1:d6aff1a420c31e025ea21d46cf056e305ae76fe8
Expand Down Expand Up @@ -17563,4 +17563,3 @@ examples:
"500":
application/json: {"error": {"code": 404, "message": "Intern not found"}}
examplesVersion: 1.0.2
releaseNotes: "## Go SDK Changes:\n* `OpenRouter.ApiKeys.Update()`: \n * `request.RequestBody.WorkspaceId` **Added**\n * `error` **Changed**\n"
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ generation:
documentation: mintlify
preApplyUnionDiscriminators: true
go:
version: 0.9.39
version: 0.9.40
additionalDependencies: {}
baseErrorName: OpenRouterError
clientServerStatusCodesAsErrors: true
Expand Down
10 changes: 5 additions & 5 deletions .speakeasy/out.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39867,7 +39867,7 @@ paths:
message: 'Only management keys can perform this operation'
schema:
$ref: '#/components/schemas/ForbiddenResponse'
description: 'The workspace is not owned by this account, or the guardrail would give a HIPAA-enabled workspace a person-name or address sensitive-info filter, which is not available there.'
description: 'The workspace is not owned by this account, or the workspace does not allow a person-name or address sensitive-info filter.'
'500':
content:
application/json:
Expand Down Expand Up @@ -40094,7 +40094,7 @@ paths:
message: 'Only management keys can perform this operation'
schema:
$ref: '#/components/schemas/ForbiddenResponse'
description: 'The update would give a HIPAA-enabled workspace a person-name or address sensitive-info filter, which is not available there.'
description: 'The update would add a person-name or address sensitive-info filter to a workspace that does not allow it.'
'404':
content:
application/json:
Expand Down Expand Up @@ -40288,7 +40288,7 @@ paths:
message: 'Only management keys can perform this operation'
schema:
$ref: '#/components/schemas/ForbiddenResponse'
description: 'The guardrail has no workspace and carries a person-name or address sensitive-info filter, and at least one target key belongs to a HIPAA-enabled workspace, where that filter is not available.'
description: 'The guardrail has no workspace and carries a person-name or address sensitive-info filter, and at least one target key belongs to a workspace that does not allow that filter.'
'404':
content:
application/json:
Expand Down Expand Up @@ -41337,7 +41337,7 @@ paths:
retryable: false
schema:
$ref: '#/components/schemas/InternLifecycleError'
description: 'The key acts as an organization and has no member who can own the intern, the workspace does not allow interns (a HIPAA workspace), or regional access is refused.'
description: 'The key acts as an organization and has no member who can own the intern, the workspace does not allow interns, or regional access is refused.'
'404':
content:
application/json:
Expand Down Expand Up @@ -44488,7 +44488,7 @@ paths:
- 'API Keys'
x-speakeasy-name-override: 'get'
patch:
description: "Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).\n\nSet `workspace_id` to move the key to another workspace. The key keeps its value, and any other fields in the same request are applied atomically with the move. Guardrail selections move with the key; other workspace-scoped settings (presets, BYOK keys, broadcast destinations, routing rules) do not. A move into or out of a HIPAA workspace is refused with `403`. In an organization, if the key's creator is not a member of a non-default target workspace, the request fails with `409`; add them to the workspace first.\n\n<Warning>\nThe request body accepts only the fields listed below, and unrecognized fields are ignored. If the body contains none of the accepted fields, the request fails with `400` and the message `No update fields provided`.\n</Warning>"
description: "Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).\n\nSet `workspace_id` to move the key to another workspace.\n\n<Warning>\nThe request body accepts only the fields listed below, and unrecognized fields are ignored. If the body contains none of the accepted fields, the request fails with `400` and the message `No update fields provided`.\n</Warning>"
operationId: 'updateKeys'
parameters:
- description: 'The hash identifier of the API key to update'
Expand Down
10 changes: 5 additions & 5 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ speakeasyVersion: 1.787.0
sources:
OpenRouter API:
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:c0b72a3547a9bab0db7a313b62416c81d0e027e761b1d29f69ae43630bbf59da
sourceBlobDigest: sha256:5c3eb90656b98ad8b0c96d72d5492d7ef61aa94705134dfa68aa435da6973c94
sourceRevisionDigest: sha256:3e33baacaf1144a7b25f32874c8ed496aac504ce541bcacf5fc32f00269cb842
sourceBlobDigest: sha256:39c1d07e48272c96589f9987706b41188070889733a80c0ab46388f834d35359
tags:
- latest
- 1.0.0
targets:
openrouter:
source: OpenRouter API
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:c0b72a3547a9bab0db7a313b62416c81d0e027e761b1d29f69ae43630bbf59da
sourceBlobDigest: sha256:5c3eb90656b98ad8b0c96d72d5492d7ef61aa94705134dfa68aa435da6973c94
sourceRevisionDigest: sha256:3e33baacaf1144a7b25f32874c8ed496aac504ce541bcacf5fc32f00269cb842
sourceBlobDigest: sha256:39c1d07e48272c96589f9987706b41188070889733a80c0ab46388f834d35359
codeSamplesNamespace: open-router-chat-completions-api-go-code-samples
codeSamplesRevisionDigest: sha256:71af6dcbbccf798bee36017e181ae306ba04b2db592073ca296d43c64e78f41d
codeSamplesRevisionDigest: sha256:514b82f04b3f4a39a9ba6f0625682a71d289500174c163e336df2e9b4651ce5e
workflow:
workflowVersion: 1.0.0
speakeasyVersion: 1.787.0
Expand Down
2 changes: 1 addition & 1 deletion OVERVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.39
go get github.com/OpenRouterTeam/go-sdk@v0.9.40
```

**Requirements:** Go 1.25 or higher
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.39
> go get github.com/OpenRouterTeam/go-sdk@v0.9.40
> ```

<!-- No Summary [summary] -->
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2908,4 +2908,14 @@ Based on:
### Generated
- [go v0.9.39] .
### Releases
- [Go v0.9.39] https://github.com/OpenRouterTeam/go-sdk/releases/tag/v0.9.39 - .
- [Go v0.9.39] https://github.com/OpenRouterTeam/go-sdk/releases/tag/v0.9.39 - .

## 2026-10-09 19:03:57
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [go v0.9.40] .
### Releases
- [Go v0.9.40] https://github.com/OpenRouterTeam/go-sdk/releases/tag/v0.9.40 - .
2 changes: 1 addition & 1 deletion apikeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,7 @@ func (s *APIKeys) Get(ctx context.Context, hash string, opts ...operations.Optio
// Update an API key
// Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).
//
// Set `workspace_id` to move the key to another workspace. The key keeps its value, and any other fields in the same request are applied atomically with the move. Guardrail selections move with the key; other workspace-scoped settings (presets, BYOK keys, broadcast destinations, routing rules) do not. A move into or out of a HIPAA workspace is refused with `403`. In an organization, if the key's creator is not a member of a non-default target workspace, the request fails with `409`; add them to the workspace first.
// Set `workspace_id` to move the key to another workspace.
//
// <Warning>
// The request body accepts only the fields listed below, and unrecognized fields are ignored. If the body contains none of the accepted fields, the request fails with `400` and the message `No update fields provided`.
Expand Down
14 changes: 14 additions & 0 deletions chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.39
go get github.com/OpenRouterTeam/go-sdk@v0.9.40

For full API documentation, visit: https://openrouter.ai/docs/client-sdks/go/overview

Expand Down
2 changes: 1 addition & 1 deletion docs/sdks/apikeys/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func main() {

Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).

Set `workspace_id` to move the key to another workspace. The key keeps its value, and any other fields in the same request are applied atomically with the move. Guardrail selections move with the key; other workspace-scoped settings (presets, BYOK keys, broadcast destinations, routing rules) do not. A move into or out of a HIPAA workspace is refused with `403`. In an organization, if the key's creator is not a member of a non-default target workspace, the request fails with `409`; add them to the workspace first.
Set `workspace_id` to move the key to another workspace.

\<Warning>
The request body accepts only the fields listed below, and unrecognized fields are ignored. If the body contains none of the accepted fields, the request fails with `400` and the message `No update fields provided`.
Expand Down
2 changes: 1 addition & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func ExampleNew() {
openrouter.WithSecurity("your-api-key"),
)
fmt.Println(sdk.SDKVersion)
// Output: 0.9.39
// Output: 0.9.40
}

// Example demonstrates basic usage of the OpenRouter SDK for chat completions.
Expand Down
4 changes: 2 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ cd ../generation && go run .
Each example pins a released SDK version in `go.mod`:

```go
require github.com/OpenRouterTeam/go-sdk v0.9.39
require github.com/OpenRouterTeam/go-sdk v0.9.40
```

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.

To use a different version:

```bash
go get github.com/OpenRouterTeam/go-sdk@v0.9.39
go get github.com/OpenRouterTeam/go-sdk@v0.9.40
go run .
```

Expand Down
4 changes: 2 additions & 2 deletions openrouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,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.39",
SDKVersion: "0.9.40",
sdkConfiguration: config.SDKConfiguration{
UserAgent: "speakeasy-sdk/go 0.9.39 2.914.0 1.0.0 github.com/OpenRouterTeam/go-sdk",
UserAgent: "speakeasy-sdk/go 0.9.40 2.914.0 1.0.0 github.com/OpenRouterTeam/go-sdk",
Globals: globals.Globals{},
ServerList: ServerList,
},
Expand Down