@openrouter/sdk 0.13.7 → 0.13.14
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 +4 -0
- package/esm/models/byokproviderslug.js +4 -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 +914 -0
- package/esm/models/imagegenerationrequest.js +267 -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 +4 -0
- package/esm/models/operations/listbyokkeys.js +4 -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 +4 -0
- package/esm/models/providername.js +4 -0
- package/esm/models/provideroptions.d.ts +25 -1
- package/esm/models/provideroptions.js +6 -0
- package/esm/models/providerresponse.d.ts +4 -0
- package/esm/models/providerresponse.js +4 -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 +39 -15
- package/esm/models/videogenerationrequest.js +17 -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 +7 -7
- 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,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 1aba9dd7a12c
|
|
4
|
+
*/
|
|
5
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as models from "../models/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
/**
|
|
17
|
+
* Delete a workspace budget
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Remove the budget for a given interval. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
21
|
+
*/
|
|
22
|
+
export function workspacesDeleteBudget(client, request, options) {
|
|
23
|
+
return new APIPromise($do(client, request, options));
|
|
24
|
+
}
|
|
25
|
+
async function $do(client, request, options) {
|
|
26
|
+
const parsed = safeParse(request, (value) => operations.DeleteWorkspaceBudgetRequest$outboundSchema.parse(value), "Input validation failed");
|
|
27
|
+
if (!parsed.ok) {
|
|
28
|
+
return [parsed, { status: "invalid" }];
|
|
29
|
+
}
|
|
30
|
+
const payload = parsed.value;
|
|
31
|
+
const body = null;
|
|
32
|
+
const pathParams = {
|
|
33
|
+
id: encodeSimple("id", payload.id, {
|
|
34
|
+
explode: false,
|
|
35
|
+
charEncoding: "percent",
|
|
36
|
+
}),
|
|
37
|
+
interval: encodeSimple("interval", payload.interval, {
|
|
38
|
+
explode: false,
|
|
39
|
+
charEncoding: "percent",
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
const path = pathToFunc("/workspaces/{id}/budgets/{interval}")(pathParams);
|
|
43
|
+
const headers = new Headers(compactMap({
|
|
44
|
+
Accept: "application/json",
|
|
45
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
46
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
47
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
48
|
+
}));
|
|
49
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
50
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
51
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
52
|
+
const context = {
|
|
53
|
+
options: client._options,
|
|
54
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
55
|
+
operationID: "deleteWorkspaceBudget",
|
|
56
|
+
oAuth2Scopes: null,
|
|
57
|
+
resolvedSecurity: requestSecurity,
|
|
58
|
+
securitySource: client._options.apiKey,
|
|
59
|
+
retryConfig: options?.retries
|
|
60
|
+
|| client._options.retryConfig
|
|
61
|
+
|| {
|
|
62
|
+
strategy: "backoff",
|
|
63
|
+
backoff: {
|
|
64
|
+
initialInterval: 500,
|
|
65
|
+
maxInterval: 60000,
|
|
66
|
+
exponent: 1.5,
|
|
67
|
+
maxElapsedTime: 3600000,
|
|
68
|
+
},
|
|
69
|
+
retryConnectionErrors: true,
|
|
70
|
+
}
|
|
71
|
+
|| { strategy: "none" },
|
|
72
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
73
|
+
};
|
|
74
|
+
const requestRes = client._createRequest(context, {
|
|
75
|
+
security: requestSecurity,
|
|
76
|
+
method: "DELETE",
|
|
77
|
+
baseURL: options?.serverURL,
|
|
78
|
+
path: path,
|
|
79
|
+
headers: headers,
|
|
80
|
+
body: body,
|
|
81
|
+
userAgent: client._options.userAgent,
|
|
82
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
83
|
+
}, options);
|
|
84
|
+
if (!requestRes.ok) {
|
|
85
|
+
return [requestRes, { status: "invalid" }];
|
|
86
|
+
}
|
|
87
|
+
const req = requestRes.value;
|
|
88
|
+
const doResult = await client._do(req, {
|
|
89
|
+
context,
|
|
90
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
91
|
+
retryConfig: context.retryConfig,
|
|
92
|
+
retryCodes: context.retryCodes,
|
|
93
|
+
});
|
|
94
|
+
if (!doResult.ok) {
|
|
95
|
+
return [doResult, { status: "request-error", request: req }];
|
|
96
|
+
}
|
|
97
|
+
const response = doResult.value;
|
|
98
|
+
const responseFields = {
|
|
99
|
+
HttpMeta: { Response: response, Request: req },
|
|
100
|
+
};
|
|
101
|
+
const [result] = await M.match(M.json(200, models.DeleteWorkspaceBudgetResponse$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
102
|
+
if (!result.ok) {
|
|
103
|
+
return [result, { status: "complete", request: req, response }];
|
|
104
|
+
}
|
|
105
|
+
return [result, { status: "complete", request: req, response }];
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=workspacesDeleteBudget.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
9
|
+
import * as operations from "../models/operations/index.js";
|
|
10
|
+
import { APIPromise } from "../types/async.js";
|
|
11
|
+
import { Result } from "../types/fp.js";
|
|
12
|
+
/**
|
|
13
|
+
* List workspace budgets
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* List all budgets configured for a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
|
+
*/
|
|
18
|
+
export declare function workspacesListBudgets(client: OpenRouterCore, request: operations.ListWorkspaceBudgetsRequest, options?: RequestOptions): APIPromise<Result<models.ListWorkspaceBudgetsResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=workspacesListBudgets.d.ts.map
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: b9c711e0ccbd
|
|
4
|
+
*/
|
|
5
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as models from "../models/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
/**
|
|
17
|
+
* List workspace budgets
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* List all budgets configured for a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
21
|
+
*/
|
|
22
|
+
export function workspacesListBudgets(client, request, options) {
|
|
23
|
+
return new APIPromise($do(client, request, options));
|
|
24
|
+
}
|
|
25
|
+
async function $do(client, request, options) {
|
|
26
|
+
const parsed = safeParse(request, (value) => operations.ListWorkspaceBudgetsRequest$outboundSchema.parse(value), "Input validation failed");
|
|
27
|
+
if (!parsed.ok) {
|
|
28
|
+
return [parsed, { status: "invalid" }];
|
|
29
|
+
}
|
|
30
|
+
const payload = parsed.value;
|
|
31
|
+
const body = null;
|
|
32
|
+
const pathParams = {
|
|
33
|
+
id: encodeSimple("id", payload.id, {
|
|
34
|
+
explode: false,
|
|
35
|
+
charEncoding: "percent",
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
const path = pathToFunc("/workspaces/{id}/budgets")(pathParams);
|
|
39
|
+
const headers = new Headers(compactMap({
|
|
40
|
+
Accept: "application/json",
|
|
41
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
42
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
43
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
44
|
+
}));
|
|
45
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
46
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
47
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
48
|
+
const context = {
|
|
49
|
+
options: client._options,
|
|
50
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
51
|
+
operationID: "listWorkspaceBudgets",
|
|
52
|
+
oAuth2Scopes: null,
|
|
53
|
+
resolvedSecurity: requestSecurity,
|
|
54
|
+
securitySource: client._options.apiKey,
|
|
55
|
+
retryConfig: options?.retries
|
|
56
|
+
|| client._options.retryConfig
|
|
57
|
+
|| {
|
|
58
|
+
strategy: "backoff",
|
|
59
|
+
backoff: {
|
|
60
|
+
initialInterval: 500,
|
|
61
|
+
maxInterval: 60000,
|
|
62
|
+
exponent: 1.5,
|
|
63
|
+
maxElapsedTime: 3600000,
|
|
64
|
+
},
|
|
65
|
+
retryConnectionErrors: true,
|
|
66
|
+
}
|
|
67
|
+
|| { strategy: "none" },
|
|
68
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
69
|
+
};
|
|
70
|
+
const requestRes = client._createRequest(context, {
|
|
71
|
+
security: requestSecurity,
|
|
72
|
+
method: "GET",
|
|
73
|
+
baseURL: options?.serverURL,
|
|
74
|
+
path: path,
|
|
75
|
+
headers: headers,
|
|
76
|
+
body: body,
|
|
77
|
+
userAgent: client._options.userAgent,
|
|
78
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
79
|
+
}, options);
|
|
80
|
+
if (!requestRes.ok) {
|
|
81
|
+
return [requestRes, { status: "invalid" }];
|
|
82
|
+
}
|
|
83
|
+
const req = requestRes.value;
|
|
84
|
+
const doResult = await client._do(req, {
|
|
85
|
+
context,
|
|
86
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
87
|
+
retryConfig: context.retryConfig,
|
|
88
|
+
retryCodes: context.retryCodes,
|
|
89
|
+
});
|
|
90
|
+
if (!doResult.ok) {
|
|
91
|
+
return [doResult, { status: "request-error", request: req }];
|
|
92
|
+
}
|
|
93
|
+
const response = doResult.value;
|
|
94
|
+
const responseFields = {
|
|
95
|
+
HttpMeta: { Response: response, Request: req },
|
|
96
|
+
};
|
|
97
|
+
const [result] = await M.match(M.json(200, models.ListWorkspaceBudgetsResponse$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
98
|
+
if (!result.ok) {
|
|
99
|
+
return [result, { status: "complete", request: req, response }];
|
|
100
|
+
}
|
|
101
|
+
return [result, { status: "complete", request: req, response }];
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=workspacesListBudgets.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
9
|
+
import * as operations from "../models/operations/index.js";
|
|
10
|
+
import { APIPromise } from "../types/async.js";
|
|
11
|
+
import { Result } from "../types/fp.js";
|
|
12
|
+
/**
|
|
13
|
+
* Create or update a workspace budget
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Create or update the budget for a given interval. Budget limits must strictly decrease as the interval narrows (lifetime > monthly > weekly > daily). [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
|
+
*/
|
|
18
|
+
export declare function workspacesSetBudget(client: OpenRouterCore, request: operations.UpsertWorkspaceBudgetRequest, options?: RequestOptions): APIPromise<Result<models.UpsertWorkspaceBudgetResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=workspacesSetBudget.d.ts.map
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: fa41d5f31215
|
|
4
|
+
*/
|
|
5
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as models from "../models/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
/**
|
|
17
|
+
* Create or update a workspace budget
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Create or update the budget for a given interval. Budget limits must strictly decrease as the interval narrows (lifetime > monthly > weekly > daily). [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
21
|
+
*/
|
|
22
|
+
export function workspacesSetBudget(client, request, options) {
|
|
23
|
+
return new APIPromise($do(client, request, options));
|
|
24
|
+
}
|
|
25
|
+
async function $do(client, request, options) {
|
|
26
|
+
const parsed = safeParse(request, (value) => operations.UpsertWorkspaceBudgetRequest$outboundSchema.parse(value), "Input validation failed");
|
|
27
|
+
if (!parsed.ok) {
|
|
28
|
+
return [parsed, { status: "invalid" }];
|
|
29
|
+
}
|
|
30
|
+
const payload = parsed.value;
|
|
31
|
+
const body = encodeJSON("body", payload.UpsertWorkspaceBudgetRequest, {
|
|
32
|
+
explode: true,
|
|
33
|
+
});
|
|
34
|
+
const pathParams = {
|
|
35
|
+
id: encodeSimple("id", payload.id, {
|
|
36
|
+
explode: false,
|
|
37
|
+
charEncoding: "percent",
|
|
38
|
+
}),
|
|
39
|
+
interval: encodeSimple("interval", payload.interval, {
|
|
40
|
+
explode: false,
|
|
41
|
+
charEncoding: "percent",
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
44
|
+
const path = pathToFunc("/workspaces/{id}/budgets/{interval}")(pathParams);
|
|
45
|
+
const headers = new Headers(compactMap({
|
|
46
|
+
"Content-Type": "application/json",
|
|
47
|
+
Accept: "application/json",
|
|
48
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
49
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
50
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
51
|
+
}));
|
|
52
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
53
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
54
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
55
|
+
const context = {
|
|
56
|
+
options: client._options,
|
|
57
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
58
|
+
operationID: "upsertWorkspaceBudget",
|
|
59
|
+
oAuth2Scopes: null,
|
|
60
|
+
resolvedSecurity: requestSecurity,
|
|
61
|
+
securitySource: client._options.apiKey,
|
|
62
|
+
retryConfig: options?.retries
|
|
63
|
+
|| client._options.retryConfig
|
|
64
|
+
|| {
|
|
65
|
+
strategy: "backoff",
|
|
66
|
+
backoff: {
|
|
67
|
+
initialInterval: 500,
|
|
68
|
+
maxInterval: 60000,
|
|
69
|
+
exponent: 1.5,
|
|
70
|
+
maxElapsedTime: 3600000,
|
|
71
|
+
},
|
|
72
|
+
retryConnectionErrors: true,
|
|
73
|
+
}
|
|
74
|
+
|| { strategy: "none" },
|
|
75
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
76
|
+
};
|
|
77
|
+
const requestRes = client._createRequest(context, {
|
|
78
|
+
security: requestSecurity,
|
|
79
|
+
method: "PUT",
|
|
80
|
+
baseURL: options?.serverURL,
|
|
81
|
+
path: path,
|
|
82
|
+
headers: headers,
|
|
83
|
+
body: body,
|
|
84
|
+
userAgent: client._options.userAgent,
|
|
85
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
86
|
+
}, options);
|
|
87
|
+
if (!requestRes.ok) {
|
|
88
|
+
return [requestRes, { status: "invalid" }];
|
|
89
|
+
}
|
|
90
|
+
const req = requestRes.value;
|
|
91
|
+
const doResult = await client._do(req, {
|
|
92
|
+
context,
|
|
93
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
94
|
+
retryConfig: context.retryConfig,
|
|
95
|
+
retryCodes: context.retryCodes,
|
|
96
|
+
});
|
|
97
|
+
if (!doResult.ok) {
|
|
98
|
+
return [doResult, { status: "request-error", request: req }];
|
|
99
|
+
}
|
|
100
|
+
const response = doResult.value;
|
|
101
|
+
const responseFields = {
|
|
102
|
+
HttpMeta: { Response: response, Request: req },
|
|
103
|
+
};
|
|
104
|
+
const [result] = await M.match(M.json(200, models.UpsertWorkspaceBudgetResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
105
|
+
if (!result.ok) {
|
|
106
|
+
return [result, { status: "complete", request: req, response }];
|
|
107
|
+
}
|
|
108
|
+
return [result, { status: "complete", request: req, response }];
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=workspacesSetBudget.js.map
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
49
49
|
export declare const SDK_METADATA: {
|
|
50
50
|
readonly language: "typescript";
|
|
51
51
|
readonly openapiDocVersion: "1.0.0";
|
|
52
|
-
readonly sdkVersion: "0.13.
|
|
52
|
+
readonly sdkVersion: "0.13.14";
|
|
53
53
|
readonly genVersion: "2.884.4";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.13.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.13.14 2.884.4 1.0.0 @openrouter/sdk";
|
|
55
55
|
};
|
|
56
56
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
|
|
|
26
26
|
export const SDK_METADATA = {
|
|
27
27
|
language: "typescript",
|
|
28
28
|
openapiDocVersion: "1.0.0",
|
|
29
|
-
sdkVersion: "0.13.
|
|
29
|
+
sdkVersion: "0.13.14",
|
|
30
30
|
genVersion: "2.884.4",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 0.13.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 0.13.14 2.884.4 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.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 AnthropicAdvisorMessageUsageIterationType: {
|
|
7
|
+
readonly AdvisorMessage: "advisor_message";
|
|
8
|
+
};
|
|
9
|
+
export type AnthropicAdvisorMessageUsageIterationType = ClosedEnum<typeof AnthropicAdvisorMessageUsageIterationType>;
|
|
10
|
+
export type AnthropicAdvisorMessageUsageIteration = {
|
|
11
|
+
cacheCreation?: AnthropicIterationCacheCreation | null | undefined;
|
|
12
|
+
cacheCreationInputTokens?: number | undefined;
|
|
13
|
+
cacheReadInputTokens?: number | undefined;
|
|
14
|
+
inputTokens?: number | undefined;
|
|
15
|
+
outputTokens?: number | undefined;
|
|
16
|
+
model: string;
|
|
17
|
+
type: AnthropicAdvisorMessageUsageIterationType;
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare const AnthropicAdvisorMessageUsageIterationType$inboundSchema: z.ZodEnum<typeof AnthropicAdvisorMessageUsageIterationType>;
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const AnthropicAdvisorMessageUsageIteration$inboundSchema: z.ZodType<AnthropicAdvisorMessageUsageIteration, unknown>;
|
|
23
|
+
export declare function anthropicAdvisorMessageUsageIterationFromJSON(jsonString: string): SafeParseResult<AnthropicAdvisorMessageUsageIteration, SDKValidationError>;
|
|
24
|
+
//# sourceMappingURL=anthropicadvisormessageusageiteration.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: ff2ce164571e
|
|
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 AnthropicAdvisorMessageUsageIterationType = {
|
|
10
|
+
AdvisorMessage: "advisor_message",
|
|
11
|
+
};
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const AnthropicAdvisorMessageUsageIterationType$inboundSchema = z.enum(AnthropicAdvisorMessageUsageIterationType);
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const AnthropicAdvisorMessageUsageIteration$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(),
|
|
23
|
+
type: AnthropicAdvisorMessageUsageIterationType$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 anthropicAdvisorMessageUsageIterationFromJSON(jsonString) {
|
|
34
|
+
return safeParse(jsonString, (x) => AnthropicAdvisorMessageUsageIteration$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnthropicAdvisorMessageUsageIteration' from JSON`);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=anthropicadvisormessageusageiteration.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
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 AnthropicCompactionUsageIterationType: {
|
|
7
|
+
readonly Compaction: "compaction";
|
|
8
|
+
};
|
|
9
|
+
export type AnthropicCompactionUsageIterationType = ClosedEnum<typeof AnthropicCompactionUsageIterationType>;
|
|
10
|
+
export type AnthropicCompactionUsageIteration = {
|
|
11
|
+
cacheCreation?: AnthropicIterationCacheCreation | null | undefined;
|
|
12
|
+
cacheCreationInputTokens?: number | undefined;
|
|
13
|
+
cacheReadInputTokens?: number | undefined;
|
|
14
|
+
inputTokens?: number | undefined;
|
|
15
|
+
outputTokens?: number | undefined;
|
|
16
|
+
type: AnthropicCompactionUsageIterationType;
|
|
17
|
+
};
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const AnthropicCompactionUsageIterationType$inboundSchema: z.ZodEnum<typeof AnthropicCompactionUsageIterationType>;
|
|
20
|
+
/** @internal */
|
|
21
|
+
export declare const AnthropicCompactionUsageIteration$inboundSchema: z.ZodType<AnthropicCompactionUsageIteration, unknown>;
|
|
22
|
+
export declare function anthropicCompactionUsageIterationFromJSON(jsonString: string): SafeParseResult<AnthropicCompactionUsageIteration, SDKValidationError>;
|
|
23
|
+
//# sourceMappingURL=anthropiccompactionusageiteration.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 5982ebca6c31
|
|
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 AnthropicCompactionUsageIterationType = {
|
|
10
|
+
Compaction: "compaction",
|
|
11
|
+
};
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const AnthropicCompactionUsageIterationType$inboundSchema = z.enum(AnthropicCompactionUsageIterationType);
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const AnthropicCompactionUsageIteration$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
|
+
type: AnthropicCompactionUsageIterationType$inboundSchema,
|
|
23
|
+
}).transform((v) => {
|
|
24
|
+
return remap$(v, {
|
|
25
|
+
"cache_creation": "cacheCreation",
|
|
26
|
+
"cache_creation_input_tokens": "cacheCreationInputTokens",
|
|
27
|
+
"cache_read_input_tokens": "cacheReadInputTokens",
|
|
28
|
+
"input_tokens": "inputTokens",
|
|
29
|
+
"output_tokens": "outputTokens",
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
export function anthropicCompactionUsageIterationFromJSON(jsonString) {
|
|
33
|
+
return safeParse(jsonString, (x) => AnthropicCompactionUsageIteration$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnthropicCompactionUsageIteration' from JSON`);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=anthropiccompactionusageiteration.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { AnthropicBase64PdfSource, AnthropicBase64PdfSource$Outbound } from "./anthropicbase64pdfsource.js";
|
|
3
3
|
import { AnthropicCacheControlDirective, AnthropicCacheControlDirective$Outbound } from "./anthropiccachecontroldirective.js";
|
|
4
|
+
import { AnthropicFileDocumentSource, AnthropicFileDocumentSource$Outbound } from "./anthropicfiledocumentsource.js";
|
|
4
5
|
import { AnthropicImageBlockParam, AnthropicImageBlockParam$Outbound } from "./anthropicimageblockparam.js";
|
|
5
6
|
import { AnthropicPlainTextSource, AnthropicPlainTextSource$Outbound } from "./anthropicplaintextsource.js";
|
|
6
7
|
import { AnthropicTextBlockParam, AnthropicTextBlockParam$Outbound } from "./anthropictextblockparam.js";
|
|
@@ -14,7 +15,7 @@ export type SourceContent = {
|
|
|
14
15
|
content: string | Array<AnthropicImageBlockParam | AnthropicTextBlockParam>;
|
|
15
16
|
type: "content";
|
|
16
17
|
};
|
|
17
|
-
export type AnthropicDocumentBlockParamSourceUnion = AnthropicBase64PdfSource | AnthropicPlainTextSource | SourceContent | AnthropicUrlPdfSource;
|
|
18
|
+
export type AnthropicDocumentBlockParamSourceUnion = AnthropicBase64PdfSource | AnthropicPlainTextSource | SourceContent | AnthropicUrlPdfSource | AnthropicFileDocumentSource;
|
|
18
19
|
export type AnthropicDocumentBlockParam = {
|
|
19
20
|
/**
|
|
20
21
|
* Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.
|
|
@@ -22,7 +23,7 @@ export type AnthropicDocumentBlockParam = {
|
|
|
22
23
|
cacheControl?: AnthropicCacheControlDirective | undefined;
|
|
23
24
|
citations?: AnthropicDocumentBlockParamCitations | null | undefined;
|
|
24
25
|
context?: string | null | undefined;
|
|
25
|
-
source: AnthropicBase64PdfSource | AnthropicPlainTextSource | SourceContent | AnthropicUrlPdfSource;
|
|
26
|
+
source: AnthropicBase64PdfSource | AnthropicPlainTextSource | SourceContent | AnthropicUrlPdfSource | AnthropicFileDocumentSource;
|
|
26
27
|
title?: string | null | undefined;
|
|
27
28
|
type: "document";
|
|
28
29
|
};
|
|
@@ -52,7 +53,7 @@ export type SourceContent$Outbound = {
|
|
|
52
53
|
export declare const SourceContent$outboundSchema: z.ZodType<SourceContent$Outbound, SourceContent>;
|
|
53
54
|
export declare function sourceContentToJSON(sourceContent: SourceContent): string;
|
|
54
55
|
/** @internal */
|
|
55
|
-
export type AnthropicDocumentBlockParamSourceUnion$Outbound = AnthropicBase64PdfSource$Outbound | AnthropicPlainTextSource$Outbound | SourceContent$Outbound | AnthropicUrlPdfSource$Outbound;
|
|
56
|
+
export type AnthropicDocumentBlockParamSourceUnion$Outbound = AnthropicBase64PdfSource$Outbound | AnthropicPlainTextSource$Outbound | SourceContent$Outbound | AnthropicUrlPdfSource$Outbound | AnthropicFileDocumentSource$Outbound;
|
|
56
57
|
/** @internal */
|
|
57
58
|
export declare const AnthropicDocumentBlockParamSourceUnion$outboundSchema: z.ZodType<AnthropicDocumentBlockParamSourceUnion$Outbound, AnthropicDocumentBlockParamSourceUnion>;
|
|
58
59
|
export declare function anthropicDocumentBlockParamSourceUnionToJSON(anthropicDocumentBlockParamSourceUnion: AnthropicDocumentBlockParamSourceUnion): string;
|
|
@@ -61,7 +62,7 @@ export type AnthropicDocumentBlockParam$Outbound = {
|
|
|
61
62
|
cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
|
|
62
63
|
citations?: AnthropicDocumentBlockParamCitations$Outbound | null | undefined;
|
|
63
64
|
context?: string | null | undefined;
|
|
64
|
-
source: AnthropicBase64PdfSource$Outbound | AnthropicPlainTextSource$Outbound | SourceContent$Outbound | AnthropicUrlPdfSource$Outbound;
|
|
65
|
+
source: AnthropicBase64PdfSource$Outbound | AnthropicPlainTextSource$Outbound | SourceContent$Outbound | AnthropicUrlPdfSource$Outbound | AnthropicFileDocumentSource$Outbound;
|
|
65
66
|
title?: string | null | undefined;
|
|
66
67
|
type: "document";
|
|
67
68
|
};
|
|
@@ -6,6 +6,7 @@ import * as z from "zod/v4";
|
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import { AnthropicBase64PdfSource$outboundSchema, } from "./anthropicbase64pdfsource.js";
|
|
8
8
|
import { AnthropicCacheControlDirective$outboundSchema, } from "./anthropiccachecontroldirective.js";
|
|
9
|
+
import { AnthropicFileDocumentSource$outboundSchema, } from "./anthropicfiledocumentsource.js";
|
|
9
10
|
import { AnthropicImageBlockParam$outboundSchema, } from "./anthropicimageblockparam.js";
|
|
10
11
|
import { AnthropicPlainTextSource$outboundSchema, } from "./anthropicplaintextsource.js";
|
|
11
12
|
import { AnthropicTextBlockParam$outboundSchema, } from "./anthropictextblockparam.js";
|
|
@@ -56,6 +57,7 @@ export const AnthropicDocumentBlockParamSourceUnion$outboundSchema = z.union([
|
|
|
56
57
|
AnthropicPlainTextSource$outboundSchema,
|
|
57
58
|
z.lazy(() => SourceContent$outboundSchema),
|
|
58
59
|
AnthropicUrlPdfSource$outboundSchema,
|
|
60
|
+
AnthropicFileDocumentSource$outboundSchema,
|
|
59
61
|
]);
|
|
60
62
|
export function anthropicDocumentBlockParamSourceUnionToJSON(anthropicDocumentBlockParamSourceUnion) {
|
|
61
63
|
return JSON.stringify(AnthropicDocumentBlockParamSourceUnion$outboundSchema.parse(anthropicDocumentBlockParamSourceUnion));
|
|
@@ -70,6 +72,7 @@ export const AnthropicDocumentBlockParam$outboundSchema = z.object({
|
|
|
70
72
|
AnthropicPlainTextSource$outboundSchema,
|
|
71
73
|
z.lazy(() => SourceContent$outboundSchema),
|
|
72
74
|
AnthropicUrlPdfSource$outboundSchema,
|
|
75
|
+
AnthropicFileDocumentSource$outboundSchema,
|
|
73
76
|
]),
|
|
74
77
|
title: z.nullable(z.string()).optional(),
|
|
75
78
|
type: z.literal("document"),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type AnthropicFileDocumentSource = {
|
|
3
|
+
fileId: string;
|
|
4
|
+
type: "file";
|
|
5
|
+
};
|
|
6
|
+
/** @internal */
|
|
7
|
+
export type AnthropicFileDocumentSource$Outbound = {
|
|
8
|
+
file_id: string;
|
|
9
|
+
type: "file";
|
|
10
|
+
};
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare const AnthropicFileDocumentSource$outboundSchema: z.ZodType<AnthropicFileDocumentSource$Outbound, AnthropicFileDocumentSource>;
|
|
13
|
+
export declare function anthropicFileDocumentSourceToJSON(anthropicFileDocumentSource: AnthropicFileDocumentSource): string;
|
|
14
|
+
//# sourceMappingURL=anthropicfiledocumentsource.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 8ad816e4eb64
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const AnthropicFileDocumentSource$outboundSchema = z.object({
|
|
9
|
+
fileId: z.string(),
|
|
10
|
+
type: z.literal("file"),
|
|
11
|
+
}).transform((v) => {
|
|
12
|
+
return remap$(v, {
|
|
13
|
+
fileId: "file_id",
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
export function anthropicFileDocumentSourceToJSON(anthropicFileDocumentSource) {
|
|
17
|
+
return JSON.stringify(AnthropicFileDocumentSource$outboundSchema.parse(anthropicFileDocumentSource));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=anthropicfiledocumentsource.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
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 AnthropicIterationCacheCreation = {
|
|
5
|
+
ephemeral1hInputTokens?: number | undefined;
|
|
6
|
+
ephemeral5mInputTokens?: number | undefined;
|
|
7
|
+
};
|
|
8
|
+
/** @internal */
|
|
9
|
+
export declare const AnthropicIterationCacheCreation$inboundSchema: z.ZodType<AnthropicIterationCacheCreation, unknown>;
|
|
10
|
+
export declare function anthropicIterationCacheCreationFromJSON(jsonString: string): SafeParseResult<AnthropicIterationCacheCreation, SDKValidationError>;
|
|
11
|
+
//# sourceMappingURL=anthropiciterationcachecreation.d.ts.map
|