Skip to content

Commit d2b5543

Browse files
committed
fixes
1 parent 4e57099 commit d2b5543

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+687
-331
lines changed

.speakeasy/gen.lock

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
lockVersion: 2.0.0
22
id: 8b6cd71c-ea04-44da-af45-e43968b5928d
33
management:
4-
docChecksum: 84232fbdd2d267684e96d466dd089ae6
4+
docChecksum: d1ed8e0c3d150ef9c912570f5a0752da
55
docVersion: 1.0.0
66
speakeasyVersion: 1.622.2
77
generationVersion: 2.711.4
8-
releaseVersion: 0.0.0-beta.2
9-
configChecksum: 8cdaeaf188a03d971cb25f6f0714872e
8+
releaseVersion: 0.0.0-beta.4
9+
configChecksum: 5e75e51e8602d29a1656c3f0fb6ce03f
1010
repoURL: https://github.com/OpenRouterTeam/typescript-sdk.git
1111
installationURL: https://github.com/OpenRouterTeam/typescript-sdk
1212
published: true
@@ -24,9 +24,11 @@ features:
2424
envVarSecurityUsage: 0.1.2
2525
globalSecurity: 2.82.14
2626
globalSecurityCallbacks: 0.1.0
27+
globalSecurityFlattening: 0.1.0
2728
globalServerURLs: 2.82.5
2829
groups: 2.81.2
2930
methodArguments: 0.1.2
31+
methodSecurity: 2.82.6
3032
nameOverrides: 2.81.2
3133
nullables: 0.1.1
3234
reactQueryHooks: 0.2.3
@@ -74,6 +76,7 @@ generatedFiles:
7476
- docs/models/chatstreamingresponsechunkerror.md
7577
- docs/models/chatstreamoptions.md
7678
- docs/models/code.md
79+
- docs/models/codeenum.md
7780
- docs/models/completiontokensdetails.md
7881
- docs/models/data.md
7982
- docs/models/detail.md
@@ -218,6 +221,7 @@ generatedFiles:
218221
- docs/models/operations/getmodelsuserprompt.md
219222
- docs/models/operations/getmodelsuserresponse.md
220223
- docs/models/operations/getmodelsuserresponsebody.md
224+
- docs/models/operations/getmodelsusersecurity.md
221225
- docs/models/operations/getmodelsusersupportedparameter.md
222226
- docs/models/operations/getmodelsusertokenizer.md
223227
- docs/models/operations/getmodelsusertopprovider.md
@@ -228,6 +232,7 @@ generatedFiles:
228232
- docs/models/operations/getparametersauthorslugrequest.md
229233
- docs/models/operations/getparametersauthorslugresponse.md
230234
- docs/models/operations/getparametersauthorslugresponsebody.md
235+
- docs/models/operations/getparametersauthorslugsecurity.md
231236
- docs/models/operations/getparametersauthorslugsupportedparameter.md
232237
- docs/models/operations/getprovidersdata.md
233238
- docs/models/operations/getprovidersresponse.md
@@ -254,6 +259,7 @@ generatedFiles:
254259
- docs/models/operations/postcreditscoinbaserequest.md
255260
- docs/models/operations/postcreditscoinbaseresponse.md
256261
- docs/models/operations/postcreditscoinbaseresponsebody.md
262+
- docs/models/operations/postcreditscoinbasesecurity.md
257263
- docs/models/operations/postembeddingsaudio.md
258264
- docs/models/operations/postembeddingscompletion.md
259265
- docs/models/operations/postembeddingsdata.md

.speakeasy/gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ generation:
2727
generateNewTests: true
2828
skipResponseBodyAssertions: false
2929
typescript:
30-
version: 0.0.0-beta.2
30+
version: 0.0.0-beta.4
3131
additionalDependencies:
3232
dependencies: {}
3333
devDependencies: {}

.speakeasy/in.openapi.yaml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,9 @@ components:
744744
type: string
745745
const: chat.completion
746746
system_fingerprint:
747-
type: string
747+
type:
748+
- string
749+
- 'null'
748750
usage:
749751
$ref: '#/components/schemas/ChatGenerationTokenUsage'
750752
required:
@@ -760,9 +762,10 @@ components:
760762
type: object
761763
properties:
762764
code:
763-
type:
764-
- string
765-
- 'null'
765+
anyOf:
766+
- type: string
767+
- type: number
768+
- type: 'null'
766769
message:
767770
type: string
768771
param:
@@ -866,7 +869,9 @@ components:
866869
type: string
867870
const: chat.completion.chunk
868871
system_fingerprint:
869-
type: string
872+
type:
873+
- string
874+
- 'null'
870875
error:
871876
type: object
872877
properties:
@@ -889,15 +894,10 @@ components:
889894
- data
890895
parameters: {}
891896
securitySchemes:
892-
bearer:
897+
apiKey:
893898
type: http
894899
scheme: bearer
895900
description: API key as bearer token in Authorization header
896-
apiKey:
897-
type: apiKey
898-
in: header
899-
name: Authorization
900-
description: API key with "Bearer " prefix
901901
paths:
902902
/activity:
903903
get:
@@ -3829,7 +3829,6 @@ servers:
38293829
x-speakeasy-server-id: production
38303830
security:
38313831
- apiKey: []
3832-
- bearer: []
38333832
externalDocs:
38343833
description: OpenRouter Documentation
38353834
url: https://openrouter.ai/docs

