@openrouter/sdk 0.12.28 → 0.12.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/chatstreamingresponse.d.ts +14 -0
- package/esm/models/chatstreamingresponse.js +27 -0
- package/esm/models/index.d.ts +1 -0
- package/esm/models/index.js +1 -0
- package/esm/models/operations/sendchatcompletionrequest.d.ts +0 -12
- package/esm/models/operations/sendchatcompletionrequest.js +2 -20
- package/jsr.json +1 -1
- package/package.json +7 -7
package/esm/lib/config.d.ts
CHANGED
|
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
49
49
|
export declare const SDK_METADATA: {
|
|
50
50
|
readonly language: "typescript";
|
|
51
51
|
readonly openapiDocVersion: "1.0.0";
|
|
52
|
-
readonly sdkVersion: "0.12.
|
|
52
|
+
readonly sdkVersion: "0.12.30";
|
|
53
53
|
readonly genVersion: "2.879.1";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.12.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.12.30 2.879.1 1.0.0 @openrouter/sdk";
|
|
55
55
|
};
|
|
56
56
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
|
|
|
26
26
|
export const SDK_METADATA = {
|
|
27
27
|
language: "typescript",
|
|
28
28
|
openapiDocVersion: "1.0.0",
|
|
29
|
-
sdkVersion: "0.12.
|
|
29
|
+
sdkVersion: "0.12.30",
|
|
30
30
|
genVersion: "2.879.1",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 0.12.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 0.12.30 2.879.1 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { ChatStreamChunk } from "./chatstreamchunk.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
export type ChatStreamingResponse = {
|
|
6
|
+
/**
|
|
7
|
+
* Streaming chat completion chunk
|
|
8
|
+
*/
|
|
9
|
+
data: ChatStreamChunk;
|
|
10
|
+
};
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare const ChatStreamingResponse$inboundSchema: z.ZodType<ChatStreamingResponse, unknown>;
|
|
13
|
+
export declare function chatStreamingResponseFromJSON(jsonString: string): SafeParseResult<ChatStreamingResponse, SDKValidationError>;
|
|
14
|
+
//# sourceMappingURL=chatstreamingresponse.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: bf6c7ab2065f
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { ChatStreamChunk$inboundSchema, } from "./chatstreamchunk.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const ChatStreamingResponse$inboundSchema = z.object({
|
|
10
|
+
data: z.string().transform((v, ctx) => {
|
|
11
|
+
try {
|
|
12
|
+
return JSON.parse(v);
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
ctx.addIssue({
|
|
16
|
+
input: v,
|
|
17
|
+
code: "custom",
|
|
18
|
+
message: `malformed json: ${err}`,
|
|
19
|
+
});
|
|
20
|
+
return z.NEVER;
|
|
21
|
+
}
|
|
22
|
+
}).pipe(ChatStreamChunk$inboundSchema),
|
|
23
|
+
});
|
|
24
|
+
export function chatStreamingResponseFromJSON(jsonString) {
|
|
25
|
+
return safeParse(jsonString, (x) => ChatStreamingResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatStreamingResponse' from JSON`);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=chatstreamingresponse.js.map
|
package/esm/models/index.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export * from "./chatsearchmodelsservertool.js";
|
|
|
51
51
|
export * from "./chatstreamchoice.js";
|
|
52
52
|
export * from "./chatstreamchunk.js";
|
|
53
53
|
export * from "./chatstreamdelta.js";
|
|
54
|
+
export * from "./chatstreamingresponse.js";
|
|
54
55
|
export * from "./chatstreamoptions.js";
|
|
55
56
|
export * from "./chatstreamtoolcall.js";
|
|
56
57
|
export * from "./chatsystemmessage.js";
|
package/esm/models/index.js
CHANGED
|
@@ -55,6 +55,7 @@ export * from "./chatsearchmodelsservertool.js";
|
|
|
55
55
|
export * from "./chatstreamchoice.js";
|
|
56
56
|
export * from "./chatstreamchunk.js";
|
|
57
57
|
export * from "./chatstreamdelta.js";
|
|
58
|
+
export * from "./chatstreamingresponse.js";
|
|
58
59
|
export * from "./chatstreamoptions.js";
|
|
59
60
|
export * from "./chatstreamtoolcall.js";
|
|
60
61
|
export * from "./chatsystemmessage.js";
|
|
@@ -46,15 +46,6 @@ export type SendChatCompletionRequestRequest = {
|
|
|
46
46
|
appCategories?: string | undefined;
|
|
47
47
|
chatRequest: models.ChatRequest;
|
|
48
48
|
};
|
|
49
|
-
/**
|
|
50
|
-
* Successful chat completion response
|
|
51
|
-
*/
|
|
52
|
-
export type SendChatCompletionRequestResponseBody = {
|
|
53
|
-
/**
|
|
54
|
-
* Streaming chat completion chunk
|
|
55
|
-
*/
|
|
56
|
-
data: models.ChatStreamChunk;
|
|
57
|
-
};
|
|
58
49
|
export type SendChatCompletionRequestResponse = models.ChatResult | EventStream<models.ChatStreamChunk>;
|
|
59
50
|
/** @internal */
|
|
60
51
|
export type SendChatCompletionRequestRequest$Outbound = {
|
|
@@ -67,9 +58,6 @@ export type SendChatCompletionRequestRequest$Outbound = {
|
|
|
67
58
|
export declare const SendChatCompletionRequestRequest$outboundSchema: z.ZodType<SendChatCompletionRequestRequest$Outbound, SendChatCompletionRequestRequest>;
|
|
68
59
|
export declare function sendChatCompletionRequestRequestToJSON(sendChatCompletionRequestRequest: SendChatCompletionRequestRequest): string;
|
|
69
60
|
/** @internal */
|
|
70
|
-
export declare const SendChatCompletionRequestResponseBody$inboundSchema: z.ZodType<SendChatCompletionRequestResponseBody, unknown>;
|
|
71
|
-
export declare function sendChatCompletionRequestResponseBodyFromJSON(jsonString: string): SafeParseResult<SendChatCompletionRequestResponseBody, SDKValidationError>;
|
|
72
|
-
/** @internal */
|
|
73
61
|
export declare const SendChatCompletionRequestResponse$inboundSchema: z.ZodType<SendChatCompletionRequestResponse, unknown>;
|
|
74
62
|
export declare function sendChatCompletionRequestResponseFromJSON(jsonString: string): SafeParseResult<SendChatCompletionRequestResponse, SDKValidationError>;
|
|
75
63
|
//# sourceMappingURL=sendchatcompletionrequest.d.ts.map
|
|
@@ -23,25 +23,6 @@ export function sendChatCompletionRequestRequestToJSON(sendChatCompletionRequest
|
|
|
23
23
|
return JSON.stringify(SendChatCompletionRequestRequest$outboundSchema.parse(sendChatCompletionRequestRequest));
|
|
24
24
|
}
|
|
25
25
|
/** @internal */
|
|
26
|
-
export const SendChatCompletionRequestResponseBody$inboundSchema = z.object({
|
|
27
|
-
data: z.string().transform((v, ctx) => {
|
|
28
|
-
try {
|
|
29
|
-
return JSON.parse(v);
|
|
30
|
-
}
|
|
31
|
-
catch (err) {
|
|
32
|
-
ctx.addIssue({
|
|
33
|
-
input: v,
|
|
34
|
-
code: "custom",
|
|
35
|
-
message: `malformed json: ${err}`,
|
|
36
|
-
});
|
|
37
|
-
return z.NEVER;
|
|
38
|
-
}
|
|
39
|
-
}).pipe(models.ChatStreamChunk$inboundSchema),
|
|
40
|
-
});
|
|
41
|
-
export function sendChatCompletionRequestResponseBodyFromJSON(jsonString) {
|
|
42
|
-
return safeParse(jsonString, (x) => SendChatCompletionRequestResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SendChatCompletionRequestResponseBody' from JSON`);
|
|
43
|
-
}
|
|
44
|
-
/** @internal */
|
|
45
26
|
export const SendChatCompletionRequestResponse$inboundSchema = z.union([
|
|
46
27
|
models.ChatResult$inboundSchema,
|
|
47
28
|
z.custom(x => x instanceof ReadableStream)
|
|
@@ -51,7 +32,8 @@ export const SendChatCompletionRequestResponse$inboundSchema = z.union([
|
|
|
51
32
|
return { done: true, value: undefined };
|
|
52
33
|
return {
|
|
53
34
|
done: false,
|
|
54
|
-
value:
|
|
35
|
+
value: models.ChatStreamingResponse$inboundSchema.parse(rawEvent)
|
|
36
|
+
?.data,
|
|
55
37
|
};
|
|
56
38
|
});
|
|
57
39
|
}),
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.30",
|
|
4
4
|
"author": "OpenRouter",
|
|
5
5
|
"description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 300+ language models through a unified API.",
|
|
6
6
|
"keywords": [
|
|
@@ -69,15 +69,15 @@
|
|
|
69
69
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
70
70
|
"build": "tsc",
|
|
71
71
|
"prepublishOnly": "npm run build",
|
|
72
|
-
"test": "vitest --run --project unit",
|
|
73
|
-
"test:transit": "exit 0",
|
|
74
|
-
"test:watch": "vitest --watch --project unit",
|
|
75
|
-
"typecheck": "tsc --noEmit",
|
|
76
|
-
"typecheck:transit": "exit 0",
|
|
77
72
|
"compile": "tsc",
|
|
78
73
|
"postinstall": "node scripts/check-types.js || true",
|
|
74
|
+
"prepare": "npm run build",
|
|
79
75
|
"test:e2e": "vitest --run --project e2e",
|
|
80
|
-
"
|
|
76
|
+
"test:transit": "exit 0",
|
|
77
|
+
"typecheck:transit": "exit 0",
|
|
78
|
+
"test": "vitest --run --project unit",
|
|
79
|
+
"test:watch": "vitest --watch --project unit",
|
|
80
|
+
"typecheck": "tsc --noEmit"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {},
|
|
83
83
|
"devDependencies": {
|