@openrouter/sdk 1.5.143 → 1.5.144

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.
@@ -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.143";
52
+ readonly sdkVersion: "1.5.144";
53
53
  readonly genVersion: "2.960.8";
54
- readonly userAgent: "speakeasy-sdk/typescript 1.5.143 2.960.8 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 1.5.144 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.143",
28
+ sdkVersion: "1.5.144",
29
29
  genVersion: "2.960.8",
30
- userAgent: "speakeasy-sdk/typescript 1.5.143 2.960.8 1.0.0 @openrouter/sdk",
30
+ userAgent: "speakeasy-sdk/typescript 1.5.144 2.960.8 1.0.0 @openrouter/sdk",
31
31
  };
32
32
  //# sourceMappingURL=config.js.map
@@ -14,6 +14,7 @@ import { AnthropicSpeed } from "./anthropicspeed.js";
14
14
  import { AnthropicUsageIteration } from "./anthropicusageiteration.js";
15
15
  import { ApiErrorType } from "./apierrortype.js";
16
16
  import { ArmorSafeguardResult } from "./armorsafeguardresult.js";
17
+ import { ChatAnnotation } from "./chatannotation.js";
17
18
  import { CostDetails } from "./costdetails.js";
18
19
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
19
20
  import { FinishReason } from "./finishreason.js";
@@ -224,7 +225,7 @@ export type ContentTopLogprob = {
224
225
  logprob: number;
225
226
  token: string;
226
227
  };
