@openrouter/sdk 0.13.24 → 0.13.25

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
 
@@ -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.25";
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.25 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.25",
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.25 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
@@ -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.25",
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.25",
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": [
@@ -75,13 +75,13 @@
75
75
  "prepublishOnly": "npm run build",
76
76
  "prepare": "npm run build",
77
77
  "test": "vitest --run --project unit",
78
+ "test:e2e": "vitest --run --project e2e",
78
79
  "test:transit": "exit 0",
79
80
  "test:watch": "vitest --watch --project unit",
80
- "typecheck": "tsc --noEmit",
81
81
  "typecheck:transit": "exit 0",
82
82
  "compile": "tsc",
83
83
  "postinstall": "node scripts/check-types.js || true",
84
- "test:e2e": "vitest --run --project e2e"
84
+ "typecheck": "tsc --noEmit"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {