@openrouter/sdk 0.5.1 → 0.9.11
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/FUNCTIONS.md +5 -1
- package/esm/funcs/analyticsGetUserActivity.d.ts +1 -1
- package/esm/funcs/analyticsGetUserActivity.js +4 -2
- package/esm/funcs/apiKeysCreate.d.ts +1 -1
- package/esm/funcs/apiKeysCreate.js +5 -3
- package/esm/funcs/apiKeysDelete.d.ts +1 -1
- package/esm/funcs/apiKeysDelete.js +3 -1
- package/esm/funcs/apiKeysGet.d.ts +1 -1
- package/esm/funcs/apiKeysGet.js +3 -1
- package/esm/funcs/apiKeysGetCurrentKeyMetadata.d.ts +1 -1
- package/esm/funcs/apiKeysGetCurrentKeyMetadata.js +14 -3
- package/esm/funcs/apiKeysList.d.ts +1 -1
- package/esm/funcs/apiKeysList.js +4 -2
- package/esm/funcs/apiKeysUpdate.d.ts +1 -1
- package/esm/funcs/apiKeysUpdate.js +3 -1
- package/esm/funcs/betaResponsesSend.d.ts +9 -5
- package/esm/funcs/betaResponsesSend.js +10 -5
- package/esm/funcs/chatSend.d.ts +11 -7
- package/esm/funcs/chatSend.js +28 -7
- package/esm/funcs/creditsCreateCoinbaseCharge.d.ts +1 -2
- package/esm/funcs/creditsCreateCoinbaseCharge.js +7 -4
- package/esm/funcs/creditsGetCredits.d.ts +2 -2
- package/esm/funcs/creditsGetCredits.js +15 -4
- package/esm/funcs/embeddingsGenerate.js +4 -2
- package/esm/funcs/embeddingsListModels.d.ts +2 -1
- package/esm/funcs/embeddingsListModels.js +15 -3
- package/esm/funcs/endpointsList.js +2 -0
- package/esm/funcs/endpointsListZdrEndpoints.d.ts +1 -1
- package/esm/funcs/endpointsListZdrEndpoints.js +14 -3
- package/esm/funcs/generationsGetGeneration.js +3 -1
- package/esm/funcs/guardrailsBulkAssignKeys.d.ts +1 -1
- package/esm/funcs/guardrailsBulkAssignKeys.js +3 -1
- package/esm/funcs/guardrailsBulkAssignMembers.d.ts +1 -1
- package/esm/funcs/guardrailsBulkAssignMembers.js +3 -1
- package/esm/funcs/guardrailsBulkUnassignKeys.d.ts +1 -1
- package/esm/funcs/guardrailsBulkUnassignKeys.js +3 -1
- package/esm/funcs/guardrailsBulkUnassignMembers.d.ts +1 -1
- package/esm/funcs/guardrailsBulkUnassignMembers.js +3 -1
- package/esm/funcs/guardrailsCreate.d.ts +1 -1
- package/esm/funcs/guardrailsCreate.js +5 -3
- package/esm/funcs/guardrailsDelete.d.ts +1 -1
- package/esm/funcs/guardrailsDelete.js +3 -1
- package/esm/funcs/guardrailsGet.d.ts +1 -1
- package/esm/funcs/guardrailsGet.js +3 -1
- package/esm/funcs/guardrailsList.d.ts +1 -1
- package/esm/funcs/guardrailsList.js +4 -2
- package/esm/funcs/guardrailsListGuardrailKeyAssignments.d.ts +1 -1
- package/esm/funcs/guardrailsListGuardrailKeyAssignments.js +3 -1
- package/esm/funcs/guardrailsListGuardrailMemberAssignments.d.ts +1 -1
- package/esm/funcs/guardrailsListGuardrailMemberAssignments.js +3 -1
- package/esm/funcs/guardrailsListKeyAssignments.d.ts +1 -1
- package/esm/funcs/guardrailsListKeyAssignments.js +4 -2
- package/esm/funcs/guardrailsListMemberAssignments.d.ts +1 -1
- package/esm/funcs/guardrailsListMemberAssignments.js +4 -2
- package/esm/funcs/guardrailsUpdate.d.ts +1 -1
- package/esm/funcs/guardrailsUpdate.js +3 -1
- package/esm/funcs/modelsCount.d.ts +2 -1
- package/esm/funcs/modelsCount.js +15 -3
- package/esm/funcs/modelsList.js +3 -1
- package/esm/funcs/modelsListForUser.d.ts +1 -1
- package/esm/funcs/modelsListForUser.js +15 -3
- package/esm/funcs/oAuthCreateAuthCode.js +4 -2
- package/esm/funcs/oAuthExchangeAuthCodeForAPIKey.js +4 -2
- package/esm/funcs/providersList.d.ts +1 -1
- package/esm/funcs/providersList.js +14 -3
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/lib/model-result.d.ts +3 -5
- package/esm/lib/model-result.js +98 -46
- package/esm/models/assistantmessage.d.ts +47 -36
- package/esm/models/assistantmessage.js +35 -47
- package/esm/models/assistantmessageimages.d.ts +33 -0
- package/esm/models/assistantmessageimages.js +44 -0
- package/esm/models/chatgenerationparams.d.ts +318 -182
- package/esm/models/chatgenerationparams.js +157 -143
- package/esm/models/chatgenerationtokenusage.d.ts +48 -0
- package/esm/models/chatmessagecontentitem.d.ts +15 -10
- package/esm/models/chatmessagecontentitem.js +25 -4
- package/esm/models/chatmessagecontentitemaudio.d.ts +20 -2
- package/esm/models/chatmessagecontentitemaudio.js +9 -2
- package/esm/models/chatmessagecontentitemcachecontrol.d.ts +14 -3
- package/esm/models/chatmessagecontentitemcachecontrol.js +9 -2
- package/esm/models/chatmessagecontentitemimage.d.ts +26 -3
- package/esm/models/chatmessagecontentitemimage.js +12 -2
- package/esm/models/chatmessagecontentitemtext.d.ts +17 -2
- package/esm/models/chatmessagecontentitemtext.js +9 -2
- package/esm/models/chatmessagecontentitemvideo.d.ts +12 -55
- package/esm/models/chatmessagecontentitemvideo.js +5 -72
- package/esm/models/chatmessagecontentitemvideolegacy.d.ts +28 -0
- package/esm/models/chatmessagecontentitemvideolegacy.js +33 -0
- package/esm/models/chatmessagetokenlogprob.d.ts +15 -0
- package/esm/models/chatmessagetokenlogprobs.d.ts +9 -0
- package/esm/models/chatmessagetoolcall.d.ts +23 -2
- package/esm/models/chatmessagetoolcall.js +9 -2
- package/esm/models/chatresponse.d.ts +29 -1
- package/esm/models/chatresponse.js +6 -1
- package/esm/models/chatresponsechoice.d.ts +13 -2
- package/esm/models/chatresponsechoice.js +1 -2
- package/esm/models/chatstreamingchoice.d.ts +13 -2
- package/esm/models/chatstreamingchoice.js +1 -2
- package/esm/models/chatstreamingmessagechunk.d.ts +29 -2
- package/esm/models/chatstreamingmessagechunk.js +5 -2
- package/esm/models/chatstreamingmessagetoolcall.d.ts +38 -1
- package/esm/models/chatstreamingmessagetoolcall.js +9 -1
- package/esm/models/chatstreamingresponsechunk.d.ts +45 -11
- package/esm/models/chatstreamingresponsechunk.js +11 -25
- package/esm/models/chatstreamoptions.d.ts +8 -0
- package/esm/models/debugoptions.d.ts +18 -0
- package/esm/models/debugoptions.js +18 -0
- package/esm/models/developermessage.d.ts +35 -0
- package/esm/models/developermessage.js +24 -0
- package/esm/models/errors/index.d.ts +0 -1
- package/esm/models/errors/index.js +0 -1
- package/esm/models/index.d.ts +13 -5
- package/esm/models/index.js +13 -5
- package/esm/models/jsonschemaconfig.d.ts +17 -2
- package/esm/models/jsonschemaconfig.js +1 -1
- package/esm/models/message.d.ts +10 -23
- package/esm/models/message.js +3 -20
- package/esm/models/modelscountresponse.d.ts +4 -4
- package/esm/models/modelscountresponse.js +4 -4
- package/esm/models/namedtoolchoice.d.ts +15 -2
- package/esm/models/namedtoolchoice.js +6 -1
- package/esm/models/openairesponsesreasoningconfig.d.ts +1 -1
- package/esm/models/openairesponsesreasoningconfig.js +1 -1
- package/esm/models/openresponsesnonstreamingresponse.d.ts +4 -4
- package/esm/models/openresponsesnonstreamingresponse.js +3 -3
- package/esm/models/openresponsesreasoning.d.ts +2 -2
- package/esm/models/openresponsesreasoning.js +1 -1
- package/esm/models/openresponsesreasoningconfig.d.ts +2 -2
- package/esm/models/openresponsesreasoningconfig.js +1 -1
- package/esm/models/openresponsesrequest.d.ts +31 -13
- package/esm/models/openresponsesrequest.js +25 -0
- package/esm/models/operations/bulkassignkeystoguardrail.d.ts +30 -0
- package/esm/models/operations/bulkassignkeystoguardrail.js +4 -0
- package/esm/models/operations/bulkassignmemberstoguardrail.d.ts +30 -0
- package/esm/models/operations/bulkassignmemberstoguardrail.js +4 -0
- package/esm/models/operations/bulkunassignkeysfromguardrail.d.ts +30 -0
- package/esm/models/operations/bulkunassignkeysfromguardrail.js +4 -0
- package/esm/models/operations/bulkunassignmembersfromguardrail.d.ts +30 -0
- package/esm/models/operations/bulkunassignmembersfromguardrail.js +4 -0
- package/esm/models/operations/createauthkeyscode.d.ts +66 -2
- package/esm/models/operations/createauthkeyscode.js +30 -1
- package/esm/models/operations/createcoinbasecharge.d.ts +41 -0
- package/esm/models/operations/createcoinbasecharge.js +16 -0
- package/esm/models/operations/createembeddings.d.ts +42 -2
- package/esm/models/operations/createembeddings.js +16 -1
- package/esm/models/operations/createguardrail.d.ts +42 -2
- package/esm/models/operations/createguardrail.js +16 -1
- package/esm/models/operations/createkeys.d.ts +42 -2
- package/esm/models/operations/createkeys.js +16 -1
- package/esm/models/operations/createresponses.d.ts +40 -0
- package/esm/models/operations/createresponses.js +16 -0
- package/esm/models/operations/deleteguardrail.d.ts +30 -0
- package/esm/models/operations/deleteguardrail.js +8 -0
- package/esm/models/operations/deletekeys.d.ts +30 -0
- package/esm/models/operations/deletekeys.js +8 -0
- package/esm/models/operations/exchangeauthcodeforapikey.d.ts +42 -2
- package/esm/models/operations/exchangeauthcodeforapikey.js +16 -1
- package/esm/models/operations/getcredits.d.ts +38 -0
- package/esm/models/operations/getcredits.js +13 -0
- package/esm/models/operations/getcurrentkey.d.ts +45 -1
- package/esm/models/operations/getcurrentkey.js +15 -0
- package/esm/models/operations/getgeneration.d.ts +153 -0
- package/esm/models/operations/getgeneration.js +135 -0
- package/esm/models/operations/getguardrail.d.ts +30 -0
- package/esm/models/operations/getguardrail.js +7 -0
- package/esm/models/operations/getkey.d.ts +30 -0
- package/esm/models/operations/getkey.js +7 -0
- package/esm/models/operations/getmodels.d.ts +30 -0
- package/esm/models/operations/getmodels.js +4 -0
- package/esm/models/operations/getuseractivity.d.ts +30 -0
- package/esm/models/operations/getuseractivity.js +8 -0
- package/esm/models/operations/index.d.ts +2 -0
- package/esm/models/operations/index.js +2 -0
- package/esm/models/operations/list.d.ts +30 -0
- package/esm/models/operations/list.js +4 -0
- package/esm/models/operations/listembeddingsmodels.d.ts +40 -0
- package/esm/models/operations/listembeddingsmodels.js +20 -0
- package/esm/models/operations/listendpoints.d.ts +30 -0
- package/esm/models/operations/listendpoints.js +8 -0
- package/esm/models/operations/listendpointszdr.d.ts +38 -0
- package/esm/models/operations/listendpointszdr.js +14 -0
- package/esm/models/operations/listguardrailkeyassignments.d.ts +30 -0
- package/esm/models/operations/listguardrailkeyassignments.js +7 -0
- package/esm/models/operations/listguardrailmemberassignments.d.ts +30 -0
- package/esm/models/operations/listguardrailmemberassignments.js +7 -0
- package/esm/models/operations/listguardrails.d.ts +30 -0
- package/esm/models/operations/listguardrails.js +7 -0
- package/esm/models/operations/listkeyassignments.d.ts +30 -0
- package/esm/models/operations/listkeyassignments.js +7 -0
- package/esm/models/operations/listmemberassignments.d.ts +30 -0
- package/esm/models/operations/listmemberassignments.js +7 -0
- package/esm/models/operations/listmodelscount.d.ts +40 -0
- package/esm/models/operations/listmodelscount.js +20 -0
- package/esm/models/operations/listmodelsuser.d.ts +38 -0
- package/esm/models/operations/listmodelsuser.js +14 -0
- package/esm/models/operations/listproviders.d.ts +38 -0
- package/esm/models/operations/listproviders.js +13 -0
- package/esm/models/operations/sendchatcompletionrequest.d.ts +53 -1
- package/esm/models/operations/sendchatcompletionrequest.js +36 -2
- package/esm/models/operations/updateguardrail.d.ts +30 -0
- package/esm/models/operations/updateguardrail.js +4 -0
- package/esm/models/operations/updatekeys.d.ts +30 -0
- package/esm/models/operations/updatekeys.js +4 -0
- package/esm/models/providername.d.ts +4 -0
- package/esm/models/providername.js +4 -0
- package/esm/models/providerpreferences.d.ts +46 -27
- package/esm/models/providerpreferences.js +29 -15
- package/esm/models/providersort.d.ts +6 -0
- package/esm/models/providersort.js +3 -0
- package/esm/models/providersortconfig.d.ts +30 -2
- package/esm/models/providersortconfig.js +15 -2
- package/esm/models/publicendpoint.d.ts +0 -39
- package/esm/models/publicpricing.d.ts +0 -39
- package/esm/models/reasoningdetailencrypted.d.ts +42 -0
- package/esm/models/reasoningdetailencrypted.js +42 -0
- package/esm/models/reasoningdetailsummary.d.ts +42 -0
- package/esm/models/reasoningdetailsummary.js +42 -0
- package/esm/models/reasoningdetailtext.d.ts +44 -0
- package/esm/models/reasoningdetailtext.js +44 -0
- package/esm/models/reasoningdetailunion.d.ts +19 -0
- package/esm/models/reasoningdetailunion.js +28 -0
- package/esm/models/responseformatjsonobject.d.ts +20 -0
- package/esm/models/responseformatjsonobject.js +21 -0
- package/esm/models/responseformatjsonschema.d.ts +6 -0
- package/esm/models/responseformattext.d.ts +15 -0
- package/esm/models/responseformattext.js +13 -0
- package/esm/models/responseformattextconfig.d.ts +3 -3
- package/esm/models/responseformattextconfig.js +3 -3
- package/esm/models/responseformattextgrammar.d.ts +6 -0
- package/esm/models/responseformattextpython.d.ts +15 -0
- package/esm/models/responseformattextpython.js +13 -0
- package/esm/models/responseserrorfield.d.ts +4 -4
- package/esm/models/responseserrorfield.js +4 -4
- package/esm/models/responsesoutputitemreasoning.d.ts +2 -2
- package/esm/models/responsesoutputitemreasoning.js +2 -2
- package/esm/models/systemmessage.d.ts +12 -0
- package/esm/models/toolchoiceoption.d.ts +31 -0
- package/esm/models/toolchoiceoption.js +32 -0
- package/esm/models/tooldefinitionjson.d.ts +38 -4
- package/esm/models/tooldefinitionjson.js +14 -2
- package/esm/models/toolresponsemessage.d.ts +12 -0
- package/esm/models/usermessage.d.ts +12 -0
- package/esm/models/videoinput.d.ts +23 -0
- package/esm/models/videoinput.js +22 -0
- package/esm/sdk/analytics.d.ts +1 -1
- package/esm/sdk/analytics.js +1 -1
- package/esm/sdk/apikeys.d.ts +6 -6
- package/esm/sdk/apikeys.js +7 -7
- package/esm/sdk/chat.d.ts +10 -6
- package/esm/sdk/credits.d.ts +3 -4
- package/esm/sdk/credits.js +3 -3
- package/esm/sdk/embeddings.d.ts +1 -1
- package/esm/sdk/embeddings.js +2 -2
- package/esm/sdk/endpoints.d.ts +1 -1
- package/esm/sdk/endpoints.js +2 -2
- package/esm/sdk/guardrails.d.ts +13 -13
- package/esm/sdk/guardrails.js +13 -13
- package/esm/sdk/models.d.ts +2 -2
- package/esm/sdk/models.js +4 -4
- package/esm/sdk/providers.d.ts +1 -1
- package/esm/sdk/providers.js +2 -2
- package/esm/sdk/responses.d.ts +9 -5
- package/esm/sdk/sdk.d.ts +2 -2
- package/esm/sdk/sdk.js +3 -3
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/esm/models/chaterror.d.ts +0 -17
- package/esm/models/chaterror.js +0 -25
- package/esm/models/errors/chaterror.d.ts +0 -19
- package/esm/models/errors/chaterror.js +0 -32
- package/esm/models/providersortunion.d.ts +0 -10
- package/esm/models/providersortunion.js +0 -13
- package/esm/models/responsesformatjsonobject.d.ts +0 -20
- package/esm/models/responsesformatjsonobject.js +0 -21
- package/esm/models/schema0.d.ts +0 -84
- package/esm/models/schema0.js +0 -87
- package/esm/models/schema2.d.ts +0 -92
- package/esm/models/schema2.js +0 -109
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
3
3
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
4
|
+
export type ListProvidersGlobals = {
|
|
5
|
+
/**
|
|
6
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* This is used to track API usage per application.
|
|
10
|
+
*/
|
|
11
|
+
httpReferer?: string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
*/
|
|
17
|
+
xTitle?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
export type ListProvidersRequest = {
|
|
20
|
+
/**
|
|
21
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* This is used to track API usage per application.
|
|
25
|
+
*/
|
|
26
|
+
httpReferer?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
*/
|
|
32
|
+
xTitle?: string | undefined;
|
|
33
|
+
};
|
|
4
34
|
export type ListProvidersData = {
|
|
5
35
|
/**
|
|
6
36
|
* Display name of the provider
|
|
@@ -30,6 +60,14 @@ export type ListProvidersResponse = {
|
|
|
30
60
|
data: Array<ListProvidersData>;
|
|
31
61
|
};
|
|
32
62
|
/** @internal */
|
|
63
|
+
export type ListProvidersRequest$Outbound = {
|
|
64
|
+
"HTTP-Referer"?: string | undefined;
|
|
65
|
+
"X-Title"?: string | undefined;
|
|
66
|
+
};
|
|
67
|
+
/** @internal */
|
|
68
|
+
export declare const ListProvidersRequest$outboundSchema: z.ZodType<ListProvidersRequest$Outbound, ListProvidersRequest>;
|
|
69
|
+
export declare function listProvidersRequestToJSON(listProvidersRequest: ListProvidersRequest): string;
|
|
70
|
+
/** @internal */
|
|
33
71
|
export declare const ListProvidersData$inboundSchema: z.ZodType<ListProvidersData, unknown>;
|
|
34
72
|
export declare function listProvidersDataFromJSON(jsonString: string): SafeParseResult<ListProvidersData, SDKValidationError>;
|
|
35
73
|
/** @internal */
|
|
@@ -6,6 +6,19 @@ import * as z from "zod/v4";
|
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
/** @internal */
|
|
9
|
+
export const ListProvidersRequest$outboundSchema = z.object({
|
|
10
|
+
httpReferer: z.string().optional(),
|
|
11
|
+
xTitle: z.string().optional(),
|
|
12
|
+
}).transform((v) => {
|
|
13
|
+
return remap$(v, {
|
|
14
|
+
httpReferer: "HTTP-Referer",
|
|
15
|
+
xTitle: "X-Title",
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
export function listProvidersRequestToJSON(listProvidersRequest) {
|
|
19
|
+
return JSON.stringify(ListProvidersRequest$outboundSchema.parse(listProvidersRequest));
|
|
20
|
+
}
|
|
21
|
+
/** @internal */
|
|
9
22
|
export const ListProvidersData$inboundSchema = z.object({
|
|
10
23
|
name: z.string(),
|
|
11
24
|
slug: z.string(),
|
|
@@ -3,7 +3,59 @@ import { EventStream } from "../../lib/event-streams.js";
|
|
|
3
3
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
4
4
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
5
5
|
import * as models from "../index.js";
|
|
6
|
-
export type
|
|
6
|
+
export type SendChatCompletionRequestGlobals = {
|
|
7
|
+
/**
|
|
8
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This is used to track API usage per application.
|
|
12
|
+
*/
|
|
13
|
+
httpReferer?: string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
*/
|
|
19
|
+
xTitle?: string | undefined;
|
|
20
|
+
};
|
|
21
|
+
export type SendChatCompletionRequestRequest = {
|
|
22
|
+
/**
|
|
23
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* This is used to track API usage per application.
|
|
27
|
+
*/
|
|
28
|
+
httpReferer?: string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
*/
|
|
34
|
+
xTitle?: string | undefined;
|
|
35
|
+
chatGenerationParams: models.ChatGenerationParams;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Successful chat completion response
|
|
39
|
+
*/
|
|
40
|
+
export type SendChatCompletionRequestResponseBody = {
|
|
41
|
+
/**
|
|
42
|
+
* Streaming chat completion chunk
|
|
43
|
+
*/
|
|
44
|
+
data: models.ChatStreamingResponseChunk;
|
|
45
|
+
};
|
|
46
|
+
export type SendChatCompletionRequestResponse = models.ChatResponse | EventStream<models.ChatStreamingResponseChunk>;
|
|
47
|
+
/** @internal */
|
|
48
|
+
export type SendChatCompletionRequestRequest$Outbound = {
|
|
49
|
+
"HTTP-Referer"?: string | undefined;
|
|
50
|
+
"X-Title"?: string | undefined;
|
|
51
|
+
ChatGenerationParams: models.ChatGenerationParams$Outbound;
|
|
52
|
+
};
|
|
53
|
+
/** @internal */
|
|
54
|
+
export declare const SendChatCompletionRequestRequest$outboundSchema: z.ZodType<SendChatCompletionRequestRequest$Outbound, SendChatCompletionRequestRequest>;
|
|
55
|
+
export declare function sendChatCompletionRequestRequestToJSON(sendChatCompletionRequestRequest: SendChatCompletionRequestRequest): string;
|
|
56
|
+
/** @internal */
|
|
57
|
+
export declare const SendChatCompletionRequestResponseBody$inboundSchema: z.ZodType<SendChatCompletionRequestResponseBody, unknown>;
|
|
58
|
+
export declare function sendChatCompletionRequestResponseBodyFromJSON(jsonString: string): SafeParseResult<SendChatCompletionRequestResponseBody, SDKValidationError>;
|
|
7
59
|
/** @internal */
|
|
8
60
|
export declare const SendChatCompletionRequestResponse$inboundSchema: z.ZodType<SendChatCompletionRequestResponse, unknown>;
|
|
9
61
|
export declare function sendChatCompletionRequestResponseFromJSON(jsonString: string): SafeParseResult<SendChatCompletionRequestResponse, SDKValidationError>;
|
|
@@ -4,9 +4,44 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { EventStream } from "../../lib/event-streams.js";
|
|
7
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
8
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
9
|
import * as models from "../index.js";
|
|
9
10
|
/** @internal */
|
|
11
|
+
export const SendChatCompletionRequestRequest$outboundSchema = z.object({
|
|
12
|
+
httpReferer: z.string().optional(),
|
|
13
|
+
xTitle: z.string().optional(),
|
|
14
|
+
chatGenerationParams: models.ChatGenerationParams$outboundSchema,
|
|
15
|
+
}).transform((v) => {
|
|
16
|
+
return remap$(v, {
|
|
17
|
+
httpReferer: "HTTP-Referer",
|
|
18
|
+
xTitle: "X-Title",
|
|
19
|
+
chatGenerationParams: "ChatGenerationParams",
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
export function sendChatCompletionRequestRequestToJSON(sendChatCompletionRequestRequest) {
|
|
23
|
+
return JSON.stringify(SendChatCompletionRequestRequest$outboundSchema.parse(sendChatCompletionRequestRequest));
|
|
24
|
+
}
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const SendChatCompletionRequestResponseBody$inboundSchema = z.object({
|
|
27
|
+
data: z.string().transform((v, ctx) => {
|
|
28
|
+
try {
|
|
29
|
+
return JSON.parse(v);
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
ctx.addIssue({
|
|
33
|
+
input: v,
|
|
34
|
+
code: "custom",
|
|
35
|
+
message: `malformed json: ${err}`,
|
|
36
|
+
});
|
|
37
|
+
return z.NEVER;
|
|
38
|
+
}
|
|
39
|
+
}).pipe(models.ChatStreamingResponseChunk$inboundSchema),
|
|
40
|
+
});
|
|
41
|
+
export function sendChatCompletionRequestResponseBodyFromJSON(jsonString) {
|
|
42
|
+
return safeParse(jsonString, (x) => SendChatCompletionRequestResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SendChatCompletionRequestResponseBody' from JSON`);
|
|
43
|
+
}
|
|
44
|
+
/** @internal */
|
|
10
45
|
export const SendChatCompletionRequestResponse$inboundSchema = z.union([
|
|
11
46
|
models.ChatResponse$inboundSchema,
|
|
12
47
|
z.custom(x => x instanceof ReadableStream)
|
|
@@ -15,8 +50,7 @@ export const SendChatCompletionRequestResponse$inboundSchema = z.union([
|
|
|
15
50
|
if (rawEvent.data === "[DONE]")
|
|
16
51
|
return { done: true };
|
|
17
52
|
return {
|
|
18
|
-
value:
|
|
19
|
-
?.data,
|
|
53
|
+
value: z.lazy(() => SendChatCompletionRequestResponseBody$inboundSchema).parse(rawEvent)?.data,
|
|
20
54
|
};
|
|
21
55
|
});
|
|
22
56
|
}),
|
|
@@ -2,6 +2,21 @@ import * as z from "zod/v4";
|
|
|
2
2
|
import { OpenEnum } from "../../types/enums.js";
|
|
3
3
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
4
4
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
5
|
+
export type UpdateGuardrailGlobals = {
|
|
6
|
+
/**
|
|
7
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This is used to track API usage per application.
|
|
11
|
+
*/
|
|
12
|
+
httpReferer?: string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
*/
|
|
18
|
+
xTitle?: string | undefined;
|
|
19
|
+
};
|
|
5
20
|
/**
|
|
6
21
|
* Interval at which the limit resets (daily, weekly, monthly)
|
|
7
22
|
*/
|
|
@@ -45,6 +60,19 @@ export type UpdateGuardrailRequestBody = {
|
|
|
45
60
|
enforceZdr?: boolean | null | undefined;
|
|
46
61
|
};
|
|
47
62
|
export type UpdateGuardrailRequest = {
|
|
63
|
+
/**
|
|
64
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* This is used to track API usage per application.
|
|
68
|
+
*/
|
|
69
|
+
httpReferer?: string | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
*/
|
|
75
|
+
xTitle?: string | undefined;
|
|
48
76
|
/**
|
|
49
77
|
* The unique identifier of the guardrail to update
|
|
50
78
|
*/
|
|
@@ -134,6 +162,8 @@ export declare const UpdateGuardrailRequestBody$outboundSchema: z.ZodType<Update
|
|
|
134
162
|
export declare function updateGuardrailRequestBodyToJSON(updateGuardrailRequestBody: UpdateGuardrailRequestBody): string;
|
|
135
163
|
/** @internal */
|
|
136
164
|
export type UpdateGuardrailRequest$Outbound = {
|
|
165
|
+
"HTTP-Referer"?: string | undefined;
|
|
166
|
+
"X-Title"?: string | undefined;
|
|
137
167
|
id: string;
|
|
138
168
|
RequestBody: UpdateGuardrailRequestBody$Outbound;
|
|
139
169
|
};
|
|
@@ -48,10 +48,14 @@ export function updateGuardrailRequestBodyToJSON(updateGuardrailRequestBody) {
|
|
|
48
48
|
}
|
|
49
49
|
/** @internal */
|
|
50
50
|
export const UpdateGuardrailRequest$outboundSchema = z.object({
|
|
51
|
+
httpReferer: z.string().optional(),
|
|
52
|
+
xTitle: z.string().optional(),
|
|
51
53
|
id: z.string(),
|
|
52
54
|
requestBody: z.lazy(() => UpdateGuardrailRequestBody$outboundSchema),
|
|
53
55
|
}).transform((v) => {
|
|
54
56
|
return remap$(v, {
|
|
57
|
+
httpReferer: "HTTP-Referer",
|
|
58
|
+
xTitle: "X-Title",
|
|
55
59
|
requestBody: "RequestBody",
|
|
56
60
|
});
|
|
57
61
|
});
|
|
@@ -2,6 +2,21 @@ import * as z from "zod/v4";
|
|
|
2
2
|
import { OpenEnum } from "../../types/enums.js";
|
|
3
3
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
4
4
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
5
|
+
export type UpdateKeysGlobals = {
|
|
6
|
+
/**
|
|
7
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This is used to track API usage per application.
|
|
11
|
+
*/
|
|
12
|
+
httpReferer?: string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
*/
|
|
18
|
+
xTitle?: string | undefined;
|
|
19
|
+
};
|
|
5
20
|
/**
|
|
6
21
|
* New limit reset type for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday.
|
|
7
22
|
*/
|
|
@@ -37,6 +52,19 @@ export type UpdateKeysRequestBody = {
|
|
|
37
52
|
includeByokInLimit?: boolean | undefined;
|
|
38
53
|
};
|
|
39
54
|
export type UpdateKeysRequest = {
|
|
55
|
+
/**
|
|
56
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
57
|
+
*
|
|
58
|
+
* @remarks
|
|
59
|
+
* This is used to track API usage per application.
|
|
60
|
+
*/
|
|
61
|
+
httpReferer?: string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
*/
|
|
67
|
+
xTitle?: string | undefined;
|
|
40
68
|
/**
|
|
41
69
|
* The hash identifier of the API key to update
|
|
42
70
|
*/
|
|
@@ -148,6 +176,8 @@ export declare const UpdateKeysRequestBody$outboundSchema: z.ZodType<UpdateKeysR
|
|
|
148
176
|
export declare function updateKeysRequestBodyToJSON(updateKeysRequestBody: UpdateKeysRequestBody): string;
|
|
149
177
|
/** @internal */
|
|
150
178
|
export type UpdateKeysRequest$Outbound = {
|
|
179
|
+
"HTTP-Referer"?: string | undefined;
|
|
180
|
+
"X-Title"?: string | undefined;
|
|
151
181
|
hash: string;
|
|
152
182
|
RequestBody: UpdateKeysRequestBody$Outbound;
|
|
153
183
|
};
|
|
@@ -34,10 +34,14 @@ export function updateKeysRequestBodyToJSON(updateKeysRequestBody) {
|
|
|
34
34
|
}
|
|
35
35
|
/** @internal */
|
|
36
36
|
export const UpdateKeysRequest$outboundSchema = z.object({
|
|
37
|
+
httpReferer: z.string().optional(),
|
|
38
|
+
xTitle: z.string().optional(),
|
|
37
39
|
hash: z.string(),
|
|
38
40
|
requestBody: z.lazy(() => UpdateKeysRequestBody$outboundSchema),
|
|
39
41
|
}).transform((v) => {
|
|
40
42
|
return remap$(v, {
|
|
43
|
+
httpReferer: "HTTP-Referer",
|
|
44
|
+
xTitle: "X-Title",
|
|
41
45
|
requestBody: "RequestBody",
|
|
42
46
|
});
|
|
43
47
|
});
|
|
@@ -4,6 +4,7 @@ export declare const ProviderName: {
|
|
|
4
4
|
readonly Ai21: "AI21";
|
|
5
5
|
readonly AionLabs: "AionLabs";
|
|
6
6
|
readonly Alibaba: "Alibaba";
|
|
7
|
+
readonly Ambient: "Ambient";
|
|
7
8
|
readonly AmazonBedrock: "Amazon Bedrock";
|
|
8
9
|
readonly AmazonNova: "Amazon Nova";
|
|
9
10
|
readonly Anthropic: "Anthropic";
|
|
@@ -34,7 +35,9 @@ export declare const ProviderName: {
|
|
|
34
35
|
readonly Inception: "Inception";
|
|
35
36
|
readonly Inceptron: "Inceptron";
|
|
36
37
|
readonly InferenceNet: "InferenceNet";
|
|
38
|
+
readonly Ionstream: "Ionstream";
|
|
37
39
|
readonly Infermatic: "Infermatic";
|
|
40
|
+
readonly IoNet: "Io Net";
|
|
38
41
|
readonly Inflection: "Inflection";
|
|
39
42
|
readonly Liquid: "Liquid";
|
|
40
43
|
readonly Mara: "Mara";
|
|
@@ -60,6 +63,7 @@ export declare const ProviderName: {
|
|
|
60
63
|
readonly Seed: "Seed";
|
|
61
64
|
readonly SiliconFlow: "SiliconFlow";
|
|
62
65
|
readonly Sourceful: "Sourceful";
|
|
66
|
+
readonly StepFun: "StepFun";
|
|
63
67
|
readonly Stealth: "Stealth";
|
|
64
68
|
readonly StreamLake: "StreamLake";
|
|
65
69
|
readonly Switchpoint: "Switchpoint";
|
|
@@ -7,6 +7,7 @@ export const ProviderName = {
|
|
|
7
7
|
Ai21: "AI21",
|
|
8
8
|
AionLabs: "AionLabs",
|
|
9
9
|
Alibaba: "Alibaba",
|
|
10
|
+
Ambient: "Ambient",
|
|
10
11
|
AmazonBedrock: "Amazon Bedrock",
|
|
11
12
|
AmazonNova: "Amazon Nova",
|
|
12
13
|
Anthropic: "Anthropic",
|
|
@@ -37,7 +38,9 @@ export const ProviderName = {
|
|
|
37
38
|
Inception: "Inception",
|
|
38
39
|
Inceptron: "Inceptron",
|
|
39
40
|
InferenceNet: "InferenceNet",
|
|
41
|
+
Ionstream: "Ionstream",
|
|
40
42
|
Infermatic: "Infermatic",
|
|
43
|
+
IoNet: "Io Net",
|
|
41
44
|
Inflection: "Inflection",
|
|
42
45
|
Liquid: "Liquid",
|
|
43
46
|
Mara: "Mara",
|
|
@@ -63,6 +66,7 @@ export const ProviderName = {
|
|
|
63
66
|
Seed: "Seed",
|
|
64
67
|
SiliconFlow: "SiliconFlow",
|
|
65
68
|
Sourceful: "Sourceful",
|
|
69
|
+
StepFun: "StepFun",
|
|
66
70
|
Stealth: "Stealth",
|
|
67
71
|
StreamLake: "StreamLake",
|
|
68
72
|
Switchpoint: "Switchpoint",
|
|
@@ -4,66 +4,83 @@ import { DataCollection } from "./datacollection.js";
|
|
|
4
4
|
import { PreferredMaxLatency, PreferredMaxLatency$Outbound } from "./preferredmaxlatency.js";
|
|
5
5
|
import { PreferredMinThroughput, PreferredMinThroughput$Outbound } from "./preferredminthroughput.js";
|
|
6
6
|
import { ProviderName } from "./providername.js";
|
|
7
|
-
import { ProviderSort } from "./providersort.js";
|
|
8
7
|
import { Quantization } from "./quantization.js";
|
|
9
8
|
export type ProviderPreferencesOrder = ProviderName | string;
|
|
10
9
|
export type ProviderPreferencesOnly = ProviderName | string;
|
|
11
10
|
export type ProviderPreferencesIgnore = ProviderName | string;
|
|
12
|
-
export declare const
|
|
11
|
+
export declare const ProviderPreferencesSortEnum: {
|
|
13
12
|
readonly Price: "price";
|
|
14
13
|
readonly Throughput: "throughput";
|
|
15
14
|
readonly Latency: "latency";
|
|
16
15
|
};
|
|
17
|
-
export type
|
|
18
|
-
export declare const
|
|
16
|
+
export type ProviderPreferencesSortEnum = OpenEnum<typeof ProviderPreferencesSortEnum>;
|
|
17
|
+
export declare const ProviderPreferencesProviderSortConfigEnum: {
|
|
19
18
|
readonly Price: "price";
|
|
20
19
|
readonly Throughput: "throughput";
|
|
21
20
|
readonly Latency: "latency";
|
|
22
21
|
};
|
|
23
|
-
export type
|
|
22
|
+
export type ProviderPreferencesProviderSortConfigEnum = ClosedEnum<typeof ProviderPreferencesProviderSortConfigEnum>;
|
|
23
|
+
/**
|
|
24
|
+
* The provider sorting strategy (price, throughput, latency)
|
|
25
|
+
*/
|
|
26
|
+
export declare const ProviderPreferencesBy: {
|
|
27
|
+
readonly Price: "price";
|
|
28
|
+
readonly Throughput: "throughput";
|
|
29
|
+
readonly Latency: "latency";
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The provider sorting strategy (price, throughput, latency)
|
|
33
|
+
*/
|
|
34
|
+
export type ProviderPreferencesBy = OpenEnum<typeof ProviderPreferencesBy>;
|
|
35
|
+
/**
|
|
36
|
+
* Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model.
|
|
37
|
+
*/
|
|
24
38
|
export declare const ProviderPreferencesPartition: {
|
|
25
39
|
readonly Model: "model";
|
|
26
40
|
readonly None: "none";
|
|
27
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model.
|
|
44
|
+
*/
|
|
28
45
|
export type ProviderPreferencesPartition = OpenEnum<typeof ProviderPreferencesPartition>;
|
|
29
46
|
export type ProviderPreferencesProviderSortConfig = {
|
|
30
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The provider sorting strategy (price, throughput, latency)
|
|
49
|
+
*/
|
|
50
|
+
by?: ProviderPreferencesBy | null | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model.
|
|
53
|
+
*/
|
|
31
54
|
partition?: ProviderPreferencesPartition | null | undefined;
|
|
32
55
|
};
|
|
33
|
-
export type
|
|
56
|
+
export type ProviderPreferencesProviderSortConfigUnion = ProviderPreferencesProviderSortConfig | ProviderPreferencesProviderSortConfigEnum;
|
|
57
|
+
/**
|
|
58
|
+
* The provider sorting strategy (price, throughput, latency)
|
|
59
|
+
*/
|
|
34
60
|
export declare const ProviderPreferencesProviderSort: {
|
|
35
61
|
readonly Price: "price";
|
|
36
62
|
readonly Throughput: "throughput";
|
|
37
63
|
readonly Latency: "latency";
|
|
38
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* The provider sorting strategy (price, throughput, latency)
|
|
67
|
+
*/
|
|
39
68
|
export type ProviderPreferencesProviderSort = OpenEnum<typeof ProviderPreferencesProviderSort>;
|
|
40
69
|
/**
|
|
41
70
|
* The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
|
|
42
71
|
*/
|
|
43
|
-
export type ProviderPreferencesSortUnion = ProviderPreferencesProviderSort | ProviderPreferencesProviderSortConfig |
|
|
72
|
+
export type ProviderPreferencesSortUnion = ProviderPreferencesProviderSort | ProviderPreferencesProviderSortConfig | ProviderPreferencesProviderSortConfigEnum | ProviderPreferencesSortEnum;
|
|
44
73
|
/**
|
|
45
74
|
* The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
|
|
46
75
|
*/
|
|
47
76
|
export type ProviderPreferencesMaxPrice = {
|
|
48
77
|
/**
|
|
49
|
-
*
|
|
78
|
+
* Price per million prompt tokens
|
|
50
79
|
*/
|
|
51
80
|
prompt?: string | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* A value in string format that is a large number
|
|
54
|
-
*/
|
|
55
81
|
completion?: string | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* A value in string format that is a large number
|
|
58
|
-
*/
|
|
59
82
|
image?: string | undefined;
|
|
60
|
-
/**
|
|
61
|
-
* A value in string format that is a large number
|
|
62
|
-
*/
|
|
63
83
|
audio?: string | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* A value in string format that is a large number
|
|
66
|
-
*/
|
|
67
84
|
request?: string | undefined;
|
|
68
85
|
};
|
|
69
86
|
/**
|
|
@@ -115,7 +132,7 @@ export type ProviderPreferences = {
|
|
|
115
132
|
* A list of quantization levels to filter the provider by.
|
|
116
133
|
*/
|
|
117
134
|
quantizations?: Array<Quantization> | null | undefined;
|
|
118
|
-
sort?: ProviderPreferencesProviderSort | ProviderPreferencesProviderSortConfig |
|
|
135
|
+
sort?: ProviderPreferencesProviderSort | ProviderPreferencesProviderSortConfig | ProviderPreferencesProviderSortConfigEnum | ProviderPreferencesSortEnum | null | undefined;
|
|
119
136
|
/**
|
|
120
137
|
* The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
|
|
121
138
|
*/
|
|
@@ -145,9 +162,11 @@ export type ProviderPreferencesIgnore$Outbound = string | string;
|
|
|
145
162
|
export declare const ProviderPreferencesIgnore$outboundSchema: z.ZodType<ProviderPreferencesIgnore$Outbound, ProviderPreferencesIgnore>;
|
|
146
163
|
export declare function providerPreferencesIgnoreToJSON(providerPreferencesIgnore: ProviderPreferencesIgnore): string;
|
|
147
164
|
/** @internal */
|
|
148
|
-
export declare const
|
|
165
|
+
export declare const ProviderPreferencesSortEnum$outboundSchema: z.ZodType<string, ProviderPreferencesSortEnum>;
|
|
166
|
+
/** @internal */
|
|
167
|
+
export declare const ProviderPreferencesProviderSortConfigEnum$outboundSchema: z.ZodEnum<typeof ProviderPreferencesProviderSortConfigEnum>;
|
|
149
168
|
/** @internal */
|
|
150
|
-
export declare const
|
|
169
|
+
export declare const ProviderPreferencesBy$outboundSchema: z.ZodType<string, ProviderPreferencesBy>;
|
|
151
170
|
/** @internal */
|
|
152
171
|
export declare const ProviderPreferencesPartition$outboundSchema: z.ZodType<string, ProviderPreferencesPartition>;
|
|
153
172
|
/** @internal */
|
|
@@ -159,10 +178,10 @@ export type ProviderPreferencesProviderSortConfig$Outbound = {
|
|
|
159
178
|
export declare const ProviderPreferencesProviderSortConfig$outboundSchema: z.ZodType<ProviderPreferencesProviderSortConfig$Outbound, ProviderPreferencesProviderSortConfig>;
|
|
160
179
|
export declare function providerPreferencesProviderSortConfigToJSON(providerPreferencesProviderSortConfig: ProviderPreferencesProviderSortConfig): string;
|
|
161
180
|
/** @internal */
|
|
162
|
-
export type
|
|
181
|
+
export type ProviderPreferencesProviderSortConfigUnion$Outbound = ProviderPreferencesProviderSortConfig$Outbound | string;
|
|
163
182
|
/** @internal */
|
|
164
|
-
export declare const
|
|
165
|
-
export declare function
|
|
183
|
+
export declare const ProviderPreferencesProviderSortConfigUnion$outboundSchema: z.ZodType<ProviderPreferencesProviderSortConfigUnion$Outbound, ProviderPreferencesProviderSortConfigUnion>;
|
|
184
|
+
export declare function providerPreferencesProviderSortConfigUnionToJSON(providerPreferencesProviderSortConfigUnion: ProviderPreferencesProviderSortConfigUnion): string;
|
|
166
185
|
/** @internal */
|
|
167
186
|
export declare const ProviderPreferencesProviderSort$outboundSchema: z.ZodType<string, ProviderPreferencesProviderSort>;
|
|
168
187
|
/** @internal */
|
|
@@ -9,22 +9,35 @@ import { DataCollection$outboundSchema, } from "./datacollection.js";
|
|
|
9
9
|
import { PreferredMaxLatency$outboundSchema, } from "./preferredmaxlatency.js";
|
|
10
10
|
import { PreferredMinThroughput$outboundSchema, } from "./preferredminthroughput.js";
|
|
11
11
|
import { ProviderName$outboundSchema } from "./providername.js";
|
|
12
|
-
import { ProviderSort$outboundSchema } from "./providersort.js";
|
|
13
12
|
import { Quantization$outboundSchema } from "./quantization.js";
|
|
14
|
-
export const
|
|
13
|
+
export const ProviderPreferencesSortEnum = {
|
|
15
14
|
Price: "price",
|
|
16
15
|
Throughput: "throughput",
|
|
17
16
|
Latency: "latency",
|
|
18
17
|
};
|
|
19
|
-
export const
|
|
18
|
+
export const ProviderPreferencesProviderSortConfigEnum = {
|
|
20
19
|
Price: "price",
|
|
21
20
|
Throughput: "throughput",
|
|
22
21
|
Latency: "latency",
|
|
23
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* The provider sorting strategy (price, throughput, latency)
|
|
25
|
+
*/
|
|
26
|
+
export const ProviderPreferencesBy = {
|
|
27
|
+
Price: "price",
|
|
28
|
+
Throughput: "throughput",
|
|
29
|
+
Latency: "latency",
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model.
|
|
33
|
+
*/
|
|
24
34
|
export const ProviderPreferencesPartition = {
|
|
25
35
|
Model: "model",
|
|
26
36
|
None: "none",
|
|
27
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* The provider sorting strategy (price, throughput, latency)
|
|
40
|
+
*/
|
|
28
41
|
export const ProviderPreferencesProviderSort = {
|
|
29
42
|
Price: "price",
|
|
30
43
|
Throughput: "throughput",
|
|
@@ -46,27 +59,28 @@ export function providerPreferencesIgnoreToJSON(providerPreferencesIgnore) {
|
|
|
46
59
|
return JSON.stringify(ProviderPreferencesIgnore$outboundSchema.parse(providerPreferencesIgnore));
|
|
47
60
|
}
|
|
48
61
|
/** @internal */
|
|
49
|
-
export const
|
|
50
|
-
|
|
62
|
+
export const ProviderPreferencesSortEnum$outboundSchema = openEnums.outboundSchema(ProviderPreferencesSortEnum);
|
|
63
|
+
/** @internal */
|
|
64
|
+
export const ProviderPreferencesProviderSortConfigEnum$outboundSchema = z.enum(ProviderPreferencesProviderSortConfigEnum);
|
|
51
65
|
/** @internal */
|
|
52
|
-
export const
|
|
66
|
+
export const ProviderPreferencesBy$outboundSchema = openEnums.outboundSchema(ProviderPreferencesBy);
|
|
53
67
|
/** @internal */
|
|
54
68
|
export const ProviderPreferencesPartition$outboundSchema = openEnums.outboundSchema(ProviderPreferencesPartition);
|
|
55
69
|
/** @internal */
|
|
56
70
|
export const ProviderPreferencesProviderSortConfig$outboundSchema = z.object({
|
|
57
|
-
by: z.nullable(
|
|
71
|
+
by: z.nullable(ProviderPreferencesBy$outboundSchema).optional(),
|
|
58
72
|
partition: z.nullable(ProviderPreferencesPartition$outboundSchema).optional(),
|
|
59
73
|
});
|
|
60
74
|
export function providerPreferencesProviderSortConfigToJSON(providerPreferencesProviderSortConfig) {
|
|
61
75
|
return JSON.stringify(ProviderPreferencesProviderSortConfig$outboundSchema.parse(providerPreferencesProviderSortConfig));
|
|
62
76
|
}
|
|
63
77
|
/** @internal */
|
|
64
|
-
export const
|
|
78
|
+
export const ProviderPreferencesProviderSortConfigUnion$outboundSchema = z.union([
|
|
65
79
|
z.lazy(() => ProviderPreferencesProviderSortConfig$outboundSchema),
|
|
66
|
-
|
|
80
|
+
ProviderPreferencesProviderSortConfigEnum$outboundSchema,
|
|
67
81
|
]);
|
|
68
|
-
export function
|
|
69
|
-
return JSON.stringify(
|
|
82
|
+
export function providerPreferencesProviderSortConfigUnionToJSON(providerPreferencesProviderSortConfigUnion) {
|
|
83
|
+
return JSON.stringify(ProviderPreferencesProviderSortConfigUnion$outboundSchema.parse(providerPreferencesProviderSortConfigUnion));
|
|
70
84
|
}
|
|
71
85
|
/** @internal */
|
|
72
86
|
export const ProviderPreferencesProviderSort$outboundSchema = openEnums.outboundSchema(ProviderPreferencesProviderSort);
|
|
@@ -75,9 +89,9 @@ export const ProviderPreferencesSortUnion$outboundSchema = z.union([
|
|
|
75
89
|
ProviderPreferencesProviderSort$outboundSchema,
|
|
76
90
|
z.union([
|
|
77
91
|
z.lazy(() => ProviderPreferencesProviderSortConfig$outboundSchema),
|
|
78
|
-
|
|
92
|
+
ProviderPreferencesProviderSortConfigEnum$outboundSchema,
|
|
79
93
|
]),
|
|
80
|
-
|
|
94
|
+
ProviderPreferencesSortEnum$outboundSchema,
|
|
81
95
|
]);
|
|
82
96
|
export function providerPreferencesSortUnionToJSON(providerPreferencesSortUnion) {
|
|
83
97
|
return JSON.stringify(ProviderPreferencesSortUnion$outboundSchema.parse(providerPreferencesSortUnion));
|
|
@@ -110,9 +124,9 @@ export const ProviderPreferences$outboundSchema = z.object({
|
|
|
110
124
|
ProviderPreferencesProviderSort$outboundSchema,
|
|
111
125
|
z.union([
|
|
112
126
|
z.lazy(() => ProviderPreferencesProviderSortConfig$outboundSchema),
|
|
113
|
-
|
|
127
|
+
ProviderPreferencesProviderSortConfigEnum$outboundSchema,
|
|
114
128
|
]),
|
|
115
|
-
|
|
129
|
+
ProviderPreferencesSortEnum$outboundSchema,
|
|
116
130
|
])).optional(),
|
|
117
131
|
maxPrice: z.lazy(() => ProviderPreferencesMaxPrice$outboundSchema).optional(),
|
|
118
132
|
preferredMinThroughput: z.nullable(PreferredMinThroughput$outboundSchema)
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
/**
|
|
4
|
+
* The provider sorting strategy (price, throughput, latency)
|
|
5
|
+
*/
|
|
3
6
|
export declare const ProviderSort: {
|
|
4
7
|
readonly Price: "price";
|
|
5
8
|
readonly Throughput: "throughput";
|
|
6
9
|
readonly Latency: "latency";
|
|
7
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* The provider sorting strategy (price, throughput, latency)
|
|
13
|
+
*/
|
|
8
14
|
export type ProviderSort = OpenEnum<typeof ProviderSort>;
|
|
9
15
|
/** @internal */
|
|
10
16
|
export declare const ProviderSort$outboundSchema: z.ZodType<string, ProviderSort>;
|