Skip to content

Commit a9b899b

Browse files
committed
add custom code region for streaming option
1 parent f2e11dd commit a9b899b

19 files changed

+176
-65
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
overlay: 1.0.0
2+
x-speakeasy-jsonpath: rfc9535
3+
info:
4+
title: Speakeasy Modifications
5+
version: 0.0.2
6+
x-speakeasy-metadata:
7+
after: ""
8+
before: ""
9+
type: speakeasy-modifications
10+
actions:
11+
- target: $["paths"]["/chat/completions"]["post"]
12+
update:
13+
x-speakeasy-name-override: complete
14+
x-speakeasy-metadata:
15+
after: sdk.chat.complete()
16+
before: sdk.Chat.createChatCompletion()
17+
created_at: 1755805257797
18+
reviewed_at: 1755805262583
19+
type: method-name
20+
- target: $["paths"]["/chat/completions#stream"]["post"]
21+
update:
22+
x-speakeasy-name-override: completeStream
23+
x-speakeasy-metadata:
24+
after: sdk.chat.completeStream()
25+
before: sdk.Chat.streamChatCompletion()
26+
created_at: 1755805257798
27+
reviewed_at: 1755805262583
28+
type: method-name

.speakeasy/gen.lock

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
lockVersion: 2.0.0
22
id: 53e6e641-e7b6-4f11-8e15-1d930a684b2b
33
management:
4-
docChecksum: 6f798c05b20e0174a12ebf742dbb933c
4+
docChecksum: 36a7cb5013d52318029144e2f7478507
55
docVersion: 1.0.0
6-
speakeasyVersion: 1.606.2
6+
speakeasyVersion: 1.606.4
77
generationVersion: 2.687.1
8-
releaseVersion: 0.1.2
9-
configChecksum: 9841cb52271fe13ecf53635b80c623c7
8+
releaseVersion: 0.3.1
9+
configChecksum: 8ca151e42ffdb65b3610b37402fc03ce
1010
repoURL: https://github.com/speakeasy-sdks/openrouter-typescript-sdk.git
1111
installationURL: https://github.com/speakeasy-sdks/openrouter-typescript-sdk
1212
features:
1313
typescript:
1414
additionalDependencies: 0.1.0
1515
constsAndDefaults: 0.1.12
1616
core: 3.21.20
17+
customCodeRegions: 0.1.0
1718
defaultEnabledRetries: 0.1.0
1819
devContainers: 2.90.0
1920
enumUnions: 0.1.0
@@ -23,6 +24,7 @@ features:
2324
globalSecurityFlattening: 0.1.0
2425
globalServerURLs: 2.82.5
2526
methodArguments: 0.1.2
27+
nameOverrides: 2.81.2
2628
nullables: 0.1.1
2729
responseFormat: 0.2.3
2830
retries: 2.83.0
@@ -224,13 +226,13 @@ generatedFiles:
224226
- eslint.config.mjs
225227
- examples/.env.template
226228
- examples/README.md
227-
- examples/chatCreateChatCompletion.example.ts
229+
- examples/chatComplete.example.ts
228230
- examples/package.json
229231
- jsr.json
230232
- package.json
231233
- src/core.ts
232-
- src/funcs/chatCreateChatCompletion.ts
233-
- src/funcs/chatStreamChatCompletion.ts
234+
- src/funcs/chatComplete.ts
235+
- src/funcs/chatCompleteStream.ts
234236
- src/hooks/hooks.ts
235237
- src/hooks/index.ts
236238
- src/hooks/types.ts

.speakeasy/gen.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ generation:
2525
generateNewTests: true
2626
skipResponseBodyAssertions: false
2727
typescript:
28-
version: 0.1.2
28+
version: 0.3.1
2929
additionalDependencies:
3030
dependencies: {}
3131
devDependencies: {}
@@ -36,7 +36,7 @@ typescript:
3636
clientServerStatusCodesAsErrors: true
3737
constFieldsAlwaysOptional: false
3838
defaultErrorName: OpenRouterDefaultError
39-
enableCustomCodeRegions: false
39+
enableCustomCodeRegions: true
4040
enableMCPServer: false
4141
enableReactQuery: false
4242
enumFormat: union

