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
33 changes: 15 additions & 18 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: 35d51121d918704fef88834da31cf17f
docChecksum: e71afb9ad878a05d222a4282761dbce6
docVersion: 1.0.0
speakeasyVersion: 1.787.0
generationVersion: 2.914.0
releaseVersion: 0.8.29
configChecksum: 90372b2cd6c38293eeeff240334fdee6
releaseVersion: 0.8.30
configChecksum: 5fc33d577bb46ee461e52a903ef591c4
repoURL: https://github.com/OpenRouterTeam/go-sdk.git
installationURL: https://github.com/OpenRouterTeam/go-sdk
persistentEdits:
generation_id: 7960c5dd-56c0-4219-9b2e-aae097814e11
pristine_commit_hash: 2d094b0a688c977c999327c9212bc0e6fff2adb2
pristine_tree_hash: f173d48f7dba96ea361509e44dfe776e210d9796
generation_id: 4eb3c695-2737-4832-bed1-00ec0f03d4eb
pristine_commit_hash: ec96314eb0d3ae4000814186bfde3aa44e12062a
pristine_tree_hash: ddb52771dac7129c4e1df1bbae24949b89b9d865
features:
go:
acceptHeaders: 2.81.2
Expand Down Expand Up @@ -3408,8 +3408,8 @@ trackedFiles:
pristine_git_object: 591544620fc439f8aae66f093a244da810d051ea
docs/models/components/imagegenerationrequestaspectratio.mdx:
id: 57d69bdf90ec
last_write_checksum: sha1:662965fa8d23b3217c5e8ce24a65603b0bbfdb38
pristine_git_object: 42363e871999937a37d2626ae17fbbcb4ab8a952
last_write_checksum: sha1:ba394f074a6dd83bd62cd4b09734458f62d7ecfc
pristine_git_object: 872d99dcc9ae1066d0599856b23fe2dc14e5cbf4
docs/models/components/imagegenerationrequestbackground.mdx:
id: 08bcf5832adc
last_write_checksum: sha1:6da8e8b152df587a0d93a2859af9ff2513ac200e
Expand All @@ -3424,8 +3424,8 @@ trackedFiles:
pristine_git_object: 18ce714e4cd5a3a2fe942befe02d4628bcdc2f3e
docs/models/components/imagegenerationrequestresolution.mdx:
id: 648403136a6f
last_write_checksum: sha1:05e966a73c982323e16b1f0155d00acae59d2a46
pristine_git_object: 06aa727c875a810ac55e1eb43396e192deeb67a5
last_write_checksum: sha1:cbc122c7cd022c97ec796e7734e9e9fc7fb73320
pristine_git_object: f52053a72140a359e2aed2ba52b48bb02f83c715
docs/models/components/imagegenerationresponse.mdx:
id: 5cb833e1c00f
last_write_checksum: sha1:1f815a8e9d8e158e42cab4ddfa754248cdf9e7b3
Expand Down Expand Up @@ -10148,8 +10148,8 @@ trackedFiles:
pristine_git_object: d32db00fac32a531a438d6a467b94558acbd6d7f
models/components/imagegenerationrequest.go:
id: 2a1c3242c506
last_write_checksum: sha1:818ca6a56052a1de43a98e9d945f2701e059daf5
pristine_git_object: e437a97c86c1aac3c60974e1408ac68e2384d14d
last_write_checksum: sha1:85fea9ec1429d61b741d533b1ab9d65e2718b93d
pristine_git_object: e30a1ee882ec0d8655fe15920e3fcc7c17a3c864
models/components/imagegenerationresponse.go:
id: bfcc44d3ad67
last_write_checksum: sha1:6c133bc51c83d5747936cf1546933cf27c536099
Expand Down Expand Up @@ -12360,8 +12360,8 @@ trackedFiles:
pristine_git_object: 5e3a2cdf8cb4ed4f5378b712293cba9c82074f16
openrouter.go:
id: 207ad004b774
last_write_checksum: sha1:e988fea0dad1f67a3eea300740ca7261e0e696c1
pristine_git_object: e69105688acf085e8711684f6c557e0211e139b1
last_write_checksum: sha1:b8addeee8ea89364b3aef5434444b62382f80aba
pristine_git_object: c6b4f52dc37e38fa895bc53a16e8da048c551ffb
optionalnullable/optionalnullable.go:
id: ce60f259ead3
last_write_checksum: sha1:d6aff1a420c31e025ea21d46cf056e305ae76fe8
Expand Down Expand Up @@ -15777,7 +15777,4 @@ examples:
examplesVersion: 1.0.2
releaseNotes: |
## Go SDK Changes:
* `OpenRouter.Batch.List()`: **Added**
* `OpenRouter.Batch.CreateBatches()`: **Added**
* `OpenRouter.Batch.Delete()`: **Added**
* `OpenRouter.Batch.GetBatches()`: **Added**
* `OpenRouter.Images.Generate()`: `request.Request` **Changed**
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.8.29
version: 0.8.30
additionalDependencies: {}
baseErrorName: OpenRouterError
clientServerStatusCodesAsErrors: true
Expand Down
3 changes: 3 additions & 0 deletions .speakeasy/out.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12916,6 +12916,8 @@ components:
- '4:5'
- '5:2'
- '5:4'
- '5:7'
- '7:5'
- '8:1'
- '9:16'
- '16:9'
Expand Down Expand Up @@ -12989,6 +12991,7 @@ components:
description: 'Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider.'
enum:
- '512'
- '768'
- '1K'
- '2K'
- '4K'
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:cc63ac7c1ea19631a25df8c9ca6969d8919c599ff318e5ac013c841727dde6cf
sourceBlobDigest: sha256:c0930c55010ed48ffb36b565f0180b8cd3cf33ffa2ff576aa2496cc71826ea35
sourceRevisionDigest: sha256:0d02464066a2d5ace8b47865cdc534925cc0ffbeb3bf37bbb145bf5dd12ba9e7
sourceBlobDigest: sha256:14b78b380716a90a4034993cffa7de22e25f8524aee29ae65cd430270caf3a39
tags:
- latest
- 1.0.0
targets:
openrouter:
source: OpenRouter API
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:cc63ac7c1ea19631a25df8c9ca6969d8919c599ff318e5ac013c841727dde6cf
sourceBlobDigest: sha256:c0930c55010ed48ffb36b565f0180b8cd3cf33ffa2ff576aa2496cc71826ea35
sourceRevisionDigest: sha256:0d02464066a2d5ace8b47865cdc534925cc0ffbeb3bf37bbb145bf5dd12ba9e7
sourceBlobDigest: sha256:14b78b380716a90a4034993cffa7de22e25f8524aee29ae65cd430270caf3a39
codeSamplesNamespace: open-router-chat-completions-api-go-code-samples
codeSamplesRevisionDigest: sha256:2b679b486960d5d15cc129b00dd0d46e21d422b148ba8984f28f1af51fa74444
codeSamplesRevisionDigest: sha256:6bb0a934bedc92aef4db8fc929900011272bdefcf9b4ce5e7fae94898d2f924e
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.8.29
go get github.com/OpenRouterTeam/go-sdk@v0.8.30
```

**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.8.29
> go get github.com/OpenRouterTeam/go-sdk@v0.8.30
> ```