.speakeasy/out.openapi.yaml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,9 @@ components:
744744
type: string
745745
const: chat.completion
746746
system_fingerprint:
747-
type: string
747+
type:
748+
- string
749+
- 'null'
748750
usage:
749751
$ref: '#/components/schemas/ChatGenerationTokenUsage'
750752
required:
@@ -760,9 +762,10 @@ components:
760762
type: object
761763
properties:
762764
code:
763-
type:
764-
- string
765-
- 'null'
765+
anyOf:
766+
- type: string
767+
- type: number
768+
- type: 'null'
766769
message:
767770
type: string
768771
param:
@@ -866,7 +869,9 @@ components:
866869
type: string
867870
const: chat.completion.chunk
868871
system_fingerprint:
869-
type: string
872+
type:
873+
- string
874+
- 'null'
870875
error:
871876
type: object
872877
properties:
@@ -889,15 +894,10 @@ components:
889894
- data
890895
parameters: {}
891896
securitySchemes:
892-
bearer:
897+
apiKey:
893898
type: http
894899
scheme: bearer
895900
description: API key as bearer token in Authorization header
896-
apiKey:
897-
type: apiKey
898-
in: header
899-
name: Authorization
900-
description: API key with "Bearer " prefix
901901
paths:
902902
/activity:
903903
get:
@@ -3829,7 +3829,6 @@ servers:
38293829
x-speakeasy-server-id: production
38303830
security:
38313831
- apiKey: []
3832-
- bearer: []
38333832
externalDocs:
38343833
description: OpenRouter Documentation
38353834
url: https://openrouter.ai/docs

.speakeasy/workflow.lock

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@ speakeasyVersion: 1.622.2
22
sources:
33
OpenRouter API:
44
sourceNamespace: open-router-chat-completions-api
5-
sourceRevisionDigest: sha256:c814cf91deea7e80928b7a15adf0416a6b8fa080bead78c93b59e3c8a26ad521
6-
sourceBlobDigest: sha256:4a5d604c480dd211d7836e31d00fd21c619b9a73eee802622cf6b479f8cbf0b6
5+
sourceRevisionDigest: sha256:9321918f4646cec8e116d0bc51695170913f9ce3815160911714551f79223f4b
6+
sourceBlobDigest: sha256:68b796460e0fe0114edafd72d16931dacae01b52389d4badc3a00193bce5d212
77
tags:
88
- latest
9-
- speakeasy-sdk-regen-1758241776
109
- 1.0.0
1110
targets:
1211
openrouter:
1312
source: OpenRouter API
1413
sourceNamespace: open-router-chat-completions-api
15-
sourceRevisionDigest: sha256:c814cf91deea7e80928b7a15adf0416a6b8fa080bead78c93b59e3c8a26ad521
16-
sourceBlobDigest: sha256:4a5d604c480dd211d7836e31d00fd21c619b9a73eee802622cf6b479f8cbf0b6
14+
sourceRevisionDigest: sha256:9321918f4646cec8e116d0bc51695170913f9ce3815160911714551f79223f4b
15+
sourceBlobDigest: sha256:68b796460e0fe0114edafd72d16931dacae01b52389d4badc3a00193bce5d212
1716
codeSamplesNamespace: open-router-chat-completions-api-typescript-code-samples
18-
codeSamplesRevisionDigest: sha256:209a837ee54fee3cfdc70f26efee566cb8725f83e0e28f6bc9c90ece5ef3828a
17+
codeSamplesRevisionDigest: sha256:bb0da01fa33373dc2dfb919d536087d675de8b21576277ef4e60706ce9e2e5a8
1918
workflow:
2019
workflowVersion: 1.0.0
2120
speakeasyVersion: latest

FUNCTIONS.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ import { getCredits } from "@openrouter/sdk/funcs/getCredits.js";
2525
// Use `OpenRouterCore` for best tree-shaking performance.
2626
// You can create one instance of it to use across an application.
2727
const openRouter = new OpenRouterCore({
28-
security: {
29-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
30-
},
28+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
3129
});
3230

