@openrouter/sdk 0.1.7 → 0.1.9
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/funcs/{modelsListEmbeddings.d.ts → embeddingsListModels.d.ts} +2 -2
- package/esm/funcs/{modelsListEmbeddings.js → embeddingsListModels.js} +4 -4
- package/esm/lib/base64.d.ts +2 -2
- package/esm/lib/base64.js +2 -4
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/lib/schemas.d.ts +1 -1
- package/esm/lib/schemas.js +2 -2
- package/esm/models/badgatewayresponseerrordata.js +1 -1
- package/esm/models/badrequestresponseerrordata.js +1 -1
- package/esm/models/chatgenerationparams.js +1 -1
- package/esm/models/chatmessagecontentitem.js +8 -20
- package/esm/models/completioncreateparams.js +5 -5
- package/esm/models/edgenetworktimeoutresponseerrordata.js +1 -1
- package/esm/models/errors/responsevalidationerror.js +2 -2
- package/esm/models/errors/sdkvalidationerror.d.ts +2 -2
- package/esm/models/errors/sdkvalidationerror.js +2 -2
- package/esm/models/forbiddenresponseerrordata.js +1 -1
- package/esm/models/internalserverresponseerrordata.js +1 -1
- package/esm/models/notfoundresponseerrordata.js +1 -1
- package/esm/models/openairesponsesinputunion.js +20 -60
- package/esm/models/openresponseseasyinputmessage.js +12 -36
- package/esm/models/openresponsesinputmessageitem.js +8 -24
- package/esm/models/operations/createkeys.d.ts +9 -0
- package/esm/models/operations/createkeys.js +4 -0
- package/esm/models/operations/getkey.d.ts +4 -0
- package/esm/models/operations/getkey.js +2 -0
- package/esm/models/operations/list.d.ts +4 -0
- package/esm/models/operations/list.js +2 -0
- package/esm/models/operations/updatekeys.d.ts +4 -0
- package/esm/models/operations/updatekeys.js +2 -0
- package/esm/models/payloadtoolargeresponseerrordata.js +1 -1
- package/esm/models/paymentrequiredresponseerrordata.js +1 -1
- package/esm/models/provideroverloadedresponseerrordata.js +1 -1
- package/esm/models/requesttimeoutresponseerrordata.js +1 -1
- package/esm/models/serviceunavailableresponseerrordata.js +1 -1
- package/esm/models/toomanyrequestsresponseerrordata.js +1 -1
- package/esm/models/unauthorizedresponseerrordata.js +1 -1
- package/esm/models/unprocessableentityresponseerrordata.js +1 -1
- package/esm/react-query/embeddingsListModels.d.ts +29 -0
- package/esm/react-query/{modelsListEmbeddings.js → embeddingsListModels.js} +18 -18
- package/esm/react-query/index.d.ts +1 -1
- package/esm/react-query/index.js +1 -1
- package/esm/sdk/embeddings.d.ts +8 -0
- package/esm/sdk/embeddings.js +10 -0
- package/esm/sdk/models.d.ts +0 -7
- package/esm/sdk/models.js +0 -10
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/esm/react-query/modelsListEmbeddings.d.ts +0 -29
|
@@ -14,5 +14,5 @@ import { Result } from "../types/fp.js";
|
|
|
14
14
|
* @remarks
|
|
15
15
|
* Returns a list of all available embeddings models and their properties
|
|
16
16
|
*/
|
|
17
|
-
export declare function
|
|
18
|
-
//# sourceMappingURL=
|
|
17
|
+
export declare function embeddingsListModels(client: OpenRouterCore, options?: RequestOptions): APIPromise<Result<models.ModelsListResponse, errors.BadRequestResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
//# sourceMappingURL=embeddingsListModels.d.ts.map
|
|
@@ -14,11 +14,11 @@ import { APIPromise } from "../types/async.js";
|
|
|
14
14
|
* @remarks
|
|
15
15
|
* Returns a list of all available embeddings models and their properties
|
|
16
16
|
*/
|
|
17
|
-
export function
|
|
17
|
+
export function embeddingsListModels(client, options) {
|
|
18
18
|
return new APIPromise($do(client, options));
|
|
19
19
|
}
|
|
20
20
|
async function $do(client, options) {
|
|
21
|
-
const path = pathToFunc("/models
|
|
21
|
+
const path = pathToFunc("/embeddings/models")();
|
|
22
22
|
const headers = new Headers(compactMap({
|
|
23
23
|
Accept: "application/json",
|
|
24
24
|
}));
|
|
@@ -28,7 +28,7 @@ async function $do(client, options) {
|
|
|
28
28
|
const context = {
|
|
29
29
|
options: client._options,
|
|
30
30
|
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
31
|
-
operationID: "
|
|
31
|
+
operationID: "listEmbeddingsModels",
|
|
32
32
|
oAuth2Scopes: null,
|
|
33
33
|
resolvedSecurity: requestSecurity,
|
|
34
34
|
securitySource: client._options.apiKey,
|
|
@@ -69,4 +69,4 @@ async function $do(client, options) {
|
|
|
69
69
|
}
|
|
70
70
|
return [result, { status: "complete", request: req, response }];
|
|
71
71
|
}
|
|
72
|
-
//# sourceMappingURL=
|
|
72
|
+
//# sourceMappingURL=embeddingsListModels.js.map
|
package/esm/lib/base64.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export declare function stringToBytes(str: string): Uint8Array;
|
|
|
5
5
|
export declare function stringFromBytes(u8arr: Uint8Array): string;
|
|
6
6
|
export declare function stringToBase64(str: string): string;
|
|
7
7
|
export declare function stringFromBase64(b64str: string): string;
|
|
8
|
-
export declare const zodOutbound: z.ZodUnion<[z.ZodCustom<Uint8Array<
|
|
9
|
-
export declare const zodInbound: z.ZodUnion<[z.ZodCustom<Uint8Array<
|
|
8
|
+
export declare const zodOutbound: z.ZodUnion<[z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, z.ZodPipe<z.ZodString, z.ZodTransform<Uint8Array<ArrayBufferLike>, string>>]>;
|
|
9
|
+
export declare const zodInbound: z.ZodUnion<[z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, z.ZodPipe<z.ZodString, z.ZodTransform<Uint8Array<ArrayBufferLike>, string>>]>;
|
|
10
10
|
//# sourceMappingURL=base64.d.ts.map
|
package/esm/lib/base64.js
CHANGED
|
@@ -20,10 +20,8 @@ export function stringToBase64(str) {
|
|
|
20
20
|
export function stringFromBase64(b64str) {
|
|
21
21
|
return stringFromBytes(bytesFromBase64(b64str));
|
|
22
22
|
}
|
|
23
|
-
export const zodOutbound = z
|
|
24
|
-
.instanceof(Uint8Array)
|
|
23
|
+
export const zodOutbound = z.custom(x => x instanceof Uint8Array)
|
|
25
24
|
.or(z.string().transform(stringToBytes));
|
|
26
|
-
export const zodInbound = z
|
|
27
|
-
.instanceof(Uint8Array)
|
|
25
|
+
export const zodInbound = z.custom(x => x instanceof Uint8Array)
|
|
28
26
|
.or(z.string().transform(bytesFromBase64));
|
|
29
27
|
//# sourceMappingURL=base64.js.map
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -37,8 +37,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
37
37
|
export declare const SDK_METADATA: {
|
|
38
38
|
readonly language: "typescript";
|
|
39
39
|
readonly openapiDocVersion: "1.0.0";
|
|
40
|
-
readonly sdkVersion: "0.1.
|
|
41
|
-
readonly genVersion: "2.
|
|
42
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.1.
|
|
40
|
+
readonly sdkVersion: "0.1.9";
|
|
41
|
+
readonly genVersion: "2.748.0";
|
|
42
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.1.9 2.748.0 1.0.0 @openrouter/sdk";
|
|
43
43
|
};
|
|
44
44
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -25,8 +25,8 @@ export function serverURLFromOptions(options) {
|
|
|
25
25
|
export const SDK_METADATA = {
|
|
26
26
|
language: "typescript",
|
|
27
27
|
openapiDocVersion: "1.0.0",
|
|
28
|
-
sdkVersion: "0.1.
|
|
29
|
-
genVersion: "2.
|
|
30
|
-
userAgent: "speakeasy-sdk/typescript 0.1.
|
|
28
|
+
sdkVersion: "0.1.9",
|
|
29
|
+
genVersion: "2.748.0",
|
|
30
|
+
userAgent: "speakeasy-sdk/typescript 0.1.9 2.748.0 1.0.0 @openrouter/sdk",
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=config.js.map
|
package/esm/lib/schemas.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare function parse<Inp, Out>(rawValue: Inp, fn: (value: Inp) => Out,
|
|
|
13
13
|
* leak Zod implementation details to user code.
|
|
14
14
|
*/
|
|
15
15
|
export declare function safeParse<Inp, Out>(rawValue: Inp, fn: (value: Inp) => Out, errorMessage: string): Result<Out, SDKValidationError>;
|
|
16
|
-
export declare function collectExtraKeys<Shape extends z.ZodRawShape, Catchall extends z.ZodType, K extends string, Optional extends boolean>(obj: z.ZodObject<Shape, z.core.$catchall<Catchall>>, extrasKey: K, optional: Optional): z.ZodPipe<z.ZodObject<Shape, z.core.$catchall<Catchall>>, z.ZodTransform<z.output<z.ZodObject<Shape, z.core.$strip>> & (Optional extends
|
|
16
|
+
export declare function collectExtraKeys<Shape extends z.ZodRawShape, Catchall extends z.ZodType, K extends string, Optional extends boolean>(obj: z.ZodObject<Shape, z.core.$catchall<Catchall>>, extrasKey: K, optional: Optional): z.ZodPipe<z.ZodObject<Shape, z.core.$catchall<Catchall>>, z.ZodTransform<z.output<z.ZodObject<Shape, z.core.$strip>> & (Optional extends false ? {
|
|
17
17
|
[k in K]: Record<string, z.output<Catchall>>;
|
|
18
18
|
} : {
|
|
19
19
|
[k in K]?: Record<string, z.output<Catchall>> | undefined;
|
package/esm/lib/schemas.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import * as z from "zod/v4";
|
|
5
5
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
6
6
|
import { ERR, OK } from "../types/fp.js";
|
|
7
7
|
/**
|
|
@@ -14,7 +14,7 @@ export function parse(rawValue, fn, errorMessage) {
|
|
|
14
14
|
return fn(rawValue);
|
|
15
15
|
}
|
|
16
16
|
catch (err) {
|
|
17
|
-
if (err instanceof ZodError) {
|
|
17
|
+
if (err instanceof z.ZodError) {
|
|
18
18
|
throw new SDKValidationError(errorMessage, err, rawValue);
|
|
19
19
|
}
|
|
20
20
|
throw err;
|
|
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
|
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export const BadGatewayResponseErrorData$inboundSchema = z.object({
|
|
8
|
-
code: z.
|
|
8
|
+
code: z.int(),
|
|
9
9
|
message: z.string(),
|
|
10
10
|
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
11
|
});
|
|
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
|
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export const BadRequestResponseErrorData$inboundSchema = z.object({
|
|
8
|
-
code: z.
|
|
8
|
+
code: z.int(),
|
|
9
9
|
message: z.string(),
|
|
10
10
|
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
11
|
});
|
|
@@ -86,7 +86,7 @@ export const ChatGenerationParams$outboundSchema = z.object({
|
|
|
86
86
|
z.lazy(() => ChatGenerationParamsResponseFormatJSONObject$outboundSchema),
|
|
87
87
|
z.lazy(() => ChatGenerationParamsResponseFormatPython$outboundSchema),
|
|
88
88
|
]).optional(),
|
|
89
|
-
seed: z.nullable(z.
|
|
89
|
+
seed: z.nullable(z.int()).optional(),
|
|
90
90
|
stop: z.nullable(z.union([z.string(), z.array(z.string())])).optional(),
|
|
91
91
|
stream: z.boolean().default(false),
|
|
92
92
|
streamOptions: z.nullable(ChatStreamOptions$outboundSchema).optional(),
|
|
@@ -9,29 +9,17 @@ import { ChatMessageContentItemText$inboundSchema, ChatMessageContentItemText$ou
|
|
|
9
9
|
import { ChatMessageContentItemVideo$inboundSchema, ChatMessageContentItemVideo$outboundSchema, } from "./chatmessagecontentitemvideo.js";
|
|
10
10
|
/** @internal */
|
|
11
11
|
export const ChatMessageContentItem$inboundSchema = z.union([
|
|
12
|
-
ChatMessageContentItemText$inboundSchema.and(z.object({ type: z.literal("text") })
|
|
13
|
-
ChatMessageContentItemImage$inboundSchema.and(z.object({ type: z.literal("image_url") })
|
|
14
|
-
|
|
15
|
-
}))
|
|
16
|
-
ChatMessageContentItemAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
17
|
-
type: v.type,
|
|
18
|
-
}))),
|
|
19
|
-
ChatMessageContentItemVideo$inboundSchema.and(z.object({ type: z.literal("input_video") }).transform((v) => ({
|
|
20
|
-
type: v.type,
|
|
21
|
-
}))),
|
|
12
|
+
ChatMessageContentItemText$inboundSchema.and(z.object({ type: z.literal("text") })),
|
|
13
|
+
ChatMessageContentItemImage$inboundSchema.and(z.object({ type: z.literal("image_url") })),
|
|
14
|
+
ChatMessageContentItemAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") })),
|
|
15
|
+
ChatMessageContentItemVideo$inboundSchema.and(z.object({ type: z.literal("input_video") })),
|
|
22
16
|
]);
|
|
23
17
|
/** @internal */
|
|
24
18
|
export const ChatMessageContentItem$outboundSchema = z.union([
|
|
25
|
-
ChatMessageContentItemText$outboundSchema.and(z.object({ type: z.literal("text") })
|
|
26
|
-
ChatMessageContentItemImage$outboundSchema.and(z.object({ type: z.literal("image_url") })
|
|
27
|
-
|
|
28
|
-
}))
|
|
29
|
-
ChatMessageContentItemAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
30
|
-
type: v.type,
|
|
31
|
-
}))),
|
|
32
|
-
ChatMessageContentItemVideo$outboundSchema.and(z.object({ type: z.literal("input_video") }).transform((v) => ({
|
|
33
|
-
type: v.type,
|
|
34
|
-
}))),
|
|
19
|
+
ChatMessageContentItemText$outboundSchema.and(z.object({ type: z.literal("text") })),
|
|
20
|
+
ChatMessageContentItemImage$outboundSchema.and(z.object({ type: z.literal("image_url") })),
|
|
21
|
+
ChatMessageContentItemAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") })),
|
|
22
|
+
ChatMessageContentItemVideo$outboundSchema.and(z.object({ type: z.literal("input_video") })),
|
|
35
23
|
]);
|
|
36
24
|
export function chatMessageContentItemToJSON(chatMessageContentItem) {
|
|
37
25
|
return JSON.stringify(ChatMessageContentItem$outboundSchema.parse(chatMessageContentItem));
|
|
@@ -74,15 +74,15 @@ export const CompletionCreateParams$outboundSchema = z.object({
|
|
|
74
74
|
z.array(z.number()),
|
|
75
75
|
z.array(z.array(z.number())),
|
|
76
76
|
]),
|
|
77
|
-
bestOf: z.nullable(z.
|
|
77
|
+
bestOf: z.nullable(z.int()).optional(),
|
|
78
78
|
echo: z.nullable(z.boolean()).optional(),
|
|
79
79
|
frequencyPenalty: z.nullable(z.number()).optional(),
|
|
80
80
|
logitBias: z.nullable(z.record(z.string(), z.number())).optional(),
|
|
81
|
-
logprobs: z.nullable(z.
|
|
82
|
-
maxTokens: z.nullable(z.
|
|
83
|
-
n: z.nullable(z.
|
|
81
|
+
logprobs: z.nullable(z.int()).optional(),
|
|
82
|
+
maxTokens: z.nullable(z.int()).optional(),
|
|
83
|
+
n: z.nullable(z.int()).optional(),
|
|
84
84
|
presencePenalty: z.nullable(z.number()).optional(),
|
|
85
|
-
seed: z.nullable(z.
|
|
85
|
+
seed: z.nullable(z.int()).optional(),
|
|
86
86
|
stop: z.nullable(z.union([z.string(), z.array(z.string())])).optional(),
|
|
87
87
|
stream: z.boolean().default(false),
|
|
88
88
|
streamOptions: z.nullable(z.lazy(() => StreamOptions$outboundSchema))
|
|
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
|
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export const EdgeNetworkTimeoutResponseErrorData$inboundSchema = z.object({
|
|
8
|
-
code: z.
|
|
8
|
+
code: z.int(),
|
|
9
9
|
message: z.string(),
|
|
10
10
|
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
11
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
|
-
import * as z from "zod/v4";
|
|
4
|
+
import * as z from "zod/v4/core";
|
|
5
5
|
import { OpenRouterError } from "./openroutererror.js";
|
|
6
6
|
import { formatZodError } from "./sdkvalidationerror.js";
|
|
7
7
|
export class ResponseValidationError extends OpenRouterError {
|
|
@@ -18,7 +18,7 @@ export class ResponseValidationError extends OpenRouterError {
|
|
|
18
18
|
* default error message.
|
|
19
19
|
*/
|
|
20
20
|
pretty() {
|
|
21
|
-
if (this.cause instanceof z
|
|
21
|
+
if (this.cause instanceof z.$ZodError) {
|
|
22
22
|
return `${this.rawMessage}\n${formatZodError(this.cause)}`;
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as z from "zod/v4";
|
|
1
|
+
import * as z from "zod/v4/core";
|
|
2
2
|
export declare class SDKValidationError extends Error {
|
|
3
3
|
/**
|
|
4
4
|
* The raw value that failed validation.
|
|
@@ -17,5 +17,5 @@ export declare class SDKValidationError extends Error {
|
|
|
17
17
|
*/
|
|
18
18
|
pretty(): string;
|
|
19
19
|
}
|
|
20
|
-
export declare function formatZodError(err: z
|
|
20
|
+
export declare function formatZodError(err: z.$ZodError): string;
|
|
21
21
|
//# sourceMappingURL=sdkvalidationerror.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
|
-
import * as z from "zod/v4";
|
|
4
|
+
import * as z from "zod/v4/core";
|
|
5
5
|
export class SDKValidationError extends Error {
|
|
6
6
|
// Allows for backwards compatibility for `instanceof` checks of `ResponseValidationError`
|
|
7
7
|
static [Symbol.hasInstance](instance) {
|
|
@@ -30,7 +30,7 @@ export class SDKValidationError extends Error {
|
|
|
30
30
|
* default error message.
|
|
31
31
|
*/
|
|
32
32
|
pretty() {
|
|
33
|
-
if (this.cause instanceof z
|
|
33
|
+
if (this.cause instanceof z.$ZodError) {
|
|
34
34
|
return `${this.rawMessage}\n${formatZodError(this.cause)}`;
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
|
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export const ForbiddenResponseErrorData$inboundSchema = z.object({
|
|
8
|
-
code: z.
|
|
8
|
+
code: z.int(),
|
|
9
9
|
message: z.string(),
|
|
10
10
|
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
11
|
});
|
|
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
|
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export const InternalServerResponseErrorData$inboundSchema = z.object({
|
|
8
|
-
code: z.
|
|
8
|
+
code: z.int(),
|
|
9
9
|
message: z.string(),
|
|
10
10
|
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
11
|
});
|
|
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
|
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export const NotFoundResponseErrorData$inboundSchema = z.object({
|
|
8
|
-
code: z.
|
|
8
|
+
code: z.int(),
|
|
9
9
|
message: z.string(),
|
|
10
10
|
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
11
|
});
|
|
@@ -98,18 +98,10 @@ export function openAIResponsesInputRoleUnion2FromJSON(jsonString) {
|
|
|
98
98
|
}
|
|
99
99
|
/** @internal */
|
|
100
100
|
export const OpenAIResponsesInputContent3$inboundSchema = z.union([
|
|
101
|
-
ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") })
|
|
102
|
-
|
|
103
|
-
}))
|
|
104
|
-
|
|
105
|
-
type: v.type,
|
|
106
|
-
}))),
|
|
107
|
-
ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
108
|
-
type: v.type,
|
|
109
|
-
}))),
|
|
110
|
-
ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
111
|
-
type: v.type,
|
|
112
|
-
}))),
|
|
101
|
+
ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") })),
|
|
102
|
+
ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") })),
|
|
103
|
+
ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") })),
|
|
104
|
+
ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") })),
|
|
113
105
|
]);
|
|
114
106
|
export function openAIResponsesInputContent3FromJSON(jsonString) {
|
|
115
107
|
return safeParse(jsonString, (x) => OpenAIResponsesInputContent3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIResponsesInputContent3' from JSON`);
|
|
@@ -124,18 +116,10 @@ export const OpenAIResponsesInputMessage2$inboundSchema = z.object({
|
|
|
124
116
|
OpenAIResponsesInputRoleDeveloper2$inboundSchema,
|
|
125
117
|
]),
|
|
126
118
|
content: z.array(z.union([
|
|
127
|
-
ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") })
|
|
128
|
-
|
|
129
|
-
}))
|
|
130
|
-
|
|
131
|
-
type: v.type,
|
|
132
|
-
}))),
|
|
133
|
-
ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
134
|
-
type: v.type,
|
|
135
|
-
}))),
|
|
136
|
-
ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
137
|
-
type: v.type,
|
|
138
|
-
}))),
|
|
119
|
+
ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") })),
|
|
120
|
+
ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") })),
|
|
121
|
+
ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") })),
|
|
122
|
+
ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") })),
|
|
139
123
|
])),
|
|
140
124
|
});
|
|
141
125
|
export function openAIResponsesInputMessage2FromJSON(jsonString) {
|
|
@@ -163,18 +147,10 @@ export function openAIResponsesInputRoleUnion1FromJSON(jsonString) {
|
|
|
163
147
|
}
|
|
164
148
|
/** @internal */
|
|
165
149
|
export const OpenAIResponsesInputContent1$inboundSchema = z.union([
|
|
166
|
-
ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") })
|
|
167
|
-
|
|
168
|
-
}))
|
|
169
|
-
|
|
170
|
-
type: v.type,
|
|
171
|
-
}))),
|
|
172
|
-
ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
173
|
-
type: v.type,
|
|
174
|
-
}))),
|
|
175
|
-
ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
176
|
-
type: v.type,
|
|
177
|
-
}))),
|
|
150
|
+
ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") })),
|
|
151
|
+
ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") })),
|
|
152
|
+
ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") })),
|
|
153
|
+
ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") })),
|
|
178
154
|
]);
|
|
179
155
|
export function openAIResponsesInputContent1FromJSON(jsonString) {
|
|
180
156
|
return safeParse(jsonString, (x) => OpenAIResponsesInputContent1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIResponsesInputContent1' from JSON`);
|
|
@@ -182,18 +158,10 @@ export function openAIResponsesInputContent1FromJSON(jsonString) {
|
|
|
182
158
|
/** @internal */
|
|
183
159
|
export const OpenAIResponsesInputContent2$inboundSchema = z.union([
|
|
184
160
|
z.array(z.union([
|
|
185
|
-
ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") })
|
|
186
|
-
|
|
187
|
-
}))
|
|
188
|
-
|
|
189
|
-
type: v.type,
|
|
190
|
-
}))),
|
|
191
|
-
ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
192
|
-
type: v.type,
|
|
193
|
-
}))),
|
|
194
|
-
ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
195
|
-
type: v.type,
|
|
196
|
-
}))),
|
|
161
|
+
ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") })),
|
|
162
|
+
ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") })),
|
|
163
|
+
ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") })),
|
|
164
|
+
ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") })),
|
|
197
165
|
])),
|
|
198
166
|
z.string(),
|
|
199
167
|
]);
|
|
@@ -211,18 +179,10 @@ export const OpenAIResponsesInputMessage1$inboundSchema = z.object({
|
|
|
211
179
|
]),
|
|
212
180
|
content: z.union([
|
|
213
181
|
z.array(z.union([
|
|
214
|
-
ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") })
|
|
215
|
-
|
|
216
|
-
}))
|
|
217
|
-
|
|
218
|
-
type: v.type,
|
|
219
|
-
}))),
|
|
220
|
-
ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
221
|
-
type: v.type,
|
|
222
|
-
}))),
|
|
223
|
-
ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
224
|
-
type: v.type,
|
|
225
|
-
}))),
|
|
182
|
+
ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") })),
|
|
183
|
+
ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") })),
|
|
184
|
+
ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") })),
|
|
185
|
+
ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") })),
|
|
226
186
|
])),
|
|
227
187
|
z.string(),
|
|
228
188
|
]),
|
|
@@ -43,18 +43,10 @@ export function openResponsesEasyInputMessageRoleUnionToJSON(openResponsesEasyIn
|
|
|
43
43
|
}
|
|
44
44
|
/** @internal */
|
|
45
45
|
export const OpenResponsesEasyInputMessageContent1$outboundSchema = z.union([
|
|
46
|
-
ResponseInputText$outboundSchema.and(z.object({ type: z.literal("input_text") })
|
|
47
|
-
|
|
48
|
-
}))
|
|
49
|
-
|
|
50
|
-
type: v.type,
|
|
51
|
-
}))),
|
|
52
|
-
ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
53
|
-
type: v.type,
|
|
54
|
-
}))),
|
|
55
|
-
ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
56
|
-
type: v.type,
|
|
57
|
-
}))),
|
|
46
|
+
ResponseInputText$outboundSchema.and(z.object({ type: z.literal("input_text") })),
|
|
47
|
+
ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") })),
|
|
48
|
+
ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") })),
|
|
49
|
+
ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") })),
|
|
58
50
|
]);
|
|
59
51
|
export function openResponsesEasyInputMessageContent1ToJSON(openResponsesEasyInputMessageContent1) {
|
|
60
52
|
return JSON.stringify(OpenResponsesEasyInputMessageContent1$outboundSchema.parse(openResponsesEasyInputMessageContent1));
|
|
@@ -62,18 +54,10 @@ export function openResponsesEasyInputMessageContent1ToJSON(openResponsesEasyInp
|
|
|
62
54
|
/** @internal */
|
|
63
55
|
export const OpenResponsesEasyInputMessageContent2$outboundSchema = z.union([
|
|
64
56
|
z.array(z.union([
|
|
65
|
-
ResponseInputText$outboundSchema.and(z.object({ type: z.literal("input_text") })
|
|
66
|
-
|
|
67
|
-
}))
|
|
68
|
-
|
|
69
|
-
type: v.type,
|
|
70
|
-
}))),
|
|
71
|
-
ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
72
|
-
type: v.type,
|
|
73
|
-
}))),
|
|
74
|
-
ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
75
|
-
type: v.type,
|
|
76
|
-
}))),
|
|
57
|
+
ResponseInputText$outboundSchema.and(z.object({ type: z.literal("input_text") })),
|
|
58
|
+
ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") })),
|
|
59
|
+
ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") })),
|
|
60
|
+
ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") })),
|
|
77
61
|
])),
|
|
78
62
|
z.string(),
|
|
79
63
|
]);
|
|
@@ -91,18 +75,10 @@ export const OpenResponsesEasyInputMessage$outboundSchema = z.object({
|
|
|
91
75
|
]),
|
|
92
76
|
content: z.union([
|
|
93
77
|
z.array(z.union([
|
|
94
|
-
ResponseInputText$outboundSchema.and(z.object({ type: z.literal("input_text") })
|
|
95
|
-
|
|
96
|
-
}))
|
|
97
|
-
|
|
98
|
-
type: v.type,
|
|
99
|
-
}))),
|
|
100
|
-
ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
101
|
-
type: v.type,
|
|
102
|
-
}))),
|
|
103
|
-
ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
104
|
-
type: v.type,
|
|
105
|
-
}))),
|
|
78
|
+
ResponseInputText$outboundSchema.and(z.object({ type: z.literal("input_text") })),
|
|
79
|
+
ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") })),
|
|
80
|
+
ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") })),
|
|
81
|
+
ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") })),
|
|
106
82
|
])),
|
|
107
83
|
z.string(),
|
|
108
84
|
]),
|
|
@@ -37,18 +37,10 @@ export function openResponsesInputMessageItemRoleUnionToJSON(openResponsesInputM
|
|
|
37
37
|
}
|
|
38
38
|
/** @internal */
|
|
39
39
|
export const OpenResponsesInputMessageItemContent$outboundSchema = z.union([
|
|
40
|
-
ResponseInputText$outboundSchema.and(z.object({ type: z.literal("input_text") })
|
|
41
|
-
|
|
42
|
-
}))
|
|
43
|
-
|
|
44
|
-
type: v.type,
|
|
45
|
-
}))),
|
|
46
|
-
ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
47
|
-
type: v.type,
|
|
48
|
-
}))),
|
|
49
|
-
ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
50
|
-
type: v.type,
|
|
51
|
-
}))),
|
|
40
|
+
ResponseInputText$outboundSchema.and(z.object({ type: z.literal("input_text") })),
|
|
41
|
+
ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") })),
|
|
42
|
+
ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") })),
|
|
43
|
+
ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") })),
|
|
52
44
|
]);
|
|
53
45
|
export function openResponsesInputMessageItemContentToJSON(openResponsesInputMessageItemContent) {
|
|
54
46
|
return JSON.stringify(OpenResponsesInputMessageItemContent$outboundSchema.parse(openResponsesInputMessageItemContent));
|
|
@@ -63,18 +55,10 @@ export const OpenResponsesInputMessageItem$outboundSchema = z.object({
|
|
|
63
55
|
OpenResponsesInputMessageItemRoleDeveloper$outboundSchema,
|
|
64
56
|
]),
|
|
65
57
|
content: z.array(z.union([
|
|
66
|
-
ResponseInputText$outboundSchema.and(z.object({ type: z.literal("input_text") })
|
|
67
|
-
|
|
68
|
-
}))
|
|
69
|
-
|
|
70
|
-
type: v.type,
|
|
71
|
-
}))),
|
|
72
|
-
ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
73
|
-
type: v.type,
|
|
74
|
-
}))),
|
|
75
|
-
ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
76
|
-
type: v.type,
|
|
77
|
-
}))),
|
|
58
|
+
ResponseInputText$outboundSchema.and(z.object({ type: z.literal("input_text") })),
|
|
59
|
+
ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") })),
|
|
60
|
+
ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") })),
|
|
61
|
+
ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") })),
|
|
78
62
|
])),
|
|
79
63
|
});
|
|
80
64
|
export function openResponsesInputMessageItemToJSON(openResponsesInputMessageItem) {
|
|
@@ -31,6 +31,10 @@ export type CreateKeysRequest = {
|
|
|
31
31
|
* Whether to include BYOK usage in the limit
|
|
32
32
|
*/
|
|
33
33
|
includeByokInLimit?: boolean | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Optional ISO 8601 timestamp with timezone when the API key should expire
|
|
36
|
+
*/
|
|
37
|
+
expiresAt?: Date | null | undefined;
|
|
34
38
|
};
|
|
35
39
|
/**
|
|
36
40
|
* The created API key information
|
|
@@ -108,6 +112,10 @@ export type CreateKeysData = {
|
|
|
108
112
|
* ISO 8601 timestamp of when the API key was last updated
|
|
109
113
|
*/
|
|
110
114
|
updatedAt: string | null;
|
|
115
|
+
/**
|
|
116
|
+
* ISO 8601 UTC timestamp when the API key expires, or null if no expiration
|
|
117
|
+
*/
|
|
118
|
+
expiresAt?: Date | null | undefined;
|
|
111
119
|
};
|
|
112
120
|
/**
|
|
113
121
|
* API key created successfully
|
|
@@ -130,6 +138,7 @@ export type CreateKeysRequest$Outbound = {
|
|
|
130
138
|
limit?: number | null | undefined;
|
|
131
139
|
limit_reset?: string | null | undefined;
|
|
132
140
|
include_byok_in_limit?: boolean | undefined;
|
|
141
|
+
expires_at?: string | null | undefined;
|
|
133
142
|
};
|
|
134
143
|
/** @internal */
|
|
135
144
|
export declare const CreateKeysRequest$outboundSchema: z.ZodType<CreateKeysRequest$Outbound, CreateKeysRequest>;
|
|
@@ -23,10 +23,12 @@ export const CreateKeysRequest$outboundSchema = z.object({
|
|
|
23
23
|
limit: z.nullable(z.number()).optional(),
|
|
24
24
|
limitReset: z.nullable(CreateKeysLimitReset$outboundSchema).optional(),
|
|
25
25
|
includeByokInLimit: z.boolean().optional(),
|
|
26
|
+
expiresAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
|
|
26
27
|
}).transform((v) => {
|
|
27
28
|
return remap$(v, {
|
|
28
29
|
limitReset: "limit_reset",
|
|
29
30
|
includeByokInLimit: "include_byok_in_limit",
|
|
31
|
+
expiresAt: "expires_at",
|
|
30
32
|
});
|
|
31
33
|
});
|
|
32
34
|
export function createKeysRequestToJSON(createKeysRequest) {
|
|
@@ -52,6 +54,7 @@ export const CreateKeysData$inboundSchema = z.object({
|
|
|
52
54
|
byok_usage_monthly: z.number(),
|
|
53
55
|
created_at: z.string(),
|
|
54
56
|
updated_at: z.nullable(z.string()),
|
|
57
|
+
expires_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
|
|
55
58
|
}).transform((v) => {
|
|
56
59
|
return remap$(v, {
|
|
57
60
|
"limit_remaining": "limitRemaining",
|
|
@@ -66,6 +69,7 @@ export const CreateKeysData$inboundSchema = z.object({
|
|
|
66
69
|
"byok_usage_monthly": "byokUsageMonthly",
|
|
67
70
|
"created_at": "createdAt",
|
|
68
71
|
"updated_at": "updatedAt",
|
|
72
|
+
"expires_at": "expiresAt",
|
|
69
73
|
});
|
|
70
74
|
});
|
|
71
75
|
export function createKeysDataFromJSON(jsonString) {
|
|
@@ -83,6 +83,10 @@ export type GetKeyData = {
|
|
|
83
83
|
* ISO 8601 timestamp of when the API key was last updated
|
|
84
84
|
*/
|
|
85
85
|
updatedAt: string | null;
|
|
86
|
+
/**
|
|
87
|
+
* ISO 8601 UTC timestamp when the API key expires, or null if no expiration
|
|
88
|
+
*/
|
|
89
|
+
expiresAt?: Date | null | undefined;
|
|
86
90
|
};
|
|
87
91
|
/**
|
|
88
92
|
* API key details
|
|
@@ -32,6 +32,7 @@ export const GetKeyData$inboundSchema = z
|
|
|
32
32
|
byok_usage_monthly: z.number(),
|
|
33
33
|
created_at: z.string(),
|
|
34
34
|
updated_at: z.nullable(z.string()),
|
|
35
|
+
expires_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
|
|
35
36
|
}).transform((v) => {
|
|
36
37
|
return remap$(v, {
|
|
37
38
|
"limit_remaining": "limitRemaining",
|
|
@@ -46,6 +47,7 @@ export const GetKeyData$inboundSchema = z
|
|
|
46
47
|
"byok_usage_monthly": "byokUsageMonthly",
|
|
47
48
|
"created_at": "createdAt",
|
|
48
49
|
"updated_at": "updatedAt",
|
|
50
|
+
"expires_at": "expiresAt",
|
|
49
51
|
});
|
|
50
52
|
});
|
|
51
53
|
export function getKeyDataFromJSON(jsonString) {
|
|
@@ -84,6 +84,10 @@ export type ListData = {
|
|
|
84
84
|
* ISO 8601 timestamp of when the API key was last updated
|
|
85
85
|
*/
|
|
86
86
|
updatedAt: string | null;
|
|
87
|
+
/**
|
|
88
|
+
* ISO 8601 UTC timestamp when the API key expires, or null if no expiration
|
|
89
|
+
*/
|
|
90
|
+
expiresAt?: Date | null | undefined;
|
|
87
91
|
};
|
|
88
92
|
/**
|
|
89
93
|
* List of API keys
|
|
@@ -36,6 +36,7 @@ export const ListData$inboundSchema = z.object({
|
|
|
36
36
|
byok_usage_monthly: z.number(),
|
|
37
37
|
created_at: z.string(),
|
|
38
38
|
updated_at: z.nullable(z.string()),
|
|
39
|
+
expires_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
|
|
39
40
|
}).transform((v) => {
|
|
40
41
|
return remap$(v, {
|
|
41
42
|
"limit_remaining": "limitRemaining",
|
|
@@ -50,6 +51,7 @@ export const ListData$inboundSchema = z.object({
|
|
|
50
51
|
"byok_usage_monthly": "byokUsageMonthly",
|
|
51
52
|
"created_at": "createdAt",
|
|
52
53
|
"updated_at": "updatedAt",
|
|
54
|
+
"expires_at": "expiresAt",
|
|
53
55
|
});
|
|
54
56
|
});
|
|
55
57
|
export function listDataFromJSON(jsonString) {
|
|
@@ -119,6 +119,10 @@ export type UpdateKeysData = {
|
|
|
119
119
|
* ISO 8601 timestamp of when the API key was last updated
|
|
120
120
|
*/
|
|
121
121
|
updatedAt: string | null;
|
|
122
|
+
/**
|
|
123
|
+
* ISO 8601 UTC timestamp when the API key expires, or null if no expiration
|
|
124
|
+
*/
|
|
125
|
+
expiresAt?: Date | null | undefined;
|
|
122
126
|
};
|
|
123
127
|
/**
|
|
124
128
|
* API key updated successfully
|
|
@@ -65,6 +65,7 @@ export const UpdateKeysData$inboundSchema = z.object({
|
|
|
65
65
|
byok_usage_monthly: z.number(),
|
|
66
66
|
created_at: z.string(),
|
|
67
67
|
updated_at: z.nullable(z.string()),
|
|
68
|
+
expires_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
|
|
68
69
|
}).transform((v) => {
|
|
69
70
|
return remap$(v, {
|
|
70
71
|
"limit_remaining": "limitRemaining",
|
|
@@ -79,6 +80,7 @@ export const UpdateKeysData$inboundSchema = z.object({
|
|
|
79
80
|
"byok_usage_monthly": "byokUsageMonthly",
|
|
80
81
|
"created_at": "createdAt",
|
|
81
82
|
"updated_at": "updatedAt",
|
|
83
|
+
"expires_at": "expiresAt",
|
|
82
84
|
});
|
|
83
85
|
});
|
|
84
86
|
export function updateKeysDataFromJSON(jsonString) {
|
|
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
|
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export const PayloadTooLargeResponseErrorData$inboundSchema = z.object({
|
|
8
|
-
code: z.
|
|
8
|
+
code: z.int(),
|
|
9
9
|
message: z.string(),
|
|
10
10
|
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
11
|
});
|
|
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
|
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export const PaymentRequiredResponseErrorData$inboundSchema = z.object({
|
|
8
|
-
code: z.
|
|
8
|
+
code: z.int(),
|
|
9
9
|
message: z.string(),
|
|
10
10
|
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
11
|
});
|
|
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
|
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export const ProviderOverloadedResponseErrorData$inboundSchema = z.object({
|
|
8
|
-
code: z.
|
|
8
|
+
code: z.int(),
|
|
9
9
|
message: z.string(),
|
|
10
10
|
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
11
|
});
|
|
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
|
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export const RequestTimeoutResponseErrorData$inboundSchema = z.object({
|
|
8
|
-
code: z.
|
|
8
|
+
code: z.int(),
|
|
9
9
|
message: z.string(),
|
|
10
10
|
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
11
|
});
|
|
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
|
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export const ServiceUnavailableResponseErrorData$inboundSchema = z.object({
|
|
8
|
-
code: z.
|
|
8
|
+
code: z.int(),
|
|
9
9
|
message: z.string(),
|
|
10
10
|
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
11
|
});
|
|
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
|
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export const TooManyRequestsResponseErrorData$inboundSchema = z.object({
|
|
8
|
-
code: z.
|
|
8
|
+
code: z.int(),
|
|
9
9
|
message: z.string(),
|
|
10
10
|
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
11
|
});
|
|
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
|
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export const UnauthorizedResponseErrorData$inboundSchema = z.object({
|
|
8
|
-
code: z.
|
|
8
|
+
code: z.int(),
|
|
9
9
|
message: z.string(),
|
|
10
10
|
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
11
|
});
|
|
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
|
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export const UnprocessableEntityResponseErrorData$inboundSchema = z.object({
|
|
8
|
-
code: z.
|
|
8
|
+
code: z.int(),
|
|
9
9
|
message: z.string(),
|
|
10
10
|
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
11
|
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { InvalidateQueryFilters, QueryClient, QueryFunctionContext, QueryKey, UseQueryResult, UseSuspenseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import { OpenRouterCore } from "../core.js";
|
|
3
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
4
|
+
import * as models from "../models/index.js";
|
|
5
|
+
import { QueryHookOptions, SuspenseQueryHookOptions } from "./_types.js";
|
|
6
|
+
export type EmbeddingsListModelsQueryData = models.ModelsListResponse;
|
|
7
|
+
/**
|
|
8
|
+
* List all embeddings models
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Returns a list of all available embeddings models and their properties
|
|
12
|
+
*/
|
|
13
|
+
export declare function useEmbeddingsListModels(options?: QueryHookOptions<EmbeddingsListModelsQueryData>): UseQueryResult<EmbeddingsListModelsQueryData, Error>;
|
|
14
|
+
/**
|
|
15
|
+
* List all embeddings models
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Returns a list of all available embeddings models and their properties
|
|
19
|
+
*/
|
|
20
|
+
export declare function useEmbeddingsListModelsSuspense(options?: SuspenseQueryHookOptions<EmbeddingsListModelsQueryData>): UseSuspenseQueryResult<EmbeddingsListModelsQueryData, Error>;
|
|
21
|
+
export declare function prefetchEmbeddingsListModels(queryClient: QueryClient, client$: OpenRouterCore): Promise<void>;
|
|
22
|
+
export declare function setEmbeddingsListModelsData(client: QueryClient, data: EmbeddingsListModelsQueryData): EmbeddingsListModelsQueryData | undefined;
|
|
23
|
+
export declare function invalidateAllEmbeddingsListModels(client: QueryClient, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
|
|
24
|
+
export declare function buildEmbeddingsListModelsQuery(client$: OpenRouterCore, options?: RequestOptions): {
|
|
25
|
+
queryKey: QueryKey;
|
|
26
|
+
queryFn: (context: QueryFunctionContext) => Promise<EmbeddingsListModelsQueryData>;
|
|
27
|
+
};
|
|
28
|
+
export declare function queryKeyEmbeddingsListModels(): QueryKey;
|
|
29
|
+
//# sourceMappingURL=embeddingsListModels.d.ts.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
import { useQuery, useSuspenseQuery, } from "@tanstack/react-query";
|
|
5
|
-
import {
|
|
5
|
+
import { embeddingsListModels } from "../funcs/embeddingsListModels.js";
|
|
6
6
|
import { combineSignals } from "../lib/primitives.js";
|
|
7
7
|
import { unwrapAsync } from "../types/fp.js";
|
|
8
8
|
import { useOpenRouterContext } from "./_context.js";
|
|
@@ -12,10 +12,10 @@ import { useOpenRouterContext } from "./_context.js";
|
|
|
12
12
|
* @remarks
|
|
13
13
|
* Returns a list of all available embeddings models and their properties
|
|
14
14
|
*/
|
|
15
|
-
export function
|
|
15
|
+
export function useEmbeddingsListModels(options) {
|
|
16
16
|
const client = useOpenRouterContext();
|
|
17
17
|
return useQuery({
|
|
18
|
-
...
|
|
18
|
+
...buildEmbeddingsListModelsQuery(client, options),
|
|
19
19
|
...options,
|
|
20
20
|
});
|
|
21
21
|
}
|
|
@@ -25,42 +25,42 @@ export function useModelsListEmbeddings(options) {
|
|
|
25
25
|
* @remarks
|
|
26
26
|
* Returns a list of all available embeddings models and their properties
|
|
27
27
|
*/
|
|
28
|
-
export function
|
|
28
|
+
export function useEmbeddingsListModelsSuspense(options) {
|
|
29
29
|
const client = useOpenRouterContext();
|
|
30
30
|
return useSuspenseQuery({
|
|
31
|
-
...
|
|
31
|
+
...buildEmbeddingsListModelsQuery(client, options),
|
|
32
32
|
...options,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
export function
|
|
35
|
+
export function prefetchEmbeddingsListModels(queryClient, client$) {
|
|
36
36
|
return queryClient.prefetchQuery({
|
|
37
|
-
...
|
|
37
|
+
...buildEmbeddingsListModelsQuery(client$),
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
export function
|
|
41
|
-
const key =
|
|
40
|
+
export function setEmbeddingsListModelsData(client, data) {
|
|
41
|
+
const key = queryKeyEmbeddingsListModels();
|
|
42
42
|
return client.setQueryData(key, data);
|
|
43
43
|
}
|
|
44
|
-
export function
|
|
44
|
+
export function invalidateAllEmbeddingsListModels(client, filters) {
|
|
45
45
|
return client.invalidateQueries({
|
|
46
46
|
...filters,
|
|
47
|
-
queryKey: ["@openrouter/sdk", "
|
|
47
|
+
queryKey: ["@openrouter/sdk", "Embeddings", "listModels"],
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
export function
|
|
50
|
+
export function buildEmbeddingsListModelsQuery(client$, options) {
|
|
51
51
|
return {
|
|
52
|
-
queryKey:
|
|
53
|
-
queryFn: async function
|
|
52
|
+
queryKey: queryKeyEmbeddingsListModels(),
|
|
53
|
+
queryFn: async function embeddingsListModelsQueryFn(ctx) {
|
|
54
54
|
const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
|
|
55
55
|
const mergedOptions = {
|
|
56
56
|
...options,
|
|
57
57
|
fetchOptions: { ...options?.fetchOptions, signal: sig },
|
|
58
58
|
};
|
|
59
|
-
return unwrapAsync(
|
|
59
|
+
return unwrapAsync(embeddingsListModels(client$, mergedOptions));
|
|
60
60
|
},
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
export function
|
|
64
|
-
return ["@openrouter/sdk", "
|
|
63
|
+
export function queryKeyEmbeddingsListModels() {
|
|
64
|
+
return ["@openrouter/sdk", "Embeddings", "listModels"];
|
|
65
65
|
}
|
|
66
|
-
//# sourceMappingURL=
|
|
66
|
+
//# sourceMappingURL=embeddingsListModels.js.map
|
|
@@ -13,12 +13,12 @@ export * from "./completionsGenerate.js";
|
|
|
13
13
|
export * from "./creditsCreateCoinbaseCharge.js";
|
|
14
14
|
export * from "./creditsGetCredits.js";
|
|
15
15
|
export * from "./embeddingsGenerate.js";
|
|
16
|
+
export * from "./embeddingsListModels.js";
|
|
16
17
|
export * from "./endpointsList.js";
|
|
17
18
|
export * from "./endpointsListZdrEndpoints.js";
|
|
18
19
|
export * from "./generationsGetGeneration.js";
|
|
19
20
|
export * from "./modelsCount.js";
|
|
20
21
|
export * from "./modelsList.js";
|
|
21
|
-
export * from "./modelsListEmbeddings.js";
|
|
22
22
|
export * from "./modelsListForUser.js";
|
|
23
23
|
export * from "./oAuthCreateAuthCode.js";
|
|
24
24
|
export * from "./oAuthExchangeAuthCodeForAPIKey.js";
|
package/esm/react-query/index.js
CHANGED
|
@@ -16,12 +16,12 @@ export * from "./completionsGenerate.js";
|
|
|
16
16
|
export * from "./creditsCreateCoinbaseCharge.js";
|
|
17
17
|
export * from "./creditsGetCredits.js";
|
|
18
18
|
export * from "./embeddingsGenerate.js";
|
|
19
|
+
export * from "./embeddingsListModels.js";
|
|
19
20
|
export * from "./endpointsList.js";
|
|
20
21
|
export * from "./endpointsListZdrEndpoints.js";
|
|
21
22
|
export * from "./generationsGetGeneration.js";
|
|
22
23
|
export * from "./modelsCount.js";
|
|
23
24
|
export * from "./modelsList.js";
|
|
24
|
-
export * from "./modelsListEmbeddings.js";
|
|
25
25
|
export * from "./modelsListForUser.js";
|
|
26
26
|
export * from "./oAuthCreateAuthCode.js";
|
|
27
27
|
export * from "./oAuthExchangeAuthCodeForAPIKey.js";
|
package/esm/sdk/embeddings.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
2
|
+
import * as models from "../models/index.js";
|
|
2
3
|
import * as operations from "../models/operations/index.js";
|
|
3
4
|
export declare class Embeddings extends ClientSDK {
|
|
4
5
|
/**
|
|
@@ -8,5 +9,12 @@ export declare class Embeddings extends ClientSDK {
|
|
|
8
9
|
* Submits an embedding request to the embeddings router
|
|
9
10
|
*/
|
|
10
11
|
generate(request: operations.CreateEmbeddingsRequest, options?: RequestOptions): Promise<operations.CreateEmbeddingsResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* List all embeddings models
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Returns a list of all available embeddings models and their properties
|
|
17
|
+
*/
|
|
18
|
+
listModels(options?: RequestOptions): Promise<models.ModelsListResponse>;
|
|
11
19
|
}
|
|
12
20
|
//# sourceMappingURL=embeddings.d.ts.map
|
package/esm/sdk/embeddings.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
import { embeddingsGenerate } from "../funcs/embeddingsGenerate.js";
|
|
5
|
+
import { embeddingsListModels } from "../funcs/embeddingsListModels.js";
|
|
5
6
|
import { ClientSDK } from "../lib/sdks.js";
|
|
6
7
|
import { unwrapAsync } from "../types/fp.js";
|
|
7
8
|
export class Embeddings extends ClientSDK {
|
|
@@ -14,5 +15,14 @@ export class Embeddings extends ClientSDK {
|
|
|
14
15
|
async generate(request, options) {
|
|
15
16
|
return unwrapAsync(embeddingsGenerate(this, request, options));
|
|
16
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* List all embeddings models
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* Returns a list of all available embeddings models and their properties
|
|
23
|
+
*/
|
|
24
|
+
async listModels(options) {
|
|
25
|
+
return unwrapAsync(embeddingsListModels(this, options));
|
|
26
|
+
}
|
|
17
27
|
}
|
|
18
28
|
//# sourceMappingURL=embeddings.js.map
|
package/esm/sdk/models.d.ts
CHANGED
|
@@ -10,13 +10,6 @@ export declare class Models extends ClientSDK {
|
|
|
10
10
|
* List all models and their properties
|
|
11
11
|
*/
|
|
12
12
|
list(request?: operations.GetModelsRequest | undefined, options?: RequestOptions): Promise<models.ModelsListResponse>;
|
|
13
|
-
/**
|
|
14
|
-
* List all embeddings models
|
|
15
|
-
*
|
|
16
|
-
* @remarks
|
|
17
|
-
* Returns a list of all available embeddings models and their properties
|
|
18
|
-
*/
|
|
19
|
-
listEmbeddings(options?: RequestOptions): Promise<models.ModelsListResponse>;
|
|
20
13
|
/**
|
|
21
14
|
* List models filtered by user provider preferences
|
|
22
15
|
*/
|
package/esm/sdk/models.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { modelsCount } from "../funcs/modelsCount.js";
|
|
5
5
|
import { modelsList } from "../funcs/modelsList.js";
|
|
6
|
-
import { modelsListEmbeddings } from "../funcs/modelsListEmbeddings.js";
|
|
7
6
|
import { modelsListForUser } from "../funcs/modelsListForUser.js";
|
|
8
7
|
import { ClientSDK } from "../lib/sdks.js";
|
|
9
8
|
import { unwrapAsync } from "../types/fp.js";
|
|
@@ -20,15 +19,6 @@ export class Models extends ClientSDK {
|
|
|
20
19
|
async list(request, options) {
|
|
21
20
|
return unwrapAsync(modelsList(this, request, options));
|
|
22
21
|
}
|
|
23
|
-
/**
|
|
24
|
-
* List all embeddings models
|
|
25
|
-
*
|
|
26
|
-
* @remarks
|
|
27
|
-
* Returns a list of all available embeddings models and their properties
|
|
28
|
-
*/
|
|
29
|
-
async listEmbeddings(options) {
|
|
30
|
-
return unwrapAsync(modelsListEmbeddings(this, options));
|
|
31
|
-
}
|
|
32
22
|
/**
|
|
33
23
|
* List models filtered by user provider preferences
|
|
34
24
|
*/
|
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.9",
|
|
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": [
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { InvalidateQueryFilters, QueryClient, QueryFunctionContext, QueryKey, UseQueryResult, UseSuspenseQueryResult } from "@tanstack/react-query";
|
|
2
|
-
import { OpenRouterCore } from "../core.js";
|
|
3
|
-
import { RequestOptions } from "../lib/sdks.js";
|
|
4
|
-
import * as models from "../models/index.js";
|
|
5
|
-
import { QueryHookOptions, SuspenseQueryHookOptions } from "./_types.js";
|
|
6
|
-
export type ModelsListEmbeddingsQueryData = models.ModelsListResponse;
|
|
7
|
-
/**
|
|
8
|
-
* List all embeddings models
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* Returns a list of all available embeddings models and their properties
|
|
12
|
-
*/
|
|
13
|
-
export declare function useModelsListEmbeddings(options?: QueryHookOptions<ModelsListEmbeddingsQueryData>): UseQueryResult<ModelsListEmbeddingsQueryData, Error>;
|
|
14
|
-
/**
|
|
15
|
-
* List all embeddings models
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* Returns a list of all available embeddings models and their properties
|
|
19
|
-
*/
|
|
20
|
-
export declare function useModelsListEmbeddingsSuspense(options?: SuspenseQueryHookOptions<ModelsListEmbeddingsQueryData>): UseSuspenseQueryResult<ModelsListEmbeddingsQueryData, Error>;
|
|
21
|
-
export declare function prefetchModelsListEmbeddings(queryClient: QueryClient, client$: OpenRouterCore): Promise<void>;
|
|
22
|
-
export declare function setModelsListEmbeddingsData(client: QueryClient, data: ModelsListEmbeddingsQueryData): ModelsListEmbeddingsQueryData | undefined;
|
|
23
|
-
export declare function invalidateAllModelsListEmbeddings(client: QueryClient, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
|
|
24
|
-
export declare function buildModelsListEmbeddingsQuery(client$: OpenRouterCore, options?: RequestOptions): {
|
|
25
|
-
queryKey: QueryKey;
|
|
26
|
-
queryFn: (context: QueryFunctionContext) => Promise<ModelsListEmbeddingsQueryData>;
|
|
27
|
-
};
|
|
28
|
-
export declare function queryKeyModelsListEmbeddings(): QueryKey;
|
|
29
|
-
//# sourceMappingURL=modelsListEmbeddings.d.ts.map
|