@openrouter/sdk 1.5.134 → 1.5.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/funcs/ttsCreateSpeech.d.ts +1 -1
- package/esm/funcs/ttsCreateSpeech.js +1 -1
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/index.d.ts +1 -0
- package/esm/models/index.js +1 -0
- package/esm/models/responsescontextmanagement.d.ts +27 -0
- package/esm/models/responsescontextmanagement.js +23 -0
- package/esm/models/responsesrequest.d.ts +6 -0
- package/esm/models/responsesrequest.js +3 -0
- package/esm/models/speechrequest.d.ts +18 -0
- package/esm/models/speechrequest.js +11 -0
- package/esm/sdk/tts.d.ts +1 -1
- package/esm/sdk/tts.js +1 -1
- package/jsr.json +1 -1
- package/package.json +3 -3
|
@@ -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. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm,
|
|
15
|
+
* Synthesizes audio from the input text. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm) by default, or a JSON response with a 24-hour signed download URL when `output_delivery` is set to `"url"`.
|
|
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.ForbiddenResponseError | errors.NotFoundResponseError | errors.PayloadTooLargeResponseError | 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. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm,
|
|
19
|
+
* Synthesizes audio from the input text. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm) by default, or a JSON response with a 24-hour signed download URL when `output_delivery` is set to `"url"`.
|
|
20
20
|
*/
|
|
21
21
|
export function ttsCreateSpeech(client, request, options) {
|
|
22
22
|
return new APIPromise($do(client, request, options));
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -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: "1.5.
|
|
52
|
+
readonly sdkVersion: "1.5.136";
|
|
53
53
|
readonly genVersion: "2.960.8";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.5.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.5.136 2.960.8 1.0.0 @openrouter/sdk";
|
|
55
55
|
};
|
|
56
56
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -25,8 +25,8 @@ export function serverURLFromOptions(options) {
|
|
|
25
25
|
export const SDK_METADATA = {
|
|
26
26
|
language: "typescript",
|
|
27
27
|
openapiDocVersion: "1.0.0",
|
|
28
|
-
sdkVersion: "1.5.
|
|
28
|
+
sdkVersion: "1.5.136",
|
|
29
29
|
genVersion: "2.960.8",
|
|
30
|
-
userAgent: "speakeasy-sdk/typescript 1.5.
|
|
30
|
+
userAgent: "speakeasy-sdk/typescript 1.5.136 2.960.8 1.0.0 @openrouter/sdk",
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=config.js.map
|
package/esm/models/index.d.ts
CHANGED
|
@@ -786,6 +786,7 @@ export * from "./responsehealingplugin.js";
|
|
|
786
786
|
export * from "./responseincludesenum.js";
|
|
787
787
|
export * from "./responseoutputtext.js";
|
|
788
788
|
export * from "./responsesbadrequestresponseerrordata.js";
|
|
789
|
+
export * from "./responsescontextmanagement.js";
|
|
789
790
|
export * from "./responsesinputtransformation.js";
|
|
790
791
|
export * from "./responsesrequest.js";
|
|
791
792
|
export * from "./responsesstreamingresponse.js";
|
package/esm/models/index.js
CHANGED
|
@@ -789,6 +789,7 @@ export * from "./responsehealingplugin.js";
|
|
|
789
789
|
export * from "./responseincludesenum.js";
|
|
790
790
|
export * from "./responseoutputtext.js";
|
|
791
791
|
export * from "./responsesbadrequestresponseerrordata.js";
|
|
792
|
+
export * from "./responsescontextmanagement.js";
|
|
792
793
|
export * from "./responsesinputtransformation.js";
|
|
793
794
|
export * from "./responsesrequest.js";
|
|
794
795
|
export * from "./responsesstreamingresponse.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
/**
|
|
3
|
+
* A server-side context management entry. With `compaction`, the provider compacts the conversation once input exceeds `compact_threshold` and returns a `compaction` output item; pass that item back in `input` on later turns.
|
|
4
|
+
*/
|
|
5
|
+
export type ResponsesContextManagement = {
|
|
6
|
+
/**
|
|
7
|
+
* Input token count at which server-side compaction is triggered.
|
|
8
|
+
*/
|
|
9
|
+
compactThreshold?: number | null | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The context management strategy. Currently only `compaction` is supported.
|
|
12
|
+
*/
|
|
13
|
+
type: string;
|
|
14
|
+
additionalProperties?: {
|
|
15
|
+
[k: string]: any;
|
|
16
|
+
} | undefined;
|
|
17
|
+
};
|
|
18
|
+
/** @internal */
|
|
19
|
+
export type ResponsesContextManagement$Outbound = {
|
|
20
|
+
compact_threshold?: number | null | undefined;
|
|
21
|
+
type: string;
|
|
22
|
+
[additionalProperties: string]: unknown;
|
|
23
|
+
};
|
|
24
|
+
/** @internal */
|
|
25
|
+
export declare const ResponsesContextManagement$outboundSchema: z.ZodType<ResponsesContextManagement$Outbound, ResponsesContextManagement>;
|
|
26
|
+
export declare function responsesContextManagementToJSON(responsesContextManagement: ResponsesContextManagement): string;
|
|
27
|
+
//# sourceMappingURL=responsescontextmanagement.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4";
|
|
5
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export const ResponsesContextManagement$outboundSchema = z.object({
|
|
8
|
+
compactThreshold: z.nullable(z.int()).optional(),
|
|
9
|
+
type: z.string(),
|
|
10
|
+
additionalProperties: z.record(z.string(), z.any()).optional(),
|
|
11
|
+
}).transform((v) => {
|
|
12
|
+
return {
|
|
13
|
+
...v.additionalProperties,
|
|
14
|
+
...remap$(v, {
|
|
15
|
+
compactThreshold: "compact_threshold",
|
|
16
|
+
additionalProperties: null,
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
export function responsesContextManagementToJSON(responsesContextManagement) {
|
|
21
|
+
return JSON.stringify(ResponsesContextManagement$outboundSchema.parse(responsesContextManagement));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=responsescontextmanagement.js.map
|
|
@@ -46,6 +46,7 @@ import { ReasoningMode } from "./reasoningmode.js";
|
|
|
46
46
|
import { ReasoningSummaryVerbosity } from "./reasoningsummaryverbosity.js";
|
|
47
47
|
import { ResponseHealingPlugin, ResponseHealingPlugin$Outbound } from "./responsehealingplugin.js";
|
|
48
48
|
import { ResponseIncludesEnum } from "./responseincludesenum.js";
|
|
49
|
+
import { ResponsesContextManagement, ResponsesContextManagement$Outbound } from "./responsescontextmanagement.js";
|
|
49
50
|
import { SearchModelsServerToolOpenRouter, SearchModelsServerToolOpenRouter$Outbound } from "./searchmodelsservertoolopenrouter.js";
|
|
50
51
|
import { ShellServerTool, ShellServerTool$Outbound } from "./shellservertool.js";
|
|
51
52
|
import { ShellServerToolOpenRouter, ShellServerToolOpenRouter$Outbound } from "./shellservertoolopenrouter.js";
|
|
@@ -207,6 +208,10 @@ export type ResponsesRequest = {
|
|
|
207
208
|
* Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.
|
|
208
209
|
*/
|
|
209
210
|
cacheControl?: AnthropicCacheControlDirective | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* Server-side context management (compaction). Supported for OpenAI models served by OpenAI or Azure, which return `compaction` output items. Providers translated to another API format drop it. Replay returned `compaction` items in `input` on later turns.
|
|
213
|
+
*/
|
|
214
|
+
contextManagement?: Array<ResponsesContextManagement> | null | undefined;
|
|
210
215
|
/**
|
|
211
216
|
* Debug options for inspecting request transformations (streaming only)
|
|
212
217
|
*/
|
|
@@ -487,6 +492,7 @@ export type ResponsesRequest$Outbound = {
|
|
|
487
492
|
access_programs?: ResponsesRequestAccessPrograms$Outbound | undefined;
|
|
488
493
|
background?: boolean | null | undefined;
|
|
489
494
|
cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
|
|
495
|
+
context_management?: Array<ResponsesContextManagement$Outbound> | null | undefined;
|
|
490
496
|
debug?: ChatDebugOptions$Outbound | undefined;
|
|
491
497
|
deferred_tools?: DeferredToolsControl$Outbound | undefined;
|
|
492
498
|
frequency_penalty?: number | null | undefined;
|
|
@@ -50,6 +50,7 @@ import { ReasoningMode$outboundSchema, } from "./reasoningmode.js";
|
|
|
50
50
|
import { ReasoningSummaryVerbosity$outboundSchema, } from "./reasoningsummaryverbosity.js";
|
|
51
51
|
import { ResponseHealingPlugin$outboundSchema, } from "./responsehealingplugin.js";
|
|
52
52
|
import { ResponseIncludesEnum$outboundSchema, } from "./responseincludesenum.js";
|
|
53
|
+
import { ResponsesContextManagement$outboundSchema, } from "./responsescontextmanagement.js";
|
|
53
54
|
import { SearchModelsServerToolOpenRouter$outboundSchema, } from "./searchmodelsservertoolopenrouter.js";
|
|
54
55
|
import { ShellServerTool$outboundSchema, } from "./shellservertool.js";
|
|
55
56
|
import { ShellServerToolOpenRouter$outboundSchema, } from "./shellservertoolopenrouter.js";
|
|
@@ -202,6 +203,7 @@ export const ResponsesRequest$outboundSchema = z.object({
|
|
|
202
203
|
.optional(),
|
|
203
204
|
background: z.nullable(z.boolean()).optional(),
|
|
204
205
|
cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
|
|
206
|
+
contextManagement: z.nullable(z.array(ResponsesContextManagement$outboundSchema)).optional(),
|
|
205
207
|
debug: ChatDebugOptions$outboundSchema.optional(),
|
|
206
208
|
deferredTools: DeferredToolsControl$outboundSchema.optional(),
|
|
207
209
|
frequencyPenalty: z.nullable(z.number()).optional(),
|
|
@@ -292,6 +294,7 @@ export const ResponsesRequest$outboundSchema = z.object({
|
|
|
292
294
|
return remap$(v, {
|
|
293
295
|
accessPrograms: "access_programs",
|
|
294
296
|
cacheControl: "cache_control",
|
|
297
|
+
contextManagement: "context_management",
|
|
295
298
|
deferredTools: "deferred_tools",
|
|
296
299
|
frequencyPenalty: "frequency_penalty",
|
|
297
300
|
imageConfig: "image_config",
|
|
@@ -5,6 +5,17 @@ import { ProviderOptions, ProviderOptions$Outbound } from "./provideroptions.js"
|
|
|
5
5
|
import { SpeechInput, SpeechInput$Outbound } from "./speechinput.js";
|
|
6
6
|
import { SpeechInputReference, SpeechInputReference$Outbound } from "./speechinputreference.js";
|
|
7
7
|
import { TraceConfig, TraceConfig$Outbound } from "./traceconfig.js";
|
|
8
|
+
/**
|
|
9
|
+
* `stream` (default) streams the audio bytes directly in the response body. `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type`. The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. Falls back to streaming raw audio bytes when a URL cannot be issued because zero-data-retention applies (account settings, guardrails, `provider.zdr`, or a ZDR endpoint) or the request has no workspace.
|
|
10
|
+
*/
|
|
11
|
+
export declare const OutputDelivery: {
|
|
12
|
+
readonly Stream: "stream";
|
|
13
|
+
readonly Url: "url";
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* `stream` (default) streams the audio bytes directly in the response body. `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type`. The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. Falls back to streaming raw audio bytes when a URL cannot be issued because zero-data-retention applies (account settings, guardrails, `provider.zdr`, or a ZDR endpoint) or the request has no workspace.
|
|
17
|
+
*/
|
|
18
|
+
export type OutputDelivery = OpenEnum<typeof OutputDelivery>;
|
|
8
19
|
/**
|
|
9
20
|
* Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
|
10
21
|
*
|
|
@@ -102,6 +113,10 @@ export type SpeechRequest = {
|
|
|
102
113
|
* TTS model identifier
|
|
103
114
|
*/
|
|
104
115
|
model: string;
|
|
116
|
+
/**
|
|
117
|
+
* `stream` (default) streams the audio bytes directly in the response body. `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type`. The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. Falls back to streaming raw audio bytes when a URL cannot be issued because zero-data-retention applies (account settings, guardrails, `provider.zdr`, or a ZDR endpoint) or the request has no workspace.
|
|
118
|
+
*/
|
|
119
|
+
outputDelivery?: OutputDelivery | undefined;
|
|
105
120
|
/**
|
|
106
121
|
* Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options
|
|
107
122
|
*/
|
|
@@ -132,6 +147,8 @@ export type SpeechRequest = {
|
|
|
132
147
|
voice?: string | undefined;
|
|
133
148
|
};
|
|
134
149
|
/** @internal */
|
|
150
|
+
export declare const OutputDelivery$outboundSchema: z.ZodType<string, OutputDelivery>;
|
|
151
|
+
/** @internal */
|
|
135
152
|
export declare const SpeechRequestDataCollection$outboundSchema: z.ZodType<string, SpeechRequestDataCollection>;
|
|
136
153
|
/** @internal */
|
|
137
154
|
export type SpeechRequestIgnore$Outbound = string | string;
|
|
@@ -169,6 +186,7 @@ export type SpeechRequest$Outbound = {
|
|
|
169
186
|
input_references?: Array<SpeechInputReference$Outbound> | undefined;
|
|
170
187
|
instructions?: string | undefined;
|
|
171
188
|
model: string;
|
|
189
|
+
output_delivery?: string | undefined;
|
|
172
190
|
provider?: SpeechRequestProvider$Outbound | undefined;
|
|
173
191
|
response_format: string;
|
|
174
192
|
session_id?: string | undefined;
|
|
@@ -9,6 +9,13 @@ import { ProviderOptions$outboundSchema, } from "./provideroptions.js";
|
|
|
9
9
|
import { SpeechInput$outboundSchema, } from "./speechinput.js";
|
|
10
10
|
import { SpeechInputReference$outboundSchema, } from "./speechinputreference.js";
|
|
11
11
|
import { TraceConfig$outboundSchema, } from "./traceconfig.js";
|
|
12
|
+
/**
|
|
13
|
+
* `stream` (default) streams the audio bytes directly in the response body. `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type`. The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. Falls back to streaming raw audio bytes when a URL cannot be issued because zero-data-retention applies (account settings, guardrails, `provider.zdr`, or a ZDR endpoint) or the request has no workspace.
|
|
14
|
+
*/
|
|
15
|
+
export const OutputDelivery = {
|
|
16
|
+
Stream: "stream",
|
|
17
|
+
Url: "url",
|
|
18
|
+
};
|
|
12
19
|
/**
|
|
13
20
|
* Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
|
14
21
|
*
|
|
@@ -29,6 +36,8 @@ export const SpeechRequestResponseFormat = {
|
|
|
29
36
|
Pcm: "pcm",
|
|
30
37
|
};
|
|
31
38
|
/** @internal */
|
|
39
|
+
export const OutputDelivery$outboundSchema = openEnums.outboundSchema(OutputDelivery);
|
|
40
|
+
/** @internal */
|
|
32
41
|
export const SpeechRequestDataCollection$outboundSchema = openEnums.outboundSchema(SpeechRequestDataCollection);
|
|
33
42
|
/** @internal */
|
|
34
43
|
export const SpeechRequestIgnore$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
|
|
@@ -74,6 +83,7 @@ export const SpeechRequest$outboundSchema = z.object({
|
|
|
74
83
|
inputReferences: z.array(SpeechInputReference$outboundSchema).optional(),
|
|
75
84
|
instructions: z.string().optional(),
|
|
76
85
|
model: z.string(),
|
|
86
|
+
outputDelivery: OutputDelivery$outboundSchema.optional(),
|
|
77
87
|
provider: z.lazy(() => SpeechRequestProvider$outboundSchema).optional(),
|
|
78
88
|
responseFormat: SpeechRequestResponseFormat$outboundSchema.default("pcm"),
|
|
79
89
|
sessionId: z.string().optional(),
|
|
@@ -84,6 +94,7 @@ export const SpeechRequest$outboundSchema = z.object({
|
|
|
84
94
|
}).transform((v) => {
|
|
85
95
|
return remap$(v, {
|
|
86
96
|
inputReferences: "input_references",
|
|
97
|
+
outputDelivery: "output_delivery",
|
|
87
98
|
responseFormat: "response_format",
|
|
88
99
|
sessionId: "session_id",
|
|
89
100
|
});
|
package/esm/sdk/tts.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare class TTS extends ClientSDK {
|
|
|
6
6
|
* Create speech
|
|
7
7
|
*
|
|
8
8
|
* @remarks
|
|
9
|
-
* Synthesizes audio from the input text. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm,
|
|
9
|
+
* Synthesizes audio from the input text. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm) by default, or a JSON response with a 24-hour signed download URL when `output_delivery` is set to `"url"`.
|
|
10
10
|
*/
|
|
11
11
|
createSpeech(request: operations.CreateAudioSpeechRequest, options?: RequestOptions): Promise<ReadableStream<Uint8Array>>;
|
|
12
12
|
/**
|
package/esm/sdk/tts.js
CHANGED
|
@@ -11,7 +11,7 @@ export class TTS extends ClientSDK {
|
|
|
11
11
|
* Create speech
|
|
12
12
|
*
|
|
13
13
|
* @remarks
|
|
14
|
-
* Synthesizes audio from the input text. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm,
|
|
14
|
+
* Synthesizes audio from the input text. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm) by default, or a JSON response with a 24-hour signed download URL when `output_delivery` is set to `"url"`.
|
|
15
15
|
*/
|
|
16
16
|
async createSpeech(request, options) {
|
|
17
17
|
return unwrapAsync(ttsCreateSpeech(this, request, options));
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.136",
|
|
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": [
|
|
@@ -77,11 +77,11 @@
|
|
|
77
77
|
"test": "vitest --run --project unit",
|
|
78
78
|
"test:e2e": "vitest --run --project e2e",
|
|
79
79
|
"test:transit": "exit 0",
|
|
80
|
-
"test:watch": "vitest --watch --project unit",
|
|
81
80
|
"typecheck": "tsc --noEmit",
|
|
82
81
|
"typecheck:transit": "exit 0",
|
|
83
82
|
"postinstall": "node scripts/check-types.js || true",
|
|
84
|
-
"prepare": "npm run build"
|
|
83
|
+
"prepare": "npm run build",
|
|
84
|
+
"test:watch": "vitest --watch --project unit"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
|