@openrouter/sdk 1.1.18 → 1.1.19
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/filesDelete.d.ts +1 -1
- package/esm/funcs/filesDelete.js +2 -1
- package/esm/funcs/filesDownload.d.ts +1 -1
- package/esm/funcs/filesDownload.js +2 -1
- package/esm/funcs/filesList.d.ts +1 -1
- package/esm/funcs/filesList.js +10 -3
- package/esm/funcs/filesRetrieve.d.ts +1 -1
- package/esm/funcs/filesRetrieve.js +2 -1
- package/esm/funcs/filesUpload.d.ts +1 -1
- package/esm/funcs/filesUpload.js +2 -1
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/anthropicfile.d.ts +33 -0
- package/esm/models/anthropicfile.js +40 -0
- package/esm/models/anthropicfiledeleted.d.ts +22 -0
- package/esm/models/anthropicfiledeleted.js +26 -0
- package/esm/models/anthropicfilelist.d.ts +18 -0
- package/esm/models/anthropicfilelist.js +27 -0
- package/esm/models/filedeleteresponse.d.ts +6 -12
- package/esm/models/filedeleteresponse.js +9 -10
- package/esm/models/filelistresponse.d.ts +6 -12
- package/esm/models/filelistresponse.js +9 -16
- package/esm/models/fileprovider.d.ts +16 -0
- package/esm/models/fileprovider.js +15 -0
- package/esm/models/fileresponse.d.ts +21 -0
- package/esm/models/fileresponse.js +26 -0
- package/esm/models/index.d.ts +11 -1
- package/esm/models/index.js +11 -1
- package/esm/models/openaifile.d.ts +53 -0
- package/esm/models/openaifile.js +58 -0
- package/esm/models/openaifiledeleted.d.ts +23 -0
- package/esm/models/openaifiledeleted.js +27 -0
- package/esm/models/openaifilelist.d.ts +26 -0
- package/esm/models/openaifilelist.js +33 -0
- package/esm/models/openrouterfile.d.ts +33 -0
- package/esm/models/openrouterfile.js +39 -0
- package/esm/models/openrouterfiledeleted.d.ts +22 -0
- package/esm/models/openrouterfiledeleted.js +26 -0
- package/esm/models/openrouterfilelist.d.ts +22 -0
- package/esm/models/openrouterfilelist.js +28 -0
- package/esm/models/operations/deletefile.d.ts +6 -0
- package/esm/models/operations/deletefile.js +2 -0
- package/esm/models/operations/downloadfilecontent.d.ts +6 -0
- package/esm/models/operations/downloadfilecontent.js +2 -0
- package/esm/models/operations/getfilemetadata.d.ts +6 -0
- package/esm/models/operations/getfilemetadata.js +2 -0
- package/esm/models/operations/listfiles.d.ts +39 -0
- package/esm/models/operations/listfiles.js +18 -0
- package/esm/models/operations/uploadfile.d.ts +6 -0
- package/esm/models/operations/uploadfile.js +2 -0
- package/esm/sdk/files.d.ts +2 -2
- package/jsr.json +1 -1
- package/package.json +7 -7
- package/esm/models/filemetadata.d.ts +0 -26
- package/esm/models/filemetadata.js +0 -33
|
@@ -5,7 +5,18 @@
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import * as openEnums from "../../types/enums.js";
|
|
8
9
|
import * as models from "../index.js";
|
|
10
|
+
/**
|
|
11
|
+
* Sort direction. Only `asc` is supported by OpenRouter storage.
|
|
12
|
+
*/
|
|
13
|
+
export const Order = {
|
|
14
|
+
Asc: "asc",
|
|
15
|
+
Desc: "desc",
|
|
16
|
+
};
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const Order$outboundSchema = openEnums
|
|
19
|
+
.outboundSchema(Order);
|
|
9
20
|
/** @internal */
|
|
10
21
|
export const ListFilesRequest$outboundSchema = z.object({
|
|
11
22
|
httpReferer: z.string().optional(),
|
|
@@ -14,10 +25,17 @@ export const ListFilesRequest$outboundSchema = z.object({
|
|
|
14
25
|
limit: z.int().optional(),
|
|
15
26
|
cursor: z.string().optional(),
|
|
16
27
|
workspaceId: z.string().optional(),
|
|
28
|
+
provider: models.FileProvider$outboundSchema.optional(),
|
|
29
|
+
after: z.string().optional(),
|
|
30
|
+
afterId: z.string().optional(),
|
|
31
|
+
beforeId: z.string().optional(),
|
|
32
|
+
order: Order$outboundSchema.optional(),
|
|
17
33
|
}).transform((v) => {
|
|
18
34
|
return remap$(v, {
|
|
19
35
|
httpReferer: "HTTP-Referer",
|
|
20
36
|
workspaceId: "workspace_id",
|
|
37
|
+
afterId: "after_id",
|
|
38
|
+
beforeId: "before_id",
|
|
21
39
|
});
|
|
22
40
|
});
|
|
23
41
|
export function listFilesRequestToJSON(listFilesRequest) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
+
import * as models from "../index.js";
|
|
2
3
|
export type UploadFileGlobals = {
|
|
3
4
|
/**
|
|
4
5
|
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
@@ -51,6 +52,10 @@ export type UploadFileRequest = {
|
|
|
51
52
|
* Workspace to scope the request to. Defaults to the caller’s default workspace.
|
|
52
53
|
*/
|
|
53
54
|
workspaceId?: string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Store or read this file on the named provider using your own API key for it. Omit to use OpenRouter storage.
|
|
57
|
+
*/
|
|
58
|
+
provider?: models.FileProvider | undefined;
|
|
54
59
|
requestBody: UploadFileRequestBody;
|
|
55
60
|
};
|
|
56
61
|
/** @internal */
|
|
@@ -74,6 +79,7 @@ export type UploadFileRequest$Outbound = {
|
|
|
74
79
|
appTitle?: string | undefined;
|
|
75
80
|
appCategories?: string | undefined;
|
|
76
81
|
workspace_id?: string | undefined;
|
|
82
|
+
provider?: string | undefined;
|
|
77
83
|
RequestBody: UploadFileRequestBody$Outbound;
|
|
78
84
|
};
|
|
79
85
|
/** @internal */
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { blobLikeSchema } from "../../types/blobs.js";
|
|
8
|
+
import * as models from "../index.js";
|
|
8
9
|
/** @internal */
|
|
9
10
|
export const UploadFileFile$outboundSchema = z.object({
|
|
10
11
|
fileName: z.string(),
|
|
@@ -31,6 +32,7 @@ export const UploadFileRequest$outboundSchema = z.object({
|
|
|
31
32
|
appTitle: z.string().optional(),
|
|
32
33
|
appCategories: z.string().optional(),
|
|
33
34
|
workspaceId: z.string().optional(),
|
|
35
|
+
provider: models.FileProvider$outboundSchema.optional(),
|
|
34
36
|
requestBody: z.lazy(() => UploadFileRequestBody$outboundSchema),
|
|
35
37
|
}).transform((v) => {
|
|
36
38
|
return remap$(v, {
|
package/esm/sdk/files.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare class Files extends ClientSDK {
|
|
|
18
18
|
* @remarks
|
|
19
19
|
* Uploads a file to be referenced in future API calls. The file is stored under the workspace of the authenticating API key. Maximum file size: 100 MB.
|
|
20
20
|
*/
|
|
21
|
-
upload(request: operations.UploadFileRequest, options?: RequestOptions): Promise<models.
|
|
21
|
+
upload(request: operations.UploadFileRequest, options?: RequestOptions): Promise<models.FileResponse>;
|
|
22
22
|
/**
|
|
23
23
|
* Delete a file
|
|
24
24
|
*
|
|
@@ -32,7 +32,7 @@ export declare class Files extends ClientSDK {
|
|
|
32
32
|
* @remarks
|
|
33
33
|
* Retrieves metadata for a single file owned by the requesting workspace.
|
|
34
34
|
*/
|
|
35
|
-
retrieve(request: operations.GetFileMetadataRequest, options?: RequestOptions): Promise<models.
|
|
35
|
+
retrieve(request: operations.GetFileMetadataRequest, options?: RequestOptions): Promise<models.FileResponse>;
|
|
36
36
|
/**
|
|
37
37
|
* Download file content
|
|
38
38
|
*
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.19",
|
|
4
4
|
"author": "OpenRouter",
|
|
5
5
|
"description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
|
|
6
6
|
"keywords": [
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
74
74
|
"build": "tsc",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
-
"test:e2e": "vitest --run --project e2e",
|
|
77
|
-
"test:watch": "vitest --watch --project unit",
|
|
78
76
|
"compile": "tsc",
|
|
79
|
-
"
|
|
77
|
+
"prepare": "npm run build",
|
|
78
|
+
"test": "vitest --run --project unit",
|
|
80
79
|
"test:transit": "exit 0",
|
|
80
|
+
"test:watch": "vitest --watch --project unit",
|
|
81
|
+
"postinstall": "node scripts/check-types.js || true",
|
|
82
|
+
"test:e2e": "vitest --run --project e2e",
|
|
81
83
|
"typecheck": "tsc --noEmit",
|
|
82
|
-
"typecheck:transit": "exit 0"
|
|
83
|
-
"prepare": "npm run build",
|
|
84
|
-
"test": "vitest --run --project unit"
|
|
84
|
+
"typecheck:transit": "exit 0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as z from "zod/v4";
|
|
2
|
-
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
-
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
-
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
-
export declare const FileMetadataType: {
|
|
6
|
-
readonly File: "file";
|
|
7
|
-
};
|
|
8
|
-
export type FileMetadataType = ClosedEnum<typeof FileMetadataType>;
|
|
9
|
-
/**
|
|
10
|
-
* Metadata describing a stored file.
|
|
11
|
-
*/
|
|
12
|
-
export type FileMetadata = {
|
|
13
|
-
createdAt: string;
|
|
14
|
-
downloadable: boolean;
|
|
15
|
-
filename: string;
|
|
16
|
-
id: string;
|
|
17
|
-
mimeType: string;
|
|
18
|
-
sizeBytes: number;
|
|
19
|
-
type: FileMetadataType;
|
|
20
|
-
};
|
|
21
|
-
/** @internal */
|
|
22
|
-
export declare const FileMetadataType$inboundSchema: z.ZodEnum<typeof FileMetadataType>;
|
|
23
|
-
/** @internal */
|
|
24
|
-
export declare const FileMetadata$inboundSchema: z.ZodType<FileMetadata, unknown>;
|
|
25
|
-
export declare function fileMetadataFromJSON(jsonString: string): SafeParseResult<FileMetadata, SDKValidationError>;
|
|
26
|
-
//# sourceMappingURL=filemetadata.d.ts.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
* @generated-id: 7a5c3a86d7a2
|
|
4
|
-
*/
|
|
5
|
-
import * as z from "zod/v4";
|
|
6
|
-
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
-
import { safeParse } from "../lib/schemas.js";
|
|
8
|
-
export const FileMetadataType = {
|
|
9
|
-
File: "file",
|
|
10
|
-
};
|
|
11
|
-
/** @internal */
|
|
12
|
-
export const FileMetadataType$inboundSchema = z.enum(FileMetadataType);
|
|
13
|
-
/** @internal */
|
|
14
|
-
export const FileMetadata$inboundSchema = z
|
|
15
|
-
.object({
|
|
16
|
-
created_at: z.string(),
|
|
17
|
-
downloadable: z.boolean(),
|
|
18
|
-
filename: z.string(),
|
|
19
|
-
id: z.string(),
|
|
20
|
-
mime_type: z.string(),
|
|
21
|
-
size_bytes: z.int(),
|
|
22
|
-
type: FileMetadataType$inboundSchema,
|
|
23
|
-
}).transform((v) => {
|
|
24
|
-
return remap$(v, {
|
|
25
|
-
"created_at": "createdAt",
|
|
26
|
-
"mime_type": "mimeType",
|
|
27
|
-
"size_bytes": "sizeBytes",
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
export function fileMetadataFromJSON(jsonString) {
|
|
31
|
-
return safeParse(jsonString, (x) => FileMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FileMetadata' from JSON`);
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=filemetadata.js.map
|