@openrouter/sdk 0.13.7 → 0.13.13
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 +3 -9
- package/esm/funcs/benchmarksGetBenchmarks.d.ts +19 -0
- package/esm/funcs/{datasetsGetBenchmarksDesignArena.js → benchmarksGetBenchmarks.js} +11 -10
- package/esm/funcs/classificationsGetTaskClassifications.d.ts +37 -0
- package/esm/funcs/classificationsGetTaskClassifications.js +119 -0
- package/esm/funcs/imagesGenerate.d.ts +30 -0
- package/esm/funcs/imagesGenerate.js +95 -0
- package/esm/funcs/imagesListModelEndpoints.d.ts +19 -0
- package/esm/funcs/imagesListModelEndpoints.js +107 -0
- package/esm/funcs/{datasetsGetBenchmarksDesignArena.d.ts → imagesListModels.d.ts} +4 -4
- package/esm/funcs/{datasetsGetBenchmarksArtificialAnalysis.js → imagesListModels.js} +10 -15
- package/esm/funcs/workspacesDeleteBudget.d.ts +19 -0
- package/esm/funcs/workspacesDeleteBudget.js +107 -0
- package/esm/funcs/workspacesListBudgets.d.ts +19 -0
- package/esm/funcs/workspacesListBudgets.js +103 -0
- package/esm/funcs/workspacesSetBudget.d.ts +19 -0
- package/esm/funcs/workspacesSetBudget.js +110 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/advisorreasoning.d.ts +1 -0
- package/esm/models/advisorreasoning.js +1 -0
- package/esm/models/anthropicadvisormessageusageiteration.d.ts +24 -0
- package/esm/models/anthropicadvisormessageusageiteration.js +36 -0
- package/esm/models/anthropiccompactionusageiteration.d.ts +23 -0
- package/esm/models/anthropiccompactionusageiteration.js +35 -0
- package/esm/models/anthropicdocumentblockparam.d.ts +5 -4
- package/esm/models/anthropicdocumentblockparam.js +3 -0
- package/esm/models/anthropicfiledocumentsource.d.ts +14 -0
- package/esm/models/anthropicfiledocumentsource.js +19 -0
- package/esm/models/anthropiciterationcachecreation.d.ts +11 -0
- package/esm/models/anthropiciterationcachecreation.js +21 -0
- package/esm/models/anthropicmessageusageiteration.d.ts +24 -0
- package/esm/models/anthropicmessageusageiteration.js +36 -0
- package/esm/models/anthropicspeed.d.ts +10 -0
- package/esm/models/anthropicspeed.js +12 -0
- package/esm/models/anthropicunknownusageiteration.d.ts +16 -0
- package/esm/models/anthropicunknownusageiteration.js +30 -0
- package/esm/models/anthropicusageiteration.d.ts +12 -0
- package/esm/models/anthropicusageiteration.js +21 -0
- package/esm/models/apierrortype.d.ts +41 -0
- package/esm/models/apierrortype.js +40 -0
- package/esm/models/booleancapability.d.ts +13 -0
- package/esm/models/booleancapability.js +14 -0
- package/esm/models/byokproviderslug.d.ts +3 -0
- package/esm/models/byokproviderslug.js +3 -0
- package/esm/models/capabilitydescriptor.d.ts +15 -0
- package/esm/models/capabilitydescriptor.js +19 -0
- package/esm/models/chatrequest.d.ts +2 -0
- package/esm/models/chatrequest.js +2 -0
- package/esm/models/chatstreamchunk.d.ts +25 -4
- package/esm/models/chatstreamchunk.js +19 -4
- package/esm/models/chatusage.d.ts +32 -8
- package/esm/models/chatusage.js +25 -8
- package/esm/models/chatwebsearchshorthand.d.ts +1 -1
- package/esm/models/contentpartimage.d.ts +9 -2
- package/esm/models/contentpartimage.js +6 -1
- package/esm/models/debugevent.d.ts +42 -0
- package/esm/models/debugevent.js +58 -0
- package/esm/models/deleteworkspacebudgetresponse.d.ts +13 -0
- package/esm/models/deleteworkspacebudgetresponse.js +14 -0
- package/esm/models/enumcapability.d.ts +14 -0
- package/esm/models/enumcapability.js +15 -0
- package/esm/models/fusionplugin.d.ts +1 -0
- package/esm/models/fusionplugin.js +1 -0
- package/esm/models/fusionservertoolconfig.d.ts +8 -1
- package/esm/models/fusionservertoolconfig.js +4 -0
- package/esm/models/imageendpoint.d.ts +41 -0
- package/esm/models/imageendpoint.js +33 -0
- package/esm/models/imagegencompletedevent.d.ts +29 -0
- package/esm/models/imagegencompletedevent.js +23 -0
- package/esm/models/imagegenerationrequest.d.ts +908 -0
- package/esm/models/imagegenerationrequest.js +266 -0
- package/esm/models/imagegenerationresponse.d.ts +34 -0
- package/esm/models/imagegenerationresponse.js +29 -0
- package/esm/models/imagegenerationservertool.d.ts +15 -15
- package/esm/models/imagegenerationservertool.js +15 -17
- package/esm/models/imagegenerationusage.d.ts +119 -0
- package/esm/models/imagegenerationusage.js +93 -0
- package/esm/models/imagegenpartialimageevent.d.ts +24 -0
- package/esm/models/imagegenpartialimageevent.js +22 -0
- package/esm/models/imagegenstreamerrorevent.d.ts +44 -0
- package/esm/models/imagegenstreamerrorevent.js +25 -0
- package/esm/models/imagemodelarchitecture.d.ts +19 -0
- package/esm/models/imagemodelarchitecture.js +23 -0
- package/esm/models/imagemodelendpointsresponse.d.ts +18 -0
- package/esm/models/imagemodelendpointsresponse.js +16 -0
- package/esm/models/imagemodellistitem.d.ts +42 -0
- package/esm/models/imagemodellistitem.js +29 -0
- package/esm/models/imagemodelslistresponse.d.ts +14 -0
- package/esm/models/imagemodelslistresponse.js +15 -0
- package/esm/models/imageoutputmodality.d.ts +16 -0
- package/esm/models/imageoutputmodality.js +18 -0
- package/esm/models/imagepricingentry.d.ts +35 -0
- package/esm/models/imagepricingentry.js +41 -0
- package/esm/models/imagestreamingresponse.d.ts +18 -0
- package/esm/models/imagestreamingresponse.js +43 -0
- package/esm/models/index.d.ts +44 -7
- package/esm/models/index.js +44 -7
- package/esm/models/inputreference.d.ts +6 -2
- package/esm/models/inputreference.js +1 -1
- package/esm/models/legacywebsearchservertool.d.ts +1 -1
- package/esm/models/listworkspacebudgetsresponse.d.ts +14 -0
- package/esm/models/listworkspacebudgetsresponse.js +15 -0
- package/esm/models/messagesrequest.d.ts +6 -6
- package/esm/models/messagesrequest.js +4 -5
- package/esm/models/model.d.ts +5 -0
- package/esm/models/model.js +2 -0
- package/esm/models/modelreasoning.d.ts +49 -0
- package/esm/models/modelreasoning.js +42 -0
- package/esm/models/observabilityarizedestination.d.ts +3 -0
- package/esm/models/openresponsesresult.d.ts +5 -0
- package/esm/models/openresponsesresult.js +3 -0
- package/esm/models/operations/createembeddings.d.ts +19 -0
- package/esm/models/operations/createembeddings.js +20 -0
- package/esm/models/operations/createimages.d.ts +63 -0
- package/esm/models/operations/createimages.js +44 -0
- package/esm/models/operations/{getbenchmarksartificialanalysis.d.ts → deleteworkspacebudget.d.ts} +15 -9
- package/esm/models/operations/deleteworkspacebudget.js +23 -0
- package/esm/models/operations/getbenchmarks.d.ts +120 -0
- package/esm/models/operations/getbenchmarks.js +60 -0
- package/esm/models/operations/getmodels.d.ts +5 -3
- package/esm/models/operations/getmodels.js +3 -1
- package/esm/models/operations/{getbenchmarksdesignarena.d.ts → gettaskclassifications.d.ts} +16 -28
- package/esm/models/operations/gettaskclassifications.js +29 -0
- package/esm/models/operations/index.d.ts +8 -2
- package/esm/models/operations/index.js +8 -2
- package/esm/models/operations/listbyokkeys.d.ts +3 -0
- package/esm/models/operations/listbyokkeys.js +3 -0
- package/esm/models/operations/listimagemodelendpoints.d.ts +63 -0
- package/esm/models/operations/listimagemodelendpoints.js +22 -0
- package/esm/models/operations/listimagemodels.d.ts +53 -0
- package/esm/models/operations/listimagemodels.js +20 -0
- package/esm/models/operations/listworkspacebudgets.d.ts +58 -0
- package/esm/models/operations/listworkspacebudgets.js +21 -0
- package/esm/models/operations/queryanalytics.d.ts +7 -3
- package/esm/models/operations/queryanalytics.js +1 -0
- package/esm/models/operations/upsertworkspacebudget.d.ts +66 -0
- package/esm/models/operations/upsertworkspacebudget.js +25 -0
- package/esm/models/preview20250311websearchservertool.d.ts +1 -1
- package/esm/models/previewwebsearchservertool.d.ts +1 -1
- package/esm/models/providername.d.ts +3 -0
- package/esm/models/providername.js +3 -0
- package/esm/models/provideroptions.d.ts +19 -1
- package/esm/models/provideroptions.js +5 -0
- package/esm/models/providerresponse.d.ts +3 -0
- package/esm/models/providerresponse.js +3 -0
- package/esm/models/rangecapability.d.ts +15 -0
- package/esm/models/rangecapability.js +16 -0
- package/esm/models/reasoningeffort.d.ts +1 -0
- package/esm/models/reasoningeffort.js +1 -0
- package/esm/models/responsesrequest.d.ts +6 -0
- package/esm/models/responsesrequest.js +2 -0
- package/esm/models/speechrequest.d.ts +1 -1
- package/esm/models/streamevents.d.ts +2 -1
- package/esm/models/streamevents.js +2 -0
- package/esm/models/sttrequest.d.ts +1 -1
- package/esm/models/subagentreasoning.d.ts +1 -0
- package/esm/models/subagentreasoning.js +1 -0
- package/esm/models/taskclassificationitem.d.ts +42 -0
- package/esm/models/taskclassificationitem.js +32 -0
- package/esm/models/taskclassificationmacrocategory.d.ts +25 -0
- package/esm/models/taskclassificationmacrocategory.js +23 -0
- package/esm/models/taskclassificationmodel.d.ts +21 -0
- package/esm/models/taskclassificationmodel.js +22 -0
- package/esm/models/taskclassificationresponse.d.ts +33 -0
- package/esm/models/taskclassificationresponse.js +33 -0
- package/esm/models/{benchmarkpricing.d.ts → unifiedbenchmarkpricing.d.ts} +4 -4
- package/esm/models/unifiedbenchmarkpricing.js +15 -0
- package/esm/models/{benchmarksaaitem.d.ts → unifiedbenchmarksaaitem.d.ts} +14 -10
- package/esm/models/unifiedbenchmarksaaitem.js +30 -0
- package/esm/models/{benchmarksdaitem.d.ts → unifiedbenchmarksdaitem.d.ts} +11 -7
- package/esm/models/{benchmarksdaitem.js → unifiedbenchmarksdaitem.js} +8 -7
- package/esm/models/unifiedbenchmarksmeta.d.ts +63 -0
- package/esm/models/unifiedbenchmarksmeta.js +46 -0
- package/esm/models/unifiedbenchmarksresponse.d.ts +19 -0
- package/esm/models/unifiedbenchmarksresponse.js +30 -0
- package/esm/models/upsertworkspacebudgetrequest.d.ts +15 -0
- package/esm/models/upsertworkspacebudgetrequest.js +18 -0
- package/esm/models/upsertworkspacebudgetresponse.d.ts +11 -0
- package/esm/models/upsertworkspacebudgetresponse.js +15 -0
- package/esm/models/videogenerationrequest.d.ts +33 -15
- package/esm/models/videogenerationrequest.js +16 -11
- package/esm/models/websearchconfig.d.ts +1 -1
- package/esm/models/websearchservertool.d.ts +1 -1
- package/esm/models/websearchservertoolconfig.d.ts +1 -1
- package/esm/models/workspacebudget.d.ts +48 -0
- package/esm/models/workspacebudget.js +39 -0
- package/esm/models/workspacebudgetinterval.d.ts +18 -0
- package/esm/models/workspacebudgetinterval.js +17 -0
- package/esm/sdk/benchmarks.d.ts +13 -0
- package/esm/sdk/benchmarks.js +19 -0
- package/esm/sdk/classifications.d.ts +31 -0
- package/esm/sdk/classifications.js +37 -0
- package/esm/sdk/datasets.d.ts +0 -14
- package/esm/sdk/datasets.js +0 -20
- package/esm/sdk/images.d.ts +38 -0
- package/esm/sdk/images.js +33 -0
- package/esm/sdk/sdk.d.ts +9 -0
- package/esm/sdk/sdk.js +12 -0
- package/esm/sdk/workspaces.d.ts +21 -0
- package/esm/sdk/workspaces.js +30 -0
- package/jsr.json +1 -1
- package/package.json +5 -5
- package/esm/funcs/datasetsGetBenchmarksArtificialAnalysis.d.ts +0 -19
- package/esm/models/benchmarkpricing.js +0 -15
- package/esm/models/benchmarksaaitem.js +0 -29
- package/esm/models/benchmarksaameta.d.ts +0 -70
- package/esm/models/benchmarksaameta.js +0 -50
- package/esm/models/benchmarksaaresponse.d.ts +0 -13
- package/esm/models/benchmarksaaresponse.js +0 -17
- package/esm/models/benchmarksdameta.d.ts +0 -98
- package/esm/models/benchmarksdameta.js +0 -62
- package/esm/models/benchmarksdaresponse.d.ts +0 -13
- package/esm/models/benchmarksdaresponse.js +0 -17
- package/esm/models/operations/getbenchmarksartificialanalysis.js +0 -22
- package/esm/models/operations/getbenchmarksdesignarena.js +0 -36
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: eafcf72fb51c
|
|
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
|
+
/** @internal */
|
|
9
|
+
export const AnthropicIterationCacheCreation$inboundSchema = z.object({
|
|
10
|
+
ephemeral_1h_input_tokens: z.int().optional(),
|
|
11
|
+
ephemeral_5m_input_tokens: z.int().optional(),
|
|
12
|
+
}).transform((v) => {
|
|
13
|
+
return remap$(v, {
|
|
14
|
+
"ephemeral_1h_input_tokens": "ephemeral1hInputTokens",
|
|
15
|
+
"ephemeral_5m_input_tokens": "ephemeral5mInputTokens",
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
export function anthropicIterationCacheCreationFromJSON(jsonString) {
|
|
19
|
+
return safeParse(jsonString, (x) => AnthropicIterationCacheCreation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnthropicIterationCacheCreation' from JSON`);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=anthropiciterationcachecreation.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { AnthropicIterationCacheCreation } from "./anthropiciterationcachecreation.js";
|
|
5
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
6
|
+
export declare const AnthropicMessageUsageIterationType: {
|
|
7
|
+
readonly Message: "message";
|
|
8
|
+
};
|
|
9
|
+
export type AnthropicMessageUsageIterationType = ClosedEnum<typeof AnthropicMessageUsageIterationType>;
|
|
10
|
+
export type AnthropicMessageUsageIteration = {
|
|
11
|
+
cacheCreation?: AnthropicIterationCacheCreation | null | undefined;
|
|
12
|
+
cacheCreationInputTokens?: number | undefined;
|
|
13
|
+
cacheReadInputTokens?: number | undefined;
|
|
14
|
+
inputTokens?: number | undefined;
|
|
15
|
+
outputTokens?: number | undefined;
|
|
16
|
+
model?: string | undefined;
|
|
17
|
+
type: AnthropicMessageUsageIterationType;
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare const AnthropicMessageUsageIterationType$inboundSchema: z.ZodEnum<typeof AnthropicMessageUsageIterationType>;
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const AnthropicMessageUsageIteration$inboundSchema: z.ZodType<AnthropicMessageUsageIteration, unknown>;
|
|
23
|
+
export declare function anthropicMessageUsageIterationFromJSON(jsonString: string): SafeParseResult<AnthropicMessageUsageIteration, SDKValidationError>;
|
|
24
|
+
//# sourceMappingURL=anthropicmessageusageiteration.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: fabb23153447
|
|
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
|
+
import { AnthropicIterationCacheCreation$inboundSchema, } from "./anthropiciterationcachecreation.js";
|
|
9
|
+
export const AnthropicMessageUsageIterationType = {
|
|
10
|
+
Message: "message",
|
|
11
|
+
};
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const AnthropicMessageUsageIterationType$inboundSchema = z.enum(AnthropicMessageUsageIterationType);
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const AnthropicMessageUsageIteration$inboundSchema = z.object({
|
|
16
|
+
cache_creation: z.nullable(AnthropicIterationCacheCreation$inboundSchema)
|
|
17
|
+
.optional(),
|
|
18
|
+
cache_creation_input_tokens: z.int().optional(),
|
|
19
|
+
cache_read_input_tokens: z.int().optional(),
|
|
20
|
+
input_tokens: z.int().optional(),
|
|
21
|
+
output_tokens: z.int().optional(),
|
|
22
|
+
model: z.string().optional(),
|
|
23
|
+
type: AnthropicMessageUsageIterationType$inboundSchema,
|
|
24
|
+
}).transform((v) => {
|
|
25
|
+
return remap$(v, {
|
|
26
|
+
"cache_creation": "cacheCreation",
|
|
27
|
+
"cache_creation_input_tokens": "cacheCreationInputTokens",
|
|
28
|
+
"cache_read_input_tokens": "cacheReadInputTokens",
|
|
29
|
+
"input_tokens": "inputTokens",
|
|
30
|
+
"output_tokens": "outputTokens",
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
export function anthropicMessageUsageIterationFromJSON(jsonString) {
|
|
34
|
+
return safeParse(jsonString, (x) => AnthropicMessageUsageIteration$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnthropicMessageUsageIteration' from JSON`);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=anthropicmessageusageiteration.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
export declare const AnthropicSpeed: {
|
|
4
|
+
readonly Fast: "fast";
|
|
5
|
+
readonly Standard: "standard";
|
|
6
|
+
};
|
|
7
|
+
export type AnthropicSpeed = OpenEnum<typeof AnthropicSpeed>;
|
|
8
|
+
/** @internal */
|
|
9
|
+
export declare const AnthropicSpeed$inboundSchema: z.ZodType<AnthropicSpeed, unknown>;
|
|
10
|
+
//# sourceMappingURL=anthropicspeed.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 8c545705b9ae
|
|
4
|
+
*/
|
|
5
|
+
import * as openEnums from "../types/enums.js";
|
|
6
|
+
export const AnthropicSpeed = {
|
|
7
|
+
Fast: "fast",
|
|
8
|
+
Standard: "standard",
|
|
9
|
+
};
|
|
10
|
+
/** @internal */
|
|
11
|
+
export const AnthropicSpeed$inboundSchema = openEnums.inboundSchema(AnthropicSpeed);
|
|
12
|
+
//# sourceMappingURL=anthropicspeed.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { AnthropicIterationCacheCreation } from "./anthropiciterationcachecreation.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
export type AnthropicUnknownUsageIteration = {
|
|
6
|
+
cacheCreation?: AnthropicIterationCacheCreation | null | undefined;
|
|
7
|
+
cacheCreationInputTokens?: number | undefined;
|
|
8
|
+
cacheReadInputTokens?: number | undefined;
|
|
9
|
+
inputTokens?: number | undefined;
|
|
10
|
+
outputTokens?: number | undefined;
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare const AnthropicUnknownUsageIteration$inboundSchema: z.ZodType<AnthropicUnknownUsageIteration, unknown>;
|
|
15
|
+
export declare function anthropicUnknownUsageIterationFromJSON(jsonString: string): SafeParseResult<AnthropicUnknownUsageIteration, SDKValidationError>;
|
|
16
|
+
//# sourceMappingURL=anthropicunknownusageiteration.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 4c070ad010b0
|
|
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
|
+
import { AnthropicIterationCacheCreation$inboundSchema, } from "./anthropiciterationcachecreation.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const AnthropicUnknownUsageIteration$inboundSchema = z.object({
|
|
11
|
+
cache_creation: z.nullable(AnthropicIterationCacheCreation$inboundSchema)
|
|
12
|
+
.optional(),
|
|
13
|
+
cache_creation_input_tokens: z.int().optional(),
|
|
14
|
+
cache_read_input_tokens: z.int().optional(),
|
|
15
|
+
input_tokens: z.int().optional(),
|
|
16
|
+
output_tokens: z.int().optional(),
|
|
17
|
+
type: z.string(),
|
|
18
|
+
}).transform((v) => {
|
|
19
|
+
return remap$(v, {
|
|
20
|
+
"cache_creation": "cacheCreation",
|
|
21
|
+
"cache_creation_input_tokens": "cacheCreationInputTokens",
|
|
22
|
+
"cache_read_input_tokens": "cacheReadInputTokens",
|
|
23
|
+
"input_tokens": "inputTokens",
|
|
24
|
+
"output_tokens": "outputTokens",
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
export function anthropicUnknownUsageIterationFromJSON(jsonString) {
|
|
28
|
+
return safeParse(jsonString, (x) => AnthropicUnknownUsageIteration$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnthropicUnknownUsageIteration' from JSON`);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=anthropicunknownusageiteration.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { AnthropicAdvisorMessageUsageIteration } from "./anthropicadvisormessageusageiteration.js";
|
|
4
|
+
import { AnthropicCompactionUsageIteration } from "./anthropiccompactionusageiteration.js";
|
|
5
|
+
import { AnthropicMessageUsageIteration } from "./anthropicmessageusageiteration.js";
|
|
6
|
+
import { AnthropicUnknownUsageIteration } from "./anthropicunknownusageiteration.js";
|
|
7
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
8
|
+
export type AnthropicUsageIteration = AnthropicAdvisorMessageUsageIteration | AnthropicCompactionUsageIteration | AnthropicMessageUsageIteration | AnthropicUnknownUsageIteration;
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare const AnthropicUsageIteration$inboundSchema: z.ZodType<AnthropicUsageIteration, unknown>;
|
|
11
|
+
export declare function anthropicUsageIterationFromJSON(jsonString: string): SafeParseResult<AnthropicUsageIteration, SDKValidationError>;
|
|
12
|
+
//# sourceMappingURL=anthropicusageiteration.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 8daa16a72772
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { AnthropicAdvisorMessageUsageIteration$inboundSchema, } from "./anthropicadvisormessageusageiteration.js";
|
|
8
|
+
import { AnthropicCompactionUsageIteration$inboundSchema, } from "./anthropiccompactionusageiteration.js";
|
|
9
|
+
import { AnthropicMessageUsageIteration$inboundSchema, } from "./anthropicmessageusageiteration.js";
|
|
10
|
+
import { AnthropicUnknownUsageIteration$inboundSchema, } from "./anthropicunknownusageiteration.js";
|
|
11
|
+
/** @internal */
|
|
12
|
+
export const AnthropicUsageIteration$inboundSchema = z.union([
|
|
13
|
+
AnthropicAdvisorMessageUsageIteration$inboundSchema,
|
|
14
|
+
AnthropicCompactionUsageIteration$inboundSchema,
|
|
15
|
+
AnthropicMessageUsageIteration$inboundSchema,
|
|
16
|
+
AnthropicUnknownUsageIteration$inboundSchema,
|
|
17
|
+
]);
|
|
18
|
+
export function anthropicUsageIterationFromJSON(jsonString) {
|
|
19
|
+
return safeParse(jsonString, (x) => AnthropicUsageIteration$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnthropicUsageIteration' from JSON`);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=anthropicusageiteration.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
/**
|
|
4
|
+
* Canonical OpenRouter error type, stable across all API formats
|
|
5
|
+
*/
|
|
6
|
+
export declare const ApiErrorType: {
|
|
7
|
+
readonly ContextLengthExceeded: "context_length_exceeded";
|
|
8
|
+
readonly MaxTokensExceeded: "max_tokens_exceeded";
|
|
9
|
+
readonly TokenLimitExceeded: "token_limit_exceeded";
|
|
10
|
+
readonly StringTooLong: "string_too_long";
|
|
11
|
+
readonly Authentication: "authentication";
|
|
12
|
+
readonly PermissionDenied: "permission_denied";
|
|
13
|
+
readonly PaymentRequired: "payment_required";
|
|
14
|
+
readonly RateLimitExceeded: "rate_limit_exceeded";
|
|
15
|
+
readonly ProviderOverloaded: "provider_overloaded";
|
|
16
|
+
readonly ProviderUnavailable: "provider_unavailable";
|
|
17
|
+
readonly InvalidRequest: "invalid_request";
|
|
18
|
+
readonly InvalidPrompt: "invalid_prompt";
|
|
19
|
+
readonly NotFound: "not_found";
|
|
20
|
+
readonly PreconditionFailed: "precondition_failed";
|
|
21
|
+
readonly PayloadTooLarge: "payload_too_large";
|
|
22
|
+
readonly Unprocessable: "unprocessable";
|
|
23
|
+
readonly ContentPolicyViolation: "content_policy_violation";
|
|
24
|
+
readonly Refusal: "refusal";
|
|
25
|
+
readonly InvalidImage: "invalid_image";
|
|
26
|
+
readonly ImageTooLarge: "image_too_large";
|
|
27
|
+
readonly ImageTooSmall: "image_too_small";
|
|
28
|
+
readonly UnsupportedImageFormat: "unsupported_image_format";
|
|
29
|
+
readonly ImageNotFound: "image_not_found";
|
|
30
|
+
readonly ImageDownloadFailed: "image_download_failed";
|
|
31
|
+
readonly Server: "server";
|
|
32
|
+
readonly Timeout: "timeout";
|
|
33
|
+
readonly Unmapped: "unmapped";
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Canonical OpenRouter error type, stable across all API formats
|
|
37
|
+
*/
|
|
38
|
+
export type ApiErrorType = OpenEnum<typeof ApiErrorType>;
|
|
39
|
+
/** @internal */
|
|
40
|
+
export declare const ApiErrorType$inboundSchema: z.ZodType<ApiErrorType, unknown>;
|
|
41
|
+
//# sourceMappingURL=apierrortype.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 240e785ddd59
|
|
4
|
+
*/
|
|
5
|
+
import * as openEnums from "../types/enums.js";
|
|
6
|
+
/**
|
|
7
|
+
* Canonical OpenRouter error type, stable across all API formats
|
|
8
|
+
*/
|
|
9
|
+
export const ApiErrorType = {
|
|
10
|
+
ContextLengthExceeded: "context_length_exceeded",
|
|
11
|
+
MaxTokensExceeded: "max_tokens_exceeded",
|
|
12
|
+
TokenLimitExceeded: "token_limit_exceeded",
|
|
13
|
+
StringTooLong: "string_too_long",
|
|
14
|
+
Authentication: "authentication",
|
|
15
|
+
PermissionDenied: "permission_denied",
|
|
16
|
+
PaymentRequired: "payment_required",
|
|
17
|
+
RateLimitExceeded: "rate_limit_exceeded",
|
|
18
|
+
ProviderOverloaded: "provider_overloaded",
|
|
19
|
+
ProviderUnavailable: "provider_unavailable",
|
|
20
|
+
InvalidRequest: "invalid_request",
|
|
21
|
+
InvalidPrompt: "invalid_prompt",
|
|
22
|
+
NotFound: "not_found",
|
|
23
|
+
PreconditionFailed: "precondition_failed",
|
|
24
|
+
PayloadTooLarge: "payload_too_large",
|
|
25
|
+
Unprocessable: "unprocessable",
|
|
26
|
+
ContentPolicyViolation: "content_policy_violation",
|
|
27
|
+
Refusal: "refusal",
|
|
28
|
+
InvalidImage: "invalid_image",
|
|
29
|
+
ImageTooLarge: "image_too_large",
|
|
30
|
+
ImageTooSmall: "image_too_small",
|
|
31
|
+
UnsupportedImageFormat: "unsupported_image_format",
|
|
32
|
+
ImageNotFound: "image_not_found",
|
|
33
|
+
ImageDownloadFailed: "image_download_failed",
|
|
34
|
+
Server: "server",
|
|
35
|
+
Timeout: "timeout",
|
|
36
|
+
Unmapped: "unmapped",
|
|
37
|
+
};
|
|
38
|
+
/** @internal */
|
|
39
|
+
export const ApiErrorType$inboundSchema = openEnums.inboundSchema(ApiErrorType);
|
|
40
|
+
//# sourceMappingURL=apierrortype.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
/**
|
|
5
|
+
* A supported-or-not flag. Present means the parameter is accepted.
|
|
6
|
+
*/
|
|
7
|
+
export type BooleanCapability = {
|
|
8
|
+
type: "boolean";
|
|
9
|
+
};
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare const BooleanCapability$inboundSchema: z.ZodType<BooleanCapability, unknown>;
|
|
12
|
+
export declare function booleanCapabilityFromJSON(jsonString: string): SafeParseResult<BooleanCapability, SDKValidationError>;
|
|
13
|
+
//# sourceMappingURL=booleancapability.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: b920d99cecda
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const BooleanCapability$inboundSchema = z.object({
|
|
9
|
+
type: z.literal("boolean"),
|
|
10
|
+
});
|
|
11
|
+
export function booleanCapabilityFromJSON(jsonString) {
|
|
12
|
+
return safeParse(jsonString, (x) => BooleanCapability$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BooleanCapability' from JSON`);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=booleancapability.js.map
|
|
@@ -42,6 +42,7 @@ export declare const BYOKProviderSlug: {
|
|
|
42
42
|
readonly Groq: "groq";
|
|
43
43
|
readonly Inception: "inception";
|
|
44
44
|
readonly Inceptron: "inceptron";
|
|
45
|
+
readonly InferactVllm: "inferact-vllm";
|
|
45
46
|
readonly InferenceNet: "inference-net";
|
|
46
47
|
readonly Infermatic: "infermatic";
|
|
47
48
|
readonly Inflection: "inflection";
|
|
@@ -72,6 +73,7 @@ export declare const BYOKProviderSlug: {
|
|
|
72
73
|
readonly Recraft: "recraft";
|
|
73
74
|
readonly Reka: "reka";
|
|
74
75
|
readonly Relace: "relace";
|
|
76
|
+
readonly SakanaAi: "sakana-ai";
|
|
75
77
|
readonly Sambanova: "sambanova";
|
|
76
78
|
readonly Seed: "seed";
|
|
77
79
|
readonly Siliconflow: "siliconflow";
|
|
@@ -79,6 +81,7 @@ export declare const BYOKProviderSlug: {
|
|
|
79
81
|
readonly Stepfun: "stepfun";
|
|
80
82
|
readonly Streamlake: "streamlake";
|
|
81
83
|
readonly Switchpoint: "switchpoint";
|
|
84
|
+
readonly Tenstorrent: "tenstorrent";
|
|
82
85
|
readonly Together: "together";
|
|
83
86
|
readonly Upstage: "upstage";
|
|
84
87
|
readonly Venice: "venice";
|
|
@@ -45,6 +45,7 @@ export const BYOKProviderSlug = {
|
|
|
45
45
|
Groq: "groq",
|
|
46
46
|
Inception: "inception",
|
|
47
47
|
Inceptron: "inceptron",
|
|
48
|
+
InferactVllm: "inferact-vllm",
|
|
48
49
|
InferenceNet: "inference-net",
|
|
49
50
|
Infermatic: "infermatic",
|
|
50
51
|
Inflection: "inflection",
|
|
@@ -75,6 +76,7 @@ export const BYOKProviderSlug = {
|
|
|
75
76
|
Recraft: "recraft",
|
|
76
77
|
Reka: "reka",
|
|
77
78
|
Relace: "relace",
|
|
79
|
+
SakanaAi: "sakana-ai",
|
|
78
80
|
Sambanova: "sambanova",
|
|
79
81
|
Seed: "seed",
|
|
80
82
|
Siliconflow: "siliconflow",
|
|
@@ -82,6 +84,7 @@ export const BYOKProviderSlug = {
|
|
|
82
84
|
Stepfun: "stepfun",
|
|
83
85
|
Streamlake: "streamlake",
|
|
84
86
|
Switchpoint: "switchpoint",
|
|
87
|
+
Tenstorrent: "tenstorrent",
|
|
85
88
|
Together: "together",
|
|
86
89
|
Upstage: "upstage",
|
|
87
90
|
Venice: "venice",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import * as discriminatedUnionTypes from "../types/discriminatedUnion.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { BooleanCapability } from "./booleancapability.js";
|
|
5
|
+
import { EnumCapability } from "./enumcapability.js";
|
|
6
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
7
|
+
import { RangeCapability } from "./rangecapability.js";
|
|
8
|
+
/**
|
|
9
|
+
* A typed descriptor for one supported request parameter.
|
|
10
|
+
*/
|
|
11
|
+
export type CapabilityDescriptor = EnumCapability | RangeCapability | BooleanCapability | discriminatedUnionTypes.Unknown<"type">;
|
|
12
|
+
/** @internal */
|
|
13
|
+
export declare const CapabilityDescriptor$inboundSchema: z.ZodType<CapabilityDescriptor, unknown>;
|
|
14
|
+
export declare function capabilityDescriptorFromJSON(jsonString: string): SafeParseResult<CapabilityDescriptor, SDKValidationError>;
|
|
15
|
+
//# sourceMappingURL=capabilitydescriptor.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 867d654ac8ab
|
|
4
|
+
*/
|
|
5
|
+
import { safeParse } from "../lib/schemas.js";
|
|
6
|
+
import { discriminatedUnion } from "../types/discriminatedUnion.js";
|
|
7
|
+
import { BooleanCapability$inboundSchema, } from "./booleancapability.js";
|
|
8
|
+
import { EnumCapability$inboundSchema, } from "./enumcapability.js";
|
|
9
|
+
import { RangeCapability$inboundSchema, } from "./rangecapability.js";
|
|
10
|
+
/** @internal */
|
|
11
|
+
export const CapabilityDescriptor$inboundSchema = discriminatedUnion("type", {
|
|
12
|
+
enum: EnumCapability$inboundSchema,
|
|
13
|
+
range: RangeCapability$inboundSchema,
|
|
14
|
+
boolean: BooleanCapability$inboundSchema,
|
|
15
|
+
});
|
|
16
|
+
export function capabilityDescriptorFromJSON(jsonString) {
|
|
17
|
+
return safeParse(jsonString, (x) => CapabilityDescriptor$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CapabilityDescriptor' from JSON`);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=capabilitydescriptor.js.map
|
|
@@ -36,6 +36,7 @@ export type ChatRequestPlugin = AutoRouterPlugin | ContextCompressionPlugin | Fi
|
|
|
36
36
|
* Constrains effort on reasoning for reasoning models
|
|
37
37
|
*/
|
|
38
38
|
export declare const ChatRequestEffort: {
|
|
39
|
+
readonly Max: "max";
|
|
39
40
|
readonly Xhigh: "xhigh";
|
|
40
41
|
readonly High: "high";
|
|
41
42
|
readonly Medium: "medium";
|
|
@@ -61,6 +62,7 @@ export type ChatRequestReasoning = {
|
|
|
61
62
|
* Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
|
|
62
63
|
*/
|
|
63
64
|
export declare const ChatRequestReasoningEffort: {
|
|
65
|
+
readonly Max: "max";
|
|
64
66
|
readonly Xhigh: "xhigh";
|
|
65
67
|
readonly High: "high";
|
|
66
68
|
readonly Medium: "medium";
|
|
@@ -39,6 +39,7 @@ export const Modality = {
|
|
|
39
39
|
* Constrains effort on reasoning for reasoning models
|
|
40
40
|
*/
|
|
41
41
|
export const ChatRequestEffort = {
|
|
42
|
+
Max: "max",
|
|
42
43
|
Xhigh: "xhigh",
|
|
43
44
|
High: "high",
|
|
44
45
|
Medium: "medium",
|
|
@@ -50,6 +51,7 @@ export const ChatRequestEffort = {
|
|
|
50
51
|
* Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
|
|
51
52
|
*/
|
|
52
53
|
export const ChatRequestReasoningEffort = {
|
|
54
|
+
Max: "max",
|
|
53
55
|
Xhigh: "xhigh",
|
|
54
56
|
High: "high",
|
|
55
57
|
Medium: "medium",
|
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { ClosedEnum } from "../types/enums.js";
|
|
3
3
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { ApiErrorType } from "./apierrortype.js";
|
|
4
5
|
import { ChatStreamChoice } from "./chatstreamchoice.js";
|
|
5
6
|
import { ChatUsage } from "./chatusage.js";
|
|
6
7
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
7
8
|
import { OpenRouterMetadata } from "./openroutermetadata.js";
|
|
9
|
+
/**
|
|
10
|
+
* Structured error metadata
|
|
11
|
+
*/
|
|
12
|
+
export type ChatStreamChunkMetadata = {
|
|
13
|
+
/**
|
|
14
|
+
* Canonical OpenRouter error type, stable across all API formats
|
|
15
|
+
*/
|
|
16
|
+
errorType: ApiErrorType;
|
|
17
|
+
/**
|
|
18
|
+
* Upstream provider-specific error code, when available
|
|
19
|
+
*/
|
|
20
|
+
providerCode?: string | undefined;
|
|
21
|
+
};
|
|
8
22
|
/**
|
|
9
23
|
* Error information
|
|
10
24
|
*/
|
|
11
|
-
export type
|
|
25
|
+
export type ChatStreamChunkError = {
|
|
12
26
|
/**
|
|
13
27
|
* Error code
|
|
14
28
|
*/
|
|
@@ -17,6 +31,10 @@ export type ErrorT = {
|
|
|
17
31
|
* Error message
|
|
18
32
|
*/
|
|
19
33
|
message: string;
|
|
34
|
+
/**
|
|
35
|
+
* Structured error metadata
|
|
36
|
+
*/
|
|
37
|
+
metadata?: ChatStreamChunkMetadata | undefined;
|
|
20
38
|
};
|
|
21
39
|
export declare const ChatStreamChunkObject: {
|
|
22
40
|
readonly ChatCompletionChunk: "chat.completion.chunk";
|
|
@@ -37,7 +55,7 @@ export type ChatStreamChunk = {
|
|
|
37
55
|
/**
|
|
38
56
|
* Error information
|
|
39
57
|
*/
|
|
40
|
-
error?:
|
|
58
|
+
error?: ChatStreamChunkError | undefined;
|
|
41
59
|
/**
|
|
42
60
|
* Unique chunk identifier
|
|
43
61
|
*/
|
|
@@ -62,8 +80,11 @@ export type ChatStreamChunk = {
|
|
|
62
80
|
usage?: ChatUsage | undefined;
|
|
63
81
|
};
|
|
64
82
|
/** @internal */
|
|
65
|
-
export declare const
|
|
66
|
-
export declare function
|
|
83
|
+
export declare const ChatStreamChunkMetadata$inboundSchema: z.ZodType<ChatStreamChunkMetadata, unknown>;
|
|
84
|
+
export declare function chatStreamChunkMetadataFromJSON(jsonString: string): SafeParseResult<ChatStreamChunkMetadata, SDKValidationError>;
|
|
85
|
+
/** @internal */
|
|
86
|
+
export declare const ChatStreamChunkError$inboundSchema: z.ZodType<ChatStreamChunkError, unknown>;
|
|
87
|
+
export declare function chatStreamChunkErrorFromJSON(jsonString: string): SafeParseResult<ChatStreamChunkError, SDKValidationError>;
|
|
67
88
|
/** @internal */
|
|
68
89
|
export declare const ChatStreamChunkObject$inboundSchema: z.ZodEnum<typeof ChatStreamChunkObject>;
|
|
69
90
|
/** @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 { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import { ApiErrorType$inboundSchema } from "./apierrortype.js";
|
|
8
9
|
import { ChatStreamChoice$inboundSchema, } from "./chatstreamchoice.js";
|
|
9
10
|
import { ChatUsage$inboundSchema } from "./chatusage.js";
|
|
10
11
|
import { OpenRouterMetadata$inboundSchema, } from "./openroutermetadata.js";
|
|
@@ -12,12 +13,26 @@ export const ChatStreamChunkObject = {
|
|
|
12
13
|
ChatCompletionChunk: "chat.completion.chunk",
|
|
13
14
|
};
|
|
14
15
|
/** @internal */
|
|
15
|
-
export const
|
|
16
|
+
export const ChatStreamChunkMetadata$inboundSchema = z.object({
|
|
17
|
+
error_type: ApiErrorType$inboundSchema,
|
|
18
|
+
provider_code: z.string().optional(),
|
|
19
|
+
}).transform((v) => {
|
|
20
|
+
return remap$(v, {
|
|
21
|
+
"error_type": "errorType",
|
|
22
|
+
"provider_code": "providerCode",
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
export function chatStreamChunkMetadataFromJSON(jsonString) {
|
|
26
|
+
return safeParse(jsonString, (x) => ChatStreamChunkMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatStreamChunkMetadata' from JSON`);
|
|
27
|
+
}
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const ChatStreamChunkError$inboundSchema = z.object({
|
|
16
30
|
code: z.int(),
|
|
17
31
|
message: z.string(),
|
|
32
|
+
metadata: z.lazy(() => ChatStreamChunkMetadata$inboundSchema).optional(),
|
|
18
33
|
});
|
|
19
|
-
export function
|
|
20
|
-
return safeParse(jsonString, (x) =>
|
|
34
|
+
export function chatStreamChunkErrorFromJSON(jsonString) {
|
|
35
|
+
return safeParse(jsonString, (x) => ChatStreamChunkError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatStreamChunkError' from JSON`);
|
|
21
36
|
}
|
|
22
37
|
/** @internal */
|
|
23
38
|
export const ChatStreamChunkObject$inboundSchema = z.enum(ChatStreamChunkObject);
|
|
@@ -25,7 +40,7 @@ export const ChatStreamChunkObject$inboundSchema = z.enum(ChatStreamChunkObject)
|
|
|
25
40
|
export const ChatStreamChunk$inboundSchema = z.object({
|
|
26
41
|
choices: z.array(ChatStreamChoice$inboundSchema),
|
|
27
42
|
created: z.int(),
|
|
28
|
-
error: z.lazy(() =>
|
|
43
|
+
error: z.lazy(() => ChatStreamChunkError$inboundSchema).optional(),
|
|
29
44
|
id: z.string(),
|
|
30
45
|
model: z.string(),
|
|
31
46
|
object: ChatStreamChunkObject$inboundSchema,
|
|
@@ -5,7 +5,7 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* Detailed completion token usage
|
|
7
7
|
*/
|
|
8
|
-
export type
|
|
8
|
+
export type ChatUsageCompletionTokensDetails = {
|
|
9
9
|
/**
|
|
10
10
|
* Accepted prediction tokens
|
|
11
11
|
*/
|
|
@@ -26,7 +26,7 @@ export type CompletionTokensDetails = {
|
|
|
26
26
|
/**
|
|
27
27
|
* Detailed prompt token usage
|
|
28
28
|
*/
|
|
29
|
-
export type
|
|
29
|
+
export type ChatUsagePromptTokensDetails = {
|
|
30
30
|
/**
|
|
31
31
|
* Audio input tokens
|
|
32
32
|
*/
|
|
@@ -44,6 +44,23 @@ export type PromptTokensDetails = {
|
|
|
44
44
|
*/
|
|
45
45
|
videoTokens?: number | undefined;
|
|
46
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Usage for server-side tool execution (e.g., web search)
|
|
49
|
+
*/
|
|
50
|
+
export type ServerToolUseDetails = {
|
|
51
|
+
/**
|
|
52
|
+
* Number of OpenRouter server tool calls that executed and produced a result
|
|
53
|
+
*/
|
|
54
|
+
toolCallsExecuted?: number | null | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.
|
|
57
|
+
*/
|
|
58
|
+
toolCallsRequested?: number | null | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.
|
|
61
|
+
*/
|
|
62
|
+
webSearchRequests?: number | null | undefined;
|
|
63
|
+
};
|
|
47
64
|
/**
|
|
48
65
|
* Token usage statistics
|
|
49
66
|
*/
|
|
@@ -55,7 +72,7 @@ export type ChatUsage = {
|
|
|
55
72
|
/**
|
|
56
73
|
* Detailed completion token usage
|
|
57
74
|
*/
|
|
58
|
-
completionTokensDetails?:
|
|
75
|
+
completionTokensDetails?: ChatUsageCompletionTokensDetails | null | undefined;
|
|
59
76
|
/**
|
|
60
77
|
* Cost of the completion
|
|
61
78
|
*/
|
|
@@ -75,18 +92,25 @@ export type ChatUsage = {
|
|
|
75
92
|
/**
|
|
76
93
|
* Detailed prompt token usage
|
|
77
94
|
*/
|
|
78
|
-
promptTokensDetails?:
|
|
95
|
+
promptTokensDetails?: ChatUsagePromptTokensDetails | null | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Usage for server-side tool execution (e.g., web search)
|
|
98
|
+
*/
|
|
99
|
+
serverToolUseDetails?: ServerToolUseDetails | null | undefined;
|
|
79
100
|
/**
|
|
80
101
|
* Total number of tokens
|
|
81
102
|
*/
|
|
82
103
|
totalTokens: number;
|
|
83
104
|
};
|
|
84
105
|
/** @internal */
|
|
85
|
-
export declare const
|
|
86
|
-
export declare function
|
|
106
|
+
export declare const ChatUsageCompletionTokensDetails$inboundSchema: z.ZodType<ChatUsageCompletionTokensDetails, unknown>;
|
|
107
|
+
export declare function chatUsageCompletionTokensDetailsFromJSON(jsonString: string): SafeParseResult<ChatUsageCompletionTokensDetails, SDKValidationError>;
|
|
108
|
+
/** @internal */
|
|
109
|
+
export declare const ChatUsagePromptTokensDetails$inboundSchema: z.ZodType<ChatUsagePromptTokensDetails, unknown>;
|
|
110
|
+
export declare function chatUsagePromptTokensDetailsFromJSON(jsonString: string): SafeParseResult<ChatUsagePromptTokensDetails, SDKValidationError>;
|
|
87
111
|
/** @internal */
|
|
88
|
-
export declare const
|
|
89
|
-
export declare function
|
|
112
|
+
export declare const ServerToolUseDetails$inboundSchema: z.ZodType<ServerToolUseDetails, unknown>;
|
|
113
|
+
export declare function serverToolUseDetailsFromJSON(jsonString: string): SafeParseResult<ServerToolUseDetails, SDKValidationError>;
|
|
90
114
|
/** @internal */
|
|
91
115
|
export declare const ChatUsage$inboundSchema: z.ZodType<ChatUsage, unknown>;
|
|
92
116
|
export declare function chatUsageFromJSON(jsonString: string): SafeParseResult<ChatUsage, SDKValidationError>;
|