@openrouter/sdk 0.12.25 → 0.12.27

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.
@@ -13,7 +13,7 @@ import { Result } from "../types/fp.js";
13
13
  * Create transcription
14
14
  *
15
15
  * @remarks
16
- * Transcribes audio into text
16
+ * Transcribes audio into text. Accepts base64-encoded audio input 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
@@ -16,7 +16,7 @@ import { APIPromise } from "../types/async.js";
16
16
  * Create transcription
17
17
  *
18
18
  * @remarks
19
- * Transcribes audio into text
19
+ * Transcribes audio into text. Accepts base64-encoded audio input and returns the transcribed text.
20
20
  */
21
21
  export function sttCreateTranscription(client, request, options) {
22
22
  return new APIPromise($do(client, request, options));
@@ -12,7 +12,7 @@ import { Result } from "../types/fp.js";
12
12
  * Create speech
13
13
  *
14
14
  * @remarks
15
- * Synthesizes audio from the input text
15
+ * Synthesizes audio from the input text. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm, wav).
16
16
  */
17
17
  export declare function ttsCreateSpeech(client: OpenRouterCore, request: operations.CreateAudioSpeechRequest, options?: RequestOptions): APIPromise<Result<ReadableStream<Uint8Array>, 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>>;
18
18
  //# sourceMappingURL=ttsCreateSpeech.d.ts.map
@@ -16,7 +16,7 @@ import { APIPromise } from "../types/async.js";
16
16
  * Create speech
17
17
  *
18
18
  * @remarks
19
- * Synthesizes audio from the input text
19
+ * Synthesizes audio from the input text. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm, wav).
20
20
  */
