@openrouter/sdk 1.5.135 → 1.5.137
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/batchGetResults.d.ts +21 -0
- package/esm/funcs/batchGetResults.js +136 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/batchobject.d.ts +6 -658
- package/esm/models/batchobject.js +6 -755
- package/esm/models/batchresult.d.ts +662 -0
- package/esm/models/batchresult.js +755 -0
- package/esm/models/batchresultspageresponse.d.ts +24 -0
- package/esm/models/batchresultspageresponse.js +28 -0
- package/esm/models/index.d.ts +3 -0
- package/esm/models/index.js +3 -0
- package/esm/models/operations/getbatchresults.d.ts +77 -0
- package/esm/models/operations/getbatchresults.js +35 -0
- package/esm/models/operations/index.d.ts +1 -0
- package/esm/models/operations/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/sdk/batch.d.ts +9 -0
- package/esm/sdk/batch.js +10 -0
- package/jsr.json +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,662 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import * as discriminatedUnionTypes from "../types/discriminatedUnion.js";
|
|
3
|
+
import { ClosedEnum, OpenEnum } from "../types/enums.js";
|
|
4
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
5
|
+
import { Alignment } from "./alignment.js";
|
|
6
|
+
import { AnthropicCacheCreation } from "./anthropiccachecreation.js";
|
|
7
|
+
import { AnthropicContainer } from "./anthropiccontainer.js";
|
|
8
|
+
import { AnthropicInputTransformation } from "./anthropicinputtransformation.js";
|
|
9
|
+
import { AnthropicOutputTokensDetails } from "./anthropicoutputtokensdetails.js";
|
|
10
|
+
import { AnthropicRefusalStopDetails } from "./anthropicrefusalstopdetails.js";
|
|
11
|
+
import { AnthropicServerToolUsage } from "./anthropicservertoolusage.js";
|
|
12
|
+
import { AnthropicServiceTier } from "./anthropicservicetier.js";
|
|
13
|
+
import { AnthropicSpeed } from "./anthropicspeed.js";
|
|
14
|
+
import { AnthropicUsageIteration } from "./anthropicusageiteration.js";
|
|
15
|
+
import { ApiErrorType } from "./apierrortype.js";
|
|
16
|
+
import { ArmorSafeguardResult } from "./armorsafeguardresult.js";
|
|
17
|
+
import { CostDetails } from "./costdetails.js";
|
|
18
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
19
|
+
import { FinishReason } from "./finishreason.js";
|
|
20
|
+
import { OpenResponsesResult } from "./openresponsesresult.js";
|
|
21
|
+
import { OpenRouterMetadata } from "./openroutermetadata.js";
|
|
22
|
+
import { ORAnthropicContentBlock } from "./oranthropiccontentblock.js";
|
|
23
|
+
import { ORAnthropicStopReason } from "./oranthropicstopreason.js";
|
|
24
|
+
import { ReasoningDetailEncrypted } from "./reasoningdetailencrypted.js";
|
|
25
|
+
import { ReasoningDetailServerToolCall } from "./reasoningdetailservertoolcall.js";
|
|
26
|
+
import { ReasoningDetailSummary } from "./reasoningdetailsummary.js";
|
|
27
|
+
import { ReasoningDetailText } from "./reasoningdetailtext.js";
|
|
28
|
+
export type BatchResultError = {
|
|
29
|
+
/**
|
|
30
|
+
* Canonical OpenRouter error type, stable across all API formats
|
|
31
|
+
*/
|
|
32
|
+
errorType?: ApiErrorType | undefined;
|
|
33
|
+
message: string;
|
|
34
|
+
param: string | null;
|
|
35
|
+
type: string;
|
|
36
|
+
};
|
|
37
|
+
export declare const BatchResultFormat2: {
|
|
38
|
+
readonly Pcm: "pcm";
|
|
39
|
+
};
|
|
40
|
+
export type BatchResultFormat2 = ClosedEnum<typeof BatchResultFormat2>;
|
|
41
|
+
export type AudioPcm2 = {
|
|
42
|
+
bitsPerSample: number;
|
|
43
|
+
byteLength: number;
|
|
44
|
+
channels: number;
|
|
45
|
+
format: BatchResultFormat2;
|
|
46
|
+
sampleRate: number;
|
|
47
|
+
sha256: string;
|
|
48
|
+
};
|
|
49
|
+
export declare const BatchResultFormat1: {
|
|
50
|
+
readonly Pcm: "pcm";
|
|
51
|
+
};
|
|
52
|
+
export type BatchResultFormat1 = ClosedEnum<typeof BatchResultFormat1>;
|
|
53
|
+
export type AudioPcm1 = {
|
|
54
|
+
bitsPerSample: number;
|
|
55
|
+
channels: number;
|
|
56
|
+
/**
|
|
57
|
+
* Base64-encoded PCM16 audio in the format the sibling fields give.
|
|
58
|
+
*/
|
|
59
|
+
data: string;
|
|
60
|
+
format: BatchResultFormat1;
|
|
61
|
+
sampleRate: number;
|
|
62
|
+
};
|
|
63
|
+
export type Audio = AudioPcm2 | AudioPcm1;
|
|
64
|
+
export declare const ObjectAudioSpeech: {
|
|
65
|
+
readonly AudioSpeech: "audio.speech";
|
|
66
|
+
};
|
|
67
|
+
export type ObjectAudioSpeech = ClosedEnum<typeof ObjectAudioSpeech>;
|
|
68
|
+
export type BatchResultUsage4 = {
|
|
69
|
+
completionTokens: number;
|
|
70
|
+
promptTokens: number;
|
|
71
|
+
totalTokens: number;
|
|
72
|
+
};
|
|
73
|
+
export type BodyAudioSpeech = {
|
|
74
|
+
audio: AudioPcm2 | AudioPcm1;
|
|
75
|
+
model: string;
|
|
76
|
+
object: ObjectAudioSpeech;
|
|
77
|
+
usage: BatchResultUsage4;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Embedding vector as an array of floats or a base64 string
|
|
81
|
+
*/
|
|
82
|
+
export type Embedding = Array<number> | string;
|
|
83
|
+
export declare const ObjectEmbedding: {
|
|
84
|
+
readonly Embedding: "embedding";
|
|
85
|
+
};
|
|
86
|
+
export type ObjectEmbedding = ClosedEnum<typeof ObjectEmbedding>;
|
|
87
|
+
/**
|
|
88
|
+
* A single embedding object
|
|
89
|
+
*/
|
|
90
|
+
export type BatchResultData = {
|
|
91
|
+
/**
|
|
92
|
+
* Index of the source document when `input` was a list of documents (contextual embeddings). Absent otherwise.
|
|
93
|
+
*/
|
|
94
|
+
documentIndex?: number | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Embedding vector as an array of floats or a base64 string
|
|
97
|
+
*/
|
|
98
|
+
embedding: Array<number> | string;
|
|
99
|
+
/**
|
|
100
|
+
* Index of the embedding in the input list
|
|
101
|
+
*/
|
|
102
|
+
index?: number | undefined;
|
|
103
|
+
object: ObjectEmbedding;
|
|
104
|
+
};
|
|
105
|
+
export declare const BatchResultObjectList: {
|
|
106
|
+
readonly List: "list";
|
|
107
|
+
};
|
|
108
|
+
export type BatchResultObjectList = ClosedEnum<typeof BatchResultObjectList>;
|
|
109
|
+
/**
|
|
110
|
+
* Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.
|
|
111
|
+
*/
|
|
112
|
+
export type BatchResultPromptTokensDetails2 = {
|
|
113
|
+
/**
|
|
114
|
+
* Number of audio tokens in the input
|
|
115
|
+
*/
|
|
116
|
+
audioTokens?: number | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Number of file/document tokens in the input
|
|
119
|
+
*/
|
|
120
|
+
fileTokens?: number | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Number of image tokens in the input
|
|
123
|
+
*/
|
|
124
|
+
imageTokens?: number | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Number of text tokens in the input
|
|
127
|
+
*/
|
|
128
|
+
textTokens?: number | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Number of video tokens in the input
|
|
131
|
+
*/
|
|
132
|
+
videoTokens?: number | undefined;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Token usage statistics
|
|
136
|
+
*/
|
|
137
|
+
export type BatchResultUsage3 = {
|
|
138
|
+
/**
|
|
139
|
+
* Cost of the request in credits
|
|
140
|
+
*/
|
|
141
|
+
cost?: number | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Breakdown of upstream inference costs
|
|
144
|
+
*/
|
|
145
|
+
costDetails?: CostDetails | null | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* Whether a request was made using a Bring Your Own Key configuration
|
|
148
|
+
*/
|
|
149
|
+
isByok?: boolean | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* Number of tokens in the input
|
|
152
|
+
*/
|
|
153
|
+
promptTokens: number;
|
|
154
|
+
/**
|
|
155
|
+
* Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.
|
|
156
|
+
*/
|
|
157
|
+
promptTokensDetails?: BatchResultPromptTokensDetails2 | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* Total number of tokens used
|
|
160
|
+
*/
|
|
161
|
+
totalTokens: number;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Embeddings response containing embedding vectors
|
|
165
|
+
*/
|
|
166
|
+
export type BodyList = {
|
|
167
|
+
/**
|
|
168
|
+
* List of embedding objects
|
|
169
|
+
*/
|
|
170
|
+
data: Array<BatchResultData>;
|
|
171
|
+
/**
|
|
172
|
+
* Unique identifier for the embeddings response
|
|
173
|
+
*/
|
|
174
|
+
id?: string | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* The model used for embeddings
|
|
177
|
+
*/
|
|
178
|
+
model: string;
|
|
179
|
+
object: BatchResultObjectList;
|
|
180
|
+
/**
|
|
181
|
+
* Token usage statistics
|
|
182
|
+
*/
|
|
183
|
+
usage?: BatchResultUsage3 | undefined;
|
|
184
|
+
};
|
|
185
|
+
export declare const BatchResultRole: {
|
|
186
|
+
readonly Assistant: "assistant";
|
|
187
|
+
};
|
|
188
|
+
export type BatchResultRole = ClosedEnum<typeof BatchResultRole>;
|
|
189
|
+
export declare const BatchResultTypeMessage: {
|
|
190
|
+
readonly Message: "message";
|
|
191
|
+
};
|
|
192
|
+
export type BatchResultTypeMessage = ClosedEnum<typeof BatchResultTypeMessage>;
|
|
193
|
+
export type BatchResultUsage2 = {
|
|
194
|
+
cacheCreation: AnthropicCacheCreation | null;
|
|
195
|
+
cacheCreationInputTokens: number | null;
|
|
196
|
+
cacheReadInputTokens: number | null;
|
|
197
|
+
inferenceGeo: string | null;
|
|
198
|
+
inputTokens: number;
|
|
199
|
+
outputTokens: number;
|
|
200
|
+
outputTokensDetails: AnthropicOutputTokensDetails | null;
|
|
201
|
+
serverToolUse: AnthropicServerToolUsage | null;
|
|
202
|
+
serviceTier: AnthropicServiceTier | null;
|
|
203
|
+
iterations?: Array<AnthropicUsageIteration> | undefined;
|
|
204
|
+
speed?: AnthropicSpeed | null | undefined;
|
|
205
|
+
};
|
|
206
|
+
export type BodyMessage = {
|
|
207
|
+
container: AnthropicContainer | null;
|
|
208
|
+
content: Array<ORAnthropicContentBlock>;
|
|
209
|
+
id: string;
|
|
210
|
+
inputTransformations?: Array<AnthropicInputTransformation> | null | undefined;
|
|
211
|
+
model: string;
|
|
212
|
+
role: BatchResultRole;
|
|
213
|
+
/**
|
|
214
|
+
* Structured information about a refusal
|
|
215
|
+
*/
|
|
216
|
+
stopDetails: AnthropicRefusalStopDetails | null;
|
|
217
|
+
stopReason: ORAnthropicStopReason | null;
|
|
218
|
+
stopSequence: string | null;
|
|
219
|
+
type: BatchResultTypeMessage;
|
|
220
|
+
usage: BatchResultUsage2;
|
|
221
|
+
};
|
|
222
|
+
export type ContentTopLogprob = {
|
|
223
|
+
bytes: Array<number> | null;
|
|
224
|
+
logprob: number;
|
|
225
|
+
token: string;
|
|
226
|
+
};
|
|
227
|
+
export type LogprobsContent = {
|
|
228
|
+
bytes: Array<number> | null;
|
|
229
|
+
logprob: number;
|
|
230
|
+
token: string;
|
|
231
|
+
topLogprobs: Array<ContentTopLogprob>;
|
|
232
|
+
};
|
|
233
|
+
export type RefusalTopLogprob = {
|
|
234
|
+
bytes: Array<number> | null;
|
|
235
|
+
logprob: number;
|
|
236
|
+
token: string;
|
|
237
|
+
};
|
|
238
|
+
export type Refusal = {
|
|
239
|
+
bytes: Array<number> | null;
|
|
240
|
+
logprob: number;
|
|
241
|
+
token: string;
|
|
242
|
+
topLogprobs: Array<RefusalTopLogprob>;
|
|
243
|
+
};
|
|
244
|
+
export type Logprobs = {
|
|
245
|
+
content: Array<LogprobsContent> | null;
|
|
246
|
+
refusal?: Array<Refusal> | null | undefined;
|
|
247
|
+
};
|
|
248
|
+
export type WebSearchCitation = {
|
|
249
|
+
citedText?: string | undefined;
|
|
250
|
+
encryptedIndex?: string | undefined;
|
|
251
|
+
title: string | null;
|
|
252
|
+
url: string;
|
|
253
|
+
};
|
|
254
|
+
export type AnnotationWebSearchCitation = {
|
|
255
|
+
type: "web_search_citation";
|
|
256
|
+
webSearchCitation: WebSearchCitation;
|
|
257
|
+
};
|
|
258
|
+
export type BatchResultUrlCitation = {
|
|
259
|
+
content?: string | undefined;
|
|
260
|
+
endIndex: number;
|
|
261
|
+
startIndex: number;
|
|
262
|
+
title: string;
|
|
263
|
+
uncited?: true | undefined;
|
|
264
|
+
url: string;
|
|
265
|
+
};
|
|
266
|
+
export type AnnotationURLCitation = {
|
|
267
|
+
type: "url_citation";
|
|
268
|
+
urlCitation: BatchResultUrlCitation;
|
|
269
|
+
};
|
|
270
|
+
export type ContentImageUrlImageUrl = {
|
|
271
|
+
url: string;
|
|
272
|
+
};
|
|
273
|
+
export type ContentImageURL = {
|
|
274
|
+
imageUrl: ContentImageUrlImageUrl;
|
|
275
|
+
type: "image_url";
|
|
276
|
+
};
|
|
277
|
+
export type ContentText = {
|
|
278
|
+
text: string;
|
|
279
|
+
type: "text";
|
|
280
|
+
};
|
|
281
|
+
export type AnnotationContentUnion = ContentText | ContentImageURL | discriminatedUnionTypes.Unknown<"type">;
|
|
282
|
+
export type BatchResultFile = {
|
|
283
|
+
content: Array<ContentText | ContentImageURL | discriminatedUnionTypes.Unknown<"type">>;
|
|
284
|
+
hash: string;
|
|
285
|
+
name?: string | undefined;
|
|
286
|
+
};
|
|
287
|
+
export type AnnotationFile = {
|
|
288
|
+
file: BatchResultFile;
|
|
289
|
+
type: "file";
|
|
290
|
+
};
|
|
291
|
+
export type Annotation = AnnotationFile | AnnotationURLCitation | AnnotationWebSearchCitation | discriminatedUnionTypes.Unknown<"type">;
|
|
292
|
+
export type BatchResultImageUrl = {
|
|
293
|
+
url: string;
|
|
294
|
+
};
|
|
295
|
+
export declare const ChoiceTypeImageURLEnum: {
|
|
296
|
+
readonly ImageUrl: "image_url";
|
|
297
|
+
};
|
|
298
|
+
export type ChoiceTypeImageURLEnum = ClosedEnum<typeof ChoiceTypeImageURLEnum>;
|
|
299
|
+
export type Image = {
|
|
300
|
+
imageUrl: BatchResultImageUrl;
|
|
301
|
+
type: ChoiceTypeImageURLEnum;
|
|
302
|
+
};
|
|
303
|
+
export type ReasoningDetail = ReasoningDetailSummary | ReasoningDetailEncrypted | ReasoningDetailText | ReasoningDetailServerToolCall | discriminatedUnionTypes.Unknown<"type">;
|
|
304
|
+
export declare const ChoiceRole: {
|
|
305
|
+
readonly Assistant: "assistant";
|
|
306
|
+
};
|
|
307
|
+
export type ChoiceRole = ClosedEnum<typeof ChoiceRole>;
|
|
308
|
+
export type BatchResultFunction = {
|
|
309
|
+
arguments: string;
|
|
310
|
+
name: string;
|
|
311
|
+
};
|
|
312
|
+
export declare const ChoiceTypeFunction: {
|
|
313
|
+
readonly Function: "function";
|
|
314
|
+
};
|
|
315
|
+
export type ChoiceTypeFunction = ClosedEnum<typeof ChoiceTypeFunction>;
|
|
316
|
+
export type ToolCall = {
|
|
317
|
+
function: BatchResultFunction;
|
|
318
|
+
id: string;
|
|
319
|
+
index: number;
|
|
320
|
+
type: ChoiceTypeFunction;
|
|
321
|
+
};
|
|
322
|
+
export type Message = {
|
|
323
|
+
annotations?: Array<AnnotationFile | AnnotationURLCitation | AnnotationWebSearchCitation | discriminatedUnionTypes.Unknown<"type">> | undefined;
|
|
324
|
+
content: string | null;
|
|
325
|
+
images?: Array<Image> | null | undefined;
|
|
326
|
+
reasoning?: string | null | undefined;
|
|
327
|
+
reasoningDetails?: Array<ReasoningDetailSummary | ReasoningDetailEncrypted | ReasoningDetailText | ReasoningDetailServerToolCall | discriminatedUnionTypes.Unknown<"type"> | null> | null | undefined;
|
|
328
|
+
refusal: string | null;
|
|
329
|
+
role: ChoiceRole;
|
|
330
|
+
toolCalls?: Array<ToolCall> | undefined;
|
|
331
|
+
};
|
|
332
|
+
export type Choice = {
|
|
333
|
+
finishReason: FinishReason;
|
|
334
|
+
index: number;
|
|
335
|
+
logprobs: Logprobs | null;
|
|
336
|
+
message: Message;
|
|
337
|
+
nativeFinishReason: string | null;
|
|
338
|
+
};
|
|
339
|
+
export declare const BatchResultEvent: {
|
|
340
|
+
readonly AdapterRequest: "adapter_request";
|
|
341
|
+
readonly UpstreamHeadersReceived: "upstream_headers_received";
|
|
342
|
+
readonly FirstTokenReceived: "first_token_received";
|
|
343
|
+
readonly UpstreamBodyEnded: "upstream_body_ended";
|
|
344
|
+
};
|
|
345
|
+
export type BatchResultEvent = OpenEnum<typeof BatchResultEvent>;
|
|
346
|
+
export type BatchResultTimings = {
|
|
347
|
+
epochMs: number;
|
|
348
|
+
event: BatchResultEvent;
|
|
349
|
+
startMs: number;
|
|
350
|
+
};
|
|
351
|
+
export type BatchResultDebug = {
|
|
352
|
+
echoUpstreamBody?: {
|
|
353
|
+
[k: string]: any;
|
|
354
|
+
} | undefined;
|
|
355
|
+
timings?: BatchResultTimings | undefined;
|
|
356
|
+
additionalProperties?: {
|
|
357
|
+
[k: string]: any;
|
|
358
|
+
} | undefined;
|
|
359
|
+
};
|
|
360
|
+
export declare const BatchResultObjectChatCompletion: {
|
|
361
|
+
readonly ChatCompletion: "chat.completion";
|
|
362
|
+
};
|
|
363
|
+
export type BatchResultObjectChatCompletion = ClosedEnum<typeof BatchResultObjectChatCompletion>;
|
|
364
|
+
export type BatchResultCompletionTokensDetails = {
|
|
365
|
+
/**
|
|
366
|
+
* Tokens generated by the model for audio output.
|
|
367
|
+
*/
|
|
368
|
+
audioTokens?: number | null | undefined;
|
|
369
|
+
/**
|
|
370
|
+
* Tokens generated by the model for image output.
|
|
371
|
+
*/
|
|
372
|
+
imageTokens?: number | null | undefined;
|
|
373
|
+
/**
|
|
374
|
+
* Tokens generated by the model for reasoning.
|
|
375
|
+
*/
|
|
376
|
+
reasoningTokens?: number | null | undefined;
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* Breakdown of tokens used in the prompt.
|
|
380
|
+
*/
|
|
381
|
+
export type BatchResultPromptTokensDetails1 = {
|
|
382
|
+
/**
|
|
383
|
+
* Tokens used for input audio.
|
|
384
|
+
*/
|
|
385
|
+
audioTokens?: number | null | undefined;
|
|
386
|
+
/**
|
|
387
|
+
* Tokens written to cache. Only returned for models with explicit caching and cache write pricing.
|
|
388
|
+
*/
|
|
389
|
+
cacheWriteTokens?: number | null | undefined;
|
|
390
|
+
/**
|
|
391
|
+
* Tokens cached by the endpoint.
|
|
392
|
+
*/
|
|
393
|
+
cachedTokens?: number | null | undefined;
|
|
394
|
+
/**
|
|
395
|
+
* Tokens used for input files/documents.
|
|
396
|
+
*/
|
|
397
|
+
fileTokens?: number | null | undefined;
|
|
398
|
+
/**
|
|
399
|
+
* Tokens used for input video.
|
|
400
|
+
*/
|
|
401
|
+
videoTokens?: number | null | undefined;
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* Usage for server-side tool execution (e.g., web search)
|
|
405
|
+
*/
|
|
406
|
+
export type BatchResultServerToolUse = {
|
|
407
|
+
/**
|
|
408
|
+
* Number of OpenRouter server tool calls that executed and produced a result.
|
|
409
|
+
*/
|
|
410
|
+
toolCallsExecuted?: number | null | undefined;
|
|
411
|
+
/**
|
|
412
|
+
* Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.
|
|
413
|
+
*/
|
|
414
|
+
toolCallsRequested?: number | null | undefined;
|
|
415
|
+
/**
|
|
416
|
+
* Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.
|
|
417
|
+
*/
|
|
418
|
+
webSearchRequests?: number | null | undefined;
|
|
419
|
+
};
|
|
420
|
+
/**
|
|
421
|
+
* Usage for server-side tool execution (e.g., web search)
|
|
422
|
+
*/
|
|
423
|
+
export type BatchResultServerToolUseDetails = {
|
|
424
|
+
/**
|
|
425
|
+
* Number of OpenRouter server tool calls that executed and produced a result.
|
|
426
|
+
*/
|
|
427
|
+
toolCallsExecuted?: number | null | undefined;
|
|
428
|
+
/**
|
|
429
|
+
* Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.
|
|
430
|
+
*/
|
|
431
|
+
toolCallsRequested?: number | null | undefined;
|
|
432
|
+
/**
|
|
433
|
+
* Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.
|
|
434
|
+
*/
|
|
435
|
+
webSearchRequests?: number | null | undefined;
|
|
436
|
+
};
|
|
437
|
+
export type BatchResultUsage1 = {
|
|
438
|
+
/**
|
|
439
|
+
* The tokens generated
|
|
440
|
+
*/
|
|
441
|
+
completionTokens: number;
|
|
442
|
+
completionTokensDetails?: BatchResultCompletionTokensDetails | null | undefined;
|
|
443
|
+
/**
|
|
444
|
+
* Including images, input audio, and tools if any
|
|
445
|
+
*/
|
|
446
|
+
promptTokens: number;
|
|
447
|
+
/**
|
|
448
|
+
* Breakdown of tokens used in the prompt.
|
|
449
|
+
*/
|
|
450
|
+
promptTokensDetails?: BatchResultPromptTokensDetails1 | null | undefined;
|
|
451
|
+
/**
|
|
452
|
+
* Usage for server-side tool execution (e.g., web search)
|
|
453
|
+
*/
|
|
454
|
+
serverToolUse?: BatchResultServerToolUse | null | undefined;
|
|
455
|
+
/**
|
|
456
|
+
* Usage for server-side tool execution (e.g., web search)
|
|
457
|
+
*/
|
|
458
|
+
serverToolUseDetails?: BatchResultServerToolUseDetails | null | undefined;
|
|
459
|
+
/**
|
|
460
|
+
* Sum of the above two fields
|
|
461
|
+
*/
|
|
462
|
+
totalTokens: number;
|
|
463
|
+
};
|
|
464
|
+
export type BodyChatCompletion = {
|
|
465
|
+
/**
|
|
466
|
+
* Beta. The result of the alignment plugin for this request; the shape may change.
|
|
467
|
+
*/
|
|
468
|
+
alignment?: Alignment | undefined;
|
|
469
|
+
choices: Array<Choice>;
|
|
470
|
+
created: number;
|
|
471
|
+
debug?: BatchResultDebug | undefined;
|
|
472
|
+
id: string;
|
|
473
|
+
model: string;
|
|
474
|
+
object: BatchResultObjectChatCompletion;
|
|
475
|
+
openrouterMetadata?: OpenRouterMetadata | undefined;
|
|
476
|
+
provider?: string | null | undefined;
|
|
477
|
+
/**
|
|
478
|
+
* OpenRouter Armor's verdict for each client tool call of this response, present whenever Armor evaluated the response (even when nothing was flagged). Independent of the `openrouter_metadata` opt-in.
|
|
479
|
+
*/
|
|
480
|
+
safeguardResults?: Array<ArmorSafeguardResult> | undefined;
|
|
481
|
+
serviceTier?: string | null | undefined;
|
|
482
|
+
systemFingerprint?: string | null | undefined;
|
|
483
|
+
usage?: BatchResultUsage1 | undefined;
|
|
484
|
+
};
|
|
485
|
+
export type Body = OpenResponsesResult | BodyMessage | BodyChatCompletion | BodyAudioSpeech | BodyList;
|
|
486
|
+
export type BatchResultResponse = {
|
|
487
|
+
body: OpenResponsesResult | BodyMessage | BodyChatCompletion | BodyAudioSpeech | BodyList;
|
|
488
|
+
requestId: string | null;
|
|
489
|
+
statusCode: number;
|
|
490
|
+
};
|
|
491
|
+
export type BatchResult = {
|
|
492
|
+
customId: string;
|
|
493
|
+
error: BatchResultError | null;
|
|
494
|
+
id: string;
|
|
495
|
+
response: BatchResultResponse | null;
|
|
496
|
+
};
|
|
497
|
+
/** @internal */
|
|
498
|
+
export declare const BatchResultError$inboundSchema: z.ZodType<BatchResultError, unknown>;
|
|
499
|
+
export declare function batchResultErrorFromJSON(jsonString: string): SafeParseResult<BatchResultError, SDKValidationError>;
|
|
500
|
+
/** @internal */
|
|
501
|
+
export declare const BatchResultFormat2$inboundSchema: z.ZodEnum<typeof BatchResultFormat2>;
|
|
502
|
+
/** @internal */
|
|
503
|
+
export declare const AudioPcm2$inboundSchema: z.ZodType<AudioPcm2, unknown>;
|
|
504
|
+
export declare function audioPcm2FromJSON(jsonString: string): SafeParseResult<AudioPcm2, SDKValidationError>;
|
|
505
|
+
/** @internal */
|
|
506
|
+
export declare const BatchResultFormat1$inboundSchema: z.ZodEnum<typeof BatchResultFormat1>;
|
|
507
|
+
/** @internal */
|
|
508
|
+
export declare const AudioPcm1$inboundSchema: z.ZodType<AudioPcm1, unknown>;
|
|
509
|
+
export declare function audioPcm1FromJSON(jsonString: string): SafeParseResult<AudioPcm1, SDKValidationError>;
|
|
510
|
+
/** @internal */
|
|
511
|
+
export declare const Audio$inboundSchema: z.ZodType<Audio, unknown>;
|
|
512
|
+
export declare function audioFromJSON(jsonString: string): SafeParseResult<Audio, SDKValidationError>;
|
|
513
|
+
/** @internal */
|
|
514
|
+
export declare const ObjectAudioSpeech$inboundSchema: z.ZodEnum<typeof ObjectAudioSpeech>;
|
|
515
|
+
/** @internal */
|
|
516
|
+
export declare const BatchResultUsage4$inboundSchema: z.ZodType<BatchResultUsage4, unknown>;
|
|
517
|
+
export declare function batchResultUsage4FromJSON(jsonString: string): SafeParseResult<BatchResultUsage4, SDKValidationError>;
|
|
518
|
+
/** @internal */
|
|
519
|
+
export declare const BodyAudioSpeech$inboundSchema: z.ZodType<BodyAudioSpeech, unknown>;
|
|
520
|
+
export declare function bodyAudioSpeechFromJSON(jsonString: string): SafeParseResult<BodyAudioSpeech, SDKValidationError>;
|
|
521
|
+
/** @internal */
|
|
522
|
+
export declare const Embedding$inboundSchema: z.ZodType<Embedding, unknown>;
|
|
523
|
+
export declare function embeddingFromJSON(jsonString: string): SafeParseResult<Embedding, SDKValidationError>;
|
|
524
|
+
/** @internal */
|
|
525
|
+
export declare const ObjectEmbedding$inboundSchema: z.ZodEnum<typeof ObjectEmbedding>;
|
|
526
|
+
/** @internal */
|
|
527
|
+
export declare const BatchResultData$inboundSchema: z.ZodType<BatchResultData, unknown>;
|
|
528
|
+
export declare function batchResultDataFromJSON(jsonString: string): SafeParseResult<BatchResultData, SDKValidationError>;
|
|
529
|
+
/** @internal */
|
|
530
|
+
export declare const BatchResultObjectList$inboundSchema: z.ZodEnum<typeof BatchResultObjectList>;
|
|
531
|
+
/** @internal */
|
|
532
|
+
export declare const BatchResultPromptTokensDetails2$inboundSchema: z.ZodType<BatchResultPromptTokensDetails2, unknown>;
|
|
533
|
+
export declare function batchResultPromptTokensDetails2FromJSON(jsonString: string): SafeParseResult<BatchResultPromptTokensDetails2, SDKValidationError>;
|
|
534
|
+
/** @internal */
|
|
535
|
+
export declare const BatchResultUsage3$inboundSchema: z.ZodType<BatchResultUsage3, unknown>;
|
|
536
|
+
export declare function batchResultUsage3FromJSON(jsonString: string): SafeParseResult<BatchResultUsage3, SDKValidationError>;
|
|
537
|
+
/** @internal */
|
|
538
|
+
export declare const BodyList$inboundSchema: z.ZodType<BodyList, unknown>;
|
|
539
|
+
export declare function bodyListFromJSON(jsonString: string): SafeParseResult<BodyList, SDKValidationError>;
|
|
540
|
+
/** @internal */
|
|
541
|
+
export declare const BatchResultRole$inboundSchema: z.ZodEnum<typeof BatchResultRole>;
|
|
542
|
+
/** @internal */
|
|
543
|
+
export declare const BatchResultTypeMessage$inboundSchema: z.ZodEnum<typeof BatchResultTypeMessage>;
|
|
544
|
+
/** @internal */
|
|
545
|
+
export declare const BatchResultUsage2$inboundSchema: z.ZodType<BatchResultUsage2, unknown>;
|
|
546
|
+
export declare function batchResultUsage2FromJSON(jsonString: string): SafeParseResult<BatchResultUsage2, SDKValidationError>;
|
|
547
|
+
/** @internal */
|
|
548
|
+
export declare const BodyMessage$inboundSchema: z.ZodType<BodyMessage, unknown>;
|
|
549
|
+
export declare function bodyMessageFromJSON(jsonString: string): SafeParseResult<BodyMessage, SDKValidationError>;
|
|
550
|
+
/** @internal */
|
|
551
|
+
export declare const ContentTopLogprob$inboundSchema: z.ZodType<ContentTopLogprob, unknown>;
|
|
552
|
+
export declare function contentTopLogprobFromJSON(jsonString: string): SafeParseResult<ContentTopLogprob, SDKValidationError>;
|
|
553
|
+
/** @internal */
|
|
554
|
+
export declare const LogprobsContent$inboundSchema: z.ZodType<LogprobsContent, unknown>;
|
|
555
|
+
export declare function logprobsContentFromJSON(jsonString: string): SafeParseResult<LogprobsContent, SDKValidationError>;
|
|
556
|
+
/** @internal */
|
|
557
|
+
export declare const RefusalTopLogprob$inboundSchema: z.ZodType<RefusalTopLogprob, unknown>;
|
|
558
|
+
export declare function refusalTopLogprobFromJSON(jsonString: string): SafeParseResult<RefusalTopLogprob, SDKValidationError>;
|
|
559
|
+
/** @internal */
|
|
560
|
+
export declare const Refusal$inboundSchema: z.ZodType<Refusal, unknown>;
|
|
561
|
+
export declare function refusalFromJSON(jsonString: string): SafeParseResult<Refusal, SDKValidationError>;
|
|
562
|
+
/** @internal */
|
|
563
|
+
export declare const Logprobs$inboundSchema: z.ZodType<Logprobs, unknown>;
|
|
564
|
+
export declare function logprobsFromJSON(jsonString: string): SafeParseResult<Logprobs, SDKValidationError>;
|
|
565
|
+
/** @internal */
|
|
566
|
+
export declare const WebSearchCitation$inboundSchema: z.ZodType<WebSearchCitation, unknown>;
|
|
567
|
+
export declare function webSearchCitationFromJSON(jsonString: string): SafeParseResult<WebSearchCitation, SDKValidationError>;
|
|
568
|
+
/** @internal */
|
|
569
|
+
export declare const AnnotationWebSearchCitation$inboundSchema: z.ZodType<AnnotationWebSearchCitation, unknown>;
|
|
570
|
+
export declare function annotationWebSearchCitationFromJSON(jsonString: string): SafeParseResult<AnnotationWebSearchCitation, SDKValidationError>;
|
|
571
|
+
/** @internal */
|
|
572
|
+
export declare const BatchResultUrlCitation$inboundSchema: z.ZodType<BatchResultUrlCitation, unknown>;
|
|
573
|
+
export declare function batchResultUrlCitationFromJSON(jsonString: string): SafeParseResult<BatchResultUrlCitation, SDKValidationError>;
|
|
574
|
+
/** @internal */
|
|
575
|
+
export declare const AnnotationURLCitation$inboundSchema: z.ZodType<AnnotationURLCitation, unknown>;
|
|
576
|
+
export declare function annotationURLCitationFromJSON(jsonString: string): SafeParseResult<AnnotationURLCitation, SDKValidationError>;
|
|
577
|
+
/** @internal */
|
|
578
|
+
export declare const ContentImageUrlImageUrl$inboundSchema: z.ZodType<ContentImageUrlImageUrl, unknown>;
|
|
579
|
+
export declare function contentImageUrlImageUrlFromJSON(jsonString: string): SafeParseResult<ContentImageUrlImageUrl, SDKValidationError>;
|
|
580
|
+
/** @internal */
|
|
581
|
+
export declare const ContentImageURL$inboundSchema: z.ZodType<ContentImageURL, unknown>;
|
|
582
|
+
export declare function contentImageURLFromJSON(jsonString: string): SafeParseResult<ContentImageURL, SDKValidationError>;
|
|
583
|
+
/** @internal */
|
|
584
|
+
export declare const ContentText$inboundSchema: z.ZodType<ContentText, unknown>;
|
|
585
|
+
export declare function contentTextFromJSON(jsonString: string): SafeParseResult<ContentText, SDKValidationError>;
|
|
586
|
+
/** @internal */
|
|
587
|
+
export declare const AnnotationContentUnion$inboundSchema: z.ZodType<AnnotationContentUnion, unknown>;
|
|
588
|
+
export declare function annotationContentUnionFromJSON(jsonString: string): SafeParseResult<AnnotationContentUnion, SDKValidationError>;
|
|
589
|
+
/** @internal */
|
|
590
|
+
export declare const BatchResultFile$inboundSchema: z.ZodType<BatchResultFile, unknown>;
|
|
591
|
+
export declare function batchResultFileFromJSON(jsonString: string): SafeParseResult<BatchResultFile, SDKValidationError>;
|
|
592
|
+
/** @internal */
|
|
593
|
+
export declare const AnnotationFile$inboundSchema: z.ZodType<AnnotationFile, unknown>;
|
|
594
|
+
export declare function annotationFileFromJSON(jsonString: string): SafeParseResult<AnnotationFile, SDKValidationError>;
|
|
595
|
+
/** @internal */
|
|
596
|
+
export declare const Annotation$inboundSchema: z.ZodType<Annotation, unknown>;
|
|
597
|
+
export declare function annotationFromJSON(jsonString: string): SafeParseResult<Annotation, SDKValidationError>;
|
|
598
|
+
/** @internal */
|
|
599
|
+
export declare const BatchResultImageUrl$inboundSchema: z.ZodType<BatchResultImageUrl, unknown>;
|
|
600
|
+
export declare function batchResultImageUrlFromJSON(jsonString: string): SafeParseResult<BatchResultImageUrl, SDKValidationError>;
|
|
601
|
+
/** @internal */
|
|
602
|
+
export declare const ChoiceTypeImageURLEnum$inboundSchema: z.ZodEnum<typeof ChoiceTypeImageURLEnum>;
|
|
603
|
+
/** @internal */
|
|
604
|
+
export declare const Image$inboundSchema: z.ZodType<Image, unknown>;
|
|
605
|
+
export declare function imageFromJSON(jsonString: string): SafeParseResult<Image, SDKValidationError>;
|
|
606
|
+
/** @internal */
|
|
607
|
+
export declare const ReasoningDetail$inboundSchema: z.ZodType<ReasoningDetail, unknown>;
|
|
608
|
+
export declare function reasoningDetailFromJSON(jsonString: string): SafeParseResult<ReasoningDetail, SDKValidationError>;
|
|
609
|
+
/** @internal */
|
|
610
|
+
export declare const ChoiceRole$inboundSchema: z.ZodEnum<typeof ChoiceRole>;
|
|
611
|
+
/** @internal */
|
|
612
|
+
export declare const BatchResultFunction$inboundSchema: z.ZodType<BatchResultFunction, unknown>;
|
|
613
|
+
export declare function batchResultFunctionFromJSON(jsonString: string): SafeParseResult<BatchResultFunction, SDKValidationError>;
|
|
614
|
+
/** @internal */
|
|
615
|
+
export declare const ChoiceTypeFunction$inboundSchema: z.ZodEnum<typeof ChoiceTypeFunction>;
|
|
616
|
+
/** @internal */
|
|
617
|
+
export declare const ToolCall$inboundSchema: z.ZodType<ToolCall, unknown>;
|
|
618
|
+
export declare function toolCallFromJSON(jsonString: string): SafeParseResult<ToolCall, SDKValidationError>;
|
|
619
|
+
/** @internal */
|
|
620
|
+
export declare const Message$inboundSchema: z.ZodType<Message, unknown>;
|
|
621
|
+
export declare function messageFromJSON(jsonString: string): SafeParseResult<Message, SDKValidationError>;
|
|
622
|
+
/** @internal */
|
|
623
|
+
export declare const Choice$inboundSchema: z.ZodType<Choice, unknown>;
|
|
624
|
+
export declare function choiceFromJSON(jsonString: string): SafeParseResult<Choice, SDKValidationError>;
|
|
625
|
+
/** @internal */
|
|
626
|
+
export declare const BatchResultEvent$inboundSchema: z.ZodType<BatchResultEvent, unknown>;
|
|
627
|
+
/** @internal */
|
|
628
|
+
export declare const BatchResultTimings$inboundSchema: z.ZodType<BatchResultTimings, unknown>;
|
|
629
|
+
export declare function batchResultTimingsFromJSON(jsonString: string): SafeParseResult<BatchResultTimings, SDKValidationError>;
|
|
630
|
+
/** @internal */
|
|
631
|
+
export declare const BatchResultDebug$inboundSchema: z.ZodType<BatchResultDebug, unknown>;
|
|
632
|
+
export declare function batchResultDebugFromJSON(jsonString: string): SafeParseResult<BatchResultDebug, SDKValidationError>;
|
|
633
|
+
/** @internal */
|
|
634
|
+
export declare const BatchResultObjectChatCompletion$inboundSchema: z.ZodEnum<typeof BatchResultObjectChatCompletion>;
|
|
635
|
+
/** @internal */
|
|
636
|
+
export declare const BatchResultCompletionTokensDetails$inboundSchema: z.ZodType<BatchResultCompletionTokensDetails, unknown>;
|
|
637
|
+
export declare function batchResultCompletionTokensDetailsFromJSON(jsonString: string): SafeParseResult<BatchResultCompletionTokensDetails, SDKValidationError>;
|
|
638
|
+
/** @internal */
|
|
639
|
+
export declare const BatchResultPromptTokensDetails1$inboundSchema: z.ZodType<BatchResultPromptTokensDetails1, unknown>;
|
|
640
|
+
export declare function batchResultPromptTokensDetails1FromJSON(jsonString: string): SafeParseResult<BatchResultPromptTokensDetails1, SDKValidationError>;
|
|
641
|
+
/** @internal */
|
|
642
|
+
export declare const BatchResultServerToolUse$inboundSchema: z.ZodType<BatchResultServerToolUse, unknown>;
|
|
643
|
+
export declare function batchResultServerToolUseFromJSON(jsonString: string): SafeParseResult<BatchResultServerToolUse, SDKValidationError>;
|
|
644
|
+
/** @internal */
|
|
645
|
+
export declare const BatchResultServerToolUseDetails$inboundSchema: z.ZodType<BatchResultServerToolUseDetails, unknown>;
|
|
646
|
+
export declare function batchResultServerToolUseDetailsFromJSON(jsonString: string): SafeParseResult<BatchResultServerToolUseDetails, SDKValidationError>;
|
|
647
|
+
/** @internal */
|
|
648
|
+
export declare const BatchResultUsage1$inboundSchema: z.ZodType<BatchResultUsage1, unknown>;
|
|
649
|
+
export declare function batchResultUsage1FromJSON(jsonString: string): SafeParseResult<BatchResultUsage1, SDKValidationError>;
|
|
650
|
+
/** @internal */
|
|
651
|
+
export declare const BodyChatCompletion$inboundSchema: z.ZodType<BodyChatCompletion, unknown>;
|
|
652
|
+
export declare function bodyChatCompletionFromJSON(jsonString: string): SafeParseResult<BodyChatCompletion, SDKValidationError>;
|
|
653
|
+
/** @internal */
|
|
654
|
+
export declare const Body$inboundSchema: z.ZodType<Body, unknown>;
|
|
655
|
+
export declare function bodyFromJSON(jsonString: string): SafeParseResult<Body, SDKValidationError>;
|
|
656
|
+
/** @internal */
|
|
657
|
+
export declare const BatchResultResponse$inboundSchema: z.ZodType<BatchResultResponse, unknown>;
|
|
658
|
+
export declare function batchResultResponseFromJSON(jsonString: string): SafeParseResult<BatchResultResponse, SDKValidationError>;
|
|
659
|
+
/** @internal */
|
|
660
|
+
export declare const BatchResult$inboundSchema: z.ZodType<BatchResult, unknown>;
|
|
661
|
+
export declare function batchResultFromJSON(jsonString: string): SafeParseResult<BatchResult, SDKValidationError>;
|
|
662
|
+
//# sourceMappingURL=batchresult.d.ts.map
|