.speakeasy/out.openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,6 +1544,7 @@ paths:
15441544
application/json:
15451545
schema:
15461546
$ref: '#/components/schemas/ChatCompletionError'
1547+
x-speakeasy-name-override: complete
15471548
/chat/completions#stream:
15481549
post:
15491550
operationId: streamChatCompletion
@@ -1594,3 +1595,4 @@ paths:
15941595
application/json:
15951596
schema:
15961597
$ref: '#/components/schemas/ChatCompletionError'
1598+
x-speakeasy-name-override: completeStream

.speakeasy/workflow.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
speakeasyVersion: 1.606.2
1+
speakeasyVersion: 1.606.4
22
sources:
33
OpenRouter Chat Completions API:
44
sourceNamespace: open-router-chat-completions-api
5-
sourceRevisionDigest: sha256:bf6bc68ff25525216444419ba3574b08569118e93a693d9f1e71f155290af886
6-
sourceBlobDigest: sha256:8c017dcce7a7eae1209a1ca75db02a31ef837c5b36736e8e494c8607e3b50c59
5+
sourceRevisionDigest: sha256:e71622a945be51370039187beb05ff7e45799cb6f52e104b930163938cd3c50e
6+
sourceBlobDigest: sha256:78142a97cdd4cdda52229772dfbee227d9c8fece8a1364ad458e153416933bee
77
tags:
88
- latest
9-
- speakeasy-sdk-regen-1755878981
109
- 1.0.0
1110
targets:
1211
open-router:
1312
source: OpenRouter Chat Completions API
1413
sourceNamespace: open-router-chat-completions-api
15-
sourceRevisionDigest: sha256:bf6bc68ff25525216444419ba3574b08569118e93a693d9f1e71f155290af886
16-
sourceBlobDigest: sha256:8c017dcce7a7eae1209a1ca75db02a31ef837c5b36736e8e494c8607e3b50c59
14+
sourceRevisionDigest: sha256:e71622a945be51370039187beb05ff7e45799cb6f52e104b930163938cd3c50e
15+
sourceBlobDigest: sha256:78142a97cdd4cdda52229772dfbee227d9c8fece8a1364ad458e153416933bee
1716
codeSamplesNamespace: open-router-chat-completions-api-typescript-code-samples
18-
codeSamplesRevisionDigest: sha256:1970171bfa04192e1a570f4ca4cb002ae4df494258559d8d4cc1347dc2ffdebe
17+
codeSamplesRevisionDigest: sha256:3d2039abea301b14aa354d834b8ed4a7569699a4e50294bee30001d016d705d1
1918
workflow:
2019
workflowVersion: 1.0.0
2120
speakeasyVersion: latest
@@ -25,6 +24,7 @@ workflow:
2524
- location: .speakeasy/OAS_files/chat-completions-openapi.yaml
2625
overlays:
2726
- location: .speakeasy/OAS_files/overlay.yaml
27+
- location: .speakeasy/OAS_files/speakeasy-modifications-overlay.yaml
2828
output: .speakeasy/out.openapi.yaml
2929
registry:
3030
location: registry.speakeasyapi.dev/sheldon-vaughn-test/sandbox/open-router-chat-completions-api

.speakeasy/workflow.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ sources:
66
- location: .speakeasy/OAS_files/chat-completions-openapi.yaml
77
overlays:
88
- location: .speakeasy/OAS_files/overlay.yaml
9+
- location: .speakeasy/OAS_files/speakeasy-modifications-overlay.yaml
910
output: .speakeasy/out.openapi.yaml
1011
registry:
1112
location: registry.speakeasyapi.dev/sheldon-vaughn-test/sandbox/open-router-chat-completions-api

FUNCTIONS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ specific category of applications.
2020

