@openrouter/sdk 1.5.45 → 1.5.46
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/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/decisionsrefusalanswer.d.ts +13 -0
- package/esm/models/decisionsrefusalanswer.js +14 -0
- package/esm/models/decisionsresponse.d.ts +9 -3
- package/esm/models/decisionsresponse.js +5 -0
- package/esm/models/decisionsurlcitationannotation.d.ts +29 -0
- package/esm/models/decisionsurlcitationannotation.js +34 -0
- package/esm/models/index.d.ts +2 -0
- package/esm/models/index.js +2 -0
- package/esm/models/speechrequest.d.ts +45 -2
- package/esm/models/speechrequest.js +23 -0
- package/esm/models/sttrequest.d.ts +45 -2
- package/esm/models/sttrequest.js +23 -0
- package/jsr.json +1 -1
- package/package.json +4 -4
package/esm/lib/config.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
50
50
|
export declare const SDK_METADATA: {
|
|
51
51
|
readonly language: "typescript";
|
|
52
52
|
readonly openapiDocVersion: "1.0.0";
|
|
53
|
-
readonly sdkVersion: "1.5.
|
|
53
|
+
readonly sdkVersion: "1.5.46";
|
|
54
54
|
readonly genVersion: "2.950.13";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.5.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.5.46 2.950.13 1.0.0 @openrouter/sdk";
|
|
56
56
|
};
|
|
57
57
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -29,8 +29,8 @@ export function serverURLFromOptions(options) {
|
|
|
29
29
|
export const SDK_METADATA = {
|
|
30
30
|
language: "typescript",
|
|
31
31
|
openapiDocVersion: "1.0.0",
|
|
32
|
-
sdkVersion: "1.5.
|
|
32
|
+
sdkVersion: "1.5.46",
|
|
33
33
|
genVersion: "2.950.13",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.5.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.5.46 2.950.13 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
/**
|
|
5
|
+
* The provider declined to answer this question; no value or probabilities are returned. Other questions in the same request can still have answers.
|
|
6
|
+
*/
|
|
7
|
+
export type DecisionsRefusalAnswer = {
|
|
8
|
+
type: "refusal";
|
|
9
|
+
};
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare const DecisionsRefusalAnswer$inboundSchema: z.ZodType<DecisionsRefusalAnswer, unknown>;
|
|
12
|
+
export declare function decisionsRefusalAnswerFromJSON(jsonString: string): SafeParseResult<DecisionsRefusalAnswer, SDKValidationError>;
|
|
13
|
+
//# sourceMappingURL=decisionsrefusalanswer.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: f2a64332441e
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const DecisionsRefusalAnswer$inboundSchema = z.object({
|
|
9
|
+
type: z.literal("refusal"),
|
|
10
|
+
});
|
|
11
|
+
export function decisionsRefusalAnswerFromJSON(jsonString) {
|
|
12
|
+
return safeParse(jsonString, (x) => DecisionsRefusalAnswer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DecisionsRefusalAnswer' from JSON`);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=decisionsrefusalanswer.js.map
|
|
@@ -4,13 +4,15 @@ import { Result as SafeParseResult } from "../types/fp.js";
|
|
|
4
4
|
import { DecisionsBoxAnswer } from "./decisionsboxanswer.js";
|
|
5
5
|
import { DecisionsChoiceAnswer } from "./decisionschoiceanswer.js";
|
|
6
6
|
import { DecisionsNoulAnswer } from "./decisionsnoulanswer.js";
|
|
7
|
+
import { DecisionsRefusalAnswer } from "./decisionsrefusalanswer.js";
|
|
7
8
|
import { DecisionsScoreAnswer } from "./decisionsscoreanswer.js";
|
|
9
|
+
import { DecisionsUrlCitationAnnotation } from "./decisionsurlcitationannotation.js";
|
|
8
10
|
import { DecisionsUsageInputTokensDetails } from "./decisionsusageinputtokensdetails.js";
|
|
9
11
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
12
|
/**
|
|
11
|
-
* A Decisions answer using a boolean, choice, score, or image bounding-box evaluation.
|
|
13
|
+
* A Decisions answer using a boolean, choice, score, or image bounding-box evaluation, or a refusal of that question.
|
|
12
14
|
*/
|
|
13
|
-
export type DecisionsResponseAnswers = DecisionsBoxAnswer | DecisionsChoiceAnswer | DecisionsNoulAnswer | DecisionsScoreAnswer | discriminatedUnionTypes.Unknown<"type">;
|
|
15
|
+
export type DecisionsResponseAnswers = DecisionsBoxAnswer | DecisionsChoiceAnswer | DecisionsNoulAnswer | DecisionsRefusalAnswer | DecisionsScoreAnswer | discriminatedUnionTypes.Unknown<"type">;
|
|
14
16
|
export type DecisionsResponseUsage = {
|
|
15
17
|
cost?: number | undefined;
|
|
16
18
|
inputTokens: number;
|
|
@@ -21,8 +23,12 @@ export type DecisionsResponseUsage = {
|
|
|
21
23
|
outputTokens: number;
|
|
22
24
|
};
|
|
23
25
|
export type DecisionsResponse = {
|
|
26
|
+
/**
|
|
27
|
+
* Sources for the request as a whole, when the provider returns them. Not attributed to individual answers.
|
|
28
|
+
*/
|
|
29
|
+
annotations?: Array<DecisionsUrlCitationAnnotation> | undefined;
|
|
24
30
|
answers: {
|
|
25
|
-
[k: string]: DecisionsBoxAnswer | DecisionsChoiceAnswer | DecisionsNoulAnswer | DecisionsScoreAnswer | discriminatedUnionTypes.Unknown<"type">;
|
|
31
|
+
[k: string]: DecisionsBoxAnswer | DecisionsChoiceAnswer | DecisionsNoulAnswer | DecisionsRefusalAnswer | DecisionsScoreAnswer | discriminatedUnionTypes.Unknown<"type">;
|
|
26
32
|
};
|
|
27
33
|
id?: string | undefined;
|
|
28
34
|
model: string;
|
|
@@ -9,13 +9,16 @@ import { discriminatedUnion } from "../types/discriminatedUnion.js";
|
|
|
9
9
|
import { DecisionsBoxAnswer$inboundSchema, } from "./decisionsboxanswer.js";
|
|
10
10
|
import { DecisionsChoiceAnswer$inboundSchema, } from "./decisionschoiceanswer.js";
|
|
11
11
|
import { DecisionsNoulAnswer$inboundSchema, } from "./decisionsnoulanswer.js";
|
|
12
|
+
import { DecisionsRefusalAnswer$inboundSchema, } from "./decisionsrefusalanswer.js";
|
|
12
13
|
import { DecisionsScoreAnswer$inboundSchema, } from "./decisionsscoreanswer.js";
|
|
14
|
+
import { DecisionsUrlCitationAnnotation$inboundSchema, } from "./decisionsurlcitationannotation.js";
|
|
13
15
|
import { DecisionsUsageInputTokensDetails$inboundSchema, } from "./decisionsusageinputtokensdetails.js";
|
|
14
16
|
/** @internal */
|
|
15
17
|
export const DecisionsResponseAnswers$inboundSchema = discriminatedUnion("type", {
|
|
16
18
|
box: DecisionsBoxAnswer$inboundSchema,
|
|
17
19
|
choice: DecisionsChoiceAnswer$inboundSchema,
|
|
18
20
|
noul: DecisionsNoulAnswer$inboundSchema,
|
|
21
|
+
refusal: DecisionsRefusalAnswer$inboundSchema,
|
|
19
22
|
score: DecisionsScoreAnswer$inboundSchema,
|
|
20
23
|
});
|
|
21
24
|
export function decisionsResponseAnswersFromJSON(jsonString) {
|
|
@@ -40,10 +43,12 @@ export function decisionsResponseUsageFromJSON(jsonString) {
|
|
|
40
43
|
}
|
|
41
44
|
/** @internal */
|
|
42
45
|
export const DecisionsResponse$inboundSchema = z.object({
|
|
46
|
+
annotations: z.array(DecisionsUrlCitationAnnotation$inboundSchema).optional(),
|
|
43
47
|
answers: z.record(z.string(), discriminatedUnion("type", {
|
|
44
48
|
box: DecisionsBoxAnswer$inboundSchema,
|
|
45
49
|
choice: DecisionsChoiceAnswer$inboundSchema,
|
|
46
50
|
noul: DecisionsNoulAnswer$inboundSchema,
|
|
51
|
+
refusal: DecisionsRefusalAnswer$inboundSchema,
|
|
47
52
|
score: DecisionsScoreAnswer$inboundSchema,
|
|
48
53
|
})),
|
|
49
54
|
id: z.string().optional(),
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
export declare const DecisionsUrlCitationAnnotationType: {
|
|
6
|
+
readonly UrlCitation: "url_citation";
|
|
7
|
+
};
|
|
8
|
+
export type DecisionsUrlCitationAnnotationType = ClosedEnum<typeof DecisionsUrlCitationAnnotationType>;
|
|
9
|
+
export type DecisionsUrlCitationAnnotationUrlCitation = {
|
|
10
|
+
content?: string | undefined;
|
|
11
|
+
title?: string | undefined;
|
|
12
|
+
url: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A web source the provider used for this request. Applies to the whole request, not to a specific answer.
|
|
16
|
+
*/
|
|
17
|
+
export type DecisionsUrlCitationAnnotation = {
|
|
18
|
+
type: DecisionsUrlCitationAnnotationType;
|
|
19
|
+
urlCitation: DecisionsUrlCitationAnnotationUrlCitation;
|
|
20
|
+
};
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const DecisionsUrlCitationAnnotationType$inboundSchema: z.ZodEnum<typeof DecisionsUrlCitationAnnotationType>;
|
|
23
|
+
/** @internal */
|
|
24
|
+
export declare const DecisionsUrlCitationAnnotationUrlCitation$inboundSchema: z.ZodType<DecisionsUrlCitationAnnotationUrlCitation, unknown>;
|
|
25
|
+
export declare function decisionsUrlCitationAnnotationUrlCitationFromJSON(jsonString: string): SafeParseResult<DecisionsUrlCitationAnnotationUrlCitation, SDKValidationError>;
|
|
26
|
+
/** @internal */
|
|
27
|
+
export declare const DecisionsUrlCitationAnnotation$inboundSchema: z.ZodType<DecisionsUrlCitationAnnotation, unknown>;
|
|
28
|
+
export declare function decisionsUrlCitationAnnotationFromJSON(jsonString: string): SafeParseResult<DecisionsUrlCitationAnnotation, SDKValidationError>;
|
|
29
|
+
//# sourceMappingURL=decisionsurlcitationannotation.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 75003a5bd0b6
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
export const DecisionsUrlCitationAnnotationType = {
|
|
9
|
+
UrlCitation: "url_citation",
|
|
10
|
+
};
|
|
11
|
+
/** @internal */
|
|
12
|
+
export const DecisionsUrlCitationAnnotationType$inboundSchema = z.enum(DecisionsUrlCitationAnnotationType);
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const DecisionsUrlCitationAnnotationUrlCitation$inboundSchema = z.object({
|
|
15
|
+
content: z.string().optional(),
|
|
16
|
+
title: z.string().optional(),
|
|
17
|
+
url: z.string(),
|
|
18
|
+
});
|
|
19
|
+
export function decisionsUrlCitationAnnotationUrlCitationFromJSON(jsonString) {
|
|
20
|
+
return safeParse(jsonString, (x) => DecisionsUrlCitationAnnotationUrlCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DecisionsUrlCitationAnnotationUrlCitation' from JSON`);
|
|
21
|
+
}
|
|
22
|
+
/** @internal */
|
|
23
|
+
export const DecisionsUrlCitationAnnotation$inboundSchema = z.object({
|
|
24
|
+
type: DecisionsUrlCitationAnnotationType$inboundSchema,
|
|
25
|
+
url_citation: z.lazy(() => DecisionsUrlCitationAnnotationUrlCitation$inboundSchema),
|
|
26
|
+
}).transform((v) => {
|
|
27
|
+
return remap$(v, {
|
|
28
|
+
"url_citation": "urlCitation",
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
export function decisionsUrlCitationAnnotationFromJSON(jsonString) {
|
|
32
|
+
return safeParse(jsonString, (x) => DecisionsUrlCitationAnnotation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DecisionsUrlCitationAnnotation' from JSON`);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=decisionsurlcitationannotation.js.map
|
package/esm/models/index.d.ts
CHANGED
|
@@ -306,10 +306,12 @@ export * from "./decisionschoicequestion.js";
|
|
|
306
306
|
export * from "./decisionsimageasset.js";
|
|
307
307
|
export * from "./decisionsnoulanswer.js";
|
|
308
308
|
export * from "./decisionsnoulquestion.js";
|
|
309
|
+
export * from "./decisionsrefusalanswer.js";
|
|
309
310
|
export * from "./decisionsrequest.js";
|
|
310
311
|
export * from "./decisionsresponse.js";
|
|
311
312
|
export * from "./decisionsscoreanswer.js";
|
|
312
313
|
export * from "./decisionsscorequestion.js";
|
|
314
|
+
export * from "./decisionsurlcitationannotation.js";
|
|
313
315
|
export * from "./decisionsusageinputtokensdetails.js";
|
|
314
316
|
export * from "./defaultparameters.js";
|
|
315
317
|
export * from "./deferredbm25search.js";
|
package/esm/models/index.js
CHANGED
|
@@ -310,10 +310,12 @@ export * from "./decisionschoicequestion.js";
|
|
|
310
310
|
export * from "./decisionsimageasset.js";
|
|
311
311
|
export * from "./decisionsnoulanswer.js";
|
|
312
312
|
export * from "./decisionsnoulquestion.js";
|
|
313
|
+
export * from "./decisionsrefusalanswer.js";
|
|
313
314
|
export * from "./decisionsrequest.js";
|
|
314
315
|
export * from "./decisionsresponse.js";
|
|
315
316
|
export * from "./decisionsscoreanswer.js";
|
|
316
317
|
export * from "./decisionsscorequestion.js";
|
|
318
|
+
export * from "./decisionsurlcitationannotation.js";
|
|
317
319
|
export * from "./decisionsusageinputtokensdetails.js";
|
|
318
320
|
export * from "./defaultparameters.js";
|
|
319
321
|
export * from "./deferredbm25search.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { ProviderName } from "./providername.js";
|
|
3
4
|
import { ProviderOptions, ProviderOptions$Outbound } from "./provideroptions.js";
|
|
4
5
|
import { SpeechInput, SpeechInput$Outbound } from "./speechinput.js";
|
|
5
6
|
import { SpeechInputReference, SpeechInputReference$Outbound } from "./speechinputreference.js";
|
|
@@ -25,10 +26,21 @@ export declare const SpeechRequestDataCollection: {
|
|
|
25
26
|
* - deny: use only providers which do not collect user data.
|
|
26
27
|
*/
|
|
27
28
|
export type SpeechRequestDataCollection = OpenEnum<typeof SpeechRequestDataCollection>;
|
|
29
|
+
export type SpeechRequestIgnore = ProviderName | string;
|
|
30
|
+
export type SpeechRequestOnly = ProviderName | string;
|
|
31
|
+
export type SpeechRequestOrder = ProviderName | string;
|
|
28
32
|
/**
|
|
29
|
-
* Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options
|
|
33
|
+
* Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options
|
|
30
34
|
*/
|
|
31
35
|
export type SpeechRequestProvider = {
|
|
36
|
+
/**
|
|
37
|
+
* Whether to allow backup providers to serve requests
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
|
|
41
|
+
* - false: use only the primary/custom provider, and return the upstream error if it's unavailable.
|
|
42
|
+
*/
|
|
43
|
+
allowFallbacks?: boolean | null | undefined;
|
|
32
44
|
/**
|
|
33
45
|
* Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
|
34
46
|
*
|
|
@@ -38,10 +50,22 @@ export type SpeechRequestProvider = {
|
|
|
38
50
|
* - deny: use only providers which do not collect user data.
|
|
39
51
|
*/
|
|
40
52
|
dataCollection?: SpeechRequestDataCollection | null | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
|
|
55
|
+
*/
|
|
56
|
+
ignore?: Array<ProviderName | string> | null | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
|
|
59
|
+
*/
|
|
60
|
+
only?: Array<ProviderName | string> | null | undefined;
|
|
41
61
|
/**
|
|
42
62
|
* Provider-specific options keyed by provider slug. The provider segment is case-insensitive; an endpoint tag after `/` must match the endpoint slug exactly. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.
|
|
43
63
|
*/
|
|
44
64
|
options?: ProviderOptions | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.
|
|
67
|
+
*/
|
|
68
|
+
order?: Array<ProviderName | string> | null | undefined;
|
|
45
69
|
/**
|
|
46
70
|
* Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
|
|
47
71
|
*/
|
|
@@ -79,7 +103,7 @@ export type SpeechRequest = {
|
|
|
79
103
|
*/
|
|
80
104
|
model: string;
|
|
81
105
|
/**
|
|
82
|
-
* Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options
|
|
106
|
+
* Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options
|
|
83
107
|
*/
|
|
84
108
|
provider?: SpeechRequestProvider | undefined;
|
|
85
109
|
/**
|
|
@@ -110,9 +134,28 @@ export type SpeechRequest = {
|
|
|
110
134
|
/** @internal */
|
|
111
135
|
export declare const SpeechRequestDataCollection$outboundSchema: z.ZodType<string, SpeechRequestDataCollection>;
|
|
112
136
|
/** @internal */
|
|
137
|
+
export type SpeechRequestIgnore$Outbound = string | string;
|
|
138
|
+
/** @internal */
|
|
139
|
+
export declare const SpeechRequestIgnore$outboundSchema: z.ZodType<SpeechRequestIgnore$Outbound, SpeechRequestIgnore>;
|
|
140
|
+
export declare function speechRequestIgnoreToJSON(speechRequestIgnore: SpeechRequestIgnore): string;
|
|
141
|
+
/** @internal */
|
|
142
|
+
export type SpeechRequestOnly$Outbound = string | string;
|
|
143
|
+
/** @internal */
|
|
144
|
+
export declare const SpeechRequestOnly$outboundSchema: z.ZodType<SpeechRequestOnly$Outbound, SpeechRequestOnly>;
|
|
145
|
+
export declare function speechRequestOnlyToJSON(speechRequestOnly: SpeechRequestOnly): string;
|
|
146
|
+
/** @internal */
|
|
147
|
+
export type SpeechRequestOrder$Outbound = string | string;
|
|
148
|
+
/** @internal */
|
|
149
|
+
export declare const SpeechRequestOrder$outboundSchema: z.ZodType<SpeechRequestOrder$Outbound, SpeechRequestOrder>;
|
|
150
|
+
export declare function speechRequestOrderToJSON(speechRequestOrder: SpeechRequestOrder): string;
|
|
151
|
+
/** @internal */
|
|
113
152
|
export type SpeechRequestProvider$Outbound = {
|
|
153
|
+
allow_fallbacks?: boolean | null | undefined;
|
|
114
154
|
data_collection?: string | null | undefined;
|
|
155
|
+
ignore?: Array<string | string> | null | undefined;
|
|
156
|
+
only?: Array<string | string> | null | undefined;
|
|
115
157
|
options?: ProviderOptions$Outbound | undefined;
|
|
158
|
+
order?: Array<string | string> | null | undefined;
|
|
116
159
|
zdr?: boolean | null | undefined;
|
|
117
160
|
};
|
|
118
161
|
/** @internal */
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import * as openEnums from "../types/enums.js";
|
|
8
|
+
import { ProviderName$outboundSchema } from "./providername.js";
|
|
8
9
|
import { ProviderOptions$outboundSchema, } from "./provideroptions.js";
|
|
9
10
|
import { SpeechInput$outboundSchema, } from "./speechinput.js";
|
|
10
11
|
import { SpeechInputReference$outboundSchema, } from "./speechinputreference.js";
|
|
@@ -31,13 +32,35 @@ export const SpeechRequestResponseFormat = {
|
|
|
31
32
|
/** @internal */
|
|
32
33
|
export const SpeechRequestDataCollection$outboundSchema = openEnums.outboundSchema(SpeechRequestDataCollection);
|
|
33
34
|
/** @internal */
|
|
35
|
+
export const SpeechRequestIgnore$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
|
|
36
|
+
export function speechRequestIgnoreToJSON(speechRequestIgnore) {
|
|
37
|
+
return JSON.stringify(SpeechRequestIgnore$outboundSchema.parse(speechRequestIgnore));
|
|
38
|
+
}
|
|
39
|
+
/** @internal */
|
|
40
|
+
export const SpeechRequestOnly$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
|
|
41
|
+
export function speechRequestOnlyToJSON(speechRequestOnly) {
|
|
42
|
+
return JSON.stringify(SpeechRequestOnly$outboundSchema.parse(speechRequestOnly));
|
|
43
|
+
}
|
|
44
|
+
/** @internal */
|
|
45
|
+
export const SpeechRequestOrder$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
|
|
46
|
+
export function speechRequestOrderToJSON(speechRequestOrder) {
|
|
47
|
+
return JSON.stringify(SpeechRequestOrder$outboundSchema.parse(speechRequestOrder));
|
|
48
|
+
}
|
|
49
|
+
/** @internal */
|
|
34
50
|
export const SpeechRequestProvider$outboundSchema = z.object({
|
|
51
|
+
allowFallbacks: z.nullable(z.boolean()).optional(),
|
|
35
52
|
dataCollection: z.nullable(SpeechRequestDataCollection$outboundSchema)
|
|
36
53
|
.optional(),
|
|
54
|
+
ignore: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()]))).optional(),
|
|
55
|
+
only: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()])))
|
|
56
|
+
.optional(),
|
|
37
57
|
options: ProviderOptions$outboundSchema.optional(),
|
|
58
|
+
order: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()])))
|
|
59
|
+
.optional(),
|
|
38
60
|
zdr: z.nullable(z.boolean()).optional(),
|
|
39
61
|
}).transform((v) => {
|
|
40
62
|
return remap$(v, {
|
|
63
|
+
allowFallbacks: "allow_fallbacks",
|
|
41
64
|
dataCollection: "data_collection",
|
|
42
65
|
});
|
|
43
66
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { ProviderName } from "./providername.js";
|
|
3
4
|
import { ProviderOptions, ProviderOptions$Outbound } from "./provideroptions.js";
|
|
4
5
|
import { STTInputAudio, STTInputAudio$Outbound } from "./sttinputaudio.js";
|
|
5
6
|
import { STTTimestampGranularity } from "./stttimestampgranularity.js";
|
|
@@ -25,10 +26,21 @@ export declare const STTRequestDataCollection: {
|
|
|
25
26
|
* - deny: use only providers which do not collect user data.
|
|
26
27
|
*/
|
|
27
28
|
export type STTRequestDataCollection = OpenEnum<typeof STTRequestDataCollection>;
|
|
29
|
+
export type STTRequestIgnore = ProviderName | string;
|
|
30
|
+
export type STTRequestOnly = ProviderName | string;
|
|
31
|
+
export type STTRequestOrder = ProviderName | string;
|
|
28
32
|
/**
|
|
29
|
-
* Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options
|
|
33
|
+
* Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options
|
|
30
34
|
*/
|
|
31
35
|
export type STTRequestProvider = {
|
|
36
|
+
/**
|
|
37
|
+
* Whether to allow backup providers to serve requests
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
|
|
41
|
+
* - false: use only the primary/custom provider, and return the upstream error if it's unavailable.
|
|
42
|
+
*/
|
|
43
|
+
allowFallbacks?: boolean | null | undefined;
|
|
32
44
|
/**
|
|
33
45
|
* Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
|
34
46
|
*
|
|
@@ -38,10 +50,22 @@ export type STTRequestProvider = {
|
|
|
38
50
|
* - deny: use only providers which do not collect user data.
|
|
39
51
|
*/
|
|
40
52
|
dataCollection?: STTRequestDataCollection | null | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
|
|
55
|
+
*/
|
|
56
|
+
ignore?: Array<ProviderName | string> | null | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
|
|
59
|
+
*/
|
|
60
|
+
only?: Array<ProviderName | string> | null | undefined;
|
|
41
61
|
/**
|
|
42
62
|
* Provider-specific options keyed by provider slug. The provider segment is case-insensitive; an endpoint tag after `/` must match the endpoint slug exactly. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.
|
|
43
63
|
*/
|
|
44
64
|
options?: ProviderOptions | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.
|
|
67
|
+
*/
|
|
68
|
+
order?: Array<ProviderName | string> | null | undefined;
|
|
45
69
|
/**
|
|
46
70
|
* Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
|
|
47
71
|
*/
|
|
@@ -83,7 +107,7 @@ export type STTRequest = {
|
|
|
83
107
|
*/
|
|
84
108
|
model: string;
|
|
85
109
|
/**
|
|
86
|
-
* Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options
|
|
110
|
+
* Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options
|
|
87
111
|
*/
|
|
88
112
|
provider?: STTRequestProvider | undefined;
|
|
89
113
|
/**
|
|
@@ -114,9 +138,28 @@ export type STTRequest = {
|
|
|
114
138
|
/** @internal */
|
|
115
139
|
export declare const STTRequestDataCollection$outboundSchema: z.ZodType<string, STTRequestDataCollection>;
|
|
116
140
|
/** @internal */
|
|
141
|
+
export type STTRequestIgnore$Outbound = string | string;
|
|
142
|
+
/** @internal */
|
|
143
|
+
export declare const STTRequestIgnore$outboundSchema: z.ZodType<STTRequestIgnore$Outbound, STTRequestIgnore>;
|
|
144
|
+
export declare function sttRequestIgnoreToJSON(sttRequestIgnore: STTRequestIgnore): string;
|
|
145
|
+
/** @internal */
|
|
146
|
+
export type STTRequestOnly$Outbound = string | string;
|
|
147
|
+
/** @internal */
|
|
148
|
+
export declare const STTRequestOnly$outboundSchema: z.ZodType<STTRequestOnly$Outbound, STTRequestOnly>;
|
|
149
|
+
export declare function sttRequestOnlyToJSON(sttRequestOnly: STTRequestOnly): string;
|
|
150
|
+
/** @internal */
|
|
151
|
+
export type STTRequestOrder$Outbound = string | string;
|
|
152
|
+
/** @internal */
|
|
153
|
+
export declare const STTRequestOrder$outboundSchema: z.ZodType<STTRequestOrder$Outbound, STTRequestOrder>;
|
|
154
|
+
export declare function sttRequestOrderToJSON(sttRequestOrder: STTRequestOrder): string;
|
|
155
|
+
/** @internal */
|
|
117
156
|
export type STTRequestProvider$Outbound = {
|
|
157
|
+
allow_fallbacks?: boolean | null | undefined;
|
|
118
158
|
data_collection?: string | null | undefined;
|
|
159
|
+
ignore?: Array<string | string> | null | undefined;
|
|
160
|
+
only?: Array<string | string> | null | undefined;
|
|
119
161
|
options?: ProviderOptions$Outbound | undefined;
|
|
162
|
+
order?: Array<string | string> | null | undefined;
|
|
120
163
|
zdr?: boolean | null | undefined;
|
|
121
164
|
};
|
|
122
165
|
/** @internal */
|
package/esm/models/sttrequest.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import * as openEnums from "../types/enums.js";
|
|
8
|
+
import { ProviderName$outboundSchema } from "./providername.js";
|
|
8
9
|
import { ProviderOptions$outboundSchema, } from "./provideroptions.js";
|
|
9
10
|
import { STTInputAudio$outboundSchema, } from "./sttinputaudio.js";
|
|
10
11
|
import { STTTimestampGranularity$outboundSchema, } from "./stttimestampgranularity.js";
|
|
@@ -31,13 +32,35 @@ export const STTRequestResponseFormat = {
|
|
|
31
32
|
/** @internal */
|
|
32
33
|
export const STTRequestDataCollection$outboundSchema = openEnums.outboundSchema(STTRequestDataCollection);
|
|
33
34
|
/** @internal */
|
|
35
|
+
export const STTRequestIgnore$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
|
|
36
|
+
export function sttRequestIgnoreToJSON(sttRequestIgnore) {
|
|
37
|
+
return JSON.stringify(STTRequestIgnore$outboundSchema.parse(sttRequestIgnore));
|
|
38
|
+
}
|
|
39
|
+
/** @internal */
|
|
40
|
+
export const STTRequestOnly$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
|
|
41
|
+
export function sttRequestOnlyToJSON(sttRequestOnly) {
|
|
42
|
+
return JSON.stringify(STTRequestOnly$outboundSchema.parse(sttRequestOnly));
|
|
43
|
+
}
|
|
44
|
+
/** @internal */
|
|
45
|
+
export const STTRequestOrder$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
|
|
46
|
+
export function sttRequestOrderToJSON(sttRequestOrder) {
|
|
47
|
+
return JSON.stringify(STTRequestOrder$outboundSchema.parse(sttRequestOrder));
|
|
48
|
+
}
|
|
49
|
+
/** @internal */
|
|
34
50
|
export const STTRequestProvider$outboundSchema = z.object({
|
|
51
|
+
allowFallbacks: z.nullable(z.boolean()).optional(),
|
|
35
52
|
dataCollection: z.nullable(STTRequestDataCollection$outboundSchema)
|
|
36
53
|
.optional(),
|
|
54
|
+
ignore: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()]))).optional(),
|
|
55
|
+
only: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()])))
|
|
56
|
+
.optional(),
|
|
37
57
|
options: ProviderOptions$outboundSchema.optional(),
|
|
58
|
+
order: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()])))
|
|
59
|
+
.optional(),
|
|
38
60
|
zdr: z.nullable(z.boolean()).optional(),
|
|
39
61
|
}).transform((v) => {
|
|
40
62
|
return remap$(v, {
|
|
63
|
+
allowFallbacks: "allow_fallbacks",
|
|
41
64
|
dataCollection: "data_collection",
|
|
42
65
|
});
|
|
43
66
|
});
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.46",
|
|
4
4
|
"author": "OpenRouter",
|
|
5
5
|
"description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
|
|
6
6
|
"keywords": [
|
|
@@ -74,14 +74,14 @@
|
|
|
74
74
|
"build": "tsc && node scripts/unbarrel-imports.js",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
76
|
"compile": "tsc && node scripts/unbarrel-imports.js",
|
|
77
|
+
"postinstall": "node scripts/check-types.js || true",
|
|
77
78
|
"prepare": "npm run build",
|
|
78
79
|
"test": "vitest --run --project unit",
|
|
79
80
|
"test:e2e": "vitest --run --project e2e",
|
|
80
|
-
"typecheck": "
|
|
81
|
-
"postinstall": "node scripts/check-types.js || true",
|
|
81
|
+
"typecheck:transit": "exit 0",
|
|
82
82
|
"test:transit": "exit 0",
|
|
83
83
|
"test:watch": "vitest --watch --project unit",
|
|
84
|
-
"typecheck
|
|
84
|
+
"typecheck": "tsc --noEmit"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
|