<!-- 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 @@ -2448,4 +2448,14 @@ Based on:
### Generated
- [go v0.8.29] .
### Releases
- [Go v0.8.29] https://github.com/OpenRouterTeam/go-sdk/releases/tag/v0.8.29 - .
- [Go v0.8.29] https://github.com/OpenRouterTeam/go-sdk/releases/tag/v0.8.29 - .

## 2026-09-25 23:05:52
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [go v0.8.30] .
### Releases
- [Go v0.8.30] https://github.com/OpenRouterTeam/go-sdk/releases/tag/v0.8.30 - .
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.8.29
go get github.com/OpenRouterTeam/go-sdk@v0.8.30

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

Expand Down
2 changes: 2 additions & 0 deletions docs/models/components/imagegenerationrequestaspectratio.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ custom := components.ImageGenerationRequestAspectRatio("custom_value")
| `ImageGenerationRequestAspectRatioFortyFive` | 4:5 |
| `ImageGenerationRequestAspectRatioFiftyTwo` | 5:2 |
| `ImageGenerationRequestAspectRatioFiftyFour` | 5:4 |
| `ImageGenerationRequestAspectRatioFiftySeven` | 5:7 |
| `ImageGenerationRequestAspectRatioSeventyFive` | 7:5 |
| `ImageGenerationRequestAspectRatioEightyOne` | 8:1 |
| `ImageGenerationRequestAspectRatioNineHundredAndSixteen` | 9:16 |
| `ImageGenerationRequestAspectRatioOneHundredAndSixtyNine` | 16:9 |
Expand Down
13 changes: 7 additions & 6 deletions docs/models/components/imagegenerationrequestresolution.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ custom := components.ImageGenerationRequestResolution("custom_value")

## Values

| Name | Value |
| ------------------------------------------------------ | ------------------------------------------------------ |
| `ImageGenerationRequestResolutionFiveHundredAndTwelve` | 512 |
| `ImageGenerationRequestResolutionOneK` | 1K |
| `ImageGenerationRequestResolutionTwoK` | 2K |
| `ImageGenerationRequestResolutionFourK` | 4K |
| Name | Value |
| ----------------------------------------------------------- | ----------------------------------------------------------- |
| `ImageGenerationRequestResolutionFiveHundredAndTwelve` | 512 |
| `ImageGenerationRequestResolutionSevenHundredAndSixtyEight` | 768 |
| `ImageGenerationRequestResolutionOneK` | 1K |
| `ImageGenerationRequestResolutionTwoK` | 2K |
| `ImageGenerationRequestResolutionFourK` | 4K |
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.8.29
// Output: 0.8.30
}

