@openrouter/sdk 1.5.89 → 1.5.90

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 a batch
14
14
  *
15
15
  * @remarks
16
- * Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
16
+ * Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`, `/v1/audio/speech`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
17
17
  */
18
18
  export declare function batchCreateBatches(client: OpenRouterCore, request: operations.CreateBatchesRequest, options?: RequestOptions): APIPromise<Result<models.BatchObject, errors.BatchErrorResponse | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
19
  //# sourceMappingURL=batchCreateBatches.d.ts.map
@@ -17,7 +17,7 @@ import { APIPromise } from "../types/async.js";
17
17
  * Create a batch
18
18
  *
19
19
  * @remarks
20
- * Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
20
+ * Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`, `/v1/audio/speech`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
21
21
  */
22
22
  export function batchCreateBatches(client, request, options) {
23
23
  return new APIPromise($do(client, request, options));
@@ -50,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
50
50
  export declare const SDK_METADATA: {
51
51
  readonly language: "typescript";
52
52
  readonly openapiDocVersion: "1.0.0";
53
- readonly sdkVersion: "1.5.89";
53
+ readonly sdkVersion: "1.5.90";
54
54
  readonly genVersion: "2.950.13";
55
- readonly userAgent: "speakeasy-sdk/typescript 1.5.89 2.950.13 1.0.0 @openrouter/sdk";
55
+ readonly userAgent: "speakeasy-sdk/typescript 1.5.90 2.950.13 1.0.0 @openrouter/sdk";
56
56
  };
57
57
  //# sourceMappingURL=config.d.ts.map
package/esm/lib/config.js CHANGED
@@ -29,8 +29,8 @@ export function serverURLFromOptions(options) {
29
29
  export const SDK_METADATA = {
30
30
  language: "typescript",
31
31
  openapiDocVersion: "1.0.0",
32
- sdkVersion: "1.5.89",
32
+ sdkVersion: "1.5.90",
33
33
  genVersion: "2.950.13",
34
- userAgent: "speakeasy-sdk/typescript 1.5.89 2.950.13 1.0.0 @openrouter/sdk",
34
+ userAgent: "speakeasy-sdk/typescript 1.5.90 2.950.13 1.0.0 @openrouter/sdk",
35
35
  };
36
36
  //# sourceMappingURL=config.js.map
@@ -50,6 +50,48 @@ export type ResultError = {
50
50
  param: string | null;
51
51
  type: string;
52
52
  };
53
+ export declare const BatchObjectFormat2: {
54
+ readonly Pcm: "pcm";
55
+ };
56
+ export type BatchObjectFormat2 = ClosedEnum<typeof BatchObjectFormat2>;
57
+ export type AudioPcm2 = {
58
+ bitsPerSample: number;
59
+ byteLength: number;
60
+ channels: number;
61
+ format: BatchObjectFormat2;
62
+ sampleRate: number;
63
+ sha256: string;
64
+ };
65
+ export declare const BatchObjectFormat1: {
66
+ readonly Pcm: "pcm";
67
+ };
68
+ export type BatchObjectFormat1 = ClosedEnum<typeof BatchObjectFormat1>;
69
+ export type AudioPcm1 = {
70
+ bitsPerSample: number;
71
+ channels: number;
72
+ /**
73
+ * Base64-encoded PCM16 audio in the format the sibling fields give.
74
+ */
75
+ data: string;
76
+ format: BatchObjectFormat1;
77
+ sampleRate: number;
78
+ };
79
+ export type Audio = AudioPcm2 | AudioPcm1;
80
+ export declare const ObjectAudioSpeech: {
81
+ readonly AudioSpeech: "audio.speech";
82
+ };
83
+ export type ObjectAudioSpeech = ClosedEnum<typeof ObjectAudioSpeech>;
84
+ export type BodyUsage4 = {
85
+ completionTokens: number;
86
+ promptTokens: number;
87
+ totalTokens: number;
88
+ };
89
+ export type BodyAudioSpeech = {
90
+ audio: AudioPcm2 | AudioPcm1;
91
+ model: string;
92
+ object: ObjectAudioSpeech;
93
+ usage: BodyUsage4;
94
+ };
53
95
  /**
54
96
  * Embedding vector as an array of floats or a base64 string
55
97
  */
@@ -451,9 +493,9 @@ export type BodyChatCompletion = {
451
493
  systemFingerprint?: string | null | undefined;
452
494
  usage?: BodyUsage1 | undefined;
453
495
  };
454
- export type Body = OpenResponsesResult | BodyMessage | BodyChatCompletion | BodyList;
496
+ export type Body = OpenResponsesResult | BodyMessage | BodyChatCompletion | BodyAudioSpeech | BodyList;
455
497
  export type BatchObjectResponse = {
456
- body: OpenResponsesResult | BodyMessage | BodyChatCompletion | BodyList;
498
+ body: OpenResponsesResult | BodyMessage | BodyChatCompletion | BodyAudioSpeech | BodyList;
457
499
  requestId: string | null;
458
500
  statusCode: number;
459
501
  };
@@ -608,6 +650,27 @@ export declare function batchObjectRequestCountsFromJSON(jsonString: string): Sa
608
650
  export declare const ResultError$inboundSchema: z.ZodType<ResultError, unknown>;
609
651
  export declare function resultErrorFromJSON(jsonString: string): SafeParseResult<ResultError, SDKValidationError>;
610
652
  /** @internal */
653
+ export declare const BatchObjectFormat2$inboundSchema: z.ZodEnum<typeof BatchObjectFormat2>;
654
+ /** @internal */
655
+ export declare const AudioPcm2$inboundSchema: z.ZodType<AudioPcm2, unknown>;
656
+ export declare function audioPcm2FromJSON(jsonString: string): SafeParseResult<AudioPcm2, SDKValidationError>;
657
+ /** @internal */
658
+ export declare const BatchObjectFormat1$inboundSchema: z.ZodEnum<typeof BatchObjectFormat1>;
659
+ /** @internal */
660
+ export declare const AudioPcm1$inboundSchema: z.ZodType<AudioPcm1, unknown>;
661
+ export declare function audioPcm1FromJSON(jsonString: string): SafeParseResult<AudioPcm1, SDKValidationError>;
662
+ /** @internal */
663
+ export declare const Audio$inboundSchema: z.ZodType<Audio, unknown>;
664
+ export declare function audioFromJSON(jsonString: string): SafeParseResult<Audio, SDKValidationError>;
665
+ /** @internal */
666
+ export declare const ObjectAudioSpeech$inboundSchema: z.ZodEnum<typeof ObjectAudioSpeech>;
667
+ /** @internal */
668
+ export declare const BodyUsage4$inboundSchema: z.ZodType<BodyUsage4, unknown>;
669
+ export declare function bodyUsage4FromJSON(jsonString: string): SafeParseResult<BodyUsage4, SDKValidationError>;
670
+ /** @internal */
671
+ export declare const BodyAudioSpeech$inboundSchema: z.ZodType<BodyAudioSpeech, unknown>;
672
+ export declare function bodyAudioSpeechFromJSON(jsonString: string): SafeParseResult<BodyAudioSpeech, SDKValidationError>;
673
+ /** @internal */
611
674
  export declare const Embedding$inboundSchema: z.ZodType<Embedding, unknown>;
612
675
  export declare function embeddingFromJSON(jsonString: string): SafeParseResult<Embedding, SDKValidationError>;
613
676
  /** @internal */
@@ -35,6 +35,15 @@ export const BatchObjectCompletionWindow = {
35
35
  export const BatchObjectObjectBatch = {
36
36
  Batch: "batch",
37
37
  };
38
+ export const BatchObjectFormat2 = {
39
+ Pcm: "pcm",
40
+ };
41
+ export const BatchObjectFormat1 = {
42
+ Pcm: "pcm",
43
+ };
44
+ export const ObjectAudioSpeech = {
45
+ AudioSpeech: "audio.speech",
46
+ };
38
47
  export const ObjectEmbedding = {
39
48
  Embedding: "embedding",
40
49
  };
@@ -111,6 +120,83 @@ export function resultErrorFromJSON(jsonString) {
111
120
  return safeParse(jsonString, (x) => ResultError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResultError' from JSON`);
112
121
  }
113
122
  /** @internal */
123
+ export const BatchObjectFormat2$inboundSchema = z.enum(BatchObjectFormat2);
124
+ /** @internal */
125
+ export const AudioPcm2$inboundSchema = z.object({
126
+ bits_per_sample: z.number(),
127
+ byte_length: z.int(),
128
+ channels: z.int(),
129
+ format: BatchObjectFormat2$inboundSchema,
130
+ sample_rate: z.int(),
131
+ sha256: z.string(),
132
+ }).transform((v) => {
133
+ return remap$(v, {
134
+ "bits_per_sample": "bitsPerSample",
135
+ "byte_length": "byteLength",
136
+ "sample_rate": "sampleRate",
137
+ });
138
+ });
139
+ export function audioPcm2FromJSON(jsonString) {
140
+ return safeParse(jsonString, (x) => AudioPcm2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AudioPcm2' from JSON`);
141
+ }
142
+ /** @internal */
143
+ export const BatchObjectFormat1$inboundSchema = z.enum(BatchObjectFormat1);
144
+ /** @internal */
145
+ export const AudioPcm1$inboundSchema = z.object({
146
+ bits_per_sample: z.number(),
147
+ channels: z.int(),
148
+ data: z.string(),
149
+ format: BatchObjectFormat1$inboundSchema,
150
+ sample_rate: z.int(),
151
+ }).transform((v) => {
152
+ return remap$(v, {
153
+ "bits_per_sample": "bitsPerSample",
154
+ "sample_rate": "sampleRate",
155
+ });
156
+ });
157
+ export function audioPcm1FromJSON(jsonString) {
158
+ return safeParse(jsonString, (x) => AudioPcm1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AudioPcm1' from JSON`);
159
+ }
160
+ /** @internal */
161
+ export const Audio$inboundSchema = z.union([
162
+ z.lazy(() => AudioPcm2$inboundSchema),
163
+ z.lazy(() => AudioPcm1$inboundSchema),
164
+ ]);
165
+ export function audioFromJSON(jsonString) {
166
+ return safeParse(jsonString, (x) => Audio$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Audio' from JSON`);
167
+ }
168
+ /** @internal */
169
+ export const ObjectAudioSpeech$inboundSchema = z.enum(ObjectAudioSpeech);
170
+ /** @internal */
171
+ export const BodyUsage4$inboundSchema = z
172
+ .object({
173
+ completion_tokens: z.int(),
174
+ prompt_tokens: z.int(),
175
+ total_tokens: z.int(),
176
+ }).transform((v) => {
177
+ return remap$(v, {
178
+ "completion_tokens": "completionTokens",
179
+ "prompt_tokens": "promptTokens",
180
+ "total_tokens": "totalTokens",
181
+ });
182
+ });
183
+ export function bodyUsage4FromJSON(jsonString) {
184
+ return safeParse(jsonString, (x) => BodyUsage4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyUsage4' from JSON`);
185
+ }
186
+ /** @internal */
187
+ export const BodyAudioSpeech$inboundSchema = z.object({
188
+ audio: z.union([
189
+ z.lazy(() => AudioPcm2$inboundSchema),
190
+ z.lazy(() => AudioPcm1$inboundSchema),
191
+ ]),
192
+ model: z.string(),
193
+ object: ObjectAudioSpeech$inboundSchema,
194
+ usage: z.lazy(() => BodyUsage4$inboundSchema),
195
+ });
196
+ export function bodyAudioSpeechFromJSON(jsonString) {
197
+ return safeParse(jsonString, (x) => BodyAudioSpeech$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyAudioSpeech' from JSON`);
198
+ }
199
+ /** @internal */
114
200
  export const Embedding$inboundSchema = z.union([
115
201
  z.array(z.number()),
116
202
  z.string(),
@@ -664,6 +750,7 @@ export const Body$inboundSchema = z.union([
664
750
  OpenResponsesResult$inboundSchema,
665
751
  z.lazy(() => BodyMessage$inboundSchema),
666
752
  z.lazy(() => BodyChatCompletion$inboundSchema),
753
+ z.lazy(() => BodyAudioSpeech$inboundSchema),
667
754
  z.lazy(() => BodyList$inboundSchema),
668
755
  ]);
669
756
  export function bodyFromJSON(jsonString) {
@@ -675,6 +762,7 @@ export const BatchObjectResponse$inboundSchema = z.object({
675
762
  OpenResponsesResult$inboundSchema,
676
763
  z.lazy(() => BodyMessage$inboundSchema),
677
764
  z.lazy(() => BodyChatCompletion$inboundSchema),
765
+ z.lazy(() => BodyAudioSpeech$inboundSchema),
678
766
  z.lazy(() => BodyList$inboundSchema),
679
767
  ]),
680
768
  request_id: z.nullable(z.string()),
@@ -10,6 +10,7 @@ export declare const Endpoint: {
10
10
  readonly RootV1Responses: "/v1/responses";
11
11
  readonly RootV1Messages: "/v1/messages";
12
12
  readonly RootV1Embeddings: "/v1/embeddings";
13
+ readonly RootV1AudioSpeech: "/v1/audio/speech";
13
14
  };
14
15
  export type Endpoint = OpenEnum<typeof Endpoint>;
15
16
  export type RequestT = {
@@ -14,6 +14,7 @@ export const Endpoint = {
14
14
  RootV1Responses: "/v1/responses",
15
15
  RootV1Messages: "/v1/messages",
16
16
  RootV1Embeddings: "/v1/embeddings",
17
+ RootV1AudioSpeech: "/v1/audio/speech",
17
18
  };
18
19
  /** @internal */
19
20
  export const BatchSubmitBodyCompletionWindow$outboundSchema = z.enum(BatchSubmitBodyCompletionWindow);
@@ -16,7 +16,7 @@ export declare class Batch extends ClientSDK {
16
16
  * Create a batch
17
17
  *
18
18
  * @remarks
19
- * Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
19
+ * Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`, `/v1/audio/speech`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
20
20
  */
21
21
  createBatches(request: operations.CreateBatchesRequest, options?: RequestOptions): Promise<models.BatchObject>;
22
22
  /**
package/esm/sdk/batch.js CHANGED
@@ -23,7 +23,7 @@ export class Batch extends ClientSDK {
23
23
  * Create a batch
24
24
  *
25
25
  * @remarks
26
- * Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
26
+ * Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`, `/v1/audio/speech`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
27
27
  */
28
28
  async createBatches(request, options) {
29
29
  return unwrapAsync(batchCreateBatches(this, request, options));
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.5.89",
5
+ "version": "1.5.90",
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": "1.5.89",
3
+ "version": "1.5.90",
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": [
@@ -73,15 +73,15 @@
73
73
  "lint": "eslint --cache --max-warnings=0 src",
74
74
  "build": "tsc && node scripts/unbarrel-imports.js",
75
75
  "prepublishOnly": "npm run build",
76
- "typecheck:transit": "exit 0",
77
76
  "compile": "tsc && node scripts/unbarrel-imports.js",
77
+ "postinstall": "node scripts/check-types.js || true",
78
78
  "prepare": "npm run build",
79
+ "test:e2e": "vitest --run --project e2e",
80
+ "typecheck": "tsc --noEmit",
81
+ "typecheck:transit": "exit 0",
79
82
  "test": "vitest --run --project unit",
80
83
  "test:transit": "exit 0",
81
- "postinstall": "node scripts/check-types.js || true",
82
- "test:e2e": "vitest --run --project e2e",
83
- "test:watch": "vitest --watch --project unit",
84
- "typecheck": "tsc --noEmit"
84
+ "test:watch": "vitest --watch --project unit"
85
85
  },
86
86
  "peerDependencies": {
87
87