2121
```typescript
2222
import { OpenRouterCore } from "open-router/core.js";
23-
import { chatCreateChatCompletion } from "open-router/funcs/chatCreateChatCompletion.js";
23+
import { chatComplete } from "open-router/funcs/chatComplete.js";
2424

2525
// Use `OpenRouterCore` for best tree-shaking performance.
2626
// You can create one instance of it to use across an application.
@@ -29,7 +29,7 @@ const openRouter = new OpenRouterCore({
2929
});
3030

3131
async function run() {
32-
const res = await chatCreateChatCompletion(openRouter, {
32+
const res = await chatComplete(openRouter, {
3333
messages: [
3434
{
3535
role: "user",
@@ -41,7 +41,7 @@ async function run() {
4141
const { value: result } = res;
4242
console.log(result);
4343
} else {
44-
console.log("chatCreateChatCompletion failed:", res.error);
44+
console.log("chatComplete failed:", res.error);
4545
}
4646
}
4747

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const openRouter = new OpenRouter({
9898
});
9999

100100
async function run() {
101-
const result = await openRouter.chat.createChatCompletion({
101+
const result = await openRouter.chat.complete({
102102
messages: [
103103
{
104104
role: "user",
@@ -135,7 +135,7 @@ const openRouter = new OpenRouter({
135135
});
136136

137137
async function run() {
138-
const result = await openRouter.chat.createChatCompletion({
138+
const result = await openRouter.chat.complete({
139139
messages: [
140140
{
141141
role: "user",
@@ -160,8 +160,8 @@ run();
160160

161161
### [chat](docs/sdks/chat/README.md)
162162

163-
* [createChatCompletion](docs/sdks/chat/README.md#createchatcompletion) - Create a chat completion
164-
* [streamChatCompletion](docs/sdks/chat/README.md#streamchatcompletion) - Create a chat completion
163+
* [complete](docs/sdks/chat/README.md#complete) - Create a chat completion
164+
* [completeStream](docs/sdks/chat/README.md#completestream) - Create a chat completion
165165

166166

167167
</details>
@@ -182,8 +182,8 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
182182

183183
<summary>Available standalone functions</summary>
184184

185-
- [`chatCreateChatCompletion`](docs/sdks/chat/README.md#createchatcompletion) - Create a chat completion
186-
- [`chatStreamChatCompletion`](docs/sdks/chat/README.md#streamchatcompletion) - Create a chat completion
185+
- [`chatComplete`](docs/sdks/chat/README.md#complete) - Create a chat completion
186+
- [`chatCompleteStream`](docs/sdks/chat/README.md#completestream) - Create a chat completion
187187

188188
</details>
189189
<!-- End Standalone functions [standalone-funcs] -->
@@ -205,7 +205,7 @@ const openRouter = new OpenRouter({
205205
});
206206

207207
async function run() {
208-
const result = await openRouter.chat.streamChatCompletion({
208+
const result = await openRouter.chat.completeStream({
209209
messages: [
210210
{
211211
role: "user",
@@ -242,7 +242,7 @@ const openRouter = new OpenRouter({
242242
});
243243

244244
async function run() {
245-
const result = await openRouter.chat.createChatCompletion({
245+
const result = await openRouter.chat.complete({
246246
messages: [
247247
{
248248
role: "user",
@@ -288,7 +288,7 @@ const openRouter = new OpenRouter({
288288
});
289289

290290
async function run() {
291-
const result = await openRouter.chat.createChatCompletion({
291+
const result = await openRouter.chat.complete({
292292
messages: [
293293
{
294294
role: "user",
@@ -330,7 +330,7 @@ const openRouter = new OpenRouter({
330330

331331
async function run() {
332332
try {
333-
const result = await openRouter.chat.createChatCompletion({
333+
const result = await openRouter.chat.complete({
334334
messages: [
335335
{
336336
role: "user",
@@ -405,7 +405,7 @@ const openRouter = new OpenRouter({
405405
});
406406

407407
async function run() {
408-
const result = await openRouter.chat.createChatCompletion({
408+
const result = await openRouter.chat.complete({
409409
messages: [
410410
{
411411
role: "user",
@@ -433,7 +433,7 @@ const openRouter = new OpenRouter({
433433
});
434434

435435
async function run() {
436-
const result = await openRouter.chat.createChatCompletion({
436+
const result = await openRouter.chat.complete({
437437
messages: [
438438
{
439439
role: "user",

USAGE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const openRouter = new OpenRouter({
77
});
88

99
async function run() {
10-
const result = await openRouter.chat.createChatCompletion({
10+
const result = await openRouter.chat.complete({
1111
messages: [
1212
{
1313
role: "user",

docs/sdks/chat/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Chat completion operations
77

88
### Available Operations
99

10-
* [createChatCompletion](#createchatcompletion) - Create a chat completion
11-
* [streamChatCompletion](#streamchatcompletion) - Create a chat completion
10+
* [complete](#complete) - Create a chat completion
11+
* [completeStream](#completestream) - Create a chat completion
1212

13-
## createChatCompletion
13+
## complete
1414

1515
Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes.
1616

@@ -25,7 +25,7 @@ const openRouter = new OpenRouter({
2525
});
2626

2727
async function run() {
28-
const result = await openRouter.chat.createChatCompletion({
28+
const result = await openRouter.chat.complete({
2929
messages: [
3030
{
3131
role: "user",
@@ -46,7 +46,7 @@ The standalone function version of this method:
4646

4747
```typescript
4848
import { OpenRouterCore } from "open-router/core.js";
49-
import { chatCreateChatCompletion } from "open-router/funcs/chatCreateChatCompletion.js";
49+
import { chatComplete } from "open-router/funcs/chatComplete.js";
5050