// 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.8.29
require github.com/OpenRouterTeam/go-sdk v0.8.30
```

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.8.29
go get github.com/OpenRouterTeam/go-sdk@v0.8.30
go run .
```

Expand Down
15 changes: 9 additions & 6 deletions models/components/imagegenerationrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const (
ImageGenerationRequestAspectRatioFortyFive ImageGenerationRequestAspectRatio = "4:5"
ImageGenerationRequestAspectRatioFiftyTwo ImageGenerationRequestAspectRatio = "5:2"
ImageGenerationRequestAspectRatioFiftyFour ImageGenerationRequestAspectRatio = "5:4"
ImageGenerationRequestAspectRatioFiftySeven ImageGenerationRequestAspectRatio = "5:7"
ImageGenerationRequestAspectRatioSeventyFive ImageGenerationRequestAspectRatio = "7:5"
ImageGenerationRequestAspectRatioEightyOne ImageGenerationRequestAspectRatio = "8:1"
ImageGenerationRequestAspectRatioNineHundredAndSixteen ImageGenerationRequestAspectRatio = "9:16"
ImageGenerationRequestAspectRatioOneHundredAndSixtyNine ImageGenerationRequestAspectRatio = "16:9"
Expand All @@ -44,7 +46,7 @@ func (e ImageGenerationRequestAspectRatio) ToPointer() *ImageGenerationRequestAs
func (e *ImageGenerationRequestAspectRatio) IsExact() bool {
if e != nil {
switch *e {
case "1:1", "1:2", "1:4", "1:8", "2:1", "2:3", "2.35:1", "3:2", "3:4", "4:1", "4:3", "4:5", "5:2", "5:4", "8:1", "9:16", "16:9", "9:19.5", "19.5:9", "9:20", "20:9", "9:21", "21:9", "auto":
case "1:1", "1:2", "1:4", "1:8", "2:1", "2:3", "2.35:1", "3:2", "3:4", "4:1", "4:3", "4:5", "5:2", "5:4", "5:7", "7:5", "8:1", "9:16", "16:9", "9:19.5", "19.5:9", "9:20", "20:9", "9:21", "21:9", "auto":
return true
}
}
Expand Down Expand Up @@ -131,10 +133,11 @@ func (e *ImageGenerationRequestQuality) IsExact() bool {
type ImageGenerationRequestResolution string

const (
ImageGenerationRequestResolutionFiveHundredAndTwelve ImageGenerationRequestResolution = "512"
ImageGenerationRequestResolutionOneK ImageGenerationRequestResolution = "1K"
ImageGenerationRequestResolutionTwoK ImageGenerationRequestResolution = "2K"
ImageGenerationRequestResolutionFourK ImageGenerationRequestResolution = "4K"
ImageGenerationRequestResolutionFiveHundredAndTwelve ImageGenerationRequestResolution = "512"
ImageGenerationRequestResolutionSevenHundredAndSixtyEight ImageGenerationRequestResolution = "768"
ImageGenerationRequestResolutionOneK ImageGenerationRequestResolution = "1K"
ImageGenerationRequestResolutionTwoK ImageGenerationRequestResolution = "2K"
ImageGenerationRequestResolutionFourK ImageGenerationRequestResolution = "4K"
)

func (e ImageGenerationRequestResolution) ToPointer() *ImageGenerationRequestResolution {
Expand All @@ -145,7 +148,7 @@ func (e ImageGenerationRequestResolution) ToPointer() *ImageGenerationRequestRes
func (e *ImageGenerationRequestResolution) IsExact() bool {
if e != nil {
switch *e {
case "512", "1K", "2K", "4K":
case "512", "768", "1K", "2K", "4K":
return true
}
}
Expand Down
18 changes: 2 additions & 16 deletions openrouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,6 @@ 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
Expand Down Expand Up @@ -228,9 +214,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.8.29",
SDKVersion: "0.8.30",
sdkConfiguration: config.SDKConfiguration{
UserAgent: "speakeasy-sdk/go 0.8.29 2.914.0 1.0.0 github.com/OpenRouterTeam/go-sdk",
UserAgent: "speakeasy-sdk/go 0.8.30 2.914.0 1.0.0 github.com/OpenRouterTeam/go-sdk",
Globals: globals.Globals{},
ServerList: ServerList,
},
Expand Down
Loading