3331
async function run() {

REACT_QUERY.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ import { OpenRouterProvider } from "@openrouter/sdk/react-query";
2323

2424
const queryClient = new QueryClient();
2525
const openRouter = new OpenRouterCore({
26-
security: {
27-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
28-
},
26+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
2927
});
3028

3129
// Retries are handled by the underlying SDK.
@@ -121,7 +119,9 @@ export function Example() {
121119

122120
// Read form data here...
123121

124-
mutate();
122+
mutate({
123+
bearer: process.env["OPENROUTER_BEARER"] ?? "",
124+
});
125125
}}
126126
>
127127
{/* Form fields go here... */}
@@ -224,9 +224,7 @@ import { useGetCreditsSuspense } from "@openrouter/sdk/react-query/getCredits.js
224224

225225
const queryClient = new QueryClient();
226226
const openRouter = new OpenRouterCore({
227-
security: {
228-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
229-
},
227+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
230228
});
231229

232230
export function App() {
@@ -282,9 +280,7 @@ import { prefetchGetCredits } from "@openrouter/sdk/react-query/getCredits.js";
282280
export default async function Page() {
283281
const queryClient = new QueryClient();
284282
const openRouter = new OpenRouterCore({
285-
security: {
286-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
287-
},
283+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
288284
});
289285

290286
await prefetchGetCredits(openRouter);

README.md

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
8585
import { OpenRouter } from "@openrouter/sdk";
8686

8787
const openRouter = new OpenRouter({
88-
security: {
89-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
90-
},
88+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
9189
});
9290

9391
async function run() {
@@ -106,21 +104,18 @@ run();
106104

107105
### Per-Client Security Schemes
108106

109-
This SDK supports the following security schemes globally:
107+
This SDK supports the following security scheme globally:
110108

111-
| Name | Type | Scheme | Environment Variable |
112-
| -------- | ------ | ----------- | -------------------- |
113-
| `apiKey` | apiKey | API key | `OPENROUTER_API_KEY` |
114-
| `bearer` | http | HTTP Bearer | `OPENROUTER_BEARER` |
109+
| Name | Type | Scheme | Environment Variable |
110+
| -------- | ---- | ----------- | -------------------- |
111+
| `apiKey` | http | HTTP Bearer | `OPENROUTER_API_KEY` |
115112

116-
You can set the security parameters through the `security` optional parameter when initializing the SDK client instance. The selected scheme will be used by default to authenticate with the API for all operations that support it. For example:
113+
To authenticate with the API the `apiKey` parameter must be set when initializing the SDK client instance. For example:
117114
```typescript
118115
import { OpenRouter } from "@openrouter/sdk";
119116

120117
const openRouter = new OpenRouter({
121-
security: {
122-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
123-
},
118+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
124119
});
125120

126121
async function run() {
@@ -131,6 +126,26 @@ async function run() {
131126

132127
run();
133128

129+
```
130+
131+
### Per-Operation Security Schemes
132+
133+
Some operations in this SDK require the security scheme to be specified at the request level. For example:
134+
```typescript
135+
import { OpenRouter } from "@openrouter/sdk";
136+
137+
const openRouter = new OpenRouter();
138+
139+
async function run() {
140+
const result = await openRouter.postCreditsCoinbase({
141+
bearer: process.env["OPENROUTER_BEARER"] ?? "",
142+
});
143+
144+
console.log(result);
145+
}
146+
147+
run();
148+
134149
```
135150
<!-- End Authentication [security] -->
136151

@@ -288,9 +303,7 @@ underlying connection.
288303
import { OpenRouter } from "@openrouter/sdk";
289304

290305
const openRouter = new OpenRouter({
291-
security: {
292-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
293-
},
306+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
294307
});
295308

296309
async function run() {
@@ -317,9 +330,7 @@ To change the default retry strategy for a single API call, simply provide a ret
317330
import { OpenRouter } from "@openrouter/sdk";
318331

319332
const openRouter = new OpenRouter({
320-
security: {
321-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
322-
},
333+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
323334
});
324335

325336
async function run() {
@@ -358,9 +369,7 @@ const openRouter = new OpenRouter({
358369
},
359370
retryConnectionErrors: false,
360371
},
361-
security: {
362-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
363-
},
372+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
364373
});
365374

366375
async function run() {
@@ -394,9 +403,7 @@ import { OpenRouter } from "@openrouter/sdk";
394403
import * as errors from "@openrouter/sdk/models/errors";
395404

396405
const openRouter = new OpenRouter({
397-
security: {
398-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
399-
},
406+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
400407
});
401408

402409
async function run() {

USAGE.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
import { OpenRouter } from "@openrouter/sdk";
44

55
const openRouter = new OpenRouter({
6-
security: {
7-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
8-
},
6+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
97
});
108

119
async function run() {

0 commit comments

Comments
 (0)