Skip to content

Commit db87e30

Browse files
committed
cleanup and add oauth routes
1 parent d2b5543 commit db87e30

Some content is hidden

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

50 files changed

+2351
-405
lines changed

.speakeasy/gen.lock

Lines changed: 55 additions & 17 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: d1ed8e0c3d150ef9c912570f5a0752da
4+
docChecksum: a1cf6756d06afbe789def40a522bb8af
55
docVersion: 1.0.0
6-
speakeasyVersion: 1.622.2
7-
generationVersion: 2.711.4
8-
releaseVersion: 0.0.0-beta.4
9-
configChecksum: 5e75e51e8602d29a1656c3f0fb6ce03f
6+
speakeasyVersion: 1.624.1
7+
generationVersion: 2.714.1
8+
releaseVersion: 0.0.0-beta.5
9+
configChecksum: b84e6447431dce7865acd13a49350f54
1010
repoURL: https://github.com/OpenRouterTeam/typescript-sdk.git
1111
installationURL: https://github.com/OpenRouterTeam/typescript-sdk
1212
published: true
@@ -15,7 +15,7 @@ features:
1515
acceptHeaders: 2.81.2
1616
additionalDependencies: 0.1.0
1717
constsAndDefaults: 0.1.12
18-
core: 3.21.24
18+
core: 3.21.25
1919
customCodeRegions: 0.1.0
2020
defaultEnabledRetries: 0.1.0
2121
deprecations: 2.81.1
@@ -254,6 +254,15 @@ generatedFiles:
254254
- docs/models/operations/patchkeyshashrequestbody.md
255255
- docs/models/operations/patchkeyshashresponse.md
256256
- docs/models/operations/patchkeyshashresponsebody.md
257+
- docs/models/operations/postauthkeyscodechallengemethod.md
258+
- docs/models/operations/postauthkeyscodecodechallengemethod.md
259+
- docs/models/operations/postauthkeyscodedata.md
260+
- docs/models/operations/postauthkeyscoderequest.md
261+
- docs/models/operations/postauthkeyscoderesponse.md
262+
- docs/models/operations/postauthkeyscoderesponsebody.md
263+
- docs/models/operations/postauthkeysrequest.md
264+
- docs/models/operations/postauthkeysresponse.md
265+
- docs/models/operations/postauthkeysresponsebody.md
257266
- docs/models/operations/postchatcompletionsresponse.md
258267
- docs/models/operations/postcreditscoinbasedata.md
259268
- docs/models/operations/postcreditscoinbaserequest.md
@@ -303,12 +312,15 @@ generatedFiles:
303312
- docs/sdks/analytics/README.md
304313
- docs/sdks/apikeys/README.md
305314
- docs/sdks/chat/README.md
315+
- docs/sdks/credits/README.md
306316
- docs/sdks/embeddings/README.md
307317
- docs/sdks/endpoints/README.md
308318
- docs/sdks/generations/README.md
319+
- docs/sdks/model/README.md
309320
- docs/sdks/models/README.md
321+
- docs/sdks/oauth/README.md
310322
- docs/sdks/openrouter/README.md
311-
- docs/sdks/parameters/README.md
323+
- docs/sdks/providers/README.md
312324
- eslint.config.mjs
313325
- examples/.env.template
314326
- examples/README.md
@@ -326,17 +338,19 @@ generatedFiles:
326338
- src/funcs/apiKeysPatchKeysHash.ts
327339
- src/funcs/apiKeysPostKeys.ts
328340
- src/funcs/chatSend.ts
329-
- src/funcs/embeddingsPostEmbeddings.ts
341+
- src/funcs/creditsPostCreditsCoinbase.ts
342+
- src/funcs/embeddingsGenerate.ts
330343
- src/funcs/endpointsGetEndpointsZdr.ts
331344
- src/funcs/endpointsGetModelsAuthorSlugEndpoints.ts
332345
- src/funcs/generationsGetGeneration.ts
333346
- src/funcs/getCredits.ts
334-
- src/funcs/getProviders.ts
347+
- src/funcs/modelGetParametersAuthorSlug.ts
335348
- src/funcs/modelsGetModels.ts
336349
- src/funcs/modelsGetModelsCount.ts
337350
- src/funcs/modelsGetModelsUser.ts
338-
- src/funcs/parametersGetParametersAuthorSlug.ts
339-
- src/funcs/postCreditsCoinbase.ts
351+
- src/funcs/oAuthPostAuthKeys.ts
352+
- src/funcs/oAuthPostAuthKeysCode.ts
353+
- src/funcs/providersGetProviders.ts
340354
- src/hooks/hooks.ts
341355
- src/hooks/index.ts
342356
- src/hooks/types.ts
@@ -406,6 +420,8 @@ generatedFiles:
406420
- src/models/operations/getproviders.ts
407421
- src/models/operations/index.ts
408422
- src/models/operations/patchkeyshash.ts
423+
- src/models/operations/postauthkeys.ts
424+
- src/models/operations/postauthkeyscode.ts
409425
- src/models/operations/postchatcompletions.ts
410426
- src/models/operations/postcreditscoinbase.ts
411427
- src/models/operations/postembeddings.ts
@@ -426,27 +442,32 @@ generatedFiles:
426442
- src/react-query/apiKeysPatchKeysHash.ts
427443
- src/react-query/apiKeysPostKeys.ts
428444
- src/react-query/chatSend.ts
429-
- src/react-query/embeddingsPostEmbeddings.ts
445+
- src/react-query/creditsPostCreditsCoinbase.ts
446+
- src/react-query/embeddingsGenerate.ts
430447
- src/react-query/endpointsGetEndpointsZdr.ts
431448
- src/react-query/endpointsGetModelsAuthorSlugEndpoints.ts
432449
- src/react-query/generationsGetGeneration.ts
433450
- src/react-query/getCredits.ts
434-
- src/react-query/getProviders.ts
435451
- src/react-query/index.ts
452+
- src/react-query/modelGetParametersAuthorSlug.ts
436453
- src/react-query/modelsGetModels.ts
437454
- src/react-query/modelsGetModelsCount.ts
438455
- src/react-query/modelsGetModelsUser.ts
439-
- src/react-query/parametersGetParametersAuthorSlug.ts
440-
- src/react-query/postCreditsCoinbase.ts
456+
- src/react-query/oAuthPostAuthKeys.ts
457+
- src/react-query/oAuthPostAuthKeysCode.ts
458+
- src/react-query/providersGetProviders.ts
441459
- src/sdk/analytics.ts
442460
- src/sdk/apikeys.ts
443461
- src/sdk/chat.ts
462+
- src/sdk/credits.ts
444463
- src/sdk/embeddings.ts
445464
- src/sdk/endpoints.ts
446465
- src/sdk/generations.ts
447466
- src/sdk/index.ts
467+
- src/sdk/model.ts
448468
- src/sdk/models.ts
449-
- src/sdk/parameters.ts
469+
- src/sdk/oauth.ts
470+
- src/sdk/providers.ts
450471
- src/sdk/sdk.ts
451472
- src/types/async.ts
452473
- src/types/blobs.ts
@@ -457,7 +478,6 @@ generatedFiles:
457478
- src/types/operations.ts
458479
- src/types/rfcdate.ts
459480
- src/types/streams.ts
460-
- temp/example.ts
461481
- tsconfig.json
462482
examples:
463483
createChatCompletion:
@@ -647,4 +667,22 @@ examples:
647667
application/json: {"error": {"code": "<value>", "message": "<value>", "param": "<value>", "type": "<value>"}}
648668
"500":
649669
application/json: {"error": {"code": "<value>", "message": "<value>", "param": "<value>", "type": "<value>"}}
670+
post_/auth/keys:
671+
speakeasy-default-post-/auth/keys:
672+
requestBody:
673+
application/json: {"code": "auth_code_abc123def456", "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "code_challenge_method": "S256"}
674+
responses:
675+
"200":
676+
application/json: {"key": "sk-or-v1-abc123def456ghi789jkl012", "user_id": "or_user_1234567890abcdef"}
677+
default:
678+
application/json: {"error": {"code": 451, "message": "<value>"}}
679+
post_/auth/keys/code:
680+
speakeasy-default-post-/auth/keys/code:
681+
requestBody:
682+
application/json: {"callback_url": "https://myapp.com/auth/callback", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "code_challenge_method": "S256", "limit": "100.0"}
683+
responses:
684+
"200":
685+
application/json: {"data": {"id": "auth_code_xyz789", "app_id": 12345, "created_at": "2025-08-24T10:30:00Z"}}
686+
default:
687+
application/json: {"error": {"code": 202, "message": "<value>"}}
650688
examplesVersion: 1.0.2

.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.4
30+
version: 0.0.0-beta.5
3131
additionalDependencies:
3232
dependencies: {}
3333
devDependencies: {}

.speakeasy/in.openapi.yaml

Lines changed: 133 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,8 @@ paths:
967967
post:
968968
security:
969969
- bearer: []
970+
tags:
971+
- Credits
970972
description: Create a Coinbase charge for crypto payment
971973
requestBody:
972974
content:
@@ -1080,6 +1082,7 @@ paths:
10801082
tags:
10811083
- Embeddings
10821084
summary: Submit an embedding request
1085+
x-speakeasy-name-override: generate
10831086
description: Submits an embedding request to the embeddings router
10841087
requestBody:
10851088
content:
@@ -3016,7 +3019,7 @@ paths:
30163019
/parameters/{author}/{slug}:
30173020
get:
30183021
tags:
3019-
- Parameters
3022+
- Model
30203023
summary: Get a model's supported parameters and data about which are most popular
30213024
security:
30223025
- bearer: []
@@ -3158,6 +3161,9 @@ paths:
31583161
$ref: '#/components/schemas/ErrorResponse'
31593162
/providers:
31603163
get:
3164+
tags:
3165+
- Providers
3166+
description: List all available model providers
31613167
responses:
31623168
'200':
31633169
description: Returns a list of providers
@@ -3771,6 +3777,132 @@ paths:
37713777
application/json:
37723778
schema:
37733779
$ref: '#/components/schemas/ErrorResponse'
3780+
/auth/keys:
3781+
post:
3782+
tags:
3783+
- OAuth
3784+
summary: Exchange authorization code for API key
3785+
description: Exchange an authorization code from the PKCE flow for a user-controlled API key
3786+
requestBody:
3787+
content:
3788+
application/json:
3789+
schema:
3790+
type: object
3791+
properties:
3792+
code:
3793+
type: string
3794+
description: The authorization code received from the OAuth redirect
3795+
example: auth_code_abc123def456
3796+
code_verifier:
3797+
type: string
3798+
description: The code verifier if code_challenge was used in the authorization request
3799+
example: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
3800+
code_challenge_method:
3801+
type: string
3802+
enum:
3803+
- S256
3804+
- plain
3805+
description: The method used to generate the code challenge
3806+
example: S256
3807+
required:
3808+
- code
3809+
responses:
3810+
'200':
3811+
description: Successfully exchanged code for an API key
3812+
content:
3813+
application/json:
3814+
schema:
3815+
type: object
3816+
properties:
3817+
key:
3818+
type: string
3819+
description: The API key to use for OpenRouter requests
3820+
example: sk-or-v1-abc123def456ghi789jkl012
3821+
user_id:
3822+
type: string
3823+
nullable: true
3824+
description: User ID associated with the API key
3825+
example: or_user_1234567890abcdef
3826+
required:
3827+
- key
3828+
- user_id
3829+
default:
3830+
description: Error response
3831+
content:
3832+
application/json:
3833+
schema:
3834+
$ref: '#/components/schemas/ErrorResponse'
3835+
/auth/keys/code:
3836+
post:
3837+
tags:
3838+
- OAuth
3839+
summary: Create authorization code
3840+
description: Create an authorization code for the PKCE flow to generate a user-controlled API key
3841+
requestBody:
3842+
content:
3843+
application/json:
3844+
schema:
3845+
type: object
3846+
properties:
3847+
callback_url:
3848+
type: string
3849+
format: uri
3850+
description: >-
3851+
The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are
3852+
allowed.
3853+
example: https://myapp.com/auth/callback
3854+
code_challenge:
3855+
type: string
3856+
description: PKCE code challenge for enhanced security
3857+
example: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
3858+
code_challenge_method:
3859+
type: string
3860+
enum:
3861+
- S256
3862+
- plain
3863+
description: The method used to generate the code challenge
3864+
example: S256
3865+
limit:
3866+
type: string
3867+
description: Credit limit for the API key to be created
3868+
example: '100.0'
3869+
required:
3870+
- callback_url
3871+
responses:
3872+
'200':
3873+
description: Successfully created authorization code
3874+
content:
3875+
application/json:
3876+
schema:
3877+
type: object
3878+
properties:
3879+
data:
3880+
type: object
3881+
properties:
3882+
id:
3883+
type: string
3884+
description: The authorization code ID to use in the exchange request
3885+
example: auth_code_xyz789
3886+
app_id:
3887+
type: number
3888+
description: The application ID associated with this auth code
3889+
example: 12345
3890+
created_at:
3891+
type: string
3892+
description: ISO 8601 timestamp of when the auth code was created
3893+
example: '2025-08-24T10:30:00Z'
3894+
required:
3895+
- id
3896+
- app_id
3897+
- created_at
3898+
required:
3899+
- data
3900+
default:
3901+
description: Error response
3902+
content:
3903+
application/json:
3904+
schema:
3905+
$ref: '#/components/schemas/ErrorResponse'
37743906
/chat/completions:
37753907
post:
37763908
summary: Create a chat completion

0 commit comments

Comments
 (0)