@openrouter/sdk 1.3.29 → 1.3.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/esm/funcs/batchCreateBatches.d.ts +19 -0
- package/esm/funcs/batchCreateBatches.js +98 -0
- package/esm/funcs/batchDelete.d.ts +19 -0
- package/esm/funcs/batchDelete.js +103 -0
- package/esm/funcs/batchGetBatches.d.ts +19 -0
- package/esm/funcs/batchGetBatches.js +103 -0
- package/esm/funcs/batchList.d.ts +21 -0
- package/esm/funcs/batchList.js +134 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/anthropicadvisortoolresult.d.ts +14 -0
- package/esm/models/anthropicadvisortoolresult.js +21 -0
- package/esm/models/anthropicbase64pdfsource.d.ts +17 -2
- package/esm/models/anthropicbase64pdfsource.js +25 -2
- package/esm/models/anthropicbashcodeexecutioncontent.d.ts +11 -0
- package/esm/models/anthropicbashcodeexecutioncontent.js +17 -0
- package/esm/models/anthropicbashcodeexecutionoutput.d.ts +18 -0
- package/esm/models/anthropicbashcodeexecutionoutput.js +25 -0
- package/esm/models/anthropicbashcodeexecutionresult.d.ts +15 -0
- package/esm/models/anthropicbashcodeexecutionresult.js +24 -0
- package/esm/models/anthropicbashcodeexecutiontoolresult.d.ts +13 -0
- package/esm/models/anthropicbashcodeexecutiontoolresult.js +22 -0
- package/esm/models/anthropicbashcodeexecutiontoolresulterror.d.ts +22 -0
- package/esm/models/anthropicbashcodeexecutiontoolresulterror.js +30 -0
- package/esm/models/anthropiccaller.d.ts +12 -0
- package/esm/models/anthropiccaller.js +19 -0
- package/esm/models/anthropiccitationcharlocation.d.ts +16 -0
- package/esm/models/anthropiccitationcharlocation.js +30 -0
- package/esm/models/anthropiccitationcontentblocklocation.d.ts +16 -0
- package/esm/models/anthropiccitationcontentblocklocation.js +30 -0
- package/esm/models/anthropiccitationpagelocation.d.ts +16 -0
- package/esm/models/anthropiccitationpagelocation.js +30 -0
- package/esm/models/anthropiccitationsconfig.d.ts +10 -0
- package/esm/models/anthropiccitationsconfig.js +14 -0
- package/esm/models/anthropiccitationsearchresultlocation.d.ts +16 -0
- package/esm/models/anthropiccitationsearchresultlocation.js +28 -0
- package/esm/models/anthropiccitationwebsearchresultlocation.d.ts +14 -0
- package/esm/models/anthropiccitationwebsearchresultlocation.js +24 -0
- package/esm/models/anthropiccodeexecution20250825caller.d.ts +11 -0
- package/esm/models/anthropiccodeexecution20250825caller.js +20 -0
- package/esm/models/anthropiccodeexecution20260120caller.d.ts +11 -0
- package/esm/models/anthropiccodeexecution20260120caller.js +20 -0
- package/esm/models/anthropiccodeexecutioncontent.d.ts +12 -0
- package/esm/models/anthropiccodeexecutioncontent.js +19 -0
- package/esm/models/anthropiccodeexecutionoutput.d.ts +18 -0
- package/esm/models/anthropiccodeexecutionoutput.js +25 -0
- package/esm/models/anthropiccodeexecutionresult.d.ts +15 -0
- package/esm/models/anthropiccodeexecutionresult.js +24 -0
- package/esm/models/anthropiccodeexecutiontoolresult.d.ts +13 -0
- package/esm/models/anthropiccodeexecutiontoolresult.js +22 -0
- package/esm/models/anthropiccodeexecutiontoolresulterror.d.ts +12 -0
- package/esm/models/anthropiccodeexecutiontoolresulterror.js +21 -0
- package/esm/models/anthropiccompactionblock.d.ts +12 -0
- package/esm/models/anthropiccompactionblock.js +21 -0
- package/esm/models/anthropiccontainer.d.ts +13 -0
- package/esm/models/anthropiccontainer.js +22 -0
- package/esm/models/anthropiccontainerskill.d.ts +20 -0
- package/esm/models/anthropiccontainerskill.js +28 -0
- package/esm/models/anthropiccontainerupload.d.ts +11 -0
- package/esm/models/anthropiccontainerupload.js +20 -0
- package/esm/models/anthropicdirectcaller.d.ts +10 -0
- package/esm/models/anthropicdirectcaller.js +14 -0
- package/esm/models/anthropicdocumentblock.d.ts +36 -0
- package/esm/models/anthropicdocumentblock.js +45 -0
- package/esm/models/anthropicdocumentblockparam.d.ts +20 -4
- package/esm/models/anthropicdocumentblockparam.js +4 -4
- package/esm/models/anthropicencryptedcodeexecutionresult.d.ts +15 -0
- package/esm/models/anthropicencryptedcodeexecutionresult.js +25 -0
- package/esm/models/anthropicinputtransformation.d.ts +18 -0
- package/esm/models/anthropicinputtransformation.js +16 -0
- package/esm/models/anthropicoutputtokensdetails.d.ts +10 -0
- package/esm/models/anthropicoutputtokensdetails.js +19 -0
- package/esm/models/anthropicplaintextsource.d.ts +17 -2
- package/esm/models/anthropicplaintextsource.js +25 -2
- package/esm/models/anthropicredactedthinkingblock.d.ts +11 -0
- package/esm/models/anthropicredactedthinkingblock.js +15 -0
- package/esm/models/anthropicrefusalstopdetails.d.ts +32 -0
- package/esm/models/anthropicrefusalstopdetails.js +31 -0
- package/esm/models/anthropicservertoolerrorcode.d.ts +12 -0
- package/esm/models/anthropicservertoolerrorcode.js +14 -0
- package/esm/models/anthropicservertoolusage.d.ts +11 -0
- package/esm/models/anthropicservertoolusage.js +21 -0
- package/esm/models/anthropicservicetier.d.ts +11 -0
- package/esm/models/anthropicservicetier.js +13 -0
- package/esm/models/anthropictextblock.d.ts +13 -0
- package/esm/models/anthropictextblock.js +17 -0
- package/esm/models/anthropictextcitation.d.ts +14 -0
- package/esm/models/anthropictextcitation.js +23 -0
- package/esm/models/anthropictexteditorcodeexecutioncontent.d.ts +13 -0
- package/esm/models/anthropictexteditorcodeexecutioncontent.js +21 -0
- package/esm/models/anthropictexteditorcodeexecutioncreateresult.d.ts +11 -0
- package/esm/models/anthropictexteditorcodeexecutioncreateresult.js +20 -0
- package/esm/models/anthropictexteditorcodeexecutionstrreplaceresult.d.ts +15 -0
- package/esm/models/anthropictexteditorcodeexecutionstrreplaceresult.js +28 -0
- package/esm/models/anthropictexteditorcodeexecutiontoolresult.d.ts +13 -0
- package/esm/models/anthropictexteditorcodeexecutiontoolresult.js +22 -0
- package/esm/models/anthropictexteditorcodeexecutiontoolresulterror.d.ts +23 -0
- package/esm/models/anthropictexteditorcodeexecutiontoolresulterror.js +33 -0
- package/esm/models/anthropictexteditorcodeexecutionviewresult.d.ts +24 -0
- package/esm/models/anthropictexteditorcodeexecutionviewresult.js +36 -0
- package/esm/models/anthropicthinkingblock.d.ts +12 -0
- package/esm/models/anthropicthinkingblock.js +16 -0
- package/esm/models/anthropictoolreference.d.ts +18 -0
- package/esm/models/anthropictoolreference.js +25 -0
- package/esm/models/anthropictoolsearchcontent.d.ts +11 -0
- package/esm/models/anthropictoolsearchcontent.js +17 -0
- package/esm/models/anthropictoolsearchresult.d.ts +12 -0
- package/esm/models/anthropictoolsearchresult.js +21 -0
- package/esm/models/anthropictoolsearchresulterror.d.ts +13 -0
- package/esm/models/anthropictoolsearchresulterror.js +23 -0
- package/esm/models/anthropictoolsearchtoolresult.d.ts +13 -0
- package/esm/models/anthropictoolsearchtoolresult.js +22 -0
- package/esm/models/anthropictooluseblock.d.ts +15 -0
- package/esm/models/anthropictooluseblock.js +19 -0
- package/esm/models/anthropicwebfetchblock.d.ts +14 -0
- package/esm/models/anthropicwebfetchblock.js +23 -0
- package/esm/models/anthropicwebfetchcontent.d.ts +11 -0
- package/esm/models/anthropicwebfetchcontent.js +17 -0
- package/esm/models/anthropicwebfetchtoolresult.d.ts +15 -0
- package/esm/models/anthropicwebfetchtoolresult.js +24 -0
- package/esm/models/anthropicwebfetchtoolresulterror.d.ts +25 -0
- package/esm/models/anthropicwebfetchtoolresulterror.js +33 -0
- package/esm/models/anthropicwebsearchresult.d.ts +21 -0
- package/esm/models/anthropicwebsearchresult.js +29 -0
- package/esm/models/anthropicwebsearchtoolresult.d.ts +20 -0
- package/esm/models/anthropicwebsearchtoolresult.js +36 -0
- package/esm/models/anthropicwebsearchtoolresulterror.d.ts +29 -0
- package/esm/models/anthropicwebsearchtoolresulterror.js +37 -0
- package/esm/models/batchdeletedobject.d.ts +26 -0
- package/esm/models/batchdeletedobject.js +22 -0
- package/esm/models/batchdeletionoutcome.d.ts +17 -0
- package/esm/models/batchdeletionoutcome.js +16 -0
- package/esm/models/batchdeletiontargets.d.ts +50 -0
- package/esm/models/batchdeletiontargets.js +32 -0
- package/esm/models/batcherrorresponse.d.ts +11 -0
- package/esm/models/batcherrorresponse.js +15 -0
- package/esm/models/batchlistitem.d.ts +181 -0
- package/esm/models/batchlistitem.js +159 -0
- package/esm/models/batchlistresponse.d.ts +25 -0
- package/esm/models/batchlistresponse.js +31 -0
- package/esm/models/batchliststatus.d.ts +20 -0
- package/esm/models/batchliststatus.js +19 -0
- package/esm/models/batchlisttimestamp.d.ts +12 -0
- package/esm/models/batchlisttimestamp.js +15 -0
- package/esm/models/batchobject.d.ts +750 -0
- package/esm/models/batchobject.js +810 -0
- package/esm/models/batchpaymentrequiredresponseerror.d.ts +159 -0
- package/esm/models/batchpaymentrequiredresponseerror.js +136 -0
- package/esm/models/batchproviderpreferences.d.ts +25 -0
- package/esm/models/batchproviderpreferences.js +20 -0
- package/esm/models/batchsubmitbody.d.ts +62 -0
- package/esm/models/batchsubmitbody.js +51 -0
- package/esm/models/debugevent.d.ts +12 -12
- package/esm/models/debugevent.js +11 -12
- package/esm/models/errors/batcherrorresponse.d.ts +19 -0
- package/esm/models/errors/batcherrorresponse.js +32 -0
- package/esm/models/errors/batchpaymentrequiredresponseerror.d.ts +53 -0
- package/esm/models/errors/batchpaymentrequiredresponseerror.js +64 -0
- package/esm/models/errors/index.d.ts +2 -0
- package/esm/models/errors/index.js +2 -0
- package/esm/models/finishreason.d.ts +13 -0
- package/esm/models/finishreason.js +15 -0
- package/esm/models/imagegenerationusage.d.ts +4 -4
- package/esm/models/imagegenerationusage.js +4 -6
- package/esm/models/index.d.ts +75 -0
- package/esm/models/index.js +75 -0
- package/esm/models/internchatchoice.d.ts +4 -4
- package/esm/models/internchatchoice.js +3 -3
- package/esm/models/messagesmessageparam.d.ts +8 -8
- package/esm/models/messagesmessageparam.js +6 -7
- package/esm/models/operations/createbatches.d.ts +59 -0
- package/esm/models/operations/createbatches.js +23 -0
- package/esm/models/operations/deletebatch.d.ts +58 -0
- package/esm/models/operations/deletebatch.js +21 -0
- package/esm/models/operations/getbatches.d.ts +58 -0
- package/esm/models/operations/getbatches.js +21 -0
- package/esm/models/operations/index.d.ts +4 -0
- package/esm/models/operations/index.js +4 -0
- package/esm/models/operations/listbatches.d.ts +87 -0
- package/esm/models/operations/listbatches.js +40 -0
- package/esm/models/oranthropicbashtoolresult.d.ts +43 -0
- package/esm/models/oranthropicbashtoolresult.js +49 -0
- package/esm/models/oranthropiccontentblock.d.ts +25 -0
- package/esm/models/oranthropiccontentblock.js +45 -0
- package/esm/models/oranthropicnullablecaller.d.ts +12 -0
- package/esm/models/oranthropicnullablecaller.js +19 -0
- package/esm/models/oranthropicservertooluseblock.d.ts +15 -0
- package/esm/models/oranthropicservertooluseblock.js +19 -0
- package/esm/models/oranthropicshelltoolresult.d.ts +43 -0
- package/esm/models/oranthropicshelltoolresult.js +50 -0
- package/esm/models/oranthropicstopreason.d.ts +16 -0
- package/esm/models/oranthropicstopreason.js +18 -0
- package/esm/models/outputfusionservertoolitem.d.ts +8 -8
- package/esm/models/outputfusionservertoolitem.js +8 -8
- package/esm/models/submitgenerationfeedbackrequest.d.ts +4 -4
- package/esm/models/submitgenerationfeedbackrequest.js +3 -4
- package/esm/sdk/batch.d.ts +37 -0
- package/esm/sdk/batch.js +50 -0
- package/esm/sdk/sdk.d.ts +3 -0
- package/esm/sdk/sdk.js +4 -0
- package/jsr.json +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 6dab967e4db6
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { ORAnthropicNullableCaller$inboundSchema, } from "./oranthropicnullablecaller.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const ORAnthropicServerToolUseBlock$inboundSchema = z.object({
|
|
10
|
+
caller: z.nullable(ORAnthropicNullableCaller$inboundSchema).optional(),
|
|
11
|
+
id: z.string(),
|
|
12
|
+
input: z.any().optional(),
|
|
13
|
+
name: z.string(),
|
|
14
|
+
type: z.literal("server_tool_use"),
|
|
15
|
+
});
|
|
16
|
+
export function orAnthropicServerToolUseBlockFromJSON(jsonString) {
|
|
17
|
+
return safeParse(jsonString, (x) => ORAnthropicServerToolUseBlock$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ORAnthropicServerToolUseBlock' from JSON`);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=oranthropicservertooluseblock.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
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 ORAnthropicShellToolResultTypeContainerFileCitation: {
|
|
6
|
+
readonly ContainerFileCitation: "container_file_citation";
|
|
7
|
+
};
|
|
8
|
+
export type ORAnthropicShellToolResultTypeContainerFileCitation = ClosedEnum<typeof ORAnthropicShellToolResultTypeContainerFileCitation>;
|
|
9
|
+
export type ORAnthropicShellToolResultFile = {
|
|
10
|
+
containerId: string;
|
|
11
|
+
endIndex: number;
|
|
12
|
+
fileId: string;
|
|
13
|
+
filename: string;
|
|
14
|
+
startIndex: number;
|
|
15
|
+
type: ORAnthropicShellToolResultTypeContainerFileCitation;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Output of an `openrouter:shell` call executed in the OpenRouter sandbox
|
|
19
|
+
*/
|
|
20
|
+
export type ORAnthropicShellToolResult = {
|
|
21
|
+
/**
|
|
22
|
+
* The canonical container id the command ran under — the `{container_id}` for the Container Files API, reusable as a `container_reference` in later requests. Present on every sandbox-executed call, even when no files changed.
|
|
23
|
+
*/
|
|
24
|
+
containerId?: string | undefined;
|
|
25
|
+
content: {
|
|
26
|
+
[k: string]: any;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Citations for the files the sandbox command created or modified, most-recently-touched first (at most 10). Retrieve them via the Container Files API.
|
|
30
|
+
*/
|
|
31
|
+
files?: Array<ORAnthropicShellToolResultFile> | undefined;
|
|
32
|
+
toolUseId: string;
|
|
33
|
+
type: "openrouter_shell_tool_result";
|
|
34
|
+
};
|
|
35
|
+
/** @internal */
|
|
36
|
+
export declare const ORAnthropicShellToolResultTypeContainerFileCitation$inboundSchema: z.ZodEnum<typeof ORAnthropicShellToolResultTypeContainerFileCitation>;
|
|
37
|
+
/** @internal */
|
|
38
|
+
export declare const ORAnthropicShellToolResultFile$inboundSchema: z.ZodType<ORAnthropicShellToolResultFile, unknown>;
|
|
39
|
+
export declare function orAnthropicShellToolResultFileFromJSON(jsonString: string): SafeParseResult<ORAnthropicShellToolResultFile, SDKValidationError>;
|
|
40
|
+
/** @internal */
|
|
41
|
+
export declare const ORAnthropicShellToolResult$inboundSchema: z.ZodType<ORAnthropicShellToolResult, unknown>;
|
|
42
|
+
export declare function orAnthropicShellToolResultFromJSON(jsonString: string): SafeParseResult<ORAnthropicShellToolResult, SDKValidationError>;
|
|
43
|
+
//# sourceMappingURL=oranthropicshelltoolresult.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 6c0f19243a3e
|
|
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 ORAnthropicShellToolResultTypeContainerFileCitation = {
|
|
9
|
+
ContainerFileCitation: "container_file_citation",
|
|
10
|
+
};
|
|
11
|
+
/** @internal */
|
|
12
|
+
export const ORAnthropicShellToolResultTypeContainerFileCitation$inboundSchema = z
|
|
13
|
+
.enum(ORAnthropicShellToolResultTypeContainerFileCitation);
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const ORAnthropicShellToolResultFile$inboundSchema = z.object({
|
|
16
|
+
container_id: z.string(),
|
|
17
|
+
end_index: z.int(),
|
|
18
|
+
file_id: z.string(),
|
|
19
|
+
filename: z.string(),
|
|
20
|
+
start_index: z.int(),
|
|
21
|
+
type: ORAnthropicShellToolResultTypeContainerFileCitation$inboundSchema,
|
|
22
|
+
}).transform((v) => {
|
|
23
|
+
return remap$(v, {
|
|
24
|
+
"container_id": "containerId",
|
|
25
|
+
"end_index": "endIndex",
|
|
26
|
+
"file_id": "fileId",
|
|
27
|
+
"start_index": "startIndex",
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
export function orAnthropicShellToolResultFileFromJSON(jsonString) {
|
|
31
|
+
return safeParse(jsonString, (x) => ORAnthropicShellToolResultFile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ORAnthropicShellToolResultFile' from JSON`);
|
|
32
|
+
}
|
|
33
|
+
/** @internal */
|
|
34
|
+
export const ORAnthropicShellToolResult$inboundSchema = z.object({
|
|
35
|
+
container_id: z.string().optional(),
|
|
36
|
+
content: z.record(z.string(), z.any()),
|
|
37
|
+
files: z.array(z.lazy(() => ORAnthropicShellToolResultFile$inboundSchema))
|
|
38
|
+
.optional(),
|
|
39
|
+
tool_use_id: z.string(),
|
|
40
|
+
type: z.literal("openrouter_shell_tool_result"),
|
|
41
|
+
}).transform((v) => {
|
|
42
|
+
return remap$(v, {
|
|
43
|
+
"container_id": "containerId",
|
|
44
|
+
"tool_use_id": "toolUseId",
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
export function orAnthropicShellToolResultFromJSON(jsonString) {
|
|
48
|
+
return safeParse(jsonString, (x) => ORAnthropicShellToolResult$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ORAnthropicShellToolResult' from JSON`);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=oranthropicshelltoolresult.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
export declare const ORAnthropicStopReason: {
|
|
4
|
+
readonly EndTurn: "end_turn";
|
|
5
|
+
readonly MaxTokens: "max_tokens";
|
|
6
|
+
readonly ModelContextWindowExceeded: "model_context_window_exceeded";
|
|
7
|
+
readonly StopSequence: "stop_sequence";
|
|
8
|
+
readonly ToolUse: "tool_use";
|
|
9
|
+
readonly PauseTurn: "pause_turn";
|
|
10
|
+
readonly Refusal: "refusal";
|
|
11
|
+
readonly Compaction: "compaction";
|
|
12
|
+
};
|
|
13
|
+
export type ORAnthropicStopReason = OpenEnum<typeof ORAnthropicStopReason>;
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare const ORAnthropicStopReason$inboundSchema: z.ZodType<ORAnthropicStopReason, unknown>;
|
|
16
|
+
//# sourceMappingURL=oranthropicstopreason.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 2f8990149810
|
|
4
|
+
*/
|
|
5
|
+
import * as openEnums from "../types/enums.js";
|
|
6
|
+
export const ORAnthropicStopReason = {
|
|
7
|
+
EndTurn: "end_turn",
|
|
8
|
+
MaxTokens: "max_tokens",
|
|
9
|
+
ModelContextWindowExceeded: "model_context_window_exceeded",
|
|
10
|
+
StopSequence: "stop_sequence",
|
|
11
|
+
ToolUse: "tool_use",
|
|
12
|
+
PauseTurn: "pause_turn",
|
|
13
|
+
Refusal: "refusal",
|
|
14
|
+
Compaction: "compaction",
|
|
15
|
+
};
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const ORAnthropicStopReason$inboundSchema = openEnums.inboundSchema(ORAnthropicStopReason);
|
|
18
|
+
//# sourceMappingURL=oranthropicstopreason.js.map
|
|
@@ -19,7 +19,7 @@ export type FailedModel = {
|
|
|
19
19
|
*/
|
|
20
20
|
statusCode?: number | undefined;
|
|
21
21
|
};
|
|
22
|
-
export type
|
|
22
|
+
export type OutputFusionServerToolItemResponse = {
|
|
23
23
|
content?: string | undefined;
|
|
24
24
|
model: string;
|
|
25
25
|
};
|
|
@@ -51,7 +51,7 @@ export type OutputFusionServerToolItem = {
|
|
|
51
51
|
/**
|
|
52
52
|
* Analysis models that produced a response in this fusion run, with each model's full panel content.
|
|
53
53
|
*/
|
|
54
|
-
responses?: Array<
|
|
54
|
+
responses?: Array<OutputFusionServerToolItemResponse> | undefined;
|
|
55
55
|
/**
|
|
56
56
|
* Web pages the analysis panels and analyst retrieved via web search during this fusion run, deduplicated by URL across the whole run. Present when at least one model cited a source.
|
|
57
57
|
*/
|
|
@@ -72,16 +72,16 @@ export declare const FailedModel$outboundSchema: z.ZodType<FailedModel$Outbound,
|
|
|
72
72
|
export declare function failedModelToJSON(failedModel: FailedModel): string;
|
|
73
73
|
export declare function failedModelFromJSON(jsonString: string): SafeParseResult<FailedModel, SDKValidationError>;
|
|
74
74
|
/** @internal */
|
|
75
|
-
export declare const
|
|
75
|
+
export declare const OutputFusionServerToolItemResponse$inboundSchema: z.ZodType<OutputFusionServerToolItemResponse, unknown>;
|
|
76
76
|
/** @internal */
|
|
77
|
-
export type
|
|
77
|
+
export type OutputFusionServerToolItemResponse$Outbound = {
|
|
78
78
|
content?: string | undefined;
|
|
79
79
|
model: string;
|
|
80
80
|
};
|
|
81
81
|
/** @internal */
|
|
82
|
-
export declare const
|
|
83
|
-
export declare function
|
|
84
|
-
export declare function
|
|
82
|
+
export declare const OutputFusionServerToolItemResponse$outboundSchema: z.ZodType<OutputFusionServerToolItemResponse$Outbound, OutputFusionServerToolItemResponse>;
|
|
83
|
+
export declare function outputFusionServerToolItemResponseToJSON(outputFusionServerToolItemResponse: OutputFusionServerToolItemResponse): string;
|
|
84
|
+
export declare function outputFusionServerToolItemResponseFromJSON(jsonString: string): SafeParseResult<OutputFusionServerToolItemResponse, SDKValidationError>;
|
|
85
85
|
/** @internal */
|
|
86
86
|
export declare const OutputFusionServerToolItemType$inboundSchema: z.ZodEnum<typeof OutputFusionServerToolItemType>;
|
|
87
87
|
/** @internal */
|
|
@@ -95,7 +95,7 @@ export type OutputFusionServerToolItem$Outbound = {
|
|
|
95
95
|
failed_models?: Array<FailedModel$Outbound> | undefined;
|
|
96
96
|
failure_reason?: string | undefined;
|
|
97
97
|
id?: string | undefined;
|
|
98
|
-
responses?: Array<
|
|
98
|
+
responses?: Array<OutputFusionServerToolItemResponse$Outbound> | undefined;
|
|
99
99
|
sources?: Array<FusionSource$Outbound> | undefined;
|
|
100
100
|
status: string;
|
|
101
101
|
type: string;
|
|
@@ -39,20 +39,20 @@ export function failedModelFromJSON(jsonString) {
|
|
|
39
39
|
return safeParse(jsonString, (x) => FailedModel$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FailedModel' from JSON`);
|
|
40
40
|
}
|
|
41
41
|
/** @internal */
|
|
42
|
-
export const
|
|
42
|
+
export const OutputFusionServerToolItemResponse$inboundSchema = z.object({
|
|
43
43
|
content: z.string().optional(),
|
|
44
44
|
model: z.string(),
|
|
45
45
|
});
|
|
46
46
|
/** @internal */
|
|
47
|
-
export const
|
|
47
|
+
export const OutputFusionServerToolItemResponse$outboundSchema = z.object({
|
|
48
48
|
content: z.string().optional(),
|
|
49
49
|
model: z.string(),
|
|
50
50
|
});
|
|
51
|
-
export function
|
|
52
|
-
return JSON.stringify(
|
|
51
|
+
export function outputFusionServerToolItemResponseToJSON(outputFusionServerToolItemResponse) {
|
|
52
|
+
return JSON.stringify(OutputFusionServerToolItemResponse$outboundSchema.parse(outputFusionServerToolItemResponse));
|
|
53
53
|
}
|
|
54
|
-
export function
|
|
55
|
-
return safeParse(jsonString, (x) =>
|
|
54
|
+
export function outputFusionServerToolItemResponseFromJSON(jsonString) {
|
|
55
|
+
return safeParse(jsonString, (x) => OutputFusionServerToolItemResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputFusionServerToolItemResponse' from JSON`);
|
|
56
56
|
}
|
|
57
57
|
/** @internal */
|
|
58
58
|
export const OutputFusionServerToolItemType$inboundSchema = z.enum(OutputFusionServerToolItemType);
|
|
@@ -65,7 +65,7 @@ export const OutputFusionServerToolItem$inboundSchema = z.object({
|
|
|
65
65
|
failed_models: z.array(z.lazy(() => FailedModel$inboundSchema)).optional(),
|
|
66
66
|
failure_reason: z.string().optional(),
|
|
67
67
|
id: z.string().optional(),
|
|
68
|
-
responses: z.array(z.lazy(() =>
|
|
68
|
+
responses: z.array(z.lazy(() => OutputFusionServerToolItemResponse$inboundSchema)).optional(),
|
|
69
69
|
sources: z.array(FusionSource$inboundSchema).optional(),
|
|
70
70
|
status: ToolCallStatus$inboundSchema,
|
|
71
71
|
type: OutputFusionServerToolItemType$inboundSchema,
|
|
@@ -82,7 +82,7 @@ export const OutputFusionServerToolItem$outboundSchema = z.object({
|
|
|
82
82
|
failedModels: z.array(z.lazy(() => FailedModel$outboundSchema)).optional(),
|
|
83
83
|
failureReason: z.string().optional(),
|
|
84
84
|
id: z.string().optional(),
|
|
85
|
-
responses: z.array(z.lazy(() =>
|
|
85
|
+
responses: z.array(z.lazy(() => OutputFusionServerToolItemResponse$outboundSchema)).optional(),
|
|
86
86
|
sources: z.array(FusionSource$outboundSchema).optional(),
|
|
87
87
|
status: ToolCallStatus$outboundSchema,
|
|
88
88
|
type: OutputFusionServerToolItemType$outboundSchema,
|
|
@@ -3,7 +3,7 @@ import { OpenEnum } from "../types/enums.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* The category of feedback being reported
|
|
5
5
|
*/
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const SubmitGenerationFeedbackRequestCategory: {
|
|
7
7
|
readonly Latency: "latency";
|
|
8
8
|
readonly Incoherence: "incoherence";
|
|
9
9
|
readonly IncorrectResponse: "incorrect_response";
|
|
@@ -15,7 +15,7 @@ export declare const Category: {
|
|
|
15
15
|
/**
|
|
16
16
|
* The category of feedback being reported
|
|
17
17
|
*/
|
|
18
|
-
export type
|
|
18
|
+
export type SubmitGenerationFeedbackRequestCategory = OpenEnum<typeof SubmitGenerationFeedbackRequestCategory>;
|
|
19
19
|
/**
|
|
20
20
|
* Structured feedback about a specific generation
|
|
21
21
|
*/
|
|
@@ -23,7 +23,7 @@ export type SubmitGenerationFeedbackRequest = {
|
|
|
23
23
|
/**
|
|
24
24
|
* The category of feedback being reported
|
|
25
25
|
*/
|
|
26
|
-
category:
|
|
26
|
+
category: SubmitGenerationFeedbackRequestCategory;
|
|
27
27
|
/**
|
|
28
28
|
* An optional free-text comment describing the feedback
|
|
29
29
|
*/
|
|
@@ -34,7 +34,7 @@ export type SubmitGenerationFeedbackRequest = {
|
|
|
34
34
|
generationId: string;
|
|
35
35
|
};
|
|
36
36
|
/** @internal */
|
|
37
|
-
export declare const
|
|
37
|
+
export declare const SubmitGenerationFeedbackRequestCategory$outboundSchema: z.ZodType<string, SubmitGenerationFeedbackRequestCategory>;
|
|
38
38
|
/** @internal */
|
|
39
39
|
export type SubmitGenerationFeedbackRequest$Outbound = {
|
|
40
40
|
category: string;
|
|
@@ -8,7 +8,7 @@ import * as openEnums from "../types/enums.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* The category of feedback being reported
|
|
10
10
|
*/
|
|
11
|
-
export const
|
|
11
|
+
export const SubmitGenerationFeedbackRequestCategory = {
|
|
12
12
|
Latency: "latency",
|
|
13
13
|
Incoherence: "incoherence",
|
|
14
14
|
IncorrectResponse: "incorrect_response",
|
|
@@ -18,11 +18,10 @@ export const Category = {
|
|
|
18
18
|
Other: "other",
|
|
19
19
|
};
|
|
20
20
|
/** @internal */
|
|
21
|
-
export const
|
|
22
|
-
.outboundSchema(Category);
|
|
21
|
+
export const SubmitGenerationFeedbackRequestCategory$outboundSchema = openEnums.outboundSchema(SubmitGenerationFeedbackRequestCategory);
|
|
23
22
|
/** @internal */
|
|
24
23
|
export const SubmitGenerationFeedbackRequest$outboundSchema = z.object({
|
|
25
|
-
category:
|
|
24
|
+
category: SubmitGenerationFeedbackRequestCategory$outboundSchema,
|
|
26
25
|
comment: z.string().optional(),
|
|
27
26
|
generationId: z.string(),
|
|
28
27
|
}).transform((v) => {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
2
|
+
import * as models from "../models/index.js";
|
|
3
|
+
import * as operations from "../models/operations/index.js";
|
|
4
|
+
import { PageIterator } from "../types/operations.js";
|
|
5
|
+
export declare class Batch extends ClientSDK {
|
|
6
|
+
/**
|
|
7
|
+
* List batches
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Lists batches in the workspace of the authenticating API key, newest first. To fetch the next page, pass the previous page's `last_id` as `after`. List items omit `results`. Use `GET /batches/{id}` to get them. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
|
|
11
|
+
*/
|
|
12
|
+
list(request?: operations.ListBatchesRequest | undefined, options?: RequestOptions): Promise<PageIterator<operations.ListBatchesResponse, {
|
|
13
|
+
cursor: string;
|
|
14
|
+
}>>;
|
|
15
|
+
/**
|
|
16
|
+
* Create a batch
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
|
|
20
|
+
*/
|
|
21
|
+
createBatches(request: operations.CreateBatchesRequest, options?: RequestOptions): Promise<models.BatchObject>;
|
|
22
|
+
/**
|
|
23
|
+
* Delete a batch
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* Deletes a batch in a terminal status (`completed`, `failed`, `expired`, or `cancelled`) and its stored requests and results. Batches still in progress return `409`. Billing and usage records are kept. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
|
|
27
|
+
*/
|
|
28
|
+
delete(request: operations.DeleteBatchRequest, options?: RequestOptions): Promise<models.BatchDeletedObject>;
|
|
29
|
+
/**
|
|
30
|
+
* Get a batch
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Returns a batch with its status and request counts. Batches in a terminal status include `results`. Failed batches report the reason in `error.message`. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
|
|
34
|
+
*/
|
|
35
|
+
getBatches(request: operations.GetBatchesRequest, options?: RequestOptions): Promise<models.BatchObject>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=batch.d.ts.map
|
package/esm/sdk/batch.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 254a218f7d6b
|
|
4
|
+
*/
|
|
5
|
+
import { batchCreateBatches } from "../funcs/batchCreateBatches.js";
|
|
6
|
+
import { batchDelete } from "../funcs/batchDelete.js";
|
|
7
|
+
import { batchGetBatches } from "../funcs/batchGetBatches.js";
|
|
8
|
+
import { batchList } from "../funcs/batchList.js";
|
|
9
|
+
import { ClientSDK } from "../lib/sdks.js";
|
|
10
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
11
|
+
import { unwrapResultIterator } from "../types/operations.js";
|
|
12
|
+
export class Batch extends ClientSDK {
|
|
13
|
+
/**
|
|
14
|
+
* List batches
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Lists batches in the workspace of the authenticating API key, newest first. To fetch the next page, pass the previous page's `last_id` as `after`. List items omit `results`. Use `GET /batches/{id}` to get them. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
|
|
18
|
+
*/
|
|
19
|
+
async list(request, options) {
|
|
20
|
+
return unwrapResultIterator(batchList(this, request, options));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Create a batch
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
|
|
27
|
+
*/
|
|
28
|
+
async createBatches(request, options) {
|
|
29
|
+
return unwrapAsync(batchCreateBatches(this, request, options));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Delete a batch
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* Deletes a batch in a terminal status (`completed`, `failed`, `expired`, or `cancelled`) and its stored requests and results. Batches still in progress return `409`. Billing and usage records are kept. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
|
|
36
|
+
*/
|
|
37
|
+
async delete(request, options) {
|
|
38
|
+
return unwrapAsync(batchDelete(this, request, options));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get a batch
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* Returns a batch with its status and request counts. Batches in a terminal status include `results`. Failed batches report the reason in `error.message`. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
|
|
45
|
+
*/
|
|
46
|
+
async getBatches(request, options) {
|
|
47
|
+
return unwrapAsync(batchGetBatches(this, request, options));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=batch.js.map
|
package/esm/sdk/sdk.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ClientSDK } from "../lib/sdks.js";
|
|
|
2
2
|
import { Alpha } from "./alpha.js";
|
|
3
3
|
import { Analytics } from "./analytics.js";
|
|
4
4
|
import { APIKeys } from "./apikeys.js";
|
|
5
|
+
import { Batch } from "./batch.js";
|
|
5
6
|
import { Benchmarks } from "./benchmarks.js";
|
|
6
7
|
import { Beta } from "./beta.js";
|
|
7
8
|
import { BYOK } from "./byok.js";
|
|
@@ -49,6 +50,8 @@ export declare class OpenRouter extends ClientSDK {
|
|
|
49
50
|
get stt(): STT;
|
|
50
51
|
private _oAuth?;
|
|
51
52
|
get oAuth(): OAuth;
|
|
53
|
+
private _batch?;
|
|
54
|
+
get batch(): Batch;
|
|
52
55
|
private _benchmarks?;
|
|
53
56
|
get benchmarks(): Benchmarks;
|
|
54
57
|
private _byok?;
|
package/esm/sdk/sdk.js
CHANGED
|
@@ -6,6 +6,7 @@ import { ClientSDK } from "../lib/sdks.js";
|
|
|
6
6
|
import { Alpha } from "./alpha.js";
|
|
7
7
|
import { Analytics } from "./analytics.js";
|
|
8
8
|
import { APIKeys } from "./apikeys.js";
|
|
9
|
+
import { Batch } from "./batch.js";
|
|
9
10
|
import { Benchmarks } from "./benchmarks.js";
|
|
10
11
|
import { Beta } from "./beta.js";
|
|
11
12
|
import { BYOK } from "./byok.js";
|
|
@@ -56,6 +57,9 @@ export class OpenRouter extends ClientSDK {
|
|
|
56
57
|
get oAuth() {
|
|
57
58
|
return (this._oAuth ?? (this._oAuth = new OAuth(this._options)));
|
|
58
59
|
}
|
|
60
|
+
get batch() {
|
|
61
|
+
return (this._batch ?? (this._batch = new Batch(this._options)));
|
|
62
|
+
}
|
|
59
63
|
get benchmarks() {
|
|
60
64
|
return (this._benchmarks ?? (this._benchmarks = new Benchmarks(this._options)));
|
|
61
65
|
}
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.30",
|
|
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 && node scripts/unbarrel-imports.js",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
-
"
|
|
76
|
+
"typecheck:transit": "exit 0",
|
|
77
|
+
"compile": "tsc && node scripts/unbarrel-imports.js",
|
|
78
|
+
"postinstall": "node scripts/check-types.js || true",
|
|
77
79
|
"test:e2e": "vitest --run --project e2e",
|
|
78
80
|
"test:transit": "exit 0",
|
|
79
81
|
"test:watch": "vitest --watch --project unit",
|
|
80
|
-
"typecheck:transit": "exit 0",
|
|
81
|
-
"test": "vitest --run --project unit",
|
|
82
82
|
"typecheck": "tsc --noEmit",
|
|
83
|
-
"
|
|
84
|
-
"
|
|
83
|
+
"prepare": "npm run build",
|
|
84
|
+
"test": "vitest --run --project unit"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
|