Skip to content

Commit 8f471e0

Browse files
authored
feat: SDK updates with API changes, type safety improvements, and Biome config (#100)
2 parents ba0fb90 + 4ab1924 commit 8f471e0

File tree

266 files changed

+17115
-30052
lines changed

Some content is hidden

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

266 files changed

+17115
-30052
lines changed

.github/actions/validate-sdk/action.yaml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,53 +9,54 @@ inputs:
99
runs:
1010
using: 'composite'
1111
steps:
12+
- name: Install pnpm
13+
uses: pnpm/action-setup@v4
14+
with:
15+
version: 10
16+
1217
- name: Setup Node.js
1318
uses: actions/setup-node@v4
1419
with:
1520
node-version: '22'
16-
cache: 'npm'
21+
cache: 'pnpm'
1722

1823
- name: Install dependencies
1924
shell: bash
20-
run: npm install
25+
run: pnpm install
2126

2227
- name: Build SDK
2328
shell: bash
24-
run: npm run build
25-
26-
# - name: Typecheck tests directory
27-
# shell: bash
28-
# run: npx tsc --noEmit --skipLibCheck --esModuleInterop --moduleResolution node --module esnext --target es2020 tests/**/*.ts
29+
run: pnpm run build
2930

3031
- name: Install examples dependencies
3132
shell: bash
3233
working-directory: examples
33-
run: npm install
34+
run: pnpm install
3435

3536
# TODO: Re-enable when Speakeasy fixes generated code type errors
36-
# - name: Typecheck examples root
37-
# shell: bash
38-
# working-directory: examples
39-
# run: npx tsc
37+
- name: Typecheck examples root
38+
shell: bash
39+
working-directory: examples
40+
run: pnpm exec tsc
4041

4142
- name: Install nextjs-example dependencies
4243
shell: bash
4344
working-directory: examples/nextjs-example
44-
run: npm install
45+
run: pnpm install
4546

4647
- name: Typecheck nextjs-example
4748
shell: bash
4849
working-directory: examples/nextjs-example
49-
run: npx tsc --noEmit
50+
run: pnpm exec tsc --noEmit
5051

5152
- name: Run unit tests
5253
shell: bash
5354
env:
5455
OPENROUTER_API_KEY: ${{ inputs.openrouter-api-key }}
55-
run: npx vitest --run --exclude 'tests/e2e/**'
56+
run: pnpm exec vitest --run --exclude 'tests/e2e/**'
5657

5758
- name: Run e2e tests
5859
shell: bash
5960
env:
6061
OPENROUTER_API_KEY: ${{ inputs.openrouter-api-key }}
61-
run: npx vitest --run tests/e2e/
62+
run: pnpm exec vitest --run tests/e2e/

.github/workflows/speakeasy_run_on_pr.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ jobs:
2020
ref: ${{ github.event.pull_request.head.ref }}
2121
token: ${{ secrets.GITHUB_TOKEN }}
2222

23+
- name: Install pnpm
24+
uses: pnpm/action-setup@v4
25+
with:
26+
version: 10
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '22'
32+
cache: 'pnpm'
33+
2334
- name: Install Speakeasy CLI
2435
run: |
2536
curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | sh

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@
3030
.env.*.local
3131
/examples/.env
3232
/examples/package-lock.json
33+
/examples/nextjs-example/package-lock.json
34+
/examples/nextjs-example/package.lock.json
3335
/temp

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
shamefully-hoist=false
2+
strict-peer-dependencies=true

.speakeasy/gen.lock

Lines changed: 20 additions & 67 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: 0ecf8d42d5f305a124cbca4ffbda5eee
4+
docChecksum: 591fccdc6b495b1230644174853f9113
55
docVersion: 1.0.0
6-
speakeasyVersion: 1.660.0
7-
generationVersion: 2.760.2
8-
releaseVersion: 0.1.27
9-
configChecksum: 2c451c32d0e42b790ff08709ef1011b4
6+
speakeasyVersion: 1.666.0
7+
generationVersion: 2.768.0
8+
releaseVersion: 0.2.6
9+
configChecksum: faa7e08defaa15a2a216f64d15953590
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.26.9
18+
core: 3.26.13
1919
customCodeRegions: 0.1.0
2020
defaultEnabledRetries: 0.1.0
2121
deprecations: 2.81.1
@@ -35,11 +35,11 @@ features:
3535
openEnums: 0.1.1
3636
responseFormat: 0.2.3
3737
retries: 2.83.0
38-
sdkHooks: 0.3.0
38+
sdkHooks: 0.4.0
3939
serverEvents: 0.1.12
4040
serverEventsSentinels: 0.1.0
4141
serverIDs: 2.81.2
42-
unions: 2.86.0
42+
unions: 2.86.3
4343
generatedFiles:
4444
- .devcontainer/README.md
4545
- .devcontainer/devcontainer.json
@@ -69,14 +69,13 @@ generatedFiles:
6969
- docs/models/chatmessagecontentitemaudio.md
7070
- docs/models/chatmessagecontentitemaudioformat.md
7171
- docs/models/chatmessagecontentitemaudioinputaudio.md
72-
- docs/models/chatmessagecontentitemfile.md
72+
- docs/models/chatmessagecontentitemcachecontrol.md
7373
- docs/models/chatmessagecontentitemimage.md
7474
- docs/models/chatmessagecontentitemimagedetail.md
7575
- docs/models/chatmessagecontentitemtext.md
7676
- docs/models/chatmessagecontentitemvideo.md
7777
- docs/models/chatmessagecontentitemvideoinputvideo.md
7878
- docs/models/chatmessagecontentitemvideovideourl.md
79-
- docs/models/chatmessagecontentitemvideovideourlvideourl.md
8079
- docs/models/chatmessagetokenlogprob.md
8180
- docs/models/chatmessagetokenlogprobs.md
8281
- docs/models/chatmessagetoolcall.md
@@ -130,14 +129,8 @@ generatedFiles:
130129
- docs/models/errors/unauthorizedresponseerror.md
131130
- docs/models/errors/unprocessableentityresponseerror.md
132131
- docs/models/filecitation.md
133-
- docs/models/filecitationtype.md
134132
- docs/models/filepath.md
135-
- docs/models/filepathtype.md
136-
- docs/models/filet.md
137133
- docs/models/forbiddenresponseerrordata.md
138-
- docs/models/idfileparser.md
139-
- docs/models/idmoderation.md
140-
- docs/models/idweb.md
141134
- docs/models/ignore.md
142135
- docs/models/imagegenerationstatus.md
143136
- docs/models/imageurl.md
@@ -192,7 +185,6 @@ generatedFiles:
192185
- docs/models/openairesponsesreasoningconfig.md
193186
- docs/models/openairesponsesreasoningeffort.md
194187
- docs/models/openairesponsesrefusalcontent.md
195-
- docs/models/openairesponsesrefusalcontenttype.md
196188
- docs/models/openairesponsesresponsestatus.md
197189
- docs/models/openairesponsesservicetier.md
198190
- docs/models/openairesponsestoolchoice.md
@@ -215,19 +207,14 @@ generatedFiles:
215207
- docs/models/openresponseseasyinputmessageroleuser.md
216208
- docs/models/openresponseseasyinputmessagetype.md
217209
- docs/models/openresponseserrorevent.md
218-
- docs/models/openresponseserroreventtype.md
219210
- docs/models/openresponsesfunctioncalloutput.md
220211
- docs/models/openresponsesfunctioncalloutputtype.md
221212
- docs/models/openresponsesfunctiontoolcall.md
222213
- docs/models/openresponsesfunctiontoolcalltype.md
223214
- docs/models/openresponsesimagegencallcompleted.md
224-
- docs/models/openresponsesimagegencallcompletedtype.md
225215
- docs/models/openresponsesimagegencallgenerating.md
226-
- docs/models/openresponsesimagegencallgeneratingtype.md
227216
- docs/models/openresponsesimagegencallinprogress.md
228-
- docs/models/openresponsesimagegencallinprogresstype.md
229217
- docs/models/openresponsesimagegencallpartialimage.md
230-
- docs/models/openresponsesimagegencallpartialimagetype.md
231218
- docs/models/openresponsesinput.md
232219
- docs/models/openresponsesinput1.md
233220
- docs/models/openresponsesinputmessageitem.md
@@ -241,29 +228,22 @@ generatedFiles:
241228
- docs/models/openresponsesnonstreamingresponse.md
242229
- docs/models/openresponsesnonstreamingresponsetoolfunction.md
243230
- docs/models/openresponsesnonstreamingresponsetoolunion.md
244-
- docs/models/openresponsesnonstreamingresponsetype.md
245231
- docs/models/openresponsesreasoning.md
246232
- docs/models/openresponsesreasoningconfig.md
247233
- docs/models/openresponsesreasoningdeltaevent.md
248-
- docs/models/openresponsesreasoningdeltaeventtype.md
249234
- docs/models/openresponsesreasoningdoneevent.md
250-
- docs/models/openresponsesreasoningdoneeventtype.md
251235
- docs/models/openresponsesreasoningformat.md
252236
- docs/models/openresponsesreasoningstatuscompleted.md
253237
- docs/models/openresponsesreasoningstatusincomplete.md
254238
- docs/models/openresponsesreasoningstatusinprogress.md
255239
- docs/models/openresponsesreasoningstatusunion.md
256240
- docs/models/openresponsesreasoningsummarypartaddedevent.md
257-
- docs/models/openresponsesreasoningsummarypartaddedeventtype.md
258241
- docs/models/openresponsesreasoningsummarytextdeltaevent.md
259-
- docs/models/openresponsesreasoningsummarytextdeltaeventtype.md
260242
- docs/models/openresponsesreasoningsummarytextdoneevent.md
261-
- docs/models/openresponsesreasoningsummarytextdoneeventtype.md
262243
- docs/models/openresponsesreasoningtype.md
263244
- docs/models/openresponsesrequest.md
264245
- docs/models/openresponsesrequesttoolfunction.md
265246
- docs/models/openresponsesrequesttoolunion.md
266-
- docs/models/openresponsesrequesttype.md
267247
- docs/models/openresponsesresponsetext.md
268248
- docs/models/openresponsesresponsetextverbosity.md
269249
- docs/models/openresponsesstreamevent.md
@@ -288,14 +268,10 @@ generatedFiles:
288268
- docs/models/openresponsesusage.md
289269
- docs/models/openresponseswebsearch20250826tool.md
290270
- docs/models/openresponseswebsearch20250826toolfilters.md
291-
- docs/models/openresponseswebsearch20250826tooltype.md
292271
- docs/models/openresponseswebsearchpreview20250311tool.md
293-
- docs/models/openresponseswebsearchpreview20250311tooltype.md
294272
- docs/models/openresponseswebsearchpreviewtool.md
295-
- docs/models/openresponseswebsearchpreviewtooltype.md
296273
- docs/models/openresponseswebsearchtool.md
297274
- docs/models/openresponseswebsearchtoolfilters.md
298-
- docs/models/openresponseswebsearchtooltype.md
299275
- docs/models/operations/apitype.md
300276
- docs/models/operations/calldata.md
301277
- docs/models/operations/content.md
@@ -326,6 +302,7 @@ generatedFiles:
326302
- docs/models/operations/exchangeauthcodeforapikeycodechallengemethod.md
327303
- docs/models/operations/exchangeauthcodeforapikeyrequest.md
328304
- docs/models/operations/exchangeauthcodeforapikeyresponse.md
305+
- docs/models/operations/getcreditsdata.md
329306
- docs/models/operations/getcreditsresponse.md
330307
- docs/models/operations/getcurrentkeydata.md
331308
- docs/models/operations/getcurrentkeyresponse.md
@@ -366,8 +343,6 @@ generatedFiles:
366343
- docs/models/operations/sendchatcompletionrequestresponse.md
367344
- docs/models/operations/supportedparameter.md
368345
- docs/models/operations/transferintent.md
369-
- docs/models/operations/typeimageurl.md
370-
- docs/models/operations/typetext.md
371346
- docs/models/operations/updatekeysdata.md
372347
- docs/models/operations/updatekeyslimitreset.md
373348
- docs/models/operations/updatekeysrequest.md
@@ -399,6 +374,7 @@ generatedFiles:
399374
- docs/models/plugin.md
400375
- docs/models/pluginfileparser.md
401376
- docs/models/pluginmoderation.md
377+
- docs/models/pluginresponsehealing.md
402378
- docs/models/pluginweb.md
403379
- docs/models/pricing.md
404380
- docs/models/prompt.md
@@ -425,23 +401,15 @@ generatedFiles:
425401
- docs/models/responseinputaudio.md
426402
- docs/models/responseinputaudioformat.md
427403
- docs/models/responseinputaudioinputaudio.md
428-
- docs/models/responseinputaudiotype.md
429404
- docs/models/responseinputfile.md
430-
- docs/models/responseinputfiletype.md
431405
- docs/models/responseinputimage.md
432406
- docs/models/responseinputimagedetail.md
433-
- docs/models/responseinputimagetype.md
434407
- docs/models/responseinputtext.md
435-
- docs/models/responseinputtexttype.md
436408
- docs/models/responseoutputtext.md
437-
- docs/models/responseoutputtexttype.md
438409
- docs/models/responseserrorfield.md
439410
- docs/models/responsesformatjsonobject.md
440-
- docs/models/responsesformatjsonobjecttype.md
441411
- docs/models/responsesformattext.md
442412
- docs/models/responsesformattextjsonschemaconfig.md
443-
- docs/models/responsesformattextjsonschemaconfigtype.md
444-
- docs/models/responsesformattexttype.md
445413
- docs/models/responsesimagegenerationcall.md
446414
- docs/models/responsesimagegenerationcalltype.md
447415
- docs/models/responsesoutputitem.md
@@ -490,32 +458,16 @@ generatedFiles:
490458
- docs/models/toplogprob.md
491459
- docs/models/topproviderinfo.md
492460
- docs/models/truncation.md
461+
- docs/models/ttl.md
493462
- docs/models/type.md
494-
- docs/models/typeresponsecompleted.md
495-
- docs/models/typeresponsecontentpartadded.md
496-
- docs/models/typeresponsecontentpartdone.md
497-
- docs/models/typeresponsecreated.md
498-
- docs/models/typeresponsefailed.md
499-
- docs/models/typeresponsefunctioncallargumentsdelta.md
500-
- docs/models/typeresponsefunctioncallargumentsdone.md
501-
- docs/models/typeresponseincomplete.md
502-
- docs/models/typeresponseinprogress.md
503-
- docs/models/typeresponseoutputitemadded.md
504-
- docs/models/typeresponseoutputitemdone.md
505-
- docs/models/typeresponseoutputtextannotationadded.md
506-
- docs/models/typeresponseoutputtextdelta.md
507-
- docs/models/typeresponseoutputtextdone.md
508-
- docs/models/typeresponsereasoningsummarypartdone.md
509-
- docs/models/typeresponserefusaldelta.md
510-
- docs/models/typeresponserefusaldone.md
511463
- docs/models/unauthorizedresponseerrordata.md
512464
- docs/models/unprocessableentityresponseerrordata.md
513465
- docs/models/urlcitation.md
514-
- docs/models/urlcitationtype.md
515466
- docs/models/usermessage.md
516467
- docs/models/usermessagecontent.md
517468
- docs/models/variables.md
518-
- docs/models/videourl.md
469+
- docs/models/videourl1.md
470+
- docs/models/videourl2.md
519471
- docs/models/websearchpreviewtooluserlocation.md
520472
- docs/models/websearchpreviewtooluserlocationtype.md
521473
- docs/models/websearchstatus.md
@@ -589,12 +541,13 @@ generatedFiles:
589541
- src/models/assistantmessage.ts
590542
- src/models/badgatewayresponseerrordata.ts
591543
- src/models/badrequestresponseerrordata.ts
544+
- src/models/chatcompletionfinishreason.ts
592545
- src/models/chaterror.ts
593546
- src/models/chatgenerationparams.ts
594547
- src/models/chatgenerationtokenusage.ts
595548
- src/models/chatmessagecontentitem.ts
596549
- src/models/chatmessagecontentitemaudio.ts
597-
- src/models/chatmessagecontentitemfile.ts
550+
- src/models/chatmessagecontentitemcachecontrol.ts
598551
- src/models/chatmessagecontentitemimage.ts
599552
- src/models/chatmessagecontentitemtext.ts
600553
- src/models/chatmessagecontentitemvideo.ts
@@ -603,6 +556,7 @@ generatedFiles:
603556
- src/models/chatmessagetoolcall.ts
604557
- src/models/chatresponse.ts
605558
- src/models/chatresponsechoice.ts
559+
- src/models/chatstreamingchoice.ts
606560
- src/models/chatstreamingmessagechunk.ts
607561
- src/models/chatstreamingmessagetoolcall.ts
608562
- src/models/chatstreamingresponsechunk.ts
@@ -769,7 +723,6 @@ generatedFiles:
769723
- src/models/unprocessableentityresponseerrordata.ts
770724
- src/models/urlcitation.ts
771725
- src/models/usermessage.ts
772-
- src/models/videourl.ts
773726
- src/models/websearchpreviewtooluserlocation.ts
774727
- src/models/websearchstatus.ts
775728
- src/sdk/analytics.ts
@@ -1159,7 +1112,7 @@ examples:
11591112
speakeasy-default-get-credits:
11601113
responses:
11611114
"200":
1162-
application/json: {}
1115+
application/json: {"data": {"total_credits": 100.5, "total_usage": 25.75}}
11631116
4XX:
11641117
application/json: {"error": {"code": 400, "message": "Invalid request parameters", "metadata": {"field": "temperature", "reason": "Must be between 0 and 2"}}, "user_id": "user-abc123"}
11651118
default:
@@ -1593,7 +1546,7 @@ examples:
15931546
speakeasy-default-list-endpoints-zdr:
15941547
responses:
15951548
"200":
1596-
application/json: {"data": [{"name": "<value>", "model_name": "<value>", "context_length": 8891.09, "pricing": {"prompt": "1000", "completion": 1000}, "provider_name": "OpenAI", "tag": "<value>", "quantization": "fp16", "max_completion_tokens": 4685.25, "max_prompt_tokens": 22.7, "supported_parameters": ["temperature"], "uptime_last_30m": 6060.66, "supports_implicit_caching": true}]}
1549+
application/json: {"data": [{"name": "<value>", "model_name": "<value>", "context_length": 8891.09, "pricing": {"prompt": 1000, "completion": 1000}, "provider_name": "OpenAI", "tag": "<value>", "quantization": "fp16", "max_completion_tokens": 4685.25, "max_prompt_tokens": 22.7, "supported_parameters": ["temperature"], "uptime_last_30m": 6060.66, "supports_implicit_caching": true}]}
15971550
default:
15981551
application/json: {"error": {"code": 400, "message": "Invalid request parameters", "metadata": {"field": "temperature", "reason": "Must be between 0 and 2"}}, "user_id": "user-abc123"}
15991552
"500":
@@ -1692,7 +1645,7 @@ examples:
16921645
createResponses:
16931646
speakeasy-default-create-responses:
16941647
requestBody:
1695-
application/json: {"stream": false}
1648+
application/json: {"store": false, "service_tier": "auto", "stream": false}
16961649
responses:
16971650
"200":
16981651
application/json: {"id": "resp-abc123", "object": "response", "created_at": 1704067200, "model": "gpt-4", "output": [{"id": "msg-abc123", "role": "assistant", "type": "message", "content": [{"type": "output_text", "text": "Hello! How can I help you today?"}]}], "error": null, "incomplete_details": null, "temperature": null, "top_p": null, "instructions": null, "metadata": null, "tools": [], "tool_choice": "auto", "parallel_tool_calls": true}

0 commit comments

Comments
 (0)