@openrouter/sdk 1.5.89 → 1.5.91
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/batchCreateBatches.d.ts +1 -1
- package/esm/funcs/batchCreateBatches.js +1 -1
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/batchobject.d.ts +69 -2
- package/esm/models/batchobject.js +93 -0
- package/esm/models/batchsubmitbody.d.ts +1 -0
- package/esm/models/batchsubmitbody.js +1 -0
- package/esm/models/operations/createembeddings.d.ts +9 -5
- package/esm/models/operations/createembeddings.js +7 -0
- package/esm/sdk/batch.d.ts +1 -1
- package/esm/sdk/batch.js +1 -1
- package/jsr.json +1 -1
- package/package.json +5 -5
|
@@ -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));
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -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.
|
|
53
|
+
readonly sdkVersion: "1.5.91";
|
|
54
54
|
readonly genVersion: "2.950.13";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.5.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.5.91 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.
|
|
32
|
+
sdkVersion: "1.5.91",
|
|
33
33
|
genVersion: "2.950.13",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.5.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.5.91 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
|
*/
|
|
@@ -62,6 +104,10 @@ export type ObjectEmbedding = ClosedEnum<typeof ObjectEmbedding>;
|
|
|
62
104
|
* A single embedding object
|
|
63
105
|
*/
|
|
64
106
|
export type BatchObjectData = {
|
|
107
|
+
/**
|
|
108
|
+
* Index of the source document when `input` was a list of documents (contextual embeddings). Absent otherwise.
|
|
109
|
+
*/
|
|
110
|
+
documentIndex?: number | undefined;
|
|
65
111
|
/**
|
|
66
112
|
* Embedding vector as an array of floats or a base64 string
|
|
67
113
|
*/
|
|
@@ -451,9 +497,9 @@ export type BodyChatCompletion = {
|
|
|
451
497
|
systemFingerprint?: string | null | undefined;
|
|
452
498
|
usage?: BodyUsage1 | undefined;
|
|
453
499
|
};
|
|
454
|
-
export type Body = OpenResponsesResult | BodyMessage | BodyChatCompletion | BodyList;
|
|
500
|
+
export type Body = OpenResponsesResult | BodyMessage | BodyChatCompletion | BodyAudioSpeech | BodyList;
|
|
455
501
|
export type BatchObjectResponse = {
|
|
456
|
-
body: OpenResponsesResult | BodyMessage | BodyChatCompletion | BodyList;
|
|
502
|
+
body: OpenResponsesResult | BodyMessage | BodyChatCompletion | BodyAudioSpeech | BodyList;
|
|
457
503
|
requestId: string | null;
|
|
458
504
|
statusCode: number;
|
|
459
505
|
};
|
|
@@ -608,6 +654,27 @@ export declare function batchObjectRequestCountsFromJSON(jsonString: string): Sa
|
|
|
608
654
|
export declare const ResultError$inboundSchema: z.ZodType<ResultError, unknown>;
|
|
609
655
|
export declare function resultErrorFromJSON(jsonString: string): SafeParseResult<ResultError, SDKValidationError>;
|
|
610
656
|
/** @internal */
|
|
657
|
+
export declare const BatchObjectFormat2$inboundSchema: z.ZodEnum<typeof BatchObjectFormat2>;
|
|
658
|
+
/** @internal */
|
|
659
|
+
export declare const AudioPcm2$inboundSchema: z.ZodType<AudioPcm2, unknown>;
|
|
660
|
+
export declare function audioPcm2FromJSON(jsonString: string): SafeParseResult<AudioPcm2, SDKValidationError>;
|
|
661
|
+
/** @internal */
|
|
662
|
+
export declare const BatchObjectFormat1$inboundSchema: z.ZodEnum<typeof BatchObjectFormat1>;
|
|
663
|
+
/** @internal */
|
|
664
|
+
export declare const AudioPcm1$inboundSchema: z.ZodType<AudioPcm1, unknown>;
|
|
665
|
+
export declare function audioPcm1FromJSON(jsonString: string): SafeParseResult<AudioPcm1, SDKValidationError>;
|
|
666
|
+
/** @internal */
|
|
667
|
+
export declare const Audio$inboundSchema: z.ZodType<Audio, unknown>;
|
|
668
|
+
export declare function audioFromJSON(jsonString: string): SafeParseResult<Audio, SDKValidationError>;
|
|
669
|
+
/** @internal */
|
|
670
|
+
export declare const ObjectAudioSpeech$inboundSchema: z.ZodEnum<typeof ObjectAudioSpeech>;
|
|
671
|
+
/** @internal */
|
|
672
|
+
export declare const BodyUsage4$inboundSchema: z.ZodType<BodyUsage4, unknown>;
|
|
673
|
+
export declare function bodyUsage4FromJSON(jsonString: string): SafeParseResult<BodyUsage4, SDKValidationError>;
|
|
674
|
+
/** @internal */
|
|
675
|
+
export declare const BodyAudioSpeech$inboundSchema: z.ZodType<BodyAudioSpeech, unknown>;
|
|
676
|
+
export declare function bodyAudioSpeechFromJSON(jsonString: string): SafeParseResult<BodyAudioSpeech, SDKValidationError>;
|
|
677
|
+
/** @internal */
|
|
611
678
|
export declare const Embedding$inboundSchema: z.ZodType<Embedding, unknown>;
|
|
612
679
|
export declare function embeddingFromJSON(jsonString: string): SafeParseResult<Embedding, SDKValidationError>;
|
|
613
680
|
/** @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(),
|
|
@@ -122,9 +208,14 @@ export function embeddingFromJSON(jsonString) {
|
|
|
122
208
|
export const ObjectEmbedding$inboundSchema = z.enum(ObjectEmbedding);
|
|
123
209
|
/** @internal */
|
|
124
210
|
export const BatchObjectData$inboundSchema = z.object({
|
|
211
|
+
document_index: z.int().optional(),
|
|
125
212
|
embedding: z.union([z.array(z.number()), z.string()]),
|
|
126
213
|
index: z.int().optional(),
|
|
127
214
|
object: ObjectEmbedding$inboundSchema,
|
|
215
|
+
}).transform((v) => {
|
|
216
|
+
return remap$(v, {
|
|
217
|
+
"document_index": "documentIndex",
|
|
218
|
+
});
|
|
128
219
|
});
|
|
129
220
|
export function batchObjectDataFromJSON(jsonString) {
|
|
130
221
|
return safeParse(jsonString, (x) => BatchObjectData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectData' from JSON`);
|
|
@@ -664,6 +755,7 @@ export const Body$inboundSchema = z.union([
|
|
|
664
755
|
OpenResponsesResult$inboundSchema,
|
|
665
756
|
z.lazy(() => BodyMessage$inboundSchema),
|
|
666
757
|
z.lazy(() => BodyChatCompletion$inboundSchema),
|
|
758
|
+
z.lazy(() => BodyAudioSpeech$inboundSchema),
|
|
667
759
|
z.lazy(() => BodyList$inboundSchema),
|
|
668
760
|
]);
|
|
669
761
|
export function bodyFromJSON(jsonString) {
|
|
@@ -675,6 +767,7 @@ export const BatchObjectResponse$inboundSchema = z.object({
|
|
|
675
767
|
OpenResponsesResult$inboundSchema,
|
|
676
768
|
z.lazy(() => BodyMessage$inboundSchema),
|
|
677
769
|
z.lazy(() => BodyChatCompletion$inboundSchema),
|
|
770
|
+
z.lazy(() => BodyAudioSpeech$inboundSchema),
|
|
678
771
|
z.lazy(() => BodyList$inboundSchema),
|
|
679
772
|
]),
|
|
680
773
|
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);
|
|
@@ -53,7 +53,7 @@ export type Input = {
|
|
|
53
53
|
/**
|
|
54
54
|
* Text, token, or multimodal input(s) to embed
|
|
55
55
|
*/
|
|
56
|
-
export type InputUnion = string | Array<string> | Array<number> | Array<Array<number>> | Array<Input>;
|
|
56
|
+
export type InputUnion = string | Array<string> | Array<Array<string>> | Array<number> | Array<Array<number>> | Array<Input>;
|
|
57
57
|
/**
|
|
58
58
|
* Embeddings request input
|
|
59
59
|
*/
|
|
@@ -69,9 +69,9 @@ export type CreateEmbeddingsRequestBody = {
|
|
|
69
69
|
/**
|
|
70
70
|
* Text, token, or multimodal input(s) to embed
|
|
71
71
|
*/
|
|
72
|
-
input: string | Array<string> | Array<number> | Array<Array<number>> | Array<Input>;
|
|
72
|
+
input: string | Array<string> | Array<Array<string>> | Array<number> | Array<Array<number>> | Array<Input>;
|
|
73
73
|
/**
|
|
74
|
-
* The type of input (e.g. search_query, search_document)
|
|
74
|
+
* The type of input (e.g. search_query, search_document). Document-chunk input (`string[][]`) is only valid with a document input type.
|
|
75
75
|
*/
|
|
76
76
|
inputType?: string | undefined;
|
|
77
77
|
/**
|
|
@@ -126,6 +126,10 @@ export type ObjectEmbedding = ClosedEnum<typeof ObjectEmbedding>;
|
|
|
126
126
|
* A single embedding object
|
|
127
127
|
*/
|
|
128
128
|
export type CreateEmbeddingsData = {
|
|
129
|
+
/**
|
|
130
|
+
* Index of the source document when `input` was a list of documents (contextual embeddings). Absent otherwise.
|
|
131
|
+
*/
|
|
132
|
+
documentIndex?: number | undefined;
|
|
129
133
|
/**
|
|
130
134
|
* Embedding vector as an array of floats or a base64 string
|
|
131
135
|
*/
|
|
@@ -255,7 +259,7 @@ export type Input$Outbound = {
|
|
|
255
259
|
export declare const Input$outboundSchema: z.ZodType<Input$Outbound, Input>;
|
|
256
260
|
export declare function inputToJSON(input: Input): string;
|
|
257
261
|
/** @internal */
|
|
258
|
-
export type InputUnion$Outbound = string | Array<string> | Array<number> | Array<Array<number>> | Array<Input$Outbound>;
|
|
262
|
+
export type InputUnion$Outbound = string | Array<string> | Array<Array<string>> | Array<number> | Array<Array<number>> | Array<Input$Outbound>;
|
|
259
263
|
/** @internal */
|
|
260
264
|
export declare const InputUnion$outboundSchema: z.ZodType<InputUnion$Outbound, InputUnion>;
|
|
261
265
|
export declare function inputUnionToJSON(inputUnion: InputUnion): string;
|
|
@@ -263,7 +267,7 @@ export declare function inputUnionToJSON(inputUnion: InputUnion): string;
|
|
|
263
267
|
export type CreateEmbeddingsRequestBody$Outbound = {
|
|
264
268
|
dimensions?: number | undefined;
|
|
265
269
|
encoding_format?: string | undefined;
|
|
266
|
-
input: string | Array<string> | Array<number> | Array<Array<number>> | Array<Input$Outbound>;
|
|
270
|
+
input: string | Array<string> | Array<Array<string>> | Array<number> | Array<Array<number>> | Array<Input$Outbound>;
|
|
267
271
|
input_type?: string | undefined;
|
|
268
272
|
model: string;
|
|
269
273
|
provider?: models.ProviderPreferences$Outbound | null | undefined;
|
|
@@ -79,6 +79,7 @@ export function inputToJSON(input) {
|
|
|
79
79
|
export const InputUnion$outboundSchema = z.union([
|
|
80
80
|
z.string(),
|
|
81
81
|
z.array(z.string()),
|
|
82
|
+
z.array(z.array(z.string())),
|
|
82
83
|
z.array(z.number()),
|
|
83
84
|
z.array(z.array(z.number())),
|
|
84
85
|
z.array(z.lazy(() => Input$outboundSchema)),
|
|
@@ -93,6 +94,7 @@ export const CreateEmbeddingsRequestBody$outboundSchema = z.object({
|
|
|
93
94
|
input: z.union([
|
|
94
95
|
z.string(),
|
|
95
96
|
z.array(z.string()),
|
|
97
|
+
z.array(z.array(z.string())),
|
|
96
98
|
z.array(z.number()),
|
|
97
99
|
z.array(z.array(z.number())),
|
|
98
100
|
z.array(z.lazy(() => Input$outboundSchema)),
|
|
@@ -140,9 +142,14 @@ export function embeddingFromJSON(jsonString) {
|
|
|
140
142
|
export const ObjectEmbedding$inboundSchema = z.enum(ObjectEmbedding);
|
|
141
143
|
/** @internal */
|
|
142
144
|
export const CreateEmbeddingsData$inboundSchema = z.object({
|
|
145
|
+
document_index: z.int().optional(),
|
|
143
146
|
embedding: z.union([z.array(z.number()), z.string()]),
|
|
144
147
|
index: z.int().optional(),
|
|
145
148
|
object: ObjectEmbedding$inboundSchema,
|
|
149
|
+
}).transform((v) => {
|
|
150
|
+
return remap$(v, {
|
|
151
|
+
"document_index": "documentIndex",
|
|
152
|
+
});
|
|
146
153
|
});
|
|
147
154
|
export function createEmbeddingsDataFromJSON(jsonString) {
|
|
148
155
|
return safeParse(jsonString, (x) => CreateEmbeddingsData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateEmbeddingsData' from JSON`);
|
package/esm/sdk/batch.d.ts
CHANGED
|
@@ -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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.91",
|
|
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
79
|
"test": "vitest --run --project unit",
|
|
80
|
-
"test:transit": "exit 0",
|
|
81
|
-
"postinstall": "node scripts/check-types.js || true",
|
|
82
80
|
"test:e2e": "vitest --run --project e2e",
|
|
81
|
+
"typecheck": "tsc --noEmit",
|
|
82
|
+
"test:transit": "exit 0",
|
|
83
83
|
"test:watch": "vitest --watch --project unit",
|
|
84
|
-
"typecheck": "
|
|
84
|
+
"typecheck:transit": "exit 0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
|