@openrouter/sdk 0.1.10 → 0.1.11
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 +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/models/chatcompletionfinishreason.js +2 -7
- package/esm/models/chatgenerationparams.d.ts +1 -1
- package/esm/models/chatgenerationparams.js +3 -4
- package/esm/models/chatmessagecontentitemaudio.d.ts +1 -1
- package/esm/models/chatmessagecontentitemaudio.js +3 -10
- package/esm/models/chatmessagecontentitemimage.d.ts +1 -1
- package/esm/models/chatmessagecontentitemimage.js +3 -10
- package/esm/models/completionchoice.js +2 -6
- package/esm/models/createchargerequest.d.ts +1 -1
- package/esm/models/createchargerequest.js +3 -4
- package/esm/models/endpointstatus.js +2 -7
- package/esm/models/imagegenerationstatus.d.ts +1 -1
- package/esm/models/imagegenerationstatus.js +3 -11
- package/esm/models/inputmodality.js +2 -7
- package/esm/models/instructtype.js +2 -7
- package/esm/models/listendpointsresponse.js +3 -6
- package/esm/models/modelarchitecture.js +2 -6
- package/esm/models/modelgroup.js +2 -7
- package/esm/models/openairesponsesincludable.d.ts +1 -1
- package/esm/models/openairesponsesincludable.js +2 -5
- package/esm/models/openairesponsesincompletedetails.js +3 -6
- package/esm/models/openairesponsesreasoningeffort.d.ts +1 -1
- package/esm/models/openairesponsesreasoningeffort.js +3 -11
- package/esm/models/openairesponsesresponsestatus.js +2 -7
- package/esm/models/openairesponsesservicetier.js +2 -7
- package/esm/models/openairesponsestruncation.js +2 -7
- package/esm/models/openresponsesreasoning.d.ts +1 -1
- package/esm/models/openresponsesreasoning.js +2 -4
- package/esm/models/openresponsesrequest.d.ts +6 -6
- package/esm/models/openresponsesrequest.js +10 -27
- package/esm/models/openresponsesresponsetext.d.ts +1 -1
- package/esm/models/openresponsesresponsetext.js +2 -4
- package/esm/models/operations/createauthkeyscode.d.ts +1 -1
- package/esm/models/operations/createauthkeyscode.js +2 -4
- package/esm/models/operations/createembeddings.d.ts +2 -2
- package/esm/models/operations/createembeddings.js +4 -8
- package/esm/models/operations/createkeys.d.ts +2 -2
- package/esm/models/operations/createkeys.js +2 -4
- package/esm/models/operations/exchangeauthcodeforapikey.d.ts +1 -1
- package/esm/models/operations/exchangeauthcodeforapikey.js +3 -4
- package/esm/models/operations/getcurrentkey.d.ts +4 -0
- package/esm/models/operations/getcurrentkey.js +2 -0
- package/esm/models/operations/getgeneration.js +3 -6
- package/esm/models/operations/getparameters.d.ts +1 -1
- package/esm/models/operations/getparameters.js +3 -10
- package/esm/models/operations/updatekeys.d.ts +1 -1
- package/esm/models/operations/updatekeys.js +2 -4
- package/esm/models/outputmodality.js +2 -7
- package/esm/models/parameter.js +3 -7
- package/esm/models/providername.d.ts +1 -1
- package/esm/models/providername.js +3 -11
- package/esm/models/publicendpoint.js +2 -6
- package/esm/models/quantization.d.ts +1 -1
- package/esm/models/quantization.js +2 -5
- package/esm/models/reasoningsummaryverbosity.d.ts +1 -1
- package/esm/models/reasoningsummaryverbosity.js +3 -11
- package/esm/models/responseinputaudio.d.ts +1 -1
- package/esm/models/responseinputaudio.js +3 -10
- package/esm/models/responseinputimage.d.ts +1 -1
- package/esm/models/responseinputimage.js +3 -10
- package/esm/models/responseserrorfield.js +3 -6
- package/esm/models/responsessearchcontextsize.d.ts +1 -1
- package/esm/models/responsessearchcontextsize.js +3 -11
- package/esm/models/responsetextconfig.js +2 -6
- package/esm/models/toolcallstatus.d.ts +1 -1
- package/esm/models/toolcallstatus.js +3 -11
- package/esm/models/websearchstatus.d.ts +1 -1
- package/esm/models/websearchstatus.js +3 -11
- package/esm/types/enums.d.ts +10 -6
- package/esm/types/enums.js +38 -1
- package/esm/types/index.d.ts +0 -1
- package/esm/types/index.js +0 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as z from "zod/v4";
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
|
-
import
|
|
6
|
+
import * as openEnums from "../types/enums.js";
|
|
7
7
|
export const CodeEnum = {
|
|
8
8
|
ServerError: "server_error",
|
|
9
9
|
RateLimitExceeded: "rate_limit_exceeded",
|
|
@@ -25,11 +25,8 @@ export const CodeEnum = {
|
|
|
25
25
|
ImageFileNotFound: "image_file_not_found",
|
|
26
26
|
};
|
|
27
27
|
/** @internal */
|
|
28
|
-
export const CodeEnum$inboundSchema =
|
|
29
|
-
.
|
|
30
|
-
z.enum(CodeEnum),
|
|
31
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
32
|
-
]);
|
|
28
|
+
export const CodeEnum$inboundSchema = openEnums
|
|
29
|
+
.inboundSchema(CodeEnum);
|
|
33
30
|
/** @internal */
|
|
34
31
|
export const ResponsesErrorField$inboundSchema = z.object({
|
|
35
32
|
code: CodeEnum$inboundSchema,
|
|
@@ -15,5 +15,5 @@ export type ResponsesSearchContextSize = OpenEnum<typeof ResponsesSearchContextS
|
|
|
15
15
|
/** @internal */
|
|
16
16
|
export declare const ResponsesSearchContextSize$inboundSchema: z.ZodType<ResponsesSearchContextSize, unknown>;
|
|
17
17
|
/** @internal */
|
|
18
|
-
export declare const ResponsesSearchContextSize$outboundSchema: z.ZodType<
|
|
18
|
+
export declare const ResponsesSearchContextSize$outboundSchema: z.ZodType<string, ResponsesSearchContextSize>;
|
|
19
19
|
//# sourceMappingURL=responsessearchcontextsize.d.ts.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
|
-
import * as
|
|
5
|
-
import { catchUnrecognizedEnum, } from "../types/enums.js";
|
|
4
|
+
import * as openEnums from "../types/enums.js";
|
|
6
5
|
/**
|
|
7
6
|
* Size of the search context for web search tools
|
|
8
7
|
*/
|
|
@@ -12,14 +11,7 @@ export const ResponsesSearchContextSize = {
|
|
|
12
11
|
High: "high",
|
|
13
12
|
};
|
|
14
13
|
/** @internal */
|
|
15
|
-
export const ResponsesSearchContextSize$inboundSchema =
|
|
16
|
-
.union([
|
|
17
|
-
z.enum(ResponsesSearchContextSize),
|
|
18
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
19
|
-
]);
|
|
14
|
+
export const ResponsesSearchContextSize$inboundSchema = openEnums.inboundSchema(ResponsesSearchContextSize);
|
|
20
15
|
/** @internal */
|
|
21
|
-
export const ResponsesSearchContextSize$outboundSchema =
|
|
22
|
-
z.enum(ResponsesSearchContextSize),
|
|
23
|
-
z.string().and(z.custom()),
|
|
24
|
-
]);
|
|
16
|
+
export const ResponsesSearchContextSize$outboundSchema = openEnums.outboundSchema(ResponsesSearchContextSize);
|
|
25
17
|
//# sourceMappingURL=responsessearchcontextsize.js.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as z from "zod/v4";
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
|
-
import
|
|
6
|
+
import * as openEnums from "../types/enums.js";
|
|
7
7
|
import { ResponseFormatTextConfig$inboundSchema, } from "./responseformattextconfig.js";
|
|
8
8
|
export const ResponseTextConfigVerbosity = {
|
|
9
9
|
High: "high",
|
|
@@ -11,11 +11,7 @@ export const ResponseTextConfigVerbosity = {
|
|
|
11
11
|
Medium: "medium",
|
|
12
12
|
};
|
|
13
13
|
/** @internal */
|
|
14
|
-
export const ResponseTextConfigVerbosity$inboundSchema =
|
|
15
|
-
.union([
|
|
16
|
-
z.enum(ResponseTextConfigVerbosity),
|
|
17
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
18
|
-
]);
|
|
14
|
+
export const ResponseTextConfigVerbosity$inboundSchema = openEnums.inboundSchema(ResponseTextConfigVerbosity);
|
|
19
15
|
/** @internal */
|
|
20
16
|
export const ResponseTextConfig$inboundSchema = z.object({
|
|
21
17
|
format: ResponseFormatTextConfig$inboundSchema.optional(),
|
|
@@ -9,5 +9,5 @@ export type ToolCallStatus = OpenEnum<typeof ToolCallStatus>;
|
|
|
9
9
|
/** @internal */
|
|
10
10
|
export declare const ToolCallStatus$inboundSchema: z.ZodType<ToolCallStatus, unknown>;
|
|
11
11
|
/** @internal */
|
|
12
|
-
export declare const ToolCallStatus$outboundSchema: z.ZodType<
|
|
12
|
+
export declare const ToolCallStatus$outboundSchema: z.ZodType<string, ToolCallStatus>;
|
|
13
13
|
//# sourceMappingURL=toolcallstatus.d.ts.map
|
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
|
-
import * as
|
|
5
|
-
import { catchUnrecognizedEnum, } from "../types/enums.js";
|
|
4
|
+
import * as openEnums from "../types/enums.js";
|
|
6
5
|
export const ToolCallStatus = {
|
|
7
6
|
InProgress: "in_progress",
|
|
8
7
|
Completed: "completed",
|
|
9
8
|
Incomplete: "incomplete",
|
|
10
9
|
};
|
|
11
10
|
/** @internal */
|
|
12
|
-
export const ToolCallStatus$inboundSchema =
|
|
13
|
-
.union([
|
|
14
|
-
z.enum(ToolCallStatus),
|
|
15
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
16
|
-
]);
|
|
11
|
+
export const ToolCallStatus$inboundSchema = openEnums.inboundSchema(ToolCallStatus);
|
|
17
12
|
/** @internal */
|
|
18
|
-
export const ToolCallStatus$outboundSchema =
|
|
19
|
-
z.enum(ToolCallStatus),
|
|
20
|
-
z.string().and(z.custom()),
|
|
21
|
-
]);
|
|
13
|
+
export const ToolCallStatus$outboundSchema = openEnums.outboundSchema(ToolCallStatus);
|
|
22
14
|
//# sourceMappingURL=toolcallstatus.js.map
|
|
@@ -10,5 +10,5 @@ export type WebSearchStatus = OpenEnum<typeof WebSearchStatus>;
|
|
|
10
10
|
/** @internal */
|
|
11
11
|
export declare const WebSearchStatus$inboundSchema: z.ZodType<WebSearchStatus, unknown>;
|
|
12
12
|
/** @internal */
|
|
13
|
-
export declare const WebSearchStatus$outboundSchema: z.ZodType<
|
|
13
|
+
export declare const WebSearchStatus$outboundSchema: z.ZodType<string, WebSearchStatus>;
|
|
14
14
|
//# sourceMappingURL=websearchstatus.d.ts.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
|
-
import * as
|
|
5
|
-
import { catchUnrecognizedEnum, } from "../types/enums.js";
|
|
4
|
+
import * as openEnums from "../types/enums.js";
|
|
6
5
|
export const WebSearchStatus = {
|
|
7
6
|
Completed: "completed",
|
|
8
7
|
Searching: "searching",
|
|
@@ -10,14 +9,7 @@ export const WebSearchStatus = {
|
|
|
10
9
|
Failed: "failed",
|
|
11
10
|
};
|
|
12
11
|
/** @internal */
|
|
13
|
-
export const WebSearchStatus$inboundSchema =
|
|
14
|
-
.union([
|
|
15
|
-
z.enum(WebSearchStatus),
|
|
16
|
-
z.string().transform(catchUnrecognizedEnum),
|
|
17
|
-
]);
|
|
12
|
+
export const WebSearchStatus$inboundSchema = openEnums.inboundSchema(WebSearchStatus);
|
|
18
13
|
/** @internal */
|
|
19
|
-
export const WebSearchStatus$outboundSchema =
|
|
20
|
-
z.enum(WebSearchStatus),
|
|
21
|
-
z.string().and(z.custom()),
|
|
22
|
-
]);
|
|
14
|
+
export const WebSearchStatus$outboundSchema = openEnums.outboundSchema(WebSearchStatus);
|
|
23
15
|
//# sourceMappingURL=websearchstatus.js.map
|
package/esm/types/enums.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
1
2
|
declare const __brand: unique symbol;
|
|
2
3
|
export type Unrecognized<T> = T & {
|
|
3
4
|
[__brand]: "unrecognized";
|
|
4
5
|
};
|
|
5
|
-
export
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export
|
|
6
|
+
export type ClosedEnum<T extends Readonly<Record<string, string | number>>> = T[keyof T];
|
|
7
|
+
export type OpenEnum<T extends Readonly<Record<string, string | number>>> = T[keyof T] | Unrecognized<T[keyof T] extends number ? number : string>;
|
|
8
|
+
export declare function unrecognizedCounter(): {
|
|
9
|
+
count: () => number;
|
|
10
|
+
};
|
|
11
|
+
export declare function inboundSchema<T extends Record<string, string>>(enumObj: T): z.ZodType<OpenEnum<T>, unknown>;
|
|
12
|
+
export declare function inboundSchemaInt<T extends Record<string, number | string>>(enumObj: T): z.ZodType<OpenEnum<T>, unknown>;
|
|
13
|
+
export declare function outboundSchema<T extends Record<string, string>>(_: T): z.ZodType<string, OpenEnum<T>>;
|
|
14
|
+
export declare function outboundSchemaInt<T extends Record<string, number | string>>(_: T): z.ZodType<number, OpenEnum<T>>;
|
|
11
15
|
export {};
|
|
12
16
|
//# sourceMappingURL=enums.d.ts.map
|
package/esm/types/enums.js
CHANGED
|
@@ -1,7 +1,44 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
import * as z from "zod/v4";
|
|
5
|
+
function unrecognized(value) {
|
|
6
|
+
unrecognizedCount++;
|
|
5
7
|
return value;
|
|
6
8
|
}
|
|
9
|
+
let unrecognizedCount = 0;
|
|
10
|
+
let refCount = 0;
|
|
11
|
+
export function unrecognizedCounter() {
|
|
12
|
+
refCount++;
|
|
13
|
+
const start = unrecognizedCount;
|
|
14
|
+
return {
|
|
15
|
+
count: () => {
|
|
16
|
+
const count = unrecognizedCount - start;
|
|
17
|
+
if (--refCount === 0)
|
|
18
|
+
unrecognizedCount = 0;
|
|
19
|
+
return count;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function inboundSchema(enumObj) {
|
|
24
|
+
const options = Object.values(enumObj);
|
|
25
|
+
return z.union([
|
|
26
|
+
...options.map(x => z.literal(x)),
|
|
27
|
+
z.string().transform(x => unrecognized(x)),
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
export function inboundSchemaInt(enumObj) {
|
|
31
|
+
// For numeric enums, Object.values returns both numbers and string keys
|
|
32
|
+
const options = Object.values(enumObj).filter(v => typeof v === "number");
|
|
33
|
+
return z.union([
|
|
34
|
+
...options.map(x => z.literal(x)),
|
|
35
|
+
z.int().transform(x => unrecognized(x)),
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
export function outboundSchema(_) {
|
|
39
|
+
return z.string();
|
|
40
|
+
}
|
|
41
|
+
export function outboundSchemaInt(_) {
|
|
42
|
+
return z.int();
|
|
43
|
+
}
|
|
7
44
|
//# sourceMappingURL=enums.js.map
|
package/esm/types/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { blobLikeSchema, isBlobLike } from "./blobs.js";
|
|
2
|
-
export { catchUnrecognizedEnum } from "./enums.js";
|
|
3
2
|
export type { ClosedEnum, OpenEnum, Unrecognized } from "./enums.js";
|
|
4
3
|
export type { Result } from "./fp.js";
|
|
5
4
|
export type { PageIterator, Paginator } from "./operations.js";
|
package/esm/types/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
export { blobLikeSchema, isBlobLike } from "./blobs.js";
|
|
5
|
-
export { catchUnrecognizedEnum } from "./enums.js";
|
|
6
5
|
export { createPageIterator } from "./operations.js";
|
|
7
6
|
export { RFCDate } from "./rfcdate.js";
|
|
8
7
|
//# sourceMappingURL=index.js.map
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
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": [
|