@openrouter/sdk 0.13.24 → 0.13.26

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 CHANGED
@@ -169,9 +169,11 @@ const openRouter = new OpenRouter({
169
169
  });
170
170
 
171
171
  async function run() {
172
- const result = await openRouter.files.upload({
172
+ const result = await openRouter.stt.createTranscriptionMultipart({
173
173
  requestBody: {
174
174
  file: await openAsBlob("example.file"),
175
+ language: "en",
176
+ model: "openai/whisper-large-v3",
175
177
  },
176
178
  });
177
179
 
@@ -33,8 +33,20 @@ async function $do(client, request, options) {
33
33
  "context": payload?.context,
34
34
  "distillable": payload?.distillable,
35
35
  "input_modalities": payload?.input_modalities,
36
+ "max_age_days": payload?.max_age_days,
37
+ "max_agentic_index": payload?.max_agentic_index,
38
+ "max_coding_index": payload?.max_coding_index,
39
+ "max_intelligence_index": payload?.max_intelligence_index,
40
+ "max_output_price": payload?.max_output_price,
36
41
  "max_price": payload?.max_price,
42
+ "max_tool_success_rate": payload?.max_tool_success_rate,
43
+ "min_age_days": payload?.min_age_days,
44
+ "min_agentic_index": payload?.min_agentic_index,
45
+ "min_coding_index": payload?.min_coding_index,
46
+ "min_intelligence_index": payload?.min_intelligence_index,
47
+ "min_output_price": payload?.min_output_price,
37
48
  "min_price": payload?.min_price,
49
+ "min_tool_success_rate": payload?.min_tool_success_rate,
38
50
  "model_authors": payload?.model_authors,
39
51
  "output_modalities": payload?.output_modalities,
40
52
  "providers": payload?.providers,
@@ -13,7 +13,7 @@ import { Result } from "../types/fp.js";
13
13
  * Create transcription
14
14
  *
15
15
  * @remarks
16
- * Transcribes audio into text. Accepts base64-encoded audio input and returns the transcribed text.
16
+ * Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text.
17
17
  */
18
18
  export declare function sttCreateTranscription(client: OpenRouterCore, request: operations.CreateAudioTranscriptionsRequest, options?: RequestOptions): APIPromise<Result<models.STTResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
19
  //# sourceMappingURL=sttCreateTranscription.d.ts.map
@@ -17,7 +17,7 @@ import { APIPromise } from "../types/async.js";
17
17
  * Create transcription
18
18
  *
19
19
  * @remarks
20
- * Transcribes audio into text. Accepts base64-encoded audio input and returns the transcribed text.
20
+ * Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text.
21
21
  */
22
22
  export function sttCreateTranscription(client, request, options) {
23
23
  return new APIPromise($do(client, request, options));
@@ -0,0 +1,19 @@
1
+ import { OpenRouterCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
4
+ import * as errors from "../models/errors/index.js";
5
+ import { OpenRouterError } from "../models/errors/openroutererror.js";
6
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
7
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
8
+ import * as models from "../models/index.js";
9
+ import * as operations from "../models/operations/index.js";
10
+ import { APIPromise } from "../types/async.js";
11
+ import { Result } from "../types/fp.js";
12
+ /**
13
+ * Create transcription
14
+ *
15
+ * @remarks
16
+ * Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text.
17
+ */
18
+ export declare function sttCreateTranscriptionMultipart(client: OpenRouterCore, request: operations.CreateAudioTranscriptionsMultipartRequest, options?: RequestOptions): APIPromise<Result<models.STTResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
+ //# sourceMappingURL=sttCreateTranscriptionMultipart.d.ts.map
@@ -0,0 +1,127 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: ec09b43036c3
4
+ */
5
+ import { appendForm, encodeSimple, normalizeBlob } from "../lib/encodings.js";
6
+ import { bytesToBlob, getContentTypeFromFileName, readableStreamToArrayBuffer, } from "../lib/files.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import * as errors from "../models/errors/index.js";
14
+ import * as models from "../models/index.js";
15
+ import * as operations from "../models/operations/index.js";
16
+ import { APIPromise } from "../types/async.js";
17
+ import { isBlobLike } from "../types/blobs.js";
18
+ import { isReadableStream } from "../types/streams.js";
19
+ /**
20
+ * Create transcription
21
+ *
22
+ * @remarks
23
+ * Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text.
24
+ */
25
+ export function sttCreateTranscriptionMultipart(client, request, options) {
26
+ return new APIPromise($do(client, request, options));
27
+ }
28
+ async function $do(client, request, options) {
29
+ const parsed = safeParse(request, (value) => operations.CreateAudioTranscriptionsMultipartRequest$outboundSchema.parse(value), "Input validation failed");
30
+ if (!parsed.ok) {
31
+ return [parsed, { status: "invalid" }];
32
+ }
33
+ const payload = parsed.value;
34
+ const body = new FormData();
35
+ if (isBlobLike(payload.RequestBody.file)) {
36
+ const file = payload.RequestBody.file;
37
+ const blob = await normalizeBlob(file);
38
+ const name = "name" in file ? file.name : undefined;
39
+ appendForm(body, "file", blob, name);
40
+ }
41
+ else if (isReadableStream(payload.RequestBody.file.content)) {
42
+ const buffer = await readableStreamToArrayBuffer(payload.RequestBody.file.content);
43
+ const contentType = getContentTypeFromFileName(payload.RequestBody.file.fileName)
44
+ || "application/octet-stream";
45
+ appendForm(body, "file", bytesToBlob(buffer, contentType), payload.RequestBody.file.fileName);
46
+ }
47
+ else {
48
+ const contentType = getContentTypeFromFileName(payload.RequestBody.file.fileName)
49
+ || "application/octet-stream";
50
+ appendForm(body, "file", bytesToBlob(payload.RequestBody.file.content, contentType), payload.RequestBody.file.fileName);
51
+ }
52
+ appendForm(body, "model", payload.RequestBody.model);
53
+ if (payload.RequestBody.language !== undefined) {
54
+ appendForm(body, "language", payload.RequestBody.language);
55
+ }
56
+ if (payload.RequestBody.response_format !== undefined) {
57
+ appendForm(body, "response_format", payload.RequestBody.response_format);
58
+ }
59
+ if (payload.RequestBody.temperature !== undefined) {
60
+ appendForm(body, "temperature", payload.RequestBody.temperature);
61
+ }
62
+ const path = pathToFunc("/audio/transcriptions")();
63
+ const headers = new Headers(compactMap({
64
+ Accept: "application/json",
65
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
66
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
67
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
68
+ }));
69
+ const secConfig = await extractSecurity(client._options.apiKey);
70
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
71
+ const requestSecurity = resolveGlobalSecurity(securityInput);
72
+ const context = {
73
+ options: client._options,
74
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
75
+ operationID: "createAudioTranscriptions_multipart",
76
+ oAuth2Scopes: null,
77
+ resolvedSecurity: requestSecurity,
78
+ securitySource: client._options.apiKey,
79
+ retryConfig: options?.retries
80
+ || client._options.retryConfig
81
+ || {
82
+ strategy: "backoff",
83
+ backoff: {
84
+ initialInterval: 500,
85
+ maxInterval: 60000,
86
+ exponent: 1.5,
87
+ maxElapsedTime: 3600000,
88
+ },
89
+ retryConnectionErrors: true,
90
+ }
91
+ || { strategy: "none" },
92
+ retryCodes: options?.retryCodes || ["5XX"],
93
+ };
94
+ const requestRes = client._createRequest(context, {
95
+ security: requestSecurity,
96
+ method: "POST",
97
+ baseURL: options?.serverURL,
98
+ path: path,
99
+ headers: headers,
100
+ body: body,
101
+ userAgent: client._options.userAgent,
102
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
103
+ }, options);
104
+ if (!requestRes.ok) {
105
+ return [requestRes, { status: "invalid" }];
106
+ }
107
+ const req = requestRes.value;
108
+ const doResult = await client._do(req, {
109
+ context,
110
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
111
+ retryConfig: context.retryConfig,
112
+ retryCodes: context.retryCodes,
113
+ });
114
+ if (!doResult.ok) {
115
+ return [doResult, { status: "request-error", request: req }];
116
+ }
117
+ const response = doResult.value;
118
+ const responseFields = {
119
+ HttpMeta: { Response: response, Request: req },
120
+ };
121
+ const [result] = await M.match(M.json(200, models.STTResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors.PaymentRequiredResponseError$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(503, errors.ServiceUnavailableResponseError$inboundSchema), M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors.ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
122
+ if (!result.ok) {
123
+ return [result, { status: "complete", request: req, response }];
124
+ }
125
+ return [result, { status: "complete", request: req, response }];
126
+ }
127
+ //# sourceMappingURL=sttCreateTranscriptionMultipart.js.map
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
49
49
  export declare const SDK_METADATA: {
50
50
  readonly language: "typescript";
51
51
  readonly openapiDocVersion: "1.0.0";
52
- readonly sdkVersion: "0.13.24";
52
+ readonly sdkVersion: "0.13.26";
53
53
  readonly genVersion: "2.884.4";
54
- readonly userAgent: "speakeasy-sdk/typescript 0.13.24 2.884.4 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 0.13.26 2.884.4 1.0.0 @openrouter/sdk";
55
55
  };
56
56
  //# sourceMappingURL=config.d.ts.map
package/esm/lib/config.js CHANGED
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
26
26
  export const SDK_METADATA = {
27
27
  language: "typescript",
28
28
  openapiDocVersion: "1.0.0",
29
- sdkVersion: "0.13.24",
29
+ sdkVersion: "0.13.26",
30
30
  genVersion: "2.884.4",
31
- userAgent: "speakeasy-sdk/typescript 0.13.24 2.884.4 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 0.13.26 2.884.4 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -507,7 +507,7 @@ export type ImageGenerationRequest = {
507
507
  */
508
508
  seed?: number | undefined;
509
509
  /**
510
- * Optional. A convenience shorthand for output dimensions — pass a tier ("2K", "4K") or explicit pixels ("2048x2048") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected.
510
+ * Optional. A convenience shorthand for output dimensions — pass a tier ("2K", "4K") or explicit pixels ("2048x2048") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400.
511
511
  */
512
512
  size?: string | undefined;
513
513
  /**
@@ -0,0 +1,113 @@
1
+ import * as z from "zod/v4";
2
+ import { ClosedEnum } from "../../types/enums.js";
3
+ export type CreateAudioTranscriptionsMultipartGlobals = {
4
+ /**
5
+ * The app identifier should be your app's URL and is used as the primary identifier for rankings.
6
+ *
7
+ * @remarks
8
+ * This is used to track API usage per application.
9
+ */
10
+ httpReferer?: string | undefined;
11
+ /**
12
+ * The app display name allows you to customize how your app appears in OpenRouter's dashboard.
13
+ *
14
+ * @remarks
15
+ */
16
+ appTitle?: string | undefined;
17
+ /**
18
+ * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
19
+ *
20
+ * @remarks
21
+ */
22
+ appCategories?: string | undefined;
23
+ };
24
+ export type CreateAudioTranscriptionsMultipartFile = {
25
+ fileName: string;
26
+ content: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array;
27
+ };
28
+ /**
29
+ * The response format. Only "json" is supported.
30
+ */
31
+ export declare const ResponseFormat: {
32
+ readonly Json: "json";
33
+ };
34
+ /**
35
+ * The response format. Only "json" is supported.
36
+ */
37
+ export type ResponseFormat = ClosedEnum<typeof ResponseFormat>;
38
+ export type CreateAudioTranscriptionsMultipartRequestBody = {
39
+ /**
40
+ * The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio.
41
+ */
42
+ file: CreateAudioTranscriptionsMultipartFile | Blob;
43
+ /**
44
+ * The language of the input audio (ISO-639-1).
45
+ */
46
+ language?: string | undefined;
47
+ /**
48
+ * The model to use for transcription.
49
+ */
50
+ model: string;
51
+ /**
52
+ * The response format. Only "json" is supported.
53
+ */
54
+ responseFormat?: ResponseFormat | undefined;
55
+ /**
56
+ * The sampling temperature.
57
+ */
58
+ temperature?: number | undefined;
59
+ };
60
+ export type CreateAudioTranscriptionsMultipartRequest = {
61
+ /**
62
+ * The app identifier should be your app's URL and is used as the primary identifier for rankings.
63
+ *
64
+ * @remarks
65
+ * This is used to track API usage per application.
66
+ */
67
+ httpReferer?: string | undefined;
68
+ /**
69
+ * The app display name allows you to customize how your app appears in OpenRouter's dashboard.
70
+ *
71
+ * @remarks
72
+ */
73
+ appTitle?: string | undefined;
74
+ /**
75
+ * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
76
+ *
77
+ * @remarks
78
+ */
79
+ appCategories?: string | undefined;
80
+ requestBody: CreateAudioTranscriptionsMultipartRequestBody;
81
+ };
82
+ /** @internal */
83
+ export type CreateAudioTranscriptionsMultipartFile$Outbound = {
84
+ fileName: string;
85
+ content: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array;
86
+ };
87
+ /** @internal */
88
+ export declare const CreateAudioTranscriptionsMultipartFile$outboundSchema: z.ZodType<CreateAudioTranscriptionsMultipartFile$Outbound, CreateAudioTranscriptionsMultipartFile>;
89
+ export declare function createAudioTranscriptionsMultipartFileToJSON(createAudioTranscriptionsMultipartFile: CreateAudioTranscriptionsMultipartFile): string;
90
+ /** @internal */
91
+ export declare const ResponseFormat$outboundSchema: z.ZodEnum<typeof ResponseFormat>;
92
+ /** @internal */
93
+ export type CreateAudioTranscriptionsMultipartRequestBody$Outbound = {
94
+ file: CreateAudioTranscriptionsMultipartFile$Outbound | Blob;
95
+ language?: string | undefined;
96
+ model: string;
97
+ response_format?: string | undefined;
98
+ temperature?: number | undefined;
99
+ };
100
+ /** @internal */
101
+ export declare const CreateAudioTranscriptionsMultipartRequestBody$outboundSchema: z.ZodType<CreateAudioTranscriptionsMultipartRequestBody$Outbound, CreateAudioTranscriptionsMultipartRequestBody>;
102
+ export declare function createAudioTranscriptionsMultipartRequestBodyToJSON(createAudioTranscriptionsMultipartRequestBody: CreateAudioTranscriptionsMultipartRequestBody): string;
103
+ /** @internal */
104
+ export type CreateAudioTranscriptionsMultipartRequest$Outbound = {
105
+ "HTTP-Referer"?: string | undefined;
106
+ appTitle?: string | undefined;
107
+ appCategories?: string | undefined;
108
+ RequestBody: CreateAudioTranscriptionsMultipartRequestBody$Outbound;
109
+ };
110
+ /** @internal */
111
+ export declare const CreateAudioTranscriptionsMultipartRequest$outboundSchema: z.ZodType<CreateAudioTranscriptionsMultipartRequest$Outbound, CreateAudioTranscriptionsMultipartRequest>;
112
+ export declare function createAudioTranscriptionsMultipartRequestToJSON(createAudioTranscriptionsMultipartRequest: CreateAudioTranscriptionsMultipartRequest): string;
113
+ //# sourceMappingURL=createaudiotranscriptionsmultipart.d.ts.map
@@ -0,0 +1,61 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 29a4e7468387
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { blobLikeSchema } from "../../types/blobs.js";
8
+ /**
9
+ * The response format. Only "json" is supported.
10
+ */
11
+ export const ResponseFormat = {
12
+ Json: "json",
13
+ };
14
+ /** @internal */
15
+ export const CreateAudioTranscriptionsMultipartFile$outboundSchema = z.object({
16
+ fileName: z.string(),
17
+ content: z.union([
18
+ z.custom(x => x instanceof ReadableStream),
19
+ z.custom(x => x instanceof Blob),
20
+ z.custom(x => x instanceof ArrayBuffer),
21
+ z.custom(x => x instanceof Uint8Array),
22
+ ]),
23
+ });
24
+ export function createAudioTranscriptionsMultipartFileToJSON(createAudioTranscriptionsMultipartFile) {
25
+ return JSON.stringify(CreateAudioTranscriptionsMultipartFile$outboundSchema.parse(createAudioTranscriptionsMultipartFile));
26
+ }
27
+ /** @internal */
28
+ export const ResponseFormat$outboundSchema = z
29
+ .enum(ResponseFormat);
30
+ /** @internal */
31
+ export const CreateAudioTranscriptionsMultipartRequestBody$outboundSchema = z.object({
32
+ file: z.lazy(() => CreateAudioTranscriptionsMultipartFile$outboundSchema)
33
+ .or(blobLikeSchema),
34
+ language: z.string().optional(),
35
+ model: z.string(),
36
+ responseFormat: ResponseFormat$outboundSchema.optional(),
37
+ temperature: z.number().optional(),
38
+ }).transform((v) => {
39
+ return remap$(v, {
40
+ responseFormat: "response_format",
41
+ });
42
+ });
43
+ export function createAudioTranscriptionsMultipartRequestBodyToJSON(createAudioTranscriptionsMultipartRequestBody) {
44
+ return JSON.stringify(CreateAudioTranscriptionsMultipartRequestBody$outboundSchema.parse(createAudioTranscriptionsMultipartRequestBody));
45
+ }
46
+ /** @internal */
47
+ export const CreateAudioTranscriptionsMultipartRequest$outboundSchema = z.object({
48
+ httpReferer: z.string().optional(),
49
+ appTitle: z.string().optional(),
50
+ appCategories: z.string().optional(),
51
+ requestBody: z.lazy(() => CreateAudioTranscriptionsMultipartRequestBody$outboundSchema),
52
+ }).transform((v) => {
53
+ return remap$(v, {
54
+ httpReferer: "HTTP-Referer",
55
+ requestBody: "RequestBody",
56
+ });
57
+ });
58
+ export function createAudioTranscriptionsMultipartRequestToJSON(createAudioTranscriptionsMultipartRequest) {
59
+ return JSON.stringify(CreateAudioTranscriptionsMultipartRequest$outboundSchema.parse(createAudioTranscriptionsMultipartRequest));
60
+ }
61
+ //# sourceMappingURL=createaudiotranscriptionsmultipart.js.map
@@ -43,7 +43,7 @@ export declare const GetModelsCategory: {
43
43
  */
44
44
  export type GetModelsCategory = OpenEnum<typeof GetModelsCategory>;
45
45
  /**
46
- * Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low (Artificial Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.
46
+ * Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.
47
47
  */
48
48
  export declare const GetModelsSort: {
49
49
  readonly MostPopular: "most-popular";
@@ -55,10 +55,12 @@ export declare const GetModelsSort: {
55
55
  readonly ThroughputHighToLow: "throughput-high-to-low";
56
56
  readonly LatencyLowToHigh: "latency-low-to-high";
57
57
  readonly IntelligenceHighToLow: "intelligence-high-to-low";
58
+ readonly CodingHighToLow: "coding-high-to-low";
59
+ readonly AgenticHighToLow: "agentic-high-to-low";
58
60
  readonly DesignArenaEloHighToLow: "design-arena-elo-high-to-low";
59
61
  };
60
62
  /**
61
- * Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low (Artificial Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.
63
+ * Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.
62
64
  */
63
65
  export type GetModelsSort = OpenEnum<typeof GetModelsSort>;
64
66
  /**
@@ -125,7 +127,7 @@ export type GetModelsRequest = {
125
127
  */
126
128
  outputModalities?: string | undefined;
127
129
  /**
128
- * Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low (Artificial Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.
130
+ * Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.
129
131
  */
130
132
  sort?: GetModelsSort | undefined;
131
133
  /**
@@ -172,6 +174,54 @@ export type GetModelsRequest = {
172
174
  * Filter to models with endpoints in the given data region. Currently only "eu" is supported.
173
175
  */
174
176
  region?: Region | undefined;
177
+ /**
178
+ * Minimum completion (output) price in $/M tokens.
179
+ */
180
+ minOutputPrice?: number | null | undefined;
181
+ /**
182
+ * Maximum completion (output) price in $/M tokens.
183
+ */
184
+ maxOutputPrice?: number | null | undefined;
185
+ /**
186
+ * Minimum model age in days since its creation date.
187
+ */
188
+ minAgeDays?: number | null | undefined;
189
+ /**
190
+ * Maximum model age in days since its creation date.
191
+ */
192
+ maxAgeDays?: number | null | undefined;
193
+ /**
194
+ * Minimum Artificial Analysis intelligence index.
195
+ */
196
+ minIntelligenceIndex?: number | null | undefined;
197
+ /**
198
+ * Maximum Artificial Analysis intelligence index.
199
+ */
200
+ maxIntelligenceIndex?: number | null | undefined;
201
+ /**
202
+ * Minimum Artificial Analysis coding index.
203
+ */
204
+ minCodingIndex?: number | null | undefined;
205
+ /**
206
+ * Maximum Artificial Analysis coding index.
207
+ */
208
+ maxCodingIndex?: number | null | undefined;
209
+ /**
210
+ * Minimum Artificial Analysis agentic index.
211
+ */
212
+ minAgenticIndex?: number | null | undefined;
213
+ /**
214
+ * Maximum Artificial Analysis agentic index.
215
+ */
216
+ maxAgenticIndex?: number | null | undefined;
217
+ /**
218
+ * Minimum tool-calling success rate, as a fraction in [0, 1] (e.g. 0.9 = 90% of requests finishing with a tool_calls finish reason).
219
+ */
220
+ minToolSuccessRate?: number | null | undefined;
221
+ /**
222
+ * Maximum tool-calling success rate, as a fraction in [0, 1].
223
+ */
224
+ maxToolSuccessRate?: number | null | undefined;
175
225
  };
176
226
  /** @internal */
177
227
  export declare const GetModelsCategory$outboundSchema: z.ZodType<string, GetModelsCategory>;
@@ -203,6 +253,18 @@ export type GetModelsRequest$Outbound = {
203
253
  distillable?: string | undefined;
204
254
  zdr?: string | undefined;
205
255
  region?: string | undefined;
256
+ min_output_price?: number | null | undefined;
257
+ max_output_price?: number | null | undefined;
258
+ min_age_days?: number | null | undefined;
259
+ max_age_days?: number | null | undefined;
260
+ min_intelligence_index?: number | null | undefined;
261
+ max_intelligence_index?: number | null | undefined;
262
+ min_coding_index?: number | null | undefined;
263
+ max_coding_index?: number | null | undefined;
264
+ min_agentic_index?: number | null | undefined;
265
+ max_agentic_index?: number | null | undefined;
266
+ min_tool_success_rate?: number | null | undefined;
267
+ max_tool_success_rate?: number | null | undefined;
206
268
  };
207
269
  /** @internal */
208
270
  export declare const GetModelsRequest$outboundSchema: z.ZodType<GetModelsRequest$Outbound, GetModelsRequest>;
@@ -23,7 +23,7 @@ export const GetModelsCategory = {
23
23
  Academia: "academia",
24
24
  };
25
25
  /**
26
- * Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low (Artificial Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.
26
+ * Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.
27
27
  */
28
28
  export const GetModelsSort = {
29
29
  MostPopular: "most-popular",
@@ -35,6 +35,8 @@ export const GetModelsSort = {
35
35
  ThroughputHighToLow: "throughput-high-to-low",
36
36
  LatencyLowToHigh: "latency-low-to-high",
37
37
  IntelligenceHighToLow: "intelligence-high-to-low",
38
+ CodingHighToLow: "coding-high-to-low",
39
+ AgenticHighToLow: "agentic-high-to-low",
38
40
  DesignArenaEloHighToLow: "design-arena-elo-high-to-low",
39
41
  };
40
42
  /**
@@ -86,6 +88,18 @@ export const GetModelsRequest$outboundSchema = z.object({
86
88
  distillable: Distillable$outboundSchema.optional(),
87
89
  zdr: Zdr$outboundSchema.optional(),
88
90
  region: Region$outboundSchema.optional(),
91
+ minOutputPrice: z.nullable(z.number()).optional(),
92
+ maxOutputPrice: z.nullable(z.number()).optional(),
93
+ minAgeDays: z.nullable(z.int()).optional(),
94
+ maxAgeDays: z.nullable(z.int()).optional(),
95
+ minIntelligenceIndex: z.nullable(z.number()).optional(),
96
+ maxIntelligenceIndex: z.nullable(z.number()).optional(),
97
+ minCodingIndex: z.nullable(z.number()).optional(),
98
+ maxCodingIndex: z.nullable(z.number()).optional(),
99
+ minAgenticIndex: z.nullable(z.number()).optional(),
100
+ maxAgenticIndex: z.nullable(z.number()).optional(),
101
+ minToolSuccessRate: z.nullable(z.number()).optional(),
102
+ maxToolSuccessRate: z.nullable(z.number()).optional(),
89
103
  }).transform((v) => {
90
104
  return remap$(v, {
91
105
  httpReferer: "HTTP-Referer",
@@ -95,6 +109,18 @@ export const GetModelsRequest$outboundSchema = z.object({
95
109
  minPrice: "min_price",
96
110
  maxPrice: "max_price",
97
111
  modelAuthors: "model_authors",
112
+ minOutputPrice: "min_output_price",
113
+ maxOutputPrice: "max_output_price",
114
+ minAgeDays: "min_age_days",
115
+ maxAgeDays: "max_age_days",
116
+ minIntelligenceIndex: "min_intelligence_index",
117
+ maxIntelligenceIndex: "max_intelligence_index",
118
+ minCodingIndex: "min_coding_index",
119
+ maxCodingIndex: "max_coding_index",
120
+ minAgenticIndex: "min_agentic_index",
121
+ maxAgenticIndex: "max_agentic_index",
122
+ minToolSuccessRate: "min_tool_success_rate",
123
+ maxToolSuccessRate: "max_tool_success_rate",
98
124
  });
99
125
  });
100
126
  export function getModelsRequestToJSON(getModelsRequest) {
@@ -6,6 +6,7 @@ export * from "./bulkunassignkeysfromguardrail.js";
6
6
  export * from "./bulkunassignmembersfromguardrail.js";
7
7
  export * from "./createaudiospeech.js";
8
8
  export * from "./createaudiotranscriptions.js";
9
+ export * from "./createaudiotranscriptionsmultipart.js";
9
10
  export * from "./createauthkeyscode.js";
10
11
  export * from "./createbyokkey.js";
11
12
  export * from "./createembeddings.js";
@@ -10,6 +10,7 @@ export * from "./bulkunassignkeysfromguardrail.js";
10
10
  export * from "./bulkunassignmembersfromguardrail.js";
11
11
  export * from "./createaudiospeech.js";
12
12
  export * from "./createaudiotranscriptions.js";
13
+ export * from "./createaudiotranscriptionsmultipart.js";
13
14
  export * from "./createauthkeyscode.js";
14
15
  export * from "./createbyokkey.js";
15
16
  export * from "./createembeddings.js";
@@ -20,12 +20,12 @@ export type UploadFileGlobals = {
20
20
  */
21
21
  appCategories?: string | undefined;
22
22
  };
23
- export type FileT = {
23
+ export type UploadFileFile = {
24
24
  fileName: string;
25
25
  content: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array;
26
26
  };
27
27
  export type UploadFileRequestBody = {
28
- file: FileT | Blob;
28
+ file: UploadFileFile | Blob;
29
29
  };
30
30
  export type UploadFileRequest = {
31
31
  /**
@@ -54,16 +54,16 @@ export type UploadFileRequest = {
54
54
  requestBody: UploadFileRequestBody;
55
55
  };
56
56
  /** @internal */
57
- export type FileT$Outbound = {
57
+ export type UploadFileFile$Outbound = {
58
58
  fileName: string;
59
59
  content: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array;
60
60
  };
61
61
  /** @internal */
62
- export declare const FileT$outboundSchema: z.ZodType<FileT$Outbound, FileT>;
63
- export declare function fileToJSON(fileT: FileT): string;
62
+ export declare const UploadFileFile$outboundSchema: z.ZodType<UploadFileFile$Outbound, UploadFileFile>;
63
+ export declare function uploadFileFileToJSON(uploadFileFile: UploadFileFile): string;
64
64
  /** @internal */
65
65
  export type UploadFileRequestBody$Outbound = {
66
- file: FileT$Outbound | Blob;
66
+ file: UploadFileFile$Outbound | Blob;
67
67
  };
68
68
  /** @internal */
69
69
  export declare const UploadFileRequestBody$outboundSchema: z.ZodType<UploadFileRequestBody$Outbound, UploadFileRequestBody>;
@@ -6,7 +6,7 @@ import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { blobLikeSchema } from "../../types/blobs.js";
8
8
  /** @internal */
9
- export const FileT$outboundSchema = z.object({
9
+ export const UploadFileFile$outboundSchema = z.object({
10
10
  fileName: z.string(),
11
11
  content: z.union([
12
12
  z.custom(x => x instanceof ReadableStream),
@@ -15,12 +15,12 @@ export const FileT$outboundSchema = z.object({
15
15
  z.custom(x => x instanceof Uint8Array),
16
16
  ]),
17
17
  });
18
- export function fileToJSON(fileT) {
19
- return JSON.stringify(FileT$outboundSchema.parse(fileT));
18
+ export function uploadFileFileToJSON(uploadFileFile) {
19
+ return JSON.stringify(UploadFileFile$outboundSchema.parse(uploadFileFile));
20
20
  }
21
21
  /** @internal */
22
22
  export const UploadFileRequestBody$outboundSchema = z.object({
23
- file: z.lazy(() => FileT$outboundSchema).or(blobLikeSchema),
23
+ file: z.lazy(() => UploadFileFile$outboundSchema).or(blobLikeSchema),
24
24
  });
25
25
  export function uploadFileRequestBodyToJSON(uploadFileRequestBody) {
26
26
  return JSON.stringify(UploadFileRequestBody$outboundSchema.parse(uploadFileRequestBody));
@@ -1,4 +1,16 @@
1
1
  import * as z from "zod/v4";
2
+ import { OpenEnum } from "../types/enums.js";
3
+ /**
4
+ * Price source for the Pareto frontier cost axis. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
5
+ */
6
+ export declare const PriceSource: {
7
+ readonly Prompt: "prompt";
8
+ readonly WeightedAvg: "weighted_avg";
9
+ };
10
+ /**
11
+ * Price source for the Pareto frontier cost axis. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
12
+ */
13
+ export type PriceSource = OpenEnum<typeof PriceSource>;
2
14
  export type ParetoRouterPlugin = {
3
15
  /**
4
16
  * Set to false to disable the pareto-router plugin for this request. Defaults to true.
@@ -6,15 +18,22 @@ export type ParetoRouterPlugin = {
6
18
  enabled?: boolean | undefined;
7
19
  id: "pareto-router";
8
20
  /**
9
- * Minimum desired coding score between 0 and 1, where 1 is best. Higher values select from stronger coding models (sourced from Artificial Analysis coding percentiles). Maps internally to one of three tiers (low, medium, high). Omit to use the router default tier.
21
+ * Minimum coding quality score between 0 and 1. Maps to internal quality tiers: >= 0.66 high (top coding models), >= 0.33 medium (strong modern flagships), < 0.33 low (capable coders above the median). Omit to default to the highest tier (equivalent to >= 0.66).
10
22
  */
11
23
  minCodingScore?: number | undefined;
24
+ /**
25
+ * Price source for the Pareto frontier cost axis. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
26
+ */
27
+ priceSource?: PriceSource | undefined;
12
28
  };
13
29
  /** @internal */
30
+ export declare const PriceSource$outboundSchema: z.ZodType<string, PriceSource>;
31
+ /** @internal */
14
32
  export type ParetoRouterPlugin$Outbound = {
15
33
  enabled?: boolean | undefined;
16
34
  id: "pareto-router";
17
35
  min_coding_score?: number | undefined;
36
+ price_source?: string | undefined;
18
37
  };
19
38
  /** @internal */
20
39
  export declare const ParetoRouterPlugin$outboundSchema: z.ZodType<ParetoRouterPlugin$Outbound, ParetoRouterPlugin>;
@@ -4,14 +4,26 @@
4
4
  */
5
5
  import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../lib/primitives.js";
7
+ import * as openEnums from "../types/enums.js";
8
+ /**
9
+ * Price source for the Pareto frontier cost axis. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
10
+ */
11
+ export const PriceSource = {
12
+ Prompt: "prompt",
13
+ WeightedAvg: "weighted_avg",
14
+ };
15
+ /** @internal */
16
+ export const PriceSource$outboundSchema = openEnums.outboundSchema(PriceSource);
7
17
  /** @internal */
8
18
  export const ParetoRouterPlugin$outboundSchema = z.object({
9
19
  enabled: z.boolean().optional(),
10
20
  id: z.literal("pareto-router"),
11
21
  minCodingScore: z.number().optional(),
22
+ priceSource: PriceSource$outboundSchema.optional(),
12
23
  }).transform((v) => {
13
24
  return remap$(v, {
14
25
  minCodingScore: "min_coding_score",
26
+ priceSource: "price_source",
15
27
  });
16
28
  });
17
29
  export function paretoRouterPluginToJSON(paretoRouterPlugin) {
package/esm/sdk/stt.d.ts CHANGED
@@ -6,8 +6,15 @@ export declare class Stt extends ClientSDK {
6
6
  * Create transcription
7
7
  *
8
8
  * @remarks
9
- * Transcribes audio into text. Accepts base64-encoded audio input and returns the transcribed text.
9
+ * Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text.
10
10
  */
11
11
  createTranscription(request: operations.CreateAudioTranscriptionsRequest, options?: RequestOptions): Promise<models.STTResponse>;
12
+ /**
13
+ * Create transcription
14
+ *
15
+ * @remarks
16
+ * Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text.
17
+ */
18
+ createTranscriptionMultipart(request: operations.CreateAudioTranscriptionsMultipartRequest, options?: RequestOptions): Promise<models.STTResponse>;
12
19
  }
13
20
  //# sourceMappingURL=stt.d.ts.map
package/esm/sdk/stt.js CHANGED
@@ -3,6 +3,7 @@
3
3
  * @generated-id: fd9e88c22d1f
4
4
  */
5
5
  import { sttCreateTranscription } from "../funcs/sttCreateTranscription.js";
6
+ import { sttCreateTranscriptionMultipart } from "../funcs/sttCreateTranscriptionMultipart.js";
6
7
  import { ClientSDK } from "../lib/sdks.js";
7
8
  import { unwrapAsync } from "../types/fp.js";
8
9
  export class Stt extends ClientSDK {
@@ -10,10 +11,19 @@ export class Stt extends ClientSDK {
10
11
  * Create transcription
11
12
  *
12
13
  * @remarks
13
- * Transcribes audio into text. Accepts base64-encoded audio input and returns the transcribed text.
14
+ * Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text.
14
15
  */
15
16
  async createTranscription(request, options) {
16
17
  return unwrapAsync(sttCreateTranscription(this, request, options));
17
18
  }
19
+ /**
20
+ * Create transcription
21
+ *
22
+ * @remarks
23
+ * Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text.
24
+ */
25
+ async createTranscriptionMultipart(request, options) {
26
+ return unwrapAsync(sttCreateTranscriptionMultipart(this, request, options));
27
+ }
18
28
  }
19
29
  //# sourceMappingURL=stt.js.map
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "0.13.24",
5
+ "version": "0.13.26",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrouter/sdk",
3
- "version": "0.13.24",
3
+ "version": "0.13.26",
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",
75
75
  "prepublishOnly": "npm run build",
76
76
  "prepare": "npm run build",
77
+ "test:e2e": "vitest --run --project e2e",
78
+ "compile": "tsc",
77
79
  "test": "vitest --run --project unit",
78
80
  "test:transit": "exit 0",
79
81
  "test:watch": "vitest --watch --project unit",
80
82
  "typecheck": "tsc --noEmit",
81
83
  "typecheck:transit": "exit 0",
82
- "compile": "tsc",
83
- "postinstall": "node scripts/check-types.js || true",
84
- "test:e2e": "vitest --run --project e2e"
84
+ "postinstall": "node scripts/check-types.js || true"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {