@openrouter/sdk 0.1.13 → 0.1.18
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/README.md +0 -8
- package/esm/lib/config.d.ts +10 -2
- package/esm/lib/config.js +2 -2
- package/esm/lib/env.d.ts +13 -0
- package/esm/lib/env.js +16 -0
- package/esm/lib/sdks.js +2 -2
- package/esm/models/chatmessagecontentitem.d.ts +5 -0
- package/esm/models/chatmessagecontentitem.js +3 -0
- package/esm/models/chatmessagecontentitemfile.d.ts +36 -0
- package/esm/models/chatmessagecontentitemfile.js +51 -0
- package/esm/models/chatmessagecontentitemvideo.d.ts +11 -23
- package/esm/models/chatmessagecontentitemvideo.js +11 -24
- package/esm/models/index.d.ts +2 -0
- package/esm/models/index.js +2 -0
- package/esm/models/videourl.d.ts +17 -0
- package/esm/models/videourl.js +21 -0
- package/jsr.json +1 -1
- package/package.json +2 -16
- package/REACT_QUERY.md +0 -296
- package/esm/react-query/_context.d.ts +0 -8
- package/esm/react-query/_context.js +0 -14
- package/esm/react-query/_types.d.ts +0 -27
- package/esm/react-query/_types.js +0 -5
- package/esm/react-query/analyticsGetUserActivity.d.ts +0 -36
- package/esm/react-query/analyticsGetUserActivity.js +0 -77
- package/esm/react-query/apiKeysCreate.d.ts +0 -20
- package/esm/react-query/apiKeysCreate.js +0 -39
- package/esm/react-query/apiKeysDelete.d.ts +0 -20
- package/esm/react-query/apiKeysDelete.js +0 -39
- package/esm/react-query/apiKeysGet.d.ts +0 -24
- package/esm/react-query/apiKeysGet.js +0 -66
- package/esm/react-query/apiKeysGetCurrentKeyMetadata.d.ts +0 -29
- package/esm/react-query/apiKeysGetCurrentKeyMetadata.js +0 -66
- package/esm/react-query/apiKeysList.d.ts +0 -37
- package/esm/react-query/apiKeysList.js +0 -69
- package/esm/react-query/apiKeysUpdate.d.ts +0 -20
- package/esm/react-query/apiKeysUpdate.js +0 -39
- package/esm/react-query/betaResponsesSend.d.ts +0 -24
- package/esm/react-query/betaResponsesSend.js +0 -42
- package/esm/react-query/chatSend.d.ts +0 -24
- package/esm/react-query/chatSend.js +0 -42
- package/esm/react-query/completionsGenerate.d.ts +0 -23
- package/esm/react-query/completionsGenerate.js +0 -42
- package/esm/react-query/creditsCreateCoinbaseCharge.d.ts +0 -25
- package/esm/react-query/creditsCreateCoinbaseCharge.js +0 -42
- package/esm/react-query/creditsGetCredits.d.ts +0 -29
- package/esm/react-query/creditsGetCredits.js +0 -66
- package/esm/react-query/embeddingsGenerate.d.ts +0 -23
- package/esm/react-query/embeddingsGenerate.js +0 -42
- package/esm/react-query/embeddingsListModels.d.ts +0 -29
- package/esm/react-query/embeddingsListModels.js +0 -66
- package/esm/react-query/endpointsList.d.ts +0 -24
- package/esm/react-query/endpointsList.js +0 -66
- package/esm/react-query/endpointsListZdrEndpoints.d.ts +0 -23
- package/esm/react-query/endpointsListZdrEndpoints.js +0 -60
- package/esm/react-query/generationsGetGeneration.d.ts +0 -30
- package/esm/react-query/generationsGetGeneration.js +0 -71
- package/esm/react-query/index.d.ts +0 -27
- package/esm/react-query/index.js +0 -30
- package/esm/react-query/modelsCount.d.ts +0 -23
- package/esm/react-query/modelsCount.js +0 -60
- package/esm/react-query/modelsList.d.ts +0 -38
- package/esm/react-query/modelsList.js +0 -69
- package/esm/react-query/modelsListForUser.d.ts +0 -24
- package/esm/react-query/modelsListForUser.js +0 -60
- package/esm/react-query/oAuthCreateAuthCode.d.ts +0 -23
- package/esm/react-query/oAuthCreateAuthCode.js +0 -42
- package/esm/react-query/oAuthExchangeAuthCodeForAPIKey.d.ts +0 -23
- package/esm/react-query/oAuthExchangeAuthCodeForAPIKey.js +0 -42
- package/esm/react-query/parametersGetParameters.d.ts +0 -38
- package/esm/react-query/parametersGetParameters.js +0 -80
- package/esm/react-query/providersList.d.ts +0 -23
- package/esm/react-query/providersList.js +0 -60
package/README.md
CHANGED
|
@@ -19,32 +19,24 @@ The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https
|
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
21
|
npm add @openrouter/sdk
|
|
22
|
-
# Install optional peer dependencies if you plan to use React hooks
|
|
23
|
-
npm add @tanstack/react-query react react-dom
|
|
24
22
|
```
|
|
25
23
|
|
|
26
24
|
### PNPM
|
|
27
25
|
|
|
28
26
|
```bash
|
|
29
27
|
pnpm add @openrouter/sdk
|
|
30
|
-
# Install optional peer dependencies if you plan to use React hooks
|
|
31
|
-
pnpm add @tanstack/react-query react react-dom
|
|
32
28
|
```
|
|
33
29
|
|
|
34
30
|
### Bun
|
|
35
31
|
|
|
36
32
|
```bash
|
|
37
33
|
bun add @openrouter/sdk
|
|
38
|
-
# Install optional peer dependencies if you plan to use React hooks
|
|
39
|
-
bun add @tanstack/react-query react react-dom
|
|
40
34
|
```
|
|
41
35
|
|
|
42
36
|
### Yarn
|
|
43
37
|
|
|
44
38
|
```bash
|
|
45
39
|
yarn add @openrouter/sdk
|
|
46
|
-
# Install optional peer dependencies if you plan to use React hooks
|
|
47
|
-
yarn add @tanstack/react-query react react-dom
|
|
48
40
|
```
|
|
49
41
|
|
|
50
42
|
> [!NOTE]
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -13,6 +13,14 @@ export declare const ServerList: {
|
|
|
13
13
|
};
|
|
14
14
|
export type SDKOptions = {
|
|
15
15
|
apiKey?: string | (() => Promise<string>) | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Allows setting the httpReferer parameter for all supported operations
|
|
18
|
+
*/
|
|
19
|
+
httpReferer?: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Allows setting the xTitle parameter for all supported operations
|
|
22
|
+
*/
|
|
23
|
+
xTitle?: string | undefined;
|
|
16
24
|
httpClient?: HTTPClient;
|
|
17
25
|
/**
|
|
18
26
|
* Allows overriding the default server used by the SDK
|
|
@@ -37,8 +45,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
37
45
|
export declare const SDK_METADATA: {
|
|
38
46
|
readonly language: "typescript";
|
|
39
47
|
readonly openapiDocVersion: "1.0.0";
|
|
40
|
-
readonly sdkVersion: "0.1.
|
|
48
|
+
readonly sdkVersion: "0.1.18";
|
|
41
49
|
readonly genVersion: "2.755.9";
|
|
42
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.1.
|
|
50
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.1.18 2.755.9 1.0.0 @openrouter/sdk";
|
|
43
51
|
};
|
|
44
52
|
//# 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.
|
|
28
|
+
sdkVersion: "0.1.18",
|
|
29
29
|
genVersion: "2.755.9",
|
|
30
|
-
userAgent: "speakeasy-sdk/typescript 0.1.
|
|
30
|
+
userAgent: "speakeasy-sdk/typescript 0.1.18 2.755.9 1.0.0 @openrouter/sdk",
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=config.js.map
|
package/esm/lib/env.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
+
import { SDKOptions } from "./config.js";
|
|
2
3
|
export interface Env {
|
|
3
4
|
OPENROUTER_API_KEY?: string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Sets the httpReferer parameter for all supported operations
|
|
7
|
+
*/
|
|
8
|
+
OPENROUTER_HTTP_REFERER?: string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the xTitle parameter for all supported operations
|
|
11
|
+
*/
|
|
12
|
+
OPENROUTER_X_TITLE?: string | undefined;
|
|
4
13
|
OPENROUTER_DEBUG?: boolean | undefined;
|
|
5
14
|
}
|
|
6
15
|
export declare const envSchema: z.ZodType<Env, unknown>;
|
|
@@ -12,4 +21,8 @@ export declare function env(): Env;
|
|
|
12
21
|
* Clears the cached env object. Useful for testing with a fresh environment.
|
|
13
22
|
*/
|
|
14
23
|
export declare function resetEnv(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Populates global parameters with environment variables.
|
|
26
|
+
*/
|
|
27
|
+
export declare function fillGlobals(options: SDKOptions): SDKOptions;
|
|
15
28
|
//# sourceMappingURL=env.d.ts.map
|
package/esm/lib/env.js
CHANGED
|
@@ -5,6 +5,8 @@ import * as z from "zod/v4";
|
|
|
5
5
|
import { dlv } from "./dlv.js";
|
|
6
6
|
export const envSchema = z.object({
|
|
7
7
|
OPENROUTER_API_KEY: z.string().optional(),
|
|
8
|
+
OPENROUTER_HTTP_REFERER: z.string().optional(),
|
|
9
|
+
OPENROUTER_X_TITLE: z.string().optional(),
|
|
8
10
|
OPENROUTER_DEBUG: z.coerce.boolean().optional(),
|
|
9
11
|
});
|
|
10
12
|
/**
|
|
@@ -41,4 +43,18 @@ export function env() {
|
|
|
41
43
|
export function resetEnv() {
|
|
42
44
|
envMemo = undefined;
|
|
43
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Populates global parameters with environment variables.
|
|
48
|
+
*/
|
|
49
|
+
export function fillGlobals(options) {
|
|
50
|
+
const clone = { ...options };
|
|
51
|
+
const envVars = env();
|
|
52
|
+
if (typeof envVars.OPENROUTER_HTTP_REFERER !== "undefined") {
|
|
53
|
+
clone.httpReferer ?? (clone.httpReferer = envVars.OPENROUTER_HTTP_REFERER);
|
|
54
|
+
}
|
|
55
|
+
if (typeof envVars.OPENROUTER_X_TITLE !== "undefined") {
|
|
56
|
+
clone.xTitle ?? (clone.xTitle = envVars.OPENROUTER_X_TITLE);
|
|
57
|
+
}
|
|
58
|
+
return clone;
|
|
59
|
+
}
|
|
44
60
|
//# sourceMappingURL=env.js.map
|
package/esm/lib/sdks.js
CHANGED
|
@@ -19,7 +19,7 @@ import { ERR, OK } from "../types/fp.js";
|
|
|
19
19
|
import { stringToBase64 } from "./base64.js";
|
|
20
20
|
import { SDK_METADATA, serverURLFromOptions } from "./config.js";
|
|
21
21
|
import { encodeForm } from "./encodings.js";
|
|
22
|
-
import { env } from "./env.js";
|
|
22
|
+
import { env, fillGlobals } from "./env.js";
|
|
23
23
|
import { HTTPClient, isAbortError, isConnectionError, isTimeoutError, matchContentType, matchStatusCode, } from "./http.js";
|
|
24
24
|
import { retry } from "./retries.js";
|
|
25
25
|
const gt = typeof globalThis === "undefined" ? null : globalThis;
|
|
@@ -54,7 +54,7 @@ export class ClientSDK {
|
|
|
54
54
|
}
|
|
55
55
|
this._baseURL = url;
|
|
56
56
|
__classPrivateFieldSet(this, _ClientSDK_httpClient, options.httpClient || defaultHttpClient, "f");
|
|
57
|
-
this._options = { ...options, hooks: __classPrivateFieldGet(this, _ClientSDK_hooks, "f") };
|
|
57
|
+
this._options = { ...fillGlobals(options), hooks: __classPrivateFieldGet(this, _ClientSDK_hooks, "f") };
|
|
58
58
|
__classPrivateFieldSet(this, _ClientSDK_logger, this._options.debugLogger, "f");
|
|
59
59
|
if (!__classPrivateFieldGet(this, _ClientSDK_logger, "f") && env().OPENROUTER_DEBUG) {
|
|
60
60
|
__classPrivateFieldSet(this, _ClientSDK_logger, console, "f");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
3
|
import { ChatMessageContentItemAudio, ChatMessageContentItemAudio$Outbound } from "./chatmessagecontentitemaudio.js";
|
|
4
|
+
import { ChatMessageContentItemFile, ChatMessageContentItemFile$Outbound } from "./chatmessagecontentitemfile.js";
|
|
4
5
|
import { ChatMessageContentItemImage, ChatMessageContentItemImage$Outbound } from "./chatmessagecontentitemimage.js";
|
|
5
6
|
import { ChatMessageContentItemText, ChatMessageContentItemText$Outbound } from "./chatmessagecontentitemtext.js";
|
|
6
7
|
import { ChatMessageContentItemVideo, ChatMessageContentItemVideo$Outbound } from "./chatmessagecontentitemvideo.js";
|
|
@@ -11,6 +12,8 @@ export type ChatMessageContentItem = (ChatMessageContentItemText & {
|
|
|
11
12
|
type: "image_url";
|
|
12
13
|
}) | (ChatMessageContentItemAudio & {
|
|
13
14
|
type: "input_audio";
|
|
15
|
+
}) | (ChatMessageContentItemFile & {
|
|
16
|
+
type: "file";
|
|
14
17
|
}) | (ChatMessageContentItemVideo & {
|
|
15
18
|
type: "input_video";
|
|
16
19
|
}) | (ChatMessageContentItemVideo & {
|
|
@@ -25,6 +28,8 @@ export type ChatMessageContentItem$Outbound = (ChatMessageContentItemText$Outbou
|
|
|
25
28
|
type: "image_url";
|
|
26
29
|
}) | (ChatMessageContentItemAudio$Outbound & {
|
|
27
30
|
type: "input_audio";
|
|
31
|
+
}) | (ChatMessageContentItemFile$Outbound & {
|
|
32
|
+
type: "file";
|
|
28
33
|
}) | (ChatMessageContentItemVideo$Outbound & {
|
|
29
34
|
type: "input_video";
|
|
30
35
|
}) | (ChatMessageContentItemVideo$Outbound & {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import * as z from "zod/v4";
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
import { ChatMessageContentItemAudio$inboundSchema, ChatMessageContentItemAudio$outboundSchema, } from "./chatmessagecontentitemaudio.js";
|
|
7
|
+
import { ChatMessageContentItemFile$inboundSchema, ChatMessageContentItemFile$outboundSchema, } from "./chatmessagecontentitemfile.js";
|
|
7
8
|
import { ChatMessageContentItemImage$inboundSchema, ChatMessageContentItemImage$outboundSchema, } from "./chatmessagecontentitemimage.js";
|
|
8
9
|
import { ChatMessageContentItemText$inboundSchema, ChatMessageContentItemText$outboundSchema, } from "./chatmessagecontentitemtext.js";
|
|
9
10
|
import { ChatMessageContentItemVideo$inboundSchema, ChatMessageContentItemVideo$outboundSchema, } from "./chatmessagecontentitemvideo.js";
|
|
@@ -12,6 +13,7 @@ export const ChatMessageContentItem$inboundSchema = z.union([
|
|
|
12
13
|
ChatMessageContentItemText$inboundSchema.and(z.object({ type: z.literal("text") })),
|
|
13
14
|
ChatMessageContentItemImage$inboundSchema.and(z.object({ type: z.literal("image_url") })),
|
|
14
15
|
ChatMessageContentItemAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") })),
|
|
16
|
+
ChatMessageContentItemFile$inboundSchema.and(z.object({ type: z.literal("file") })),
|
|
15
17
|
ChatMessageContentItemVideo$inboundSchema.and(z.object({ type: z.literal("input_video") })),
|
|
16
18
|
z.lazy(() => ChatMessageContentItemVideo$inboundSchema).and(z.object({ type: z.literal("video_url") })),
|
|
17
19
|
]);
|
|
@@ -20,6 +22,7 @@ export const ChatMessageContentItem$outboundSchema = z.union([
|
|
|
20
22
|
ChatMessageContentItemText$outboundSchema.and(z.object({ type: z.literal("text") })),
|
|
21
23
|
ChatMessageContentItemImage$outboundSchema.and(z.object({ type: z.literal("image_url") })),
|
|
22
24
|
ChatMessageContentItemAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") })),
|
|
25
|
+
ChatMessageContentItemFile$outboundSchema.and(z.object({ type: z.literal("file") })),
|
|
23
26
|
ChatMessageContentItemVideo$outboundSchema.and(z.object({ type: z.literal("input_video") })),
|
|
24
27
|
z.lazy(() => ChatMessageContentItemVideo$outboundSchema).and(z.object({ type: z.literal("video_url") })),
|
|
25
28
|
]);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
export type FileT = {
|
|
5
|
+
fileData: string;
|
|
6
|
+
fileId?: string | undefined;
|
|
7
|
+
filename?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
export type ChatMessageContentItemFile = {
|
|
10
|
+
type: "file";
|
|
11
|
+
file: FileT;
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare const FileT$inboundSchema: z.ZodType<FileT, unknown>;
|
|
15
|
+
/** @internal */
|
|
16
|
+
export type FileT$Outbound = {
|
|
17
|
+
file_data: string;
|
|
18
|
+
file_id?: string | undefined;
|
|
19
|
+
filename?: string | undefined;
|
|
20
|
+
};
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const FileT$outboundSchema: z.ZodType<FileT$Outbound, FileT>;
|
|
23
|
+
export declare function fileToJSON(fileT: FileT): string;
|
|
24
|
+
export declare function fileFromJSON(jsonString: string): SafeParseResult<FileT, SDKValidationError>;
|
|
25
|
+
/** @internal */
|
|
26
|
+
export declare const ChatMessageContentItemFile$inboundSchema: z.ZodType<ChatMessageContentItemFile, unknown>;
|
|
27
|
+
/** @internal */
|
|
28
|
+
export type ChatMessageContentItemFile$Outbound = {
|
|
29
|
+
type: "file";
|
|
30
|
+
file: FileT$Outbound;
|
|
31
|
+
};
|
|
32
|
+
/** @internal */
|
|
33
|
+
export declare const ChatMessageContentItemFile$outboundSchema: z.ZodType<ChatMessageContentItemFile$Outbound, ChatMessageContentItemFile>;
|
|
34
|
+
export declare function chatMessageContentItemFileToJSON(chatMessageContentItemFile: ChatMessageContentItemFile): string;
|
|
35
|
+
export declare function chatMessageContentItemFileFromJSON(jsonString: string): SafeParseResult<ChatMessageContentItemFile, SDKValidationError>;
|
|
36
|
+
//# sourceMappingURL=chatmessagecontentitemfile.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4";
|
|
5
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const FileT$inboundSchema = z.object({
|
|
9
|
+
file_data: z.string(),
|
|
10
|
+
file_id: z.string().optional(),
|
|
11
|
+
filename: z.string().optional(),
|
|
12
|
+
}).transform((v) => {
|
|
13
|
+
return remap$(v, {
|
|
14
|
+
"file_data": "fileData",
|
|
15
|
+
"file_id": "fileId",
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const FileT$outboundSchema = z.object({
|
|
20
|
+
fileData: z.string(),
|
|
21
|
+
fileId: z.string().optional(),
|
|
22
|
+
filename: z.string().optional(),
|
|
23
|
+
}).transform((v) => {
|
|
24
|
+
return remap$(v, {
|
|
25
|
+
fileData: "file_data",
|
|
26
|
+
fileId: "file_id",
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
export function fileToJSON(fileT) {
|
|
30
|
+
return JSON.stringify(FileT$outboundSchema.parse(fileT));
|
|
31
|
+
}
|
|
32
|
+
export function fileFromJSON(jsonString) {
|
|
33
|
+
return safeParse(jsonString, (x) => FileT$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FileT' from JSON`);
|
|
34
|
+
}
|
|
35
|
+
/** @internal */
|
|
36
|
+
export const ChatMessageContentItemFile$inboundSchema = z.object({
|
|
37
|
+
type: z.literal("file"),
|
|
38
|
+
file: z.lazy(() => FileT$inboundSchema),
|
|
39
|
+
});
|
|
40
|
+
/** @internal */
|
|
41
|
+
export const ChatMessageContentItemFile$outboundSchema = z.object({
|
|
42
|
+
type: z.literal("file"),
|
|
43
|
+
file: z.lazy(() => FileT$outboundSchema),
|
|
44
|
+
});
|
|
45
|
+
export function chatMessageContentItemFileToJSON(chatMessageContentItemFile) {
|
|
46
|
+
return JSON.stringify(ChatMessageContentItemFile$outboundSchema.parse(chatMessageContentItemFile));
|
|
47
|
+
}
|
|
48
|
+
export function chatMessageContentItemFileFromJSON(jsonString) {
|
|
49
|
+
return safeParse(jsonString, (x) => ChatMessageContentItemFile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatMessageContentItemFile' from JSON`);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=chatmessagecontentitemfile.js.map
|
|
@@ -1,58 +1,46 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
3
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
-
|
|
4
|
+
import { VideoURL, VideoURL$Outbound } from "./videourl.js";
|
|
5
|
+
export type ChatMessageContentItemVideoVideoUrlVideoUrl = {
|
|
5
6
|
url: string;
|
|
6
7
|
};
|
|
7
8
|
export type ChatMessageContentItemVideoVideoURL = {
|
|
8
9
|
type: "video_url";
|
|
9
|
-
videoUrl:
|
|
10
|
-
};
|
|
11
|
-
export type VideoUrl1 = {
|
|
12
|
-
url: string;
|
|
10
|
+
videoUrl: ChatMessageContentItemVideoVideoUrlVideoUrl;
|
|
13
11
|
};
|
|
14
12
|
export type ChatMessageContentItemVideoInputVideo = {
|
|
15
13
|
type: "input_video";
|
|
16
|
-
videoUrl:
|
|
14
|
+
videoUrl: VideoURL;
|
|
17
15
|
};
|
|
18
16
|
export type ChatMessageContentItemVideo = ChatMessageContentItemVideoInputVideo | ChatMessageContentItemVideoVideoURL;
|
|
19
17
|
/** @internal */
|
|
20
|
-
export declare const
|
|
18
|
+
export declare const ChatMessageContentItemVideoVideoUrlVideoUrl$inboundSchema: z.ZodType<ChatMessageContentItemVideoVideoUrlVideoUrl, unknown>;
|
|
21
19
|
/** @internal */
|
|
22
|
-
export type
|
|
20
|
+
export type ChatMessageContentItemVideoVideoUrlVideoUrl$Outbound = {
|
|
23
21
|
url: string;
|
|
24
22
|
};
|
|
25
23
|
/** @internal */
|
|
26
|
-
export declare const
|
|
27
|
-
export declare function
|
|
28
|
-
export declare function
|
|
24
|
+
export declare const ChatMessageContentItemVideoVideoUrlVideoUrl$outboundSchema: z.ZodType<ChatMessageContentItemVideoVideoUrlVideoUrl$Outbound, ChatMessageContentItemVideoVideoUrlVideoUrl>;
|
|
25
|
+
export declare function chatMessageContentItemVideoVideoUrlVideoUrlToJSON(chatMessageContentItemVideoVideoUrlVideoUrl: ChatMessageContentItemVideoVideoUrlVideoUrl): string;
|
|
26
|
+
export declare function chatMessageContentItemVideoVideoUrlVideoUrlFromJSON(jsonString: string): SafeParseResult<ChatMessageContentItemVideoVideoUrlVideoUrl, SDKValidationError>;
|
|
29
27
|
/** @internal */
|
|
30
28
|
export declare const ChatMessageContentItemVideoVideoURL$inboundSchema: z.ZodType<ChatMessageContentItemVideoVideoURL, unknown>;
|
|
31
29
|
/** @internal */
|
|
32
30
|
export type ChatMessageContentItemVideoVideoURL$Outbound = {
|
|
33
31
|
type: "video_url";
|
|
34
|
-
video_url:
|
|
32
|
+
video_url: ChatMessageContentItemVideoVideoUrlVideoUrl$Outbound;
|
|
35
33
|
};
|
|
36
34
|
/** @internal */
|
|
37
35
|
export declare const ChatMessageContentItemVideoVideoURL$outboundSchema: z.ZodType<ChatMessageContentItemVideoVideoURL$Outbound, ChatMessageContentItemVideoVideoURL>;
|
|
38
36
|
export declare function chatMessageContentItemVideoVideoURLToJSON(chatMessageContentItemVideoVideoURL: ChatMessageContentItemVideoVideoURL): string;
|
|
39
37
|
export declare function chatMessageContentItemVideoVideoURLFromJSON(jsonString: string): SafeParseResult<ChatMessageContentItemVideoVideoURL, SDKValidationError>;
|
|
40
38
|
/** @internal */
|
|
41
|
-
export declare const VideoUrl1$inboundSchema: z.ZodType<VideoUrl1, unknown>;
|
|
42
|
-
/** @internal */
|
|
43
|
-
export type VideoUrl1$Outbound = {
|
|
44
|
-
url: string;
|
|
45
|
-
};
|
|
46
|
-
/** @internal */
|
|
47
|
-
export declare const VideoUrl1$outboundSchema: z.ZodType<VideoUrl1$Outbound, VideoUrl1>;
|
|
48
|
-
export declare function videoUrl1ToJSON(videoUrl1: VideoUrl1): string;
|
|
49
|
-
export declare function videoUrl1FromJSON(jsonString: string): SafeParseResult<VideoUrl1, SDKValidationError>;
|
|
50
|
-
/** @internal */
|
|
51
39
|
export declare const ChatMessageContentItemVideoInputVideo$inboundSchema: z.ZodType<ChatMessageContentItemVideoInputVideo, unknown>;
|
|
52
40
|
/** @internal */
|
|
53
41
|
export type ChatMessageContentItemVideoInputVideo$Outbound = {
|
|
54
42
|
type: "input_video";
|
|
55
|
-
video_url:
|
|
43
|
+
video_url: VideoURL$Outbound;
|
|
56
44
|
};
|
|
57
45
|
/** @internal */
|
|
58
46
|
export declare const ChatMessageContentItemVideoInputVideo$outboundSchema: z.ZodType<ChatMessageContentItemVideoInputVideo$Outbound, ChatMessageContentItemVideoInputVideo>;
|
|
@@ -4,24 +4,25 @@
|
|
|
4
4
|
import * as z from "zod/v4";
|
|
5
5
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { VideoURL$inboundSchema, VideoURL$outboundSchema, } from "./videourl.js";
|
|
7
8
|
/** @internal */
|
|
8
|
-
export const
|
|
9
|
+
export const ChatMessageContentItemVideoVideoUrlVideoUrl$inboundSchema = z.object({
|
|
9
10
|
url: z.string(),
|
|
10
11
|
});
|
|
11
12
|
/** @internal */
|
|
12
|
-
export const
|
|
13
|
+
export const ChatMessageContentItemVideoVideoUrlVideoUrl$outboundSchema = z.object({
|
|
13
14
|
url: z.string(),
|
|
14
15
|
});
|
|
15
|
-
export function
|
|
16
|
-
return JSON.stringify(
|
|
16
|
+
export function chatMessageContentItemVideoVideoUrlVideoUrlToJSON(chatMessageContentItemVideoVideoUrlVideoUrl) {
|
|
17
|
+
return JSON.stringify(ChatMessageContentItemVideoVideoUrlVideoUrl$outboundSchema.parse(chatMessageContentItemVideoVideoUrlVideoUrl));
|
|
17
18
|
}
|
|
18
|
-
export function
|
|
19
|
-
return safeParse(jsonString, (x) =>
|
|
19
|
+
export function chatMessageContentItemVideoVideoUrlVideoUrlFromJSON(jsonString) {
|
|
20
|
+
return safeParse(jsonString, (x) => ChatMessageContentItemVideoVideoUrlVideoUrl$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatMessageContentItemVideoVideoUrlVideoUrl' from JSON`);
|
|
20
21
|
}
|
|
21
22
|
/** @internal */
|
|
22
23
|
export const ChatMessageContentItemVideoVideoURL$inboundSchema = z.object({
|
|
23
24
|
type: z.literal("video_url"),
|
|
24
|
-
video_url: z.lazy(() =>
|
|
25
|
+
video_url: z.lazy(() => ChatMessageContentItemVideoVideoUrlVideoUrl$inboundSchema),
|
|
25
26
|
}).transform((v) => {
|
|
26
27
|
return remap$(v, {
|
|
27
28
|
"video_url": "videoUrl",
|
|
@@ -30,7 +31,7 @@ export const ChatMessageContentItemVideoVideoURL$inboundSchema = z.object({
|
|
|
30
31
|
/** @internal */
|
|
31
32
|
export const ChatMessageContentItemVideoVideoURL$outboundSchema = z.object({
|
|
32
33
|
type: z.literal("video_url"),
|
|
33
|
-
videoUrl: z.lazy(() =>
|
|
34
|
+
videoUrl: z.lazy(() => ChatMessageContentItemVideoVideoUrlVideoUrl$outboundSchema),
|
|
34
35
|
}).transform((v) => {
|
|
35
36
|
return remap$(v, {
|
|
36
37
|
videoUrl: "video_url",
|
|
@@ -43,23 +44,9 @@ export function chatMessageContentItemVideoVideoURLFromJSON(jsonString) {
|
|
|
43
44
|
return safeParse(jsonString, (x) => ChatMessageContentItemVideoVideoURL$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatMessageContentItemVideoVideoURL' from JSON`);
|
|
44
45
|
}
|
|
45
46
|
/** @internal */
|
|
46
|
-
export const VideoUrl1$inboundSchema = z.object({
|
|
47
|
-
url: z.string(),
|
|
48
|
-
});
|
|
49
|
-
/** @internal */
|
|
50
|
-
export const VideoUrl1$outboundSchema = z.object({
|
|
51
|
-
url: z.string(),
|
|
52
|
-
});
|
|
53
|
-
export function videoUrl1ToJSON(videoUrl1) {
|
|
54
|
-
return JSON.stringify(VideoUrl1$outboundSchema.parse(videoUrl1));
|
|
55
|
-
}
|
|
56
|
-
export function videoUrl1FromJSON(jsonString) {
|
|
57
|
-
return safeParse(jsonString, (x) => VideoUrl1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VideoUrl1' from JSON`);
|
|
58
|
-
}
|
|
59
|
-
/** @internal */
|
|
60
47
|
export const ChatMessageContentItemVideoInputVideo$inboundSchema = z.object({
|
|
61
48
|
type: z.literal("input_video"),
|
|
62
|
-
video_url:
|
|
49
|
+
video_url: VideoURL$inboundSchema,
|
|
63
50
|
}).transform((v) => {
|
|
64
51
|
return remap$(v, {
|
|
65
52
|
"video_url": "videoUrl",
|
|
@@ -68,7 +55,7 @@ export const ChatMessageContentItemVideoInputVideo$inboundSchema = z.object({
|
|
|
68
55
|
/** @internal */
|
|
69
56
|
export const ChatMessageContentItemVideoInputVideo$outboundSchema = z.object({
|
|
70
57
|
type: z.literal("input_video"),
|
|
71
|
-
videoUrl:
|
|
58
|
+
videoUrl: VideoURL$outboundSchema,
|
|
72
59
|
}).transform((v) => {
|
|
73
60
|
return remap$(v, {
|
|
74
61
|
videoUrl: "video_url",
|
package/esm/models/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./chatgenerationparams.js";
|
|
|
7
7
|
export * from "./chatgenerationtokenusage.js";
|
|
8
8
|
export * from "./chatmessagecontentitem.js";
|
|
9
9
|
export * from "./chatmessagecontentitemaudio.js";
|
|
10
|
+
export * from "./chatmessagecontentitemfile.js";
|
|
10
11
|
export * from "./chatmessagecontentitemimage.js";
|
|
11
12
|
export * from "./chatmessagecontentitemtext.js";
|
|
12
13
|
export * from "./chatmessagecontentitemvideo.js";
|
|
@@ -137,6 +138,7 @@ export * from "./unauthorizedresponseerrordata.js";
|
|
|
137
138
|
export * from "./unprocessableentityresponseerrordata.js";
|
|
138
139
|
export * from "./urlcitation.js";
|
|
139
140
|
export * from "./usermessage.js";
|
|
141
|
+
export * from "./videourl.js";
|
|
140
142
|
export * from "./websearchpreviewtooluserlocation.js";
|
|
141
143
|
export * from "./websearchstatus.js";
|
|
142
144
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/models/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export * from "./chatgenerationparams.js";
|
|
|
10
10
|
export * from "./chatgenerationtokenusage.js";
|
|
11
11
|
export * from "./chatmessagecontentitem.js";
|
|
12
12
|
export * from "./chatmessagecontentitemaudio.js";
|
|
13
|
+
export * from "./chatmessagecontentitemfile.js";
|
|
13
14
|
export * from "./chatmessagecontentitemimage.js";
|
|
14
15
|
export * from "./chatmessagecontentitemtext.js";
|
|
15
16
|
export * from "./chatmessagecontentitemvideo.js";
|
|
@@ -140,6 +141,7 @@ export * from "./unauthorizedresponseerrordata.js";
|
|
|
140
141
|
export * from "./unprocessableentityresponseerrordata.js";
|
|
141
142
|
export * from "./urlcitation.js";
|
|
142
143
|
export * from "./usermessage.js";
|
|
144
|
+
export * from "./videourl.js";
|
|
143
145
|
export * from "./websearchpreviewtooluserlocation.js";
|
|
144
146
|
export * from "./websearchstatus.js";
|
|
145
147
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
export type VideoURL = {
|
|
5
|
+
url: string;
|
|
6
|
+
};
|
|
7
|
+
/** @internal */
|
|
8
|
+
export declare const VideoURL$inboundSchema: z.ZodType<VideoURL, unknown>;
|
|
9
|
+
/** @internal */
|
|
10
|
+
export type VideoURL$Outbound = {
|
|
11
|
+
url: string;
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare const VideoURL$outboundSchema: z.ZodType<VideoURL$Outbound, VideoURL>;
|
|
15
|
+
export declare function videoURLToJSON(videoURL: VideoURL): string;
|
|
16
|
+
export declare function videoURLFromJSON(jsonString: string): SafeParseResult<VideoURL, SDKValidationError>;
|
|
17
|
+
//# sourceMappingURL=videourl.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4";
|
|
5
|
+
import { safeParse } from "../lib/schemas.js";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export const VideoURL$inboundSchema = z.object({
|
|
8
|
+
url: z.string(),
|
|
9
|
+
});
|
|
10
|
+
/** @internal */
|
|
11
|
+
export const VideoURL$outboundSchema = z
|
|
12
|
+
.object({
|
|
13
|
+
url: z.string(),
|
|
14
|
+
});
|
|
15
|
+
export function videoURLToJSON(videoURL) {
|
|
16
|
+
return JSON.stringify(VideoURL$outboundSchema.parse(videoURL));
|
|
17
|
+
}
|
|
18
|
+
export function videoURLFromJSON(jsonString) {
|
|
19
|
+
return safeParse(jsonString, (x) => VideoURL$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VideoURL' from JSON`);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=videourl.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.18",
|
|
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": [
|
|
@@ -48,11 +48,6 @@
|
|
|
48
48
|
"types": "./esm/models/operations/index.d.ts",
|
|
49
49
|
"default": "./esm/models/operations/index.js"
|
|
50
50
|
},
|
|
51
|
-
"./react-query": {
|
|
52
|
-
"source": "./src/react-query/index.ts",
|
|
53
|
-
"types": "./esm/react-query/index.d.ts",
|
|
54
|
-
"default": "./esm/react-query/index.js"
|
|
55
|
-
},
|
|
56
51
|
"./*.js": {
|
|
57
52
|
"source": "./src/*.ts",
|
|
58
53
|
"types": "./esm/*.d.ts",
|
|
@@ -75,20 +70,11 @@
|
|
|
75
70
|
"prepublishOnly": "npm run build"
|
|
76
71
|
},
|
|
77
72
|
"peerDependencies": {
|
|
78
|
-
|
|
79
|
-
"react": "^18 || ^19",
|
|
80
|
-
"react-dom": "^18 || ^19"
|
|
81
|
-
},
|
|
82
|
-
"peerDependenciesMeta": {
|
|
83
|
-
"@tanstack/react-query": {"optional":true},
|
|
84
|
-
"react": {"optional":true},
|
|
85
|
-
"react-dom": {"optional":true}
|
|
73
|
+
|
|
86
74
|
},
|
|
87
75
|
"devDependencies": {
|
|
88
76
|
"@eslint/js": "^9.19.0",
|
|
89
|
-
"@tanstack/react-query": "^5.61.4",
|
|
90
77
|
"@types/node": "^22.13.12",
|
|
91
|
-
"@types/react": "^18.3.12",
|
|
92
78
|
"dotenv": "^16.4.7",
|
|
93
79
|
"eslint": "^9.19.0",
|
|
94
80
|
"globals": "^15.14.0",
|