227
- export type LogprobsContent = {
228
+ export type BatchResultContent = {
228
229
  bytes: Array<number> | null;
229
230
  logprob: number;
230
231
  token: string;
@@ -242,63 +243,19 @@ export type Refusal = {
242
243
  topLogprobs: Array<RefusalTopLogprob>;
243
244
  };
244
245
  export type Logprobs = {
245
- content: Array<LogprobsContent> | null;
246
+ content: Array<BatchResultContent> | null;
246
247
  refusal?: Array<Refusal> | null | undefined;
247
248
  };
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
249
  export type BatchResultImageUrl = {
293
250
  url: string;
294
251
  };
295
- export declare const ChoiceTypeImageURLEnum: {
252
+ export declare const ChoiceTypeImageURL: {
296
253
  readonly ImageUrl: "image_url";
297
254
  };
298
- export type ChoiceTypeImageURLEnum = ClosedEnum<typeof ChoiceTypeImageURLEnum>;
255
+ export type ChoiceTypeImageURL = ClosedEnum<typeof ChoiceTypeImageURL>;
299
256
  export type Image = {
300
257
  imageUrl: BatchResultImageUrl;
301
- type: ChoiceTypeImageURLEnum;
258
+ type: ChoiceTypeImageURL;
302
259
  };
303
260
  export type ReasoningDetail = ReasoningDetailSummary | ReasoningDetailEncrypted | ReasoningDetailText | ReasoningDetailServerToolCall | discriminatedUnionTypes.Unknown<"type">;
304
261
  export declare const ChoiceRole: {
@@ -320,7 +277,7 @@ export type ToolCall = {
320
277
  type: ChoiceTypeFunction;
321
278
  };
322
279
  export type Message = {
323
- annotations?: Array<AnnotationFile | AnnotationURLCitation | AnnotationWebSearchCitation | discriminatedUnionTypes.Unknown<"type">> | undefined;
280
+ annotations?: Array<ChatAnnotation> | undefined;
324
281
  content: string | null;
325
282
  images?: Array<Image> | null | undefined;
326
283
  reasoning?: string | null | undefined;
@@ -551,8 +508,8 @@ export declare function bodyMessageFromJSON(jsonString: string): SafeParseResult
551
508
  export declare const ContentTopLogprob$inboundSchema: z.ZodType<ContentTopLogprob, unknown>;
552
509
  export declare function contentTopLogprobFromJSON(jsonString: string): SafeParseResult<ContentTopLogprob, SDKValidationError>;
553
510
  /** @internal */
554
- export declare const LogprobsContent$inboundSchema: z.ZodType<LogprobsContent, unknown>;
555
- export declare function logprobsContentFromJSON(jsonString: string): SafeParseResult<LogprobsContent, SDKValidationError>;
511
+ export declare const BatchResultContent$inboundSchema: z.ZodType<BatchResultContent, unknown>;
512
+ export declare function batchResultContentFromJSON(jsonString: string): SafeParseResult<BatchResultContent, SDKValidationError>;
556
513
  /** @internal */
557
514
  export declare const RefusalTopLogprob$inboundSchema: z.ZodType<RefusalTopLogprob, unknown>;
558
515
  export declare function refusalTopLogprobFromJSON(jsonString: string): SafeParseResult<RefusalTopLogprob, SDKValidationError>;
@@ -563,43 +520,10 @@ export declare function refusalFromJSON(jsonString: string): SafeParseResult<Ref
563
520
  export declare const Logprobs$inboundSchema: z.ZodType<Logprobs, unknown>;
564
521
  export declare function logprobsFromJSON(jsonString: string): SafeParseResult<Logprobs, SDKValidationError>;
565
522
  /** @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
523
  export declare const BatchResultImageUrl$inboundSchema: z.ZodType<BatchResultImageUrl, unknown>;
600
524
  export declare function batchResultImageUrlFromJSON(jsonString: string): SafeParseResult<BatchResultImageUrl, SDKValidationError>;
601
525
  /** @internal */
602
- export declare const ChoiceTypeImageURLEnum$inboundSchema: z.ZodEnum<typeof ChoiceTypeImageURLEnum>;
526
+ export declare const ChoiceTypeImageURL$inboundSchema: z.ZodEnum<typeof ChoiceTypeImageURL>;
603
527
  /** @internal */
604
528
  export declare const Image$inboundSchema: z.ZodType<Image, unknown>;
605
529
  export declare function imageFromJSON(jsonString: string): SafeParseResult<Image, SDKValidationError>;
@@ -18,6 +18,7 @@ import { AnthropicSpeed$inboundSchema, } from "./anthropicspeed.js";
18
18
  import { AnthropicUsageIteration$inboundSchema, } from "./anthropicusageiteration.js";
19
19
  import { ApiErrorType$inboundSchema } from "./apierrortype.js";
20
20
  import { ArmorSafeguardResult$inboundSchema, } from "./armorsafeguardresult.js";
21
+ import { ChatAnnotation$inboundSchema, } from "./chatannotation.js";
21
22
  import { CostDetails$inboundSchema } from "./costdetails.js";
22
23
  import { FinishReason$inboundSchema } from "./finishreason.js";
23
24
  import { OpenResponsesResult$inboundSchema, } from "./openresponsesresult.js";
@@ -49,7 +50,7 @@ export const BatchResultRole = {
49
50
  export const BatchResultTypeMessage = {
50
51
  Message: "message",
51
52
  };
52
- export const ChoiceTypeImageURLEnum = {
53
+ export const ChoiceTypeImageURL = {
53
54
  ImageUrl: "image_url",
54
55
  };
55
56
  export const ChoiceRole = {
@@ -301,7 +302,7 @@ export function contentTopLogprobFromJSON(jsonString) {
301
302
  return safeParse(jsonString, (x) => ContentTopLogprob$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentTopLogprob' from JSON`);
302
303
  }
303
304
  /** @internal */
304
- export const LogprobsContent$inboundSchema = z.object({
305
+ export const BatchResultContent$inboundSchema = z.object({
305
306
  bytes: z.nullable(z.array(z.int())),
306
307
  logprob: z.number(),
307
308
  token: z.string(),
@@ -311,8 +312,8 @@ export const LogprobsContent$inboundSchema = z.object({
311
312
  "top_logprobs": "topLogprobs",
312
313
  });
313
314
  });
314
- export function logprobsContentFromJSON(jsonString) {
315
- return safeParse(jsonString, (x) => LogprobsContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LogprobsContent' from JSON`);
315
+ export function batchResultContentFromJSON(jsonString) {
316
+ return safeParse(jsonString, (x) => BatchResultContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultContent' from JSON`);
316
317
  }
317
318
  /** @internal */
318
319
  export const RefusalTopLogprob$inboundSchema = z.object({
@@ -339,134 +340,13 @@ export function refusalFromJSON(jsonString) {
339
340
  }
340
341
  /** @internal */
341
342
  export const Logprobs$inboundSchema = z.object({
342
- content: z.nullable(z.array(z.lazy(() => LogprobsContent$inboundSchema))),
343
+ content: z.nullable(z.array(z.lazy(() => BatchResultContent$inboundSchema))),
343
344
  refusal: z.nullable(z.array(z.lazy(() => Refusal$inboundSchema))).optional(),
344
345
  });
345
346
  export function logprobsFromJSON(jsonString) {
346
347
  return safeParse(jsonString, (x) => Logprobs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Logprobs' from JSON`);
347
348
  }
348
349
  /** @internal */
349
- export const WebSearchCitation$inboundSchema = z.object({
350
- cited_text: z.string().optional(),
351
- encrypted_index: z.string().optional(),
352
- title: z.nullable(z.string()),
353
- url: z.string(),
354
- }).transform((v) => {
355
- return remap$(v, {
356
- "cited_text": "citedText",
357
- "encrypted_index": "encryptedIndex",
358
- });
359
- });
360
- export function webSearchCitationFromJSON(jsonString) {
361
- return safeParse(jsonString, (x) => WebSearchCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebSearchCitation' from JSON`);
362
- }
363
- /** @internal */
364
- export const AnnotationWebSearchCitation$inboundSchema = z.object({
365
- type: z.literal("web_search_citation"),
366
- web_search_citation: z.lazy(() => WebSearchCitation$inboundSchema),
367
- }).transform((v) => {
368
- return remap$(v, {
369
- "web_search_citation": "webSearchCitation",
370
- });
371
- });
372
- export function annotationWebSearchCitationFromJSON(jsonString) {
373
- return safeParse(jsonString, (x) => AnnotationWebSearchCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnnotationWebSearchCitation' from JSON`);
374
- }
375
- /** @internal */
376
- export const BatchResultUrlCitation$inboundSchema = z.object({
377
- content: z.string().optional(),
378
- end_index: z.int(),
379
- start_index: z.int(),
380
- title: z.string(),
381
- uncited: z.literal(true).optional(),
382
- url: z.string(),
383
- }).transform((v) => {
384
- return remap$(v, {
385
- "end_index": "endIndex",
386
- "start_index": "startIndex",
387
- });
388
- });
389
- export function batchResultUrlCitationFromJSON(jsonString) {
390
- return safeParse(jsonString, (x) => BatchResultUrlCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultUrlCitation' from JSON`);
391
- }
392
- /** @internal */
393
- export const AnnotationURLCitation$inboundSchema = z.object({
394
- type: z.literal("url_citation"),
395
- url_citation: z.lazy(() => BatchResultUrlCitation$inboundSchema),
396
- }).transform((v) => {
397
- return remap$(v, {
398
- "url_citation": "urlCitation",
399
- });
400
- });
401
- export function annotationURLCitationFromJSON(jsonString) {
402
- return safeParse(jsonString, (x) => AnnotationURLCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnnotationURLCitation' from JSON`);
403
- }
404
- /** @internal */
405
- export const ContentImageUrlImageUrl$inboundSchema = z.object({
406
- url: z.string(),
407
- });
408
- export function contentImageUrlImageUrlFromJSON(jsonString) {
409
- return safeParse(jsonString, (x) => ContentImageUrlImageUrl$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentImageUrlImageUrl' from JSON`);
410
- }
411
- /** @internal */
412
- export const ContentImageURL$inboundSchema = z.object({
413
- image_url: z.lazy(() => ContentImageUrlImageUrl$inboundSchema),
414
- type: z.literal("image_url"),
415
- }).transform((v) => {
416
- return remap$(v, {
417
- "image_url": "imageUrl",
418
- });
419
- });
420
- export function contentImageURLFromJSON(jsonString) {
421
- return safeParse(jsonString, (x) => ContentImageURL$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentImageURL' from JSON`);
422
- }
423
- /** @internal */
424
- export const ContentText$inboundSchema = z
425
- .object({
426
- text: z.string(),
427
- type: z.literal("text"),
428
- });
429
- export function contentTextFromJSON(jsonString) {
430
- return safeParse(jsonString, (x) => ContentText$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentText' from JSON`);
431
- }
432
- /** @internal */
433
- export const AnnotationContentUnion$inboundSchema = discriminatedUnion("type", {
434
- text: z.lazy(() => ContentText$inboundSchema),
435
- image_url: z.lazy(() => ContentImageURL$inboundSchema),
436
- });
437
- export function annotationContentUnionFromJSON(jsonString) {
438
- return safeParse(jsonString, (x) => AnnotationContentUnion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnnotationContentUnion' from JSON`);
439
- }
440
- /** @internal */
441
- export const BatchResultFile$inboundSchema = z.object({
442
- content: z.array(discriminatedUnion("type", {
443
- text: z.lazy(() => ContentText$inboundSchema),
444
- image_url: z.lazy(() => ContentImageURL$inboundSchema),
445
- })),
446
- hash: z.string(),
447
- name: z.string().optional(),
448
- });
449
- export function batchResultFileFromJSON(jsonString) {
450
- return safeParse(jsonString, (x) => BatchResultFile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultFile' from JSON`);
451
- }
452
- /** @internal */
453
- export const AnnotationFile$inboundSchema = z.object({
454
- file: z.lazy(() => BatchResultFile$inboundSchema),
455
- type: z.literal("file"),
456
- });
457
- export function annotationFileFromJSON(jsonString) {
458
- return safeParse(jsonString, (x) => AnnotationFile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnnotationFile' from JSON`);
459
- }
460
- /** @internal */
461
- export const Annotation$inboundSchema = discriminatedUnion("type", {
462
- file: z.lazy(() => AnnotationFile$inboundSchema),
463
- url_citation: z.lazy(() => AnnotationURLCitation$inboundSchema),
464
- web_search_citation: z.lazy(() => AnnotationWebSearchCitation$inboundSchema),
465
- });
466
- export function annotationFromJSON(jsonString) {
467
- return safeParse(jsonString, (x) => Annotation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Annotation' from JSON`);
468
- }
469
- /** @internal */
470
350
  export const BatchResultImageUrl$inboundSchema = z.object({
471
351
  url: z.string(),
472
352
  });
@@ -474,11 +354,11 @@ export function batchResultImageUrlFromJSON(jsonString) {
474
354
  return safeParse(jsonString, (x) => BatchResultImageUrl$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultImageUrl' from JSON`);
475
355
  }
476
356
  /** @internal */
477
- export const ChoiceTypeImageURLEnum$inboundSchema = z.enum(ChoiceTypeImageURLEnum);
357
+ export const ChoiceTypeImageURL$inboundSchema = z.enum(ChoiceTypeImageURL);
478
358
  /** @internal */
479
359
  export const Image$inboundSchema = z.object({
480
360
  image_url: z.lazy(() => BatchResultImageUrl$inboundSchema),
481
- type: ChoiceTypeImageURLEnum$inboundSchema,
361
+ type: ChoiceTypeImageURL$inboundSchema,
482
362
  }).transform((v) => {
483
363
  return remap$(v, {
484
364
  "image_url": "imageUrl",
@@ -521,11 +401,7 @@ export function toolCallFromJSON(jsonString) {
521
401
  }
522
402
  /** @internal */
523
403
  export const Message$inboundSchema = z.object({
524
- annotations: z.array(discriminatedUnion("type", {
525
- file: z.lazy(() => AnnotationFile$inboundSchema),
526
- url_citation: z.lazy(() => AnnotationURLCitation$inboundSchema),
527
- web_search_citation: z.lazy(() => AnnotationWebSearchCitation$inboundSchema),
528
- })).optional(),
404
+ annotations: z.array(ChatAnnotation$inboundSchema).optional(),
529
405
  content: z.nullable(z.string()),
530
406
  images: z.nullable(z.array(z.lazy(() => Image$inboundSchema))).optional(),
531
407
  reasoning: z.nullable(z.string()).optional(),
@@ -0,0 +1,15 @@
1
+ import * as z from "zod/v4";
2
+ import * as discriminatedUnionTypes from "../types/discriminatedUnion.js";
3
+ import { Result as SafeParseResult } from "../types/fp.js";
4
+ import { ChatFileAnnotation } from "./chatfileannotation.js";
5
+ import { ChatUrlCitationAnnotation } from "./chaturlcitationannotation.js";
6
+ import { ChatWebSearchCitationAnnotation } from "./chatwebsearchcitationannotation.js";
7
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
8
+ /**
9
+ * Citation or file annotation on an assistant message
10
+ */
11
+ export type ChatAnnotation = ChatFileAnnotation | ChatUrlCitationAnnotation | ChatWebSearchCitationAnnotation | discriminatedUnionTypes.Unknown<"type">;
12
+ /** @internal */
13
+ export declare const ChatAnnotation$inboundSchema: z.ZodType<ChatAnnotation, unknown>;
14
+ export declare function chatAnnotationFromJSON(jsonString: string): SafeParseResult<ChatAnnotation, SDKValidationError>;
15
+ //# sourceMappingURL=chatannotation.d.ts.map
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ import { safeParse } from "../lib/schemas.js";
5
+ import { discriminatedUnion } from "../types/discriminatedUnion.js";
6
+ import { ChatFileAnnotation$inboundSchema, } from "./chatfileannotation.js";
7
+ import { ChatUrlCitationAnnotation$inboundSchema, } from "./chaturlcitationannotation.js";
8
+ import { ChatWebSearchCitationAnnotation$inboundSchema, } from "./chatwebsearchcitationannotation.js";
9
+ /** @internal */
10
+ export const ChatAnnotation$inboundSchema = discriminatedUnion("type", {
11
+ file: ChatFileAnnotation$inboundSchema,
12
+ url_citation: ChatUrlCitationAnnotation$inboundSchema,
13
+ web_search_citation: ChatWebSearchCitationAnnotation$inboundSchema,
14
+ });
15
+ export function chatAnnotationFromJSON(jsonString) {
16
+ return safeParse(jsonString, (x) => ChatAnnotation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatAnnotation' from JSON`);
17
+ }
18
+ //# sourceMappingURL=chatannotation.js.map
@@ -0,0 +1,47 @@
1
+ import * as z from "zod/v4";
2
+ import * as discriminatedUnionTypes from "../types/discriminatedUnion.js";
3
+ import { Result as SafeParseResult } from "../types/fp.js";
4
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
+ export type ChatFileAnnotationImageUrl = {
6
+ url: string;
7
+ };
8
+ export type ContentImageURL = {
9
+ imageUrl: ChatFileAnnotationImageUrl;
10
+ type: "image_url";
11
+ };
12
+ export type ContentText = {
13
+ text: string;
14
+ type: "text";
15
+ };
16
+ export type ChatFileAnnotationContentUnion = ContentText | ContentImageURL | discriminatedUnionTypes.Unknown<"type">;
17
+ export type ChatFileAnnotationFile = {
18
+ content: Array<ContentText | ContentImageURL | discriminatedUnionTypes.Unknown<"type">>;
19
+ hash: string;
20
+ name?: string | undefined;
21
+ };
22
+ /**
23
+ * File annotation with the parsed file content
24
+ */
25
+ export type ChatFileAnnotation = {
26
+ file: ChatFileAnnotationFile;
27
+ type: "file";
28
+ };
29
+ /** @internal */
30
+ export declare const ChatFileAnnotationImageUrl$inboundSchema: z.ZodType<ChatFileAnnotationImageUrl, unknown>;
31
+ export declare function chatFileAnnotationImageUrlFromJSON(jsonString: string): SafeParseResult<ChatFileAnnotationImageUrl, SDKValidationError>;
32
+ /** @internal */
33
+ export declare const ContentImageURL$inboundSchema: z.ZodType<ContentImageURL, unknown>;
34
+ export declare function contentImageURLFromJSON(jsonString: string): SafeParseResult<ContentImageURL, SDKValidationError>;
35
+ /** @internal */
36
+ export declare const ContentText$inboundSchema: z.ZodType<ContentText, unknown>;
37
+ export declare function contentTextFromJSON(jsonString: string): SafeParseResult<ContentText, SDKValidationError>;
38
+ /** @internal */
39
+ export declare const ChatFileAnnotationContentUnion$inboundSchema: z.ZodType<ChatFileAnnotationContentUnion, unknown>;
40
+ export declare function chatFileAnnotationContentUnionFromJSON(jsonString: string): SafeParseResult<ChatFileAnnotationContentUnion, SDKValidationError>;
41
+ /** @internal */
42
+ export declare const ChatFileAnnotationFile$inboundSchema: z.ZodType<ChatFileAnnotationFile, unknown>;
43
+ export declare function chatFileAnnotationFileFromJSON(jsonString: string): SafeParseResult<ChatFileAnnotationFile, SDKValidationError>;
44
+ /** @internal */
45
+ export declare const ChatFileAnnotation$inboundSchema: z.ZodType<ChatFileAnnotation, unknown>;
46
+ export declare function chatFileAnnotationFromJSON(jsonString: string): SafeParseResult<ChatFileAnnotation, SDKValidationError>;
47
+ //# sourceMappingURL=chatfileannotation.d.ts.map
@@ -0,0 +1,64 @@
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
+ import { safeParse } from "../lib/schemas.js";
7
+ import { discriminatedUnion } from "../types/discriminatedUnion.js";
8
+ /** @internal */
9
+ export const ChatFileAnnotationImageUrl$inboundSchema = z.object({
10
+ url: z.string(),
11
+ });
12
+ export function chatFileAnnotationImageUrlFromJSON(jsonString) {
13
+ return safeParse(jsonString, (x) => ChatFileAnnotationImageUrl$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatFileAnnotationImageUrl' from JSON`);
14
+ }
15
+ /** @internal */
16
+ export const ContentImageURL$inboundSchema = z.object({
17
+ image_url: z.lazy(() => ChatFileAnnotationImageUrl$inboundSchema),
18
+ type: z.literal("image_url"),
19
+ }).transform((v) => {
20
+ return remap$(v, {
21
+ "image_url": "imageUrl",
22
+ });
23
+ });
24
+ export function contentImageURLFromJSON(jsonString) {
25
+ return safeParse(jsonString, (x) => ContentImageURL$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentImageURL' from JSON`);
26
+ }
27
+ /** @internal */
28
+ export const ContentText$inboundSchema = z
29
+ .object({
30
+ text: z.string(),
31
+ type: z.literal("text"),
32
+ });
33
+ export function contentTextFromJSON(jsonString) {
34
+ return safeParse(jsonString, (x) => ContentText$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentText' from JSON`);
35
+ }
36
+ /** @internal */
37
+ export const ChatFileAnnotationContentUnion$inboundSchema = discriminatedUnion("type", {
38
+ text: z.lazy(() => ContentText$inboundSchema),
39
+ image_url: z.lazy(() => ContentImageURL$inboundSchema),
40
+ });
41
+ export function chatFileAnnotationContentUnionFromJSON(jsonString) {
42
+ return safeParse(jsonString, (x) => ChatFileAnnotationContentUnion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatFileAnnotationContentUnion' from JSON`);
43
+ }
44
+ /** @internal */
45
+ export const ChatFileAnnotationFile$inboundSchema = z.object({
46
+ content: z.array(discriminatedUnion("type", {
47
+ text: z.lazy(() => ContentText$inboundSchema),
48
+ image_url: z.lazy(() => ContentImageURL$inboundSchema),
49
+ })),
50
+ hash: z.string(),
51
+ name: z.string().optional(),
52
+ });
53
+ export function chatFileAnnotationFileFromJSON(jsonString) {
54
+ return safeParse(jsonString, (x) => ChatFileAnnotationFile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatFileAnnotationFile' from JSON`);
55
+ }
56
+ /** @internal */
57
+ export const ChatFileAnnotation$inboundSchema = z.object({
58
+ file: z.lazy(() => ChatFileAnnotationFile$inboundSchema),
59
+ type: z.literal("file"),
60
+ });
61
+ export function chatFileAnnotationFromJSON(jsonString) {
62
+ return safeParse(jsonString, (x) => ChatFileAnnotation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatFileAnnotation' from JSON`);
63
+ }
64
+ //# sourceMappingURL=chatfileannotation.js.map
@@ -0,0 +1,25 @@
1
+ import * as z from "zod/v4";
2
+ import { Result as SafeParseResult } from "../types/fp.js";
3
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
+ export type ChatUrlCitationAnnotationUrlCitation = {
5
+ content?: string | undefined;
6
+ endIndex: number;
7
+ startIndex: number;
8
+ title: string;
9
+ uncited?: true | undefined;
10
+ url: string;
11
+ };
12
+ /**
13
+ * URL citation annotation
14
+ */
15
+ export type ChatUrlCitationAnnotation = {
16
+ type: "url_citation";
17
+ urlCitation: ChatUrlCitationAnnotationUrlCitation;
18
+ };
19
+ /** @internal */
20
+ export declare const ChatUrlCitationAnnotationUrlCitation$inboundSchema: z.ZodType<ChatUrlCitationAnnotationUrlCitation, unknown>;
21
+ export declare function chatUrlCitationAnnotationUrlCitationFromJSON(jsonString: string): SafeParseResult<ChatUrlCitationAnnotationUrlCitation, SDKValidationError>;
22
+ /** @internal */
23
+ export declare const ChatUrlCitationAnnotation$inboundSchema: z.ZodType<ChatUrlCitationAnnotation, unknown>;
24
+ export declare function chatUrlCitationAnnotationFromJSON(jsonString: string): SafeParseResult<ChatUrlCitationAnnotation, SDKValidationError>;
25
+ //# sourceMappingURL=chaturlcitationannotation.d.ts.map
@@ -0,0 +1,36 @@
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
+ import { safeParse } from "../lib/schemas.js";
7
+ /** @internal */
8
+ export const ChatUrlCitationAnnotationUrlCitation$inboundSchema = z.object({
9
+ content: z.string().optional(),
10
+ end_index: z.int(),
11
+ start_index: z.int(),
12
+ title: z.string(),
13
+ uncited: z.literal(true).optional(),
14
+ url: z.string(),
15
+ }).transform((v) => {
16
+ return remap$(v, {
17
+ "end_index": "endIndex",
18
+ "start_index": "startIndex",
19
+ });
20
+ });
21
+ export function chatUrlCitationAnnotationUrlCitationFromJSON(jsonString) {
22
+ return safeParse(jsonString, (x) => ChatUrlCitationAnnotationUrlCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatUrlCitationAnnotationUrlCitation' from JSON`);
23
+ }
24
+ /** @internal */
25
+ export const ChatUrlCitationAnnotation$inboundSchema = z.object({
26
+ type: z.literal("url_citation"),
27
+ url_citation: z.lazy(() => ChatUrlCitationAnnotationUrlCitation$inboundSchema),
28
+ }).transform((v) => {
29
+ return remap$(v, {
30
+ "url_citation": "urlCitation",
31
+ });
32
+ });
33
+ export function chatUrlCitationAnnotationFromJSON(jsonString) {
34
+ return safeParse(jsonString, (x) => ChatUrlCitationAnnotation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatUrlCitationAnnotation' from JSON`);
35
+ }
36
+ //# sourceMappingURL=chaturlcitationannotation.js.map
@@ -0,0 +1,23 @@
1
+ import * as z from "zod/v4";
2
+ import { Result as SafeParseResult } from "../types/fp.js";
3
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
+ export type WebSearchCitation = {
5
+ citedText?: string | undefined;
6
+ encryptedIndex?: string | undefined;
7
+ title: string | null;
8
+ url: string;
9
+ };
10
+ /**
11
+ * Web search citation annotation
12
+ */
13
+ export type ChatWebSearchCitationAnnotation = {
14
+ type: "web_search_citation";
15
+ webSearchCitation: WebSearchCitation;
16
+ };
17
+ /** @internal */
18
+ export declare const WebSearchCitation$inboundSchema: z.ZodType<WebSearchCitation, unknown>;
19
+ export declare function webSearchCitationFromJSON(jsonString: string): SafeParseResult<WebSearchCitation, SDKValidationError>;
20
+ /** @internal */
21
+ export declare const ChatWebSearchCitationAnnotation$inboundSchema: z.ZodType<ChatWebSearchCitationAnnotation, unknown>;
22
+ export declare function chatWebSearchCitationAnnotationFromJSON(jsonString: string): SafeParseResult<ChatWebSearchCitationAnnotation, SDKValidationError>;
23
+ //# sourceMappingURL=chatwebsearchcitationannotation.d.ts.map
@@ -0,0 +1,34 @@
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
+ import { safeParse } from "../lib/schemas.js";
7
+ /** @internal */
8
+ export const WebSearchCitation$inboundSchema = z.object({
9
+ cited_text: z.string().optional(),
10
+ encrypted_index: z.string().optional(),
11
+ title: z.nullable(z.string()),
12
+ url: z.string(),
13
+ }).transform((v) => {
14
+ return remap$(v, {
15
+ "cited_text": "citedText",
16
+ "encrypted_index": "encryptedIndex",
17
+ });
18
+ });
19
+ export function webSearchCitationFromJSON(jsonString) {
20
+ return safeParse(jsonString, (x) => WebSearchCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebSearchCitation' from JSON`);
21
+ }
22
+ /** @internal */
23
+ export const ChatWebSearchCitationAnnotation$inboundSchema = z.object({
24
+ type: z.literal("web_search_citation"),
25
+ web_search_citation: z.lazy(() => WebSearchCitation$inboundSchema),
26
+ }).transform((v) => {
27
+ return remap$(v, {
28
+ "web_search_citation": "webSearchCitation",
29
+ });
30
+ });
31
+ export function chatWebSearchCitationAnnotationFromJSON(jsonString) {
32
+ return safeParse(jsonString, (x) => ChatWebSearchCitationAnnotation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatWebSearchCitationAnnotation' from JSON`);
33
+ }
34
+ //# sourceMappingURL=chatwebsearchcitationannotation.js.map
@@ -198,6 +198,7 @@ export * from "./byokproviderslug.js";
198
198
  export * from "./capabilitydescriptor.js";
199
199
  export * from "./changeguardrailpolicyassignmentrequest.js";
200
200
  export * from "./changeguardrailpolicyassignmentresponse.js";
201
+ export * from "./chatannotation.js";
201
202
  export * from "./chatassistantimages.js";
202
203
  export * from "./chatassistantmessage.js";
203
204
  export * from "./chataudiooutput.js";
@@ -213,6 +214,7 @@ export * from "./chatcontentvideoinput.js";
213
214
  export * from "./chatdebugoptions.js";
214
215
  export * from "./chatdevelopermessage.js";
215
216
  export * from "./chatdynamicservertool.js";
217
+ export * from "./chatfileannotation.js";
216
218
  export * from "./chatfinishreasonenum.js";
217
219
  export * from "./chatformatgrammarconfig.js";
218
220
  export * from "./chatformatjsonobjectconfig.js";
@@ -240,8 +242,10 @@ export * from "./chattokenlogprobs.js";
240
242
  export * from "./chattoolcall.js";
241
243
  export * from "./chattoolchoice.js";
242
244
  export * from "./chattoolmessage.js";
245
+ export * from "./chaturlcitationannotation.js";
243
246
  export * from "./chatusage.js";
244
247
  export * from "./chatusermessage.js";
248
+ export * from "./chatwebsearchcitationannotation.js";
245
249
  export * from "./chatwebsearchshorthand.js";
246
250
  export * from "./classifierfiltersfilter.js";
247
251
  export * from "./classifierscalarfilter.js";
@@ -201,6 +201,7 @@ export * from "./byokproviderslug.js";
201
201
  export * from "./capabilitydescriptor.js";
202
202
  export * from "./changeguardrailpolicyassignmentrequest.js";
203
203
  export * from "./changeguardrailpolicyassignmentresponse.js";
204
+ export * from "./chatannotation.js";
204
205
  export * from "./chatassistantimages.js";
205
206
  export * from "./chatassistantmessage.js";
206
207
  export * from "./chataudiooutput.js";
@@ -216,6 +217,7 @@ export * from "./chatcontentvideoinput.js";
216
217
  export * from "./chatdebugoptions.js";
217
218
  export * from "./chatdevelopermessage.js";
218
219
  export * from "./chatdynamicservertool.js";
220
+ export * from "./chatfileannotation.js";
219
221
  export * from "./chatfinishreasonenum.js";
220
222
  export * from "./chatformatgrammarconfig.js";
221
223
  export * from "./chatformatjsonobjectconfig.js";
@@ -243,8 +245,10 @@ export * from "./chattokenlogprobs.js";
243
245
  export * from "./chattoolcall.js";
244
246
  export * from "./chattoolchoice.js";
245
247
  export * from "./chattoolmessage.js";
248
+ export * from "./chaturlcitationannotation.js";
246
249
  export * from "./chatusage.js";
247
250
  export * from "./chatusermessage.js";
251
+ export * from "./chatwebsearchcitationannotation.js";
248
252
  export * from "./chatwebsearchshorthand.js";
249
253
  export * from "./classifierfiltersfilter.js";
250
254
  export * from "./classifierscalarfilter.js";
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.5.143",
5
+ "version": "1.5.144",
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.143",
3
+ "version": "1.5.144",
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,14 +73,14 @@
73
73
  "lint": "eslint --cache --max-warnings=0 src",
74
74
  "build": "node --max-old-space-size=8192 ./node_modules/typescript/bin/tsc && node scripts/unbarrel-imports.js",
75
75
  "prepublishOnly": "npm run build",
76
+ "compile": "node --max-old-space-size=8192 ./node_modules/typescript/bin/tsc && node scripts/unbarrel-imports.js",
76
77
  "postinstall": "node scripts/check-types.js || true",
77
78
  "prepare": "npm run build",
78
- "test": "vitest --run --project unit",
79
79
  "test:transit": "exit 0",
80
- "typecheck": "tsc --noEmit",
81
- "compile": "node --max-old-space-size=8192 ./node_modules/typescript/bin/tsc && node scripts/unbarrel-imports.js",
80
+ "test": "vitest --run --project unit",
82
81
  "test:e2e": "vitest --run --project e2e",
83
82
  "test:watch": "vitest --watch --project unit",
83
+ "typecheck": "tsc --noEmit",
84
84
  "typecheck:transit": "exit 0"
85
85
  },
86
86
  "peerDependencies": {