21
21
  export function ttsCreateSpeech(client, request, options) {
22
22
  return new APIPromise($do(client, request, options));
@@ -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.12.25";
52
+ readonly sdkVersion: "0.12.27";
53
53
  readonly genVersion: "2.879.1";
54
- readonly userAgent: "speakeasy-sdk/typescript 0.12.25 2.879.1 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 0.12.27 2.879.1 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.12.25",
29
+ sdkVersion: "0.12.27",
30
30
  genVersion: "2.879.1",
31
- userAgent: "speakeasy-sdk/typescript 0.12.25 2.879.1 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 0.12.27 2.879.1 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -16,7 +16,7 @@ export type ChatWebSearchShorthandType = OpenEnum<typeof ChatWebSearchShorthandT
16
16
  */
17
17
  export type ChatWebSearchShorthand = {
18
18
  /**
19
- * Limit search results to these domains. Supported by Exa, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Firecrawl or Perplexity.
19
+ * Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.
20
20
  */
21
21
  allowedDomains?: Array<string> | undefined;
22
22
  /**
@@ -24,7 +24,7 @@ export type ChatWebSearchShorthand = {
24
24
  */
25
25
  engine?: WebSearchEngineEnum | undefined;
26
26
  /**
27
- * Exclude search results from these domains. Supported by Exa, Parallel, Anthropic, and xAI. Not supported with Firecrawl, OpenAI (silently ignored), or Perplexity.
27
+ * Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.
28
28
  */
29
29
  excludedDomains?: Array<string> | undefined;
30
30
  /**
@@ -290,6 +290,7 @@ export * from "./websearchengine.js";
290
290
  export * from "./websearchengineenum.js";
291
291
  export * from "./websearchplugin.js";
292
292
  export * from "./websearchservertool.js";
293
+ export * from "./websearchservertoolconfig.js";
293
294
  export * from "./websearchservertoolopenrouter.js";
294
295
  export * from "./websearchsource.js";
295
296
  export * from "./websearchstatus.js";
@@ -294,6 +294,7 @@ export * from "./websearchengine.js";
294
294
  export * from "./websearchengineenum.js";
295
295
  export * from "./websearchplugin.js";
296
296
  export * from "./websearchservertool.js";
297
+ export * from "./websearchservertoolconfig.js";
297
298
  export * from "./websearchservertoolopenrouter.js";
298
299
  export * from "./websearchsource.js";
299
300
  export * from "./websearchstatus.js";
@@ -72,6 +72,10 @@ export type Model = {
72
72
  * List of supported parameters for this model
73
73
  */
74
74
  supportedParameters: Array<Parameter>;
75
+ /**
76
+ * List of supported voice identifiers for TTS models. Null for non-TTS models.
77
+ */
78
+ supportedVoices: Array<string> | null;
75
79
  /**
76
80
  * Information about the top provider for this model
77
81
  */
@@ -29,6 +29,7 @@ export const Model$inboundSchema = z.object({
29
29
  per_request_limits: z.nullable(PerRequestLimits$inboundSchema),
30
30
  pricing: PublicPricing$inboundSchema,
31
31
  supported_parameters: z.array(Parameter$inboundSchema),
32
+ supported_voices: z.nullable(z.array(z.string())),
32
33
  top_provider: TopProviderInfo$inboundSchema,
33
34
  }).transform((v) => {
34
35
  return remap$(v, {
@@ -40,6 +41,7 @@ export const Model$inboundSchema = z.object({
40
41
  "knowledge_cutoff": "knowledgeCutoff",
41
42
  "per_request_limits": "perRequestLimits",
42
43
  "supported_parameters": "supportedParameters",
44
+ "supported_voices": "supportedVoices",
43
45
  "top_provider": "topProvider",
44
46
  });
45
47
  });
@@ -4,7 +4,7 @@ import { WebSearchEngineEnum } from "./websearchengineenum.js";
4
4
  import { WebSearchUserLocationServerTool, WebSearchUserLocationServerTool$Outbound } from "./websearchuserlocationservertool.js";
5
5
  export type WebSearchConfig = {
6
6
  /**
7
- * Limit search results to these domains. Supported by Exa, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Firecrawl or Perplexity.
7
+ * Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.
8
8
  */
9
9
  allowedDomains?: Array<string> | undefined;
10
10
  /**
@@ -12,7 +12,7 @@ export type WebSearchConfig = {
12
12
  */
13
13
  engine?: WebSearchEngineEnum | undefined;
14
14
  /**
15
- * Exclude search results from these domains. Supported by Exa, Parallel, Anthropic, and xAI. Not supported with Firecrawl, OpenAI (silently ignored), or Perplexity.
15
+ * Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.
16
16
  */
17
17
  excludedDomains?: Array<string> | undefined;
18
18
  /**
@@ -0,0 +1,51 @@
1
+ import * as z from "zod/v4";
2
+ import { SearchQualityLevel } from "./searchqualitylevel.js";
3
+ import { WebSearchEngineEnum } from "./websearchengineenum.js";
4
+ import { WebSearchUserLocationServerTool, WebSearchUserLocationServerTool$Outbound } from "./websearchuserlocationservertool.js";
5
+ /**
6
+ * Configuration for the openrouter:web_search server tool
7
+ */
8
+ export type WebSearchServerToolConfig = {
9
+ /**
10
+ * Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.
11
+ */
12
+ allowedDomains?: Array<string> | undefined;
13
+ /**
14
+ * Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API.
15
+ */
16
+ engine?: WebSearchEngineEnum | undefined;
17
+ /**
18
+ * Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.
19
+ */
20
+ excludedDomains?: Array<string> | undefined;
21
+ /**
22
+ * Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.
23
+ */
24
+ maxResults?: number | undefined;
25
+ /**
26
+ * Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops.
27
+ */
28
+ maxTotalResults?: number | undefined;
29
+ /**
30
+ * How much context to retrieve per result. Defaults to medium (15000 chars). Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl.
31
+ */
32
+ searchContextSize?: SearchQualityLevel | undefined;
33
+ /**
34
+ * Approximate user location for location-biased results.
35
+ */
36
+ userLocation?: WebSearchUserLocationServerTool | undefined;
37
+ };
38
+ /** @internal */
39
+ export type WebSearchServerToolConfig$Outbound = {
40
+ allowed_domains?: Array<string> | undefined;
41
+ engine?: string | undefined;
42
+ excluded_domains?: Array<string> | undefined;
43
+ max_results?: number | undefined;
44
+ max_total_results?: number | undefined;
45
+ search_context_size?: string | undefined;
46
+ user_location?: WebSearchUserLocationServerTool$Outbound | undefined;
47
+ };
48
+ /** @internal */
49
+ export declare const WebSearchServerToolConfig$outboundSchema: z.ZodType<WebSearchServerToolConfig$Outbound, WebSearchServerToolConfig>;
50
+ export declare function webSearchServerToolConfigToJSON(webSearchServerToolConfig: WebSearchServerToolConfig): string;
51
+ //# sourceMappingURL=websearchservertoolconfig.d.ts.map
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 900e829383d7
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { SearchQualityLevel$outboundSchema, } from "./searchqualitylevel.js";
8
+ import { WebSearchEngineEnum$outboundSchema, } from "./websearchengineenum.js";
9
+ import { WebSearchUserLocationServerTool$outboundSchema, } from "./websearchuserlocationservertool.js";
10
+ /** @internal */
11
+ export const WebSearchServerToolConfig$outboundSchema = z.object({
12
+ allowedDomains: z.array(z.string()).optional(),
13
+ engine: WebSearchEngineEnum$outboundSchema.optional(),
14
+ excludedDomains: z.array(z.string()).optional(),
15
+ maxResults: z.int().optional(),
16
+ maxTotalResults: z.int().optional(),
17
+ searchContextSize: SearchQualityLevel$outboundSchema.optional(),
18
+ userLocation: WebSearchUserLocationServerTool$outboundSchema.optional(),
19
+ }).transform((v) => {
20
+ return remap$(v, {
21
+ allowedDomains: "allowed_domains",
22
+ excludedDomains: "excluded_domains",
23
+ maxResults: "max_results",
24
+ maxTotalResults: "max_total_results",
25
+ searchContextSize: "search_context_size",
26
+ userLocation: "user_location",
27
+ });
28
+ });
29
+ export function webSearchServerToolConfigToJSON(webSearchServerToolConfig) {
30
+ return JSON.stringify(WebSearchServerToolConfig$outboundSchema.parse(webSearchServerToolConfig));
31
+ }
32
+ //# sourceMappingURL=websearchservertoolconfig.js.map
@@ -1,32 +1,18 @@
1
1
  import * as z from "zod/v4";
2
- export type ParametersT = {
3
- /**
4
- * Maximum number of search results to return per search call. Defaults to 5.
5
- */
6
- maxResults?: number | undefined;
7
- /**
8
- * Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results.
9
- */
10
- maxTotalResults?: number | undefined;
11
- };
2
+ import { WebSearchServerToolConfig, WebSearchServerToolConfig$Outbound } from "./websearchservertoolconfig.js";
12
3
  /**
13
4
  * OpenRouter built-in server tool: searches the web for current information
14
5
  */
15
6
  export type WebSearchServerToolOpenRouter = {
16
- parameters?: ParametersT | undefined;
7
+ /**
8
+ * Configuration for the openrouter:web_search server tool
9
+ */
10
+ parameters?: WebSearchServerToolConfig | undefined;
17
11
  type: "openrouter:web_search";
18
12
  };
19
13
  /** @internal */
20
- export type ParametersT$Outbound = {
21
- max_results?: number | undefined;
22
- max_total_results?: number | undefined;
23
- };
24
- /** @internal */
25
- export declare const ParametersT$outboundSchema: z.ZodType<ParametersT$Outbound, ParametersT>;
26
- export declare function parametersToJSON(parametersT: ParametersT): string;
27
- /** @internal */
28
14
  export type WebSearchServerToolOpenRouter$Outbound = {
29
- parameters?: ParametersT$Outbound | undefined;
15
+ parameters?: WebSearchServerToolConfig$Outbound | undefined;
30
16
  type: "openrouter:web_search";
31
17
  };
32
18
  /** @internal */
@@ -3,23 +3,10 @@
3
3
  * @generated-id: 99dffefc1c11
4
4
  */
5
5
  import * as z from "zod/v4";
6
- import { remap as remap$ } from "../lib/primitives.js";
7
- /** @internal */
8
- export const ParametersT$outboundSchema = z.object({
9
- maxResults: z.int().optional(),
10
- maxTotalResults: z.int().optional(),
11
- }).transform((v) => {
12
- return remap$(v, {
13
- maxResults: "max_results",
14
- maxTotalResults: "max_total_results",
15
- });
16
- });
17
- export function parametersToJSON(parametersT) {
18
- return JSON.stringify(ParametersT$outboundSchema.parse(parametersT));
19
- }
6
+ import { WebSearchServerToolConfig$outboundSchema, } from "./websearchservertoolconfig.js";
20
7
  /** @internal */
21
8
  export const WebSearchServerToolOpenRouter$outboundSchema = z.object({
22
- parameters: z.lazy(() => ParametersT$outboundSchema).optional(),
9
+ parameters: WebSearchServerToolConfig$outboundSchema.optional(),
23
10
  type: z.literal("openrouter:web_search"),
24
11
  });
25
12
  export function webSearchServerToolOpenRouterToJSON(webSearchServerToolOpenRouter) {
package/esm/sdk/stt.d.ts CHANGED
@@ -6,7 +6,7 @@ export declare class Stt extends ClientSDK {
6
6
  * Create transcription
7
7
  *
8
8
  * @remarks
9
- * Transcribes audio into text
9
+ * Transcribes audio into text. Accepts base64-encoded audio input and returns the transcribed text.
10
10
  */
11
11
  createTranscription(request: operations.CreateAudioTranscriptionsRequest, options?: RequestOptions): Promise<models.STTResponse>;
12
12
  }
package/esm/sdk/stt.js CHANGED
@@ -10,7 +10,7 @@ export class Stt extends ClientSDK {
10
10
  * Create transcription
11
11
  *
12
12
  * @remarks
13
- * Transcribes audio into text
13
+ * Transcribes audio into text. Accepts base64-encoded audio input and returns the transcribed text.
14
14
  */
15
15
  async createTranscription(request, options) {
16
16
  return unwrapAsync(sttCreateTranscription(this, request, options));
package/esm/sdk/tts.d.ts CHANGED
@@ -5,7 +5,7 @@ export declare class Tts extends ClientSDK {
5
5
  * Create speech
6
6
  *
7
7
  * @remarks
8
- * Synthesizes audio from the input text
8
+ * Synthesizes audio from the input text. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm, wav).
9
9
  */
10
10
  createSpeech(request: operations.CreateAudioSpeechRequest, options?: RequestOptions): Promise<ReadableStream<Uint8Array>>;
11
11
  }
package/esm/sdk/tts.js CHANGED
@@ -10,7 +10,7 @@ export class Tts extends ClientSDK {
10
10
  * Create speech
11
11
  *
12
12
  * @remarks
13
- * Synthesizes audio from the input text
13
+ * Synthesizes audio from the input text. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm, wav).
14
14
  */
15
15
  async createSpeech(request, options) {
16
16
  return unwrapAsync(ttsCreateSpeech(this, request, options));
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "0.12.25",
5
+ "version": "0.12.27",
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.12.25",
3
+ "version": "0.12.27",
4
4
  "author": "OpenRouter",
5
5
  "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 300+ language models through a unified API.",
6
6
  "keywords": [
@@ -69,13 +69,13 @@
69
69
  "lint": "eslint --cache --max-warnings=0 src",
70
70
  "build": "tsc",
71
71
  "prepublishOnly": "npm run build",
72
- "test": "vitest --run --project unit",
73
- "test:watch": "vitest --watch --project unit",
74
72
  "compile": "tsc",
75
- "postinstall": "node scripts/check-types.js || true",
76
73
  "prepare": "npm run build",
74
+ "test": "vitest --run --project unit",
77
75
  "test:e2e": "vitest --run --project e2e",
78
76
  "test:transit": "exit 0",
77
+ "postinstall": "node scripts/check-types.js || true",
78
+ "test:watch": "vitest --watch --project unit",
79
79
  "typecheck": "tsc --noEmit",
80
80
  "typecheck:transit": "exit 0"
81
81
  },