@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
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
-
# OpenRouter SDK
|
|
3
|
+
# OpenRouter SDK
|
|
4
4
|
|
|
5
|
-
The [OpenRouter SDK](https://openrouter.ai/docs/sdks/typescript) is a TypeScript toolkit designed to help you build AI-powered features and solutions in any JS or TS based runtime. Giving you easy access to
|
|
5
|
+
The [OpenRouter SDK](https://openrouter.ai/docs/sdks/typescript) is a TypeScript toolkit designed to help you build AI-powered features and solutions in any JS or TS based runtime. Giving you easy access to 400+ models across providers in an easy and type-safe way.
|
|
6
6
|
|
|
7
7
|
To learn more about how to use the OpenRouter SDK, check out our [API Reference](https://openrouter.ai/docs/sdks/typescript/reference) and [Documentation](https://openrouter.ai/docs/sdks/typescript).
|
|
8
8
|
|
|
@@ -228,10 +228,4 @@ To run the test suite, you'll need to set up your environment with an OpenRouter
|
|
|
228
228
|
|
|
229
229
|
```bash
|
|
230
230
|
npx vitest
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
## Maturity
|
|
234
|
-
|
|
235
|
-
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
|
|
236
|
-
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
|
|
237
|
-
looking for the latest version.
|
|
231
|
+
```
|
|
@@ -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 Benchmarks
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Unified benchmark endpoint that aggregates scores from multiple benchmark sources (Artificial Analysis, Design Arena). Filter by source to reproduce the exact shapes from the legacy per-source endpoints, or use task_type to find models suited for specific workloads. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
|
|
17
|
+
*/
|
|
18
|
+
export declare function benchmarksGetBenchmarks(client: OpenRouterCore, request?: operations.GetBenchmarksRequest | undefined, options?: RequestOptions): APIPromise<Result<models.UnifiedBenchmarksResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=benchmarksGetBenchmarks.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
* @generated-id:
|
|
3
|
+
* @generated-id: 1b5fbe93cea7
|
|
4
4
|
*/
|
|
5
5
|
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
6
6
|
import { matchStatusCode } from "../lib/http.js";
|
|
@@ -14,27 +14,28 @@ import * as models from "../models/index.js";
|
|
|
14
14
|
import * as operations from "../models/operations/index.js";
|
|
15
15
|
import { APIPromise } from "../types/async.js";
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* List Benchmarks
|
|
18
18
|
*
|
|
19
19
|
* @remarks
|
|
20
|
-
*
|
|
20
|
+
* Unified benchmark endpoint that aggregates scores from multiple benchmark sources (Artificial Analysis, Design Arena). Filter by source to reproduce the exact shapes from the legacy per-source endpoints, or use task_type to find models suited for specific workloads. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
|
|
21
21
|
*/
|
|
22
|
-
export function
|
|
22
|
+
export function benchmarksGetBenchmarks(client, request, options) {
|
|
23
23
|
return new APIPromise($do(client, request, options));
|
|
24
24
|
}
|
|
25
25
|
async function $do(client, request, options) {
|
|
26
|
-
const parsed = safeParse(request, (value) => operations.
|
|
27
|
-
.parse(value), "Input validation failed");
|
|
26
|
+
const parsed = safeParse(request, (value) => operations.GetBenchmarksRequest$outboundSchema.optional().parse(value), "Input validation failed");
|
|
28
27
|
if (!parsed.ok) {
|
|
29
28
|
return [parsed, { status: "invalid" }];
|
|
30
29
|
}
|
|
31
30
|
const payload = parsed.value;
|
|
32
31
|
const body = null;
|
|
33
|
-
const path = pathToFunc("/
|
|
32
|
+
const path = pathToFunc("/benchmarks")();
|
|
34
33
|
const query = encodeFormQuery({
|
|
35
34
|
"arena": payload?.arena,
|
|
36
35
|
"category": payload?.category,
|
|
37
36
|
"max_results": payload?.max_results,
|
|
37
|
+
"source": payload?.source,
|
|
38
|
+
"task_type": payload?.task_type,
|
|
38
39
|
});
|
|
39
40
|
const headers = new Headers(compactMap({
|
|
40
41
|
Accept: "application/json",
|
|
@@ -48,7 +49,7 @@ async function $do(client, request, options) {
|
|
|
48
49
|
const context = {
|
|
49
50
|
options: client._options,
|
|
50
51
|
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
51
|
-
operationID: "
|
|
52
|
+
operationID: "getBenchmarks",
|
|
52
53
|
oAuth2Scopes: null,
|
|
53
54
|
resolvedSecurity: requestSecurity,
|
|
54
55
|
securitySource: client._options.apiKey,
|
|
@@ -95,10 +96,10 @@ async function $do(client, request, options) {
|
|
|
95
96
|
const responseFields = {
|
|
96
97
|
HttpMeta: { Response: response, Request: req },
|
|
97
98
|
};
|
|
98
|
-
const [result] = await M.match(M.json(200, models.
|
|
99
|
+
const [result] = await M.match(M.json(200, models.UnifiedBenchmarksResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
99
100
|
if (!result.ok) {
|
|
100
101
|
return [result, { status: "complete", request: req, response }];
|
|
101
102
|
}
|
|
102
103
|
return [result, { status: "complete", request: req, response }];
|
|
103
104
|
}
|
|
104
|
-
//# sourceMappingURL=
|
|
105
|
+
//# sourceMappingURL=benchmarksGetBenchmarks.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
* Task classification market share
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Returns the market-share breakdown of OpenRouter traffic by task classification
|
|
17
|
+
* (e.g. code generation, web search, summarization) over a trailing time window.
|
|
18
|
+
*
|
|
19
|
+
* Each classification reports its share of classified sampled requests (`usage_share`)
|
|
20
|
+
* and classified sampled token volume (`token_share`) as fractions between 0 and 1.
|
|
21
|
+
* The unclassified `other` bucket is excluded. Absolute volumes are not exposed
|
|
22
|
+
* because the underlying data is sampled.
|
|
23
|
+
*
|
|
24
|
+
* Each classification also includes a `models` array listing the top models by
|
|
25
|
+
* request volume within that classification, with their within-tag usage and token shares.
|
|
26
|
+
*
|
|
27
|
+
* Classifications are grouped into macro-categories (Code, Data, Agent, General)
|
|
28
|
+
* with aggregate shares provided for each.
|
|
29
|
+
*
|
|
30
|
+
* Authenticate with any valid OpenRouter API key (same key used for inference).
|
|
31
|
+
* Rate-limited to 30 requests/minute per key and 500 requests/day per account.
|
|
32
|
+
*
|
|
33
|
+
* When republishing or quoting this data, cite as:
|
|
34
|
+
* "Source: OpenRouter (openrouter.ai/rankings), as of {as_of}."
|
|
35
|
+
*/
|
|
36
|
+
export declare function classificationsGetTaskClassifications(client: OpenRouterCore, request?: operations.GetTaskClassificationsRequest | undefined, options?: RequestOptions): APIPromise<Result<models.TaskClassificationResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
37
|
+
//# sourceMappingURL=classificationsGetTaskClassifications.d.ts.map
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 6f25b0c4e7a9
|
|
4
|
+
*/
|
|
5
|
+
import { encodeFormQuery, 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
|
+
* Task classification market share
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Returns the market-share breakdown of OpenRouter traffic by task classification
|
|
21
|
+
* (e.g. code generation, web search, summarization) over a trailing time window.
|
|
22
|
+
*
|
|
23
|
+
* Each classification reports its share of classified sampled requests (`usage_share`)
|
|
24
|
+
* and classified sampled token volume (`token_share`) as fractions between 0 and 1.
|
|
25
|
+
* The unclassified `other` bucket is excluded. Absolute volumes are not exposed
|
|
26
|
+
* because the underlying data is sampled.
|
|
27
|
+
*
|
|
28
|
+
* Each classification also includes a `models` array listing the top models by
|
|
29
|
+
* request volume within that classification, with their within-tag usage and token shares.
|
|
30
|
+
*
|
|
31
|
+
* Classifications are grouped into macro-categories (Code, Data, Agent, General)
|
|
32
|
+
* with aggregate shares provided for each.
|
|
33
|
+
*
|
|
34
|
+
* Authenticate with any valid OpenRouter API key (same key used for inference).
|
|
35
|
+
* Rate-limited to 30 requests/minute per key and 500 requests/day per account.
|
|
36
|
+
*
|
|
37
|
+
* When republishing or quoting this data, cite as:
|
|
38
|
+
* "Source: OpenRouter (openrouter.ai/rankings), as of {as_of}."
|
|
39
|
+
*/
|
|
40
|
+
export function classificationsGetTaskClassifications(client, request, options) {
|
|
41
|
+
return new APIPromise($do(client, request, options));
|
|
42
|
+
}
|
|
43
|
+
async function $do(client, request, options) {
|
|
44
|
+
const parsed = safeParse(request, (value) => operations.GetTaskClassificationsRequest$outboundSchema.optional().parse(value), "Input validation failed");
|
|
45
|
+
if (!parsed.ok) {
|
|
46
|
+
return [parsed, { status: "invalid" }];
|
|
47
|
+
}
|
|
48
|
+
const payload = parsed.value;
|
|
49
|
+
const body = null;
|
|
50
|
+
const path = pathToFunc("/classifications/task")();
|
|
51
|
+
const query = encodeFormQuery({
|
|
52
|
+
"window": payload?.window,
|
|
53
|
+
});
|
|
54
|
+
const headers = new Headers(compactMap({
|
|
55
|
+
Accept: "application/json",
|
|
56
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload?.["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
57
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload?.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
58
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload?.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
59
|
+
}));
|
|
60
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
61
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
62
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
63
|
+
const context = {
|
|
64
|
+
options: client._options,
|
|
65
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
66
|
+
operationID: "getTaskClassifications",
|
|
67
|
+
oAuth2Scopes: null,
|
|
68
|
+
resolvedSecurity: requestSecurity,
|
|
69
|
+
securitySource: client._options.apiKey,
|
|
70
|
+
retryConfig: options?.retries
|
|
71
|
+
|| client._options.retryConfig
|
|
72
|
+
|| {
|
|
73
|
+
strategy: "backoff",
|
|
74
|
+
backoff: {
|
|
75
|
+
initialInterval: 500,
|
|
76
|
+
maxInterval: 60000,
|
|
77
|
+
exponent: 1.5,
|
|
78
|
+
maxElapsedTime: 3600000,
|
|
79
|
+
},
|
|
80
|
+
retryConnectionErrors: true,
|
|
81
|
+
}
|
|
82
|
+
|| { strategy: "none" },
|
|
83
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
84
|
+
};
|
|
85
|
+
const requestRes = client._createRequest(context, {
|
|
86
|
+
security: requestSecurity,
|
|
87
|
+
method: "GET",
|
|
88
|
+
baseURL: options?.serverURL,
|
|
89
|
+
path: path,
|
|
90
|
+
headers: headers,
|
|
91
|
+
query: query,
|
|
92
|
+
body: body,
|
|
93
|
+
userAgent: client._options.userAgent,
|
|
94
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
95
|
+
}, options);
|
|
96
|
+
if (!requestRes.ok) {
|
|
97
|
+
return [requestRes, { status: "invalid" }];
|
|
98
|
+
}
|
|
99
|
+
const req = requestRes.value;
|
|
100
|
+
const doResult = await client._do(req, {
|
|
101
|
+
context,
|
|
102
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
103
|
+
retryConfig: context.retryConfig,
|
|
104
|
+
retryCodes: context.retryCodes,
|
|
105
|
+
});
|
|
106
|
+
if (!doResult.ok) {
|
|
107
|
+
return [doResult, { status: "request-error", request: req }];
|
|
108
|
+
}
|
|
109
|
+
const response = doResult.value;
|
|
110
|
+
const responseFields = {
|
|
111
|
+
HttpMeta: { Response: response, Request: req },
|
|
112
|
+
};
|
|
113
|
+
const [result] = await M.match(M.json(200, models.TaskClassificationResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
114
|
+
if (!result.ok) {
|
|
115
|
+
return [result, { status: "complete", request: req, response }];
|
|
116
|
+
}
|
|
117
|
+
return [result, { status: "complete", request: req, response }];
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=classificationsGetTaskClassifications.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { EventStream } from "../lib/event-streams.js";
|
|
3
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
4
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
5
|
+
import * as errors from "../models/errors/index.js";
|
|
6
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
7
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
8
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
9
|
+
import * as models from "../models/index.js";
|
|
10
|
+
import * as operations from "../models/operations/index.js";
|
|
11
|
+
import { APIPromise } from "../types/async.js";
|
|
12
|
+
import { Result } from "../types/fp.js";
|
|
13
|
+
/**
|
|
14
|
+
* Generate an image
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Generates an image from a text prompt via the image generation router
|
|
18
|
+
*/
|
|
19
|
+
export declare function imagesGenerate(client: OpenRouterCore, request: operations.CreateImagesRequest & {
|
|
20
|
+
imageGenerationRequest: {
|
|
21
|
+
stream?: false;
|
|
22
|
+
};
|
|
23
|
+
}, options?: RequestOptions): APIPromise<Result<models.ImageGenerationResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
24
|
+
export declare function imagesGenerate(client: OpenRouterCore, request: operations.CreateImagesRequest & {
|
|
25
|
+
imageGenerationRequest: {
|
|
26
|
+
stream: true;
|
|
27
|
+
};
|
|
28
|
+
}, options?: RequestOptions): APIPromise<Result<EventStream<models.ImageStreamingResponseData>, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
29
|
+
export declare function imagesGenerate(client: OpenRouterCore, request: operations.CreateImagesRequest, options?: RequestOptions): APIPromise<Result<operations.CreateImagesResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
30
|
+
//# sourceMappingURL=imagesGenerate.d.ts.map
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 5e770eb62f14
|
|
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 operations from "../models/operations/index.js";
|
|
14
|
+
import { APIPromise } from "../types/async.js";
|
|
15
|
+
export function imagesGenerate(client, request, options) {
|
|
16
|
+
return new APIPromise($do(client, request, options));
|
|
17
|
+
}
|
|
18
|
+
async function $do(client, request, options) {
|
|
19
|
+
const parsed = safeParse(request, (value) => operations.CreateImagesRequest$outboundSchema.parse(value), "Input validation failed");
|
|
20
|
+
if (!parsed.ok) {
|
|
21
|
+
return [parsed, { status: "invalid" }];
|
|
22
|
+
}
|
|
23
|
+
const payload = parsed.value;
|
|
24
|
+
const body = encodeJSON("body", payload.ImageGenerationRequest, {
|
|
25
|
+
explode: true,
|
|
26
|
+
});
|
|
27
|
+
const path = pathToFunc("/images")();
|
|
28
|
+
const headers = new Headers(compactMap({
|
|
29
|
+
"Content-Type": "application/json",
|
|
30
|
+
Accept: request?.imageGenerationRequest?.stream
|
|
31
|
+
? "text/event-stream"
|
|
32
|
+
: "application/json",
|
|
33
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
34
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
35
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
36
|
+
}));
|
|
37
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
38
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
39
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
40
|
+
const context = {
|
|
41
|
+
options: client._options,
|
|
42
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
43
|
+
operationID: "createImages",
|
|
44
|
+
oAuth2Scopes: null,
|
|
45
|
+
resolvedSecurity: requestSecurity,
|
|
46
|
+
securitySource: client._options.apiKey,
|
|
47
|
+
retryConfig: options?.retries
|
|
48
|
+
|| client._options.retryConfig
|
|
49
|
+
|| {
|
|
50
|
+
strategy: "backoff",
|
|
51
|
+
backoff: {
|
|
52
|
+
initialInterval: 500,
|
|
53
|
+
maxInterval: 60000,
|
|
54
|
+
exponent: 1.5,
|
|
55
|
+
maxElapsedTime: 3600000,
|
|
56
|
+
},
|
|
57
|
+
retryConnectionErrors: true,
|
|
58
|
+
}
|
|
59
|
+
|| { strategy: "none" },
|
|
60
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
61
|
+
};
|
|
62
|
+
const requestRes = client._createRequest(context, {
|
|
63
|
+
security: requestSecurity,
|
|
64
|
+
method: "POST",
|
|
65
|
+
baseURL: options?.serverURL,
|
|
66
|
+
path: path,
|
|
67
|
+
headers: headers,
|
|
68
|
+
body: body,
|
|
69
|
+
userAgent: client._options.userAgent,
|
|
70
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
71
|
+
}, options);
|
|
72
|
+
if (!requestRes.ok) {
|
|
73
|
+
return [requestRes, { status: "invalid" }];
|
|
74
|
+
}
|
|
75
|
+
const req = requestRes.value;
|
|
76
|
+
const doResult = await client._do(req, {
|
|
77
|
+
context,
|
|
78
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
79
|
+
retryConfig: context.retryConfig,
|
|
80
|
+
retryCodes: context.retryCodes,
|
|
81
|
+
});
|
|
82
|
+
if (!doResult.ok) {
|
|
83
|
+
return [doResult, { status: "request-error", request: req }];
|
|
84
|
+
}
|
|
85
|
+
const response = doResult.value;
|
|
86
|
+
const responseFields = {
|
|
87
|
+
HttpMeta: { Response: response, Request: req },
|
|
88
|
+
};
|
|
89
|
+
const [result] = await M.match(M.json(200, operations.CreateImagesResponse$inboundSchema), M.sse(200, operations.CreateImagesResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors.PaymentRequiredResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors.ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
90
|
+
if (!result.ok) {
|
|
91
|
+
return [result, { status: "complete", request: req, response }];
|
|
92
|
+
}
|
|
93
|
+
return [result, { status: "complete", request: req, response }];
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=imagesGenerate.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 endpoints for an image model
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Returns the full per-endpoint records for an image model: each endpoint's definitive supported parameters, pricing, and passthrough allowlist.
|
|
17
|
+
*/
|
|
18
|
+
export declare function imagesListModelEndpoints(client: OpenRouterCore, request: operations.ListImageModelEndpointsRequest, options?: RequestOptions): APIPromise<Result<models.ImageModelEndpointsResponse, errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=imagesListModelEndpoints.d.ts.map
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 3ea7b12b2160
|
|
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 endpoints for an image model
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Returns the full per-endpoint records for an image model: each endpoint's definitive supported parameters, pricing, and passthrough allowlist.
|
|
21
|
+
*/
|
|
22
|
+
export function imagesListModelEndpoints(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.ListImageModelEndpointsRequest$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
|
+
author: encodeSimple("author", payload.author, {
|
|
34
|
+
explode: false,
|
|
35
|
+
charEncoding: "percent",
|
|
36
|
+
}),
|
|
37
|
+
slug: encodeSimple("slug", payload.slug, {
|
|
38
|
+
explode: false,
|
|
39
|
+
charEncoding: "percent",
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
const path = pathToFunc("/images/models/{author}/{slug}/endpoints")(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: "listImageModelEndpoints",
|
|
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: "GET",
|
|
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.ImageModelEndpointsResponse$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=imagesListModelEndpoints.js.map
|
|
@@ -10,10 +10,10 @@ import * as operations from "../models/operations/index.js";
|
|
|
10
10
|
import { APIPromise } from "../types/async.js";
|
|
11
11
|
import { Result } from "../types/fp.js";
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* List image generation models
|
|
14
14
|
*
|
|
15
15
|
* @remarks
|
|
16
|
-
*
|
|
16
|
+
* Lists every image generation model with its top-level supported-parameter superset and a URL to its full per-endpoint records.
|
|
17
17
|
*/
|
|
18
|
-
export declare function
|
|
19
|
-
//# sourceMappingURL=
|
|
18
|
+
export declare function imagesListModels(client: OpenRouterCore, request?: operations.ListImageModelsRequest | undefined, options?: RequestOptions): APIPromise<Result<models.ImageModelsListResponse, errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=imagesListModels.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
* @generated-id:
|
|
3
|
+
* @generated-id: fa32f43b49ee
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
6
6
|
import { matchStatusCode } from "../lib/http.js";
|
|
7
7
|
import * as M from "../lib/matchers.js";
|
|
8
8
|
import { compactMap } from "../lib/primitives.js";
|
|
@@ -14,26 +14,22 @@ import * as models from "../models/index.js";
|
|
|
14
14
|
import * as operations from "../models/operations/index.js";
|
|
15
15
|
import { APIPromise } from "../types/async.js";
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* List image generation models
|
|
18
18
|
*
|
|
19
19
|
* @remarks
|
|
20
|
-
*
|
|
20
|
+
* Lists every image generation model with its top-level supported-parameter superset and a URL to its full per-endpoint records.
|
|
21
21
|
*/
|
|
22
|
-
export function
|
|
22
|
+
export function imagesListModels(client, request, options) {
|
|
23
23
|
return new APIPromise($do(client, request, options));
|
|
24
24
|
}
|
|
25
25
|
async function $do(client, request, options) {
|
|
26
|
-
const parsed = safeParse(request, (value) => operations.
|
|
27
|
-
.optional().parse(value), "Input validation failed");
|
|
26
|
+
const parsed = safeParse(request, (value) => operations.ListImageModelsRequest$outboundSchema.optional().parse(value), "Input validation failed");
|
|
28
27
|
if (!parsed.ok) {
|
|
29
28
|
return [parsed, { status: "invalid" }];
|
|
30
29
|
}
|
|
31
30
|
const payload = parsed.value;
|
|
32
31
|
const body = null;
|
|
33
|
-
const path = pathToFunc("/
|
|
34
|
-
const query = encodeFormQuery({
|
|
35
|
-
"max_results": payload?.max_results,
|
|
36
|
-
});
|
|
32
|
+
const path = pathToFunc("/images/models")();
|
|
37
33
|
const headers = new Headers(compactMap({
|
|
38
34
|
Accept: "application/json",
|
|
39
35
|
"HTTP-Referer": encodeSimple("HTTP-Referer", payload?.["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
@@ -46,7 +42,7 @@ async function $do(client, request, options) {
|
|
|
46
42
|
const context = {
|
|
47
43
|
options: client._options,
|
|
48
44
|
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
49
|
-
operationID: "
|
|
45
|
+
operationID: "listImageModels",
|
|
50
46
|
oAuth2Scopes: null,
|
|
51
47
|
resolvedSecurity: requestSecurity,
|
|
52
48
|
securitySource: client._options.apiKey,
|
|
@@ -71,7 +67,6 @@ async function $do(client, request, options) {
|
|
|
71
67
|
baseURL: options?.serverURL,
|
|
72
68
|
path: path,
|
|
73
69
|
headers: headers,
|
|
74
|
-
query: query,
|
|
75
70
|
body: body,
|
|
76
71
|
userAgent: client._options.userAgent,
|
|
77
72
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
@@ -93,10 +88,10 @@ async function $do(client, request, options) {
|
|
|
93
88
|
const responseFields = {
|
|
94
89
|
HttpMeta: { Response: response, Request: req },
|
|
95
90
|
};
|
|
96
|
-
const [result] = await M.match(M.json(200, models.
|
|
91
|
+
const [result] = await M.match(M.json(200, models.ImageModelsListResponse$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
97
92
|
if (!result.ok) {
|
|
98
93
|
return [result, { status: "complete", request: req, response }];
|
|
99
94
|
}
|
|
100
95
|
return [result, { status: "complete", request: req, response }];
|
|
101
96
|
}
|
|
102
|
-
//# sourceMappingURL=
|
|
97
|
+
//# sourceMappingURL=imagesListModels.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
|
+
* Delete a workspace budget
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Remove the budget for a given interval. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
|
+
*/
|
|
18
|
+
export declare function workspacesDeleteBudget(client: OpenRouterCore, request: operations.DeleteWorkspaceBudgetRequest, options?: RequestOptions): APIPromise<Result<models.DeleteWorkspaceBudgetResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=workspacesDeleteBudget.d.ts.map
|