5151
// Use `OpenRouterCore` for best tree-shaking performance.
5252
// You can create one instance of it to use across an application.
@@ -55,7 +55,7 @@ const openRouter = new OpenRouterCore({
5555
});
5656

5757
async function run() {
58-
const res = await chatCreateChatCompletion(openRouter, {
58+
const res = await chatComplete(openRouter, {
5959
messages: [
6060
{
6161
role: "user",
@@ -67,7 +67,7 @@ async function run() {
6767
const { value: result } = res;
6868
console.log(result);
6969
} else {
70-
console.log("chatCreateChatCompletion failed:", res.error);
70+
console.log("chatComplete failed:", res.error);
7171
}
7272
}
7373

@@ -95,7 +95,7 @@ run();
9595
| errors.ChatCompletionError | 500 | application/json |
9696
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
9797

98-
## streamChatCompletion
98+
## completeStream
9999

100100
Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes.
101101

@@ -110,7 +110,7 @@ const openRouter = new OpenRouter({
110110
});
111111

112112
async function run() {
113-
const result = await openRouter.chat.streamChatCompletion({
113+
const result = await openRouter.chat.completeStream({
114114
messages: [
115115
{
116116
role: "user",
@@ -134,7 +134,7 @@ The standalone function version of this method:
134134

135135
```typescript
136136
import { OpenRouterCore } from "open-router/core.js";
137-
import { chatStreamChatCompletion } from "open-router/funcs/chatStreamChatCompletion.js";
137+
import { chatCompleteStream } from "open-router/funcs/chatCompleteStream.js";
138138

139139
// Use `OpenRouterCore` for best tree-shaking performance.
140140
// You can create one instance of it to use across an application.
@@ -143,7 +143,7 @@ const openRouter = new OpenRouterCore({
143143
});
144144

145145
async function run() {
146-
const res = await chatStreamChatCompletion(openRouter, {
146+
const res = await chatCompleteStream(openRouter, {
147147
messages: [
148148
{
149149
role: "user",
@@ -158,7 +158,7 @@ async function run() {
158158
console.log(event);
159159
}
160160
} else {
161-
console.log("chatStreamChatCompletion failed:", res.error);
161+
console.log("chatCompleteStream failed:", res.error);
162162
}
163163
}
164164

0 commit comments

Comments
 (0)