@openrouter/sdk 0.12.20 → 0.12.22

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.
Files changed (66) hide show
  1. package/esm/lib/config.d.ts +2 -2
  2. package/esm/lib/config.js +2 -2
  3. package/esm/models/chatusage.d.ts +13 -0
  4. package/esm/models/chatusage.js +6 -0
  5. package/esm/models/costdetails.d.ts +15 -0
  6. package/esm/models/costdetails.js +24 -0
  7. package/esm/models/createworkspacerequest.d.ts +10 -0
  8. package/esm/models/createworkspacerequest.js +4 -0
  9. package/esm/models/generationresponse.d.ts +5 -0
  10. package/esm/models/generationresponse.js +3 -0
  11. package/esm/models/index.d.ts +1 -0
  12. package/esm/models/index.js +1 -0
  13. package/esm/models/inputsunion.d.ts +18 -4
  14. package/esm/models/inputsunion.js +42 -0
  15. package/esm/models/outputapplypatchservertoolitem.d.ts +21 -1
  16. package/esm/models/outputapplypatchservertoolitem.js +20 -2
  17. package/esm/models/outputbashservertoolitem.d.ts +23 -1
  18. package/esm/models/outputbashservertoolitem.js +22 -2
  19. package/esm/models/outputbrowseruseservertoolitem.d.ts +21 -1
  20. package/esm/models/outputbrowseruseservertoolitem.js +20 -2
  21. package/esm/models/outputcodeinterpretercallitem.d.ts +43 -1
  22. package/esm/models/outputcodeinterpretercallitem.js +52 -2
  23. package/esm/models/outputcodeinterpreterservertoolitem.d.ts +24 -1
  24. package/esm/models/outputcodeinterpreterservertoolitem.js +23 -2
  25. package/esm/models/outputcomputercallitem.d.ts +33 -2
  26. package/esm/models/outputcomputercallitem.js +36 -1
  27. package/esm/models/outputfilesearchservertoolitem.d.ts +20 -1
  28. package/esm/models/outputfilesearchservertoolitem.js +19 -2
  29. package/esm/models/outputimagegenerationservertoolitem.d.ts +23 -1
  30. package/esm/models/outputimagegenerationservertoolitem.js +22 -2
  31. package/esm/models/outputitems.d.ts +31 -3
  32. package/esm/models/outputitems.js +19 -14
  33. package/esm/models/outputmcpservertoolitem.d.ts +21 -1
  34. package/esm/models/outputmcpservertoolitem.js +20 -2
  35. package/esm/models/outputmemoryservertoolitem.d.ts +24 -2
  36. package/esm/models/outputmemoryservertoolitem.js +23 -2
  37. package/esm/models/outputmodality.d.ts +1 -0
  38. package/esm/models/outputmodality.js +1 -0
  39. package/esm/models/outputsearchmodelsservertoolitem.d.ts +21 -1
  40. package/esm/models/outputsearchmodelsservertoolitem.js +20 -2
  41. package/esm/models/outputtexteditorservertoolitem.d.ts +23 -2
  42. package/esm/models/outputtexteditorservertoolitem.js +23 -2
  43. package/esm/models/outputtoolsearchservertoolitem.d.ts +20 -1
  44. package/esm/models/outputtoolsearchservertoolitem.js +19 -2
  45. package/esm/models/outputwebfetchservertoolitem.d.ts +22 -1
  46. package/esm/models/outputwebfetchservertoolitem.js +21 -2
  47. package/esm/models/providername.d.ts +1 -0
  48. package/esm/models/providername.js +1 -0
  49. package/esm/models/providerresponse.d.ts +1 -0
  50. package/esm/models/providerresponse.js +1 -0
  51. package/esm/models/speechrequest.d.ts +6 -0
  52. package/esm/models/speechrequest.js +1 -0
  53. package/esm/models/updateworkspacerequest.d.ts +10 -0
  54. package/esm/models/updateworkspacerequest.js +4 -0
  55. package/esm/models/usage.d.ts +4 -4
  56. package/esm/models/usage.js +4 -5
  57. package/esm/models/videogenerationrequest.d.ts +11 -0
  58. package/esm/models/videogenerationrequest.js +3 -0
  59. package/esm/models/websearchplugin.d.ts +35 -0
  60. package/esm/models/websearchplugin.js +21 -0
  61. package/esm/models/websearchuserlocationservertool.d.ts +8 -8
  62. package/esm/models/websearchuserlocationservertool.js +4 -4
  63. package/esm/models/workspace.d.ts +8 -0
  64. package/esm/models/workspace.js +4 -0
  65. package/jsr.json +1 -1
  66. package/package.json +5 -5
@@ -1,5 +1,6 @@
1
1
  import * as z from "zod/v4";
2
2
  import * as discriminatedUnionTypes from "../types/discriminatedUnion.js";
3
+ import { ClosedEnum } from "../types/enums.js";
3
4
  import { Result as SafeParseResult } from "../types/fp.js";
4
5
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
6
  import { ToolCallStatus } from "./toolcallstatus.js";
@@ -12,6 +13,10 @@ export type OutputImage = {
12
13
  url: string;
13
14
  };
14
15
  export type OutputCodeInterpreterCallItemOutputUnion = OutputImage | OutputLogs | discriminatedUnionTypes.Unknown<"type">;
16
+ export declare const TypeCodeInterpreterCall: {
17
+ readonly CodeInterpreterCall: "code_interpreter_call";
18
+ };
19
+ export type TypeCodeInterpreterCall = ClosedEnum<typeof TypeCodeInterpreterCall>;
15
20
  /**
16
21
  * A code interpreter execution call with outputs
17
22
  */
@@ -21,18 +26,55 @@ export type OutputCodeInterpreterCallItem = {
21
26
  id: string;
22
27
  outputs: Array<OutputImage | OutputLogs | discriminatedUnionTypes.Unknown<"type">> | null;
23
28
  status: ToolCallStatus;
24
- type: "code_interpreter_call";
29
+ type: TypeCodeInterpreterCall;
25
30
  };
26
31
  /** @internal */
27
32
  export declare const OutputLogs$inboundSchema: z.ZodType<OutputLogs, unknown>;
33
+ /** @internal */
34
+ export type OutputLogs$Outbound = {
35
+ logs: string;
36
+ type: "logs";
37
+ };
38
+ /** @internal */
39
+ export declare const OutputLogs$outboundSchema: z.ZodType<OutputLogs$Outbound, OutputLogs>;
40
+ export declare function outputLogsToJSON(outputLogs: OutputLogs): string;
28
41
  export declare function outputLogsFromJSON(jsonString: string): SafeParseResult<OutputLogs, SDKValidationError>;
29
42
  /** @internal */
30
43
  export declare const OutputImage$inboundSchema: z.ZodType<OutputImage, unknown>;
44
+ /** @internal */
45
+ export type OutputImage$Outbound = {
46
+ type: "image";
47
+ url: string;
48
+ };
49
+ /** @internal */
50
+ export declare const OutputImage$outboundSchema: z.ZodType<OutputImage$Outbound, OutputImage>;
51
+ export declare function outputImageToJSON(outputImage: OutputImage): string;
31
52
  export declare function outputImageFromJSON(jsonString: string): SafeParseResult<OutputImage, SDKValidationError>;
32
53
  /** @internal */
33
54
  export declare const OutputCodeInterpreterCallItemOutputUnion$inboundSchema: z.ZodType<OutputCodeInterpreterCallItemOutputUnion, unknown>;
55
+ /** @internal */
56
+ export type OutputCodeInterpreterCallItemOutputUnion$Outbound = OutputImage$Outbound | OutputLogs$Outbound;
57
+ /** @internal */
58
+ export declare const OutputCodeInterpreterCallItemOutputUnion$outboundSchema: z.ZodType<OutputCodeInterpreterCallItemOutputUnion$Outbound, OutputCodeInterpreterCallItemOutputUnion>;
59
+ export declare function outputCodeInterpreterCallItemOutputUnionToJSON(outputCodeInterpreterCallItemOutputUnion: OutputCodeInterpreterCallItemOutputUnion): string;
34
60
  export declare function outputCodeInterpreterCallItemOutputUnionFromJSON(jsonString: string): SafeParseResult<OutputCodeInterpreterCallItemOutputUnion, SDKValidationError>;
35
61
  /** @internal */
62
+ export declare const TypeCodeInterpreterCall$inboundSchema: z.ZodEnum<typeof TypeCodeInterpreterCall>;
63
+ /** @internal */
64
+ export declare const TypeCodeInterpreterCall$outboundSchema: z.ZodEnum<typeof TypeCodeInterpreterCall>;
65
+ /** @internal */
36
66
  export declare const OutputCodeInterpreterCallItem$inboundSchema: z.ZodType<OutputCodeInterpreterCallItem, unknown>;
67
+ /** @internal */
68
+ export type OutputCodeInterpreterCallItem$Outbound = {
69
+ code: string | null;
70
+ container_id: string;
71
+ id: string;
72
+ outputs: Array<OutputImage$Outbound | OutputLogs$Outbound> | null;
73
+ status: string;
74
+ type: string;
75
+ };
76
+ /** @internal */
77
+ export declare const OutputCodeInterpreterCallItem$outboundSchema: z.ZodType<OutputCodeInterpreterCallItem$Outbound, OutputCodeInterpreterCallItem>;
78
+ export declare function outputCodeInterpreterCallItemToJSON(outputCodeInterpreterCallItem: OutputCodeInterpreterCallItem): string;
37
79
  export declare function outputCodeInterpreterCallItemFromJSON(jsonString: string): SafeParseResult<OutputCodeInterpreterCallItem, SDKValidationError>;
38
80
  //# sourceMappingURL=outputcodeinterpretercallitem.d.ts.map
@@ -6,13 +6,24 @@ import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../lib/primitives.js";
7
7
  import { safeParse } from "../lib/schemas.js";
8
8
  import { discriminatedUnion } from "../types/discriminatedUnion.js";
9
- import { ToolCallStatus$inboundSchema, } from "./toolcallstatus.js";
9
+ import { ToolCallStatus$inboundSchema, ToolCallStatus$outboundSchema, } from "./toolcallstatus.js";
10
+ export const TypeCodeInterpreterCall = {
11
+ CodeInterpreterCall: "code_interpreter_call",
12
+ };
10
13
  /** @internal */
11
14
  export const OutputLogs$inboundSchema = z
12
15
  .object({
13
16
  logs: z.string(),
14
17
  type: z.literal("logs"),
15
18
  });
19
+ /** @internal */
20
+ export const OutputLogs$outboundSchema = z.object({
21
+ logs: z.string(),
22
+ type: z.literal("logs"),
23
+ });
24
+ export function outputLogsToJSON(outputLogs) {
25
+ return JSON.stringify(OutputLogs$outboundSchema.parse(outputLogs));
26
+ }
16
27
  export function outputLogsFromJSON(jsonString) {
17
28
  return safeParse(jsonString, (x) => OutputLogs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputLogs' from JSON`);
18
29
  }
@@ -22,6 +33,14 @@ export const OutputImage$inboundSchema = z
22
33
  type: z.literal("image"),
23
34
  url: z.string(),
24
35
  });
36
+ /** @internal */
37
+ export const OutputImage$outboundSchema = z.object({
38
+ type: z.literal("image"),
39
+ url: z.string(),
40
+ });
41
+ export function outputImageToJSON(outputImage) {
42
+ return JSON.stringify(OutputImage$outboundSchema.parse(outputImage));
43
+ }
25
44
  export function outputImageFromJSON(jsonString) {
26
45
  return safeParse(jsonString, (x) => OutputImage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputImage' from JSON`);
27
46
  }
@@ -30,10 +49,22 @@ export const OutputCodeInterpreterCallItemOutputUnion$inboundSchema = discrimina
30
49
  image: z.lazy(() => OutputImage$inboundSchema),
31
50
  logs: z.lazy(() => OutputLogs$inboundSchema),
32
51
  });
52
+ /** @internal */
53
+ export const OutputCodeInterpreterCallItemOutputUnion$outboundSchema = z.union([
54
+ z.lazy(() => OutputImage$outboundSchema),
55
+ z.lazy(() => OutputLogs$outboundSchema),
56
+ ]);
57
+ export function outputCodeInterpreterCallItemOutputUnionToJSON(outputCodeInterpreterCallItemOutputUnion) {
58
+ return JSON.stringify(OutputCodeInterpreterCallItemOutputUnion$outboundSchema.parse(outputCodeInterpreterCallItemOutputUnion));
59
+ }
33
60
  export function outputCodeInterpreterCallItemOutputUnionFromJSON(jsonString) {
34
61
  return safeParse(jsonString, (x) => OutputCodeInterpreterCallItemOutputUnion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputCodeInterpreterCallItemOutputUnion' from JSON`);
35
62
  }
36
63
  /** @internal */
64
+ export const TypeCodeInterpreterCall$inboundSchema = z.enum(TypeCodeInterpreterCall);
65
+ /** @internal */
66
+ export const TypeCodeInterpreterCall$outboundSchema = TypeCodeInterpreterCall$inboundSchema;
67
+ /** @internal */
37
68
  export const OutputCodeInterpreterCallItem$inboundSchema = z.object({
38
69
  code: z.nullable(z.string()),
39
70
  container_id: z.string(),
@@ -43,12 +74,31 @@ export const OutputCodeInterpreterCallItem$inboundSchema = z.object({
43
74
  logs: z.lazy(() => OutputLogs$inboundSchema),
44
75
  }))),
45
76
  status: ToolCallStatus$inboundSchema,
46
- type: z.literal("code_interpreter_call"),
77
+ type: TypeCodeInterpreterCall$inboundSchema,
47
78
  }).transform((v) => {
48
79
  return remap$(v, {
49
80
  "container_id": "containerId",
50
81
  });
51
82
  });
83
+ /** @internal */
84
+ export const OutputCodeInterpreterCallItem$outboundSchema = z.object({
85
+ code: z.nullable(z.string()),
86
+ containerId: z.string(),
87
+ id: z.string(),
88
+ outputs: z.nullable(z.array(z.union([
89
+ z.lazy(() => OutputImage$outboundSchema),
90
+ z.lazy(() => OutputLogs$outboundSchema),
91
+ ]))),
92
+ status: ToolCallStatus$outboundSchema,
93
+ type: TypeCodeInterpreterCall$outboundSchema,
94
+ }).transform((v) => {
95
+ return remap$(v, {
96
+ containerId: "container_id",
97
+ });
98
+ });
99
+ export function outputCodeInterpreterCallItemToJSON(outputCodeInterpreterCallItem) {
100
+ return JSON.stringify(OutputCodeInterpreterCallItem$outboundSchema.parse(outputCodeInterpreterCallItem));
101
+ }
52
102
  export function outputCodeInterpreterCallItemFromJSON(jsonString) {
53
103
  return safeParse(jsonString, (x) => OutputCodeInterpreterCallItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputCodeInterpreterCallItem' from JSON`);
54
104
  }
@@ -1,7 +1,12 @@
1
1
  import * as z from "zod/v4";
2
+ import { ClosedEnum } from "../types/enums.js";
2
3
  import { Result as SafeParseResult } from "../types/fp.js";
3
4
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
5
  import { ToolCallStatus } from "./toolcallstatus.js";
6
+ export declare const OutputCodeInterpreterServerToolItemType: {
7
+ readonly OpenrouterCodeInterpreter: "openrouter:code_interpreter";
8
+ };
9
+ export type OutputCodeInterpreterServerToolItemType = ClosedEnum<typeof OutputCodeInterpreterServerToolItemType>;
5
10
  /**
6
11
  * An openrouter:code_interpreter server tool output item
7
12
  */
@@ -13,9 +18,27 @@ export type OutputCodeInterpreterServerToolItem = {
13
18
  status: ToolCallStatus;
14
19
  stderr?: string | undefined;
15
20
  stdout?: string | undefined;
16
- type: "openrouter:code_interpreter";
21
+ type: OutputCodeInterpreterServerToolItemType;
17
22
  };
18
23
  /** @internal */
24
+ export declare const OutputCodeInterpreterServerToolItemType$inboundSchema: z.ZodEnum<typeof OutputCodeInterpreterServerToolItemType>;
25
+ /** @internal */
26
+ export declare const OutputCodeInterpreterServerToolItemType$outboundSchema: z.ZodEnum<typeof OutputCodeInterpreterServerToolItemType>;
27
+ /** @internal */
19
28
  export declare const OutputCodeInterpreterServerToolItem$inboundSchema: z.ZodType<OutputCodeInterpreterServerToolItem, unknown>;
29
+ /** @internal */
30
+ export type OutputCodeInterpreterServerToolItem$Outbound = {
31
+ code?: string | undefined;
32
+ exitCode?: number | undefined;
33
+ id?: string | undefined;
34
+ language?: string | undefined;
35
+ status: string;
36
+ stderr?: string | undefined;
37
+ stdout?: string | undefined;
38
+ type: string;
39
+ };
40
+ /** @internal */
41
+ export declare const OutputCodeInterpreterServerToolItem$outboundSchema: z.ZodType<OutputCodeInterpreterServerToolItem$Outbound, OutputCodeInterpreterServerToolItem>;
42
+ export declare function outputCodeInterpreterServerToolItemToJSON(outputCodeInterpreterServerToolItem: OutputCodeInterpreterServerToolItem): string;
20
43
  export declare function outputCodeInterpreterServerToolItemFromJSON(jsonString: string): SafeParseResult<OutputCodeInterpreterServerToolItem, SDKValidationError>;
21
44
  //# sourceMappingURL=outputcodeinterpreterservertoolitem.d.ts.map
@@ -4,7 +4,14 @@
4
4
  */
5
5
  import * as z from "zod/v4";
6
6
  import { safeParse } from "../lib/schemas.js";
7
- import { ToolCallStatus$inboundSchema, } from "./toolcallstatus.js";
7
+ import { ToolCallStatus$inboundSchema, ToolCallStatus$outboundSchema, } from "./toolcallstatus.js";
8
+ export const OutputCodeInterpreterServerToolItemType = {
9
+ OpenrouterCodeInterpreter: "openrouter:code_interpreter",
10
+ };
11
+ /** @internal */
12
+ export const OutputCodeInterpreterServerToolItemType$inboundSchema = z.enum(OutputCodeInterpreterServerToolItemType);
13
+ /** @internal */
14
+ export const OutputCodeInterpreterServerToolItemType$outboundSchema = OutputCodeInterpreterServerToolItemType$inboundSchema;
8
15
  /** @internal */
9
16
  export const OutputCodeInterpreterServerToolItem$inboundSchema = z.object({
10
17
  code: z.string().optional(),
@@ -14,8 +21,22 @@ export const OutputCodeInterpreterServerToolItem$inboundSchema = z.object({
14
21
  status: ToolCallStatus$inboundSchema,
15
22
  stderr: z.string().optional(),
16
23
  stdout: z.string().optional(),
17
- type: z.literal("openrouter:code_interpreter"),
24
+ type: OutputCodeInterpreterServerToolItemType$inboundSchema,
18
25
  });
26
+ /** @internal */
27
+ export const OutputCodeInterpreterServerToolItem$outboundSchema = z.object({
28
+ code: z.string().optional(),
29
+ exitCode: z.int().optional(),
30
+ id: z.string().optional(),
31
+ language: z.string().optional(),
32
+ status: ToolCallStatus$outboundSchema,
33
+ stderr: z.string().optional(),
34
+ stdout: z.string().optional(),
35
+ type: OutputCodeInterpreterServerToolItemType$outboundSchema,
36
+ });
37
+ export function outputCodeInterpreterServerToolItemToJSON(outputCodeInterpreterServerToolItem) {
38
+ return JSON.stringify(OutputCodeInterpreterServerToolItem$outboundSchema.parse(outputCodeInterpreterServerToolItem));
39
+ }
19
40
  export function outputCodeInterpreterServerToolItemFromJSON(jsonString) {
20
41
  return safeParse(jsonString, (x) => OutputCodeInterpreterServerToolItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputCodeInterpreterServerToolItem' from JSON`);
21
42
  }
@@ -1,5 +1,5 @@
1
1
  import * as z from "zod/v4";
2
- import { OpenEnum } from "../types/enums.js";
2
+ import { ClosedEnum, OpenEnum } from "../types/enums.js";
3
3
  import { Result as SafeParseResult } from "../types/fp.js";
4
4
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
5
  export type PendingSafetyCheck = {
@@ -13,20 +13,51 @@ export declare const OutputComputerCallItemStatus: {
13
13
  readonly InProgress: "in_progress";
14
14
  };
15
15
  export type OutputComputerCallItemStatus = OpenEnum<typeof OutputComputerCallItemStatus>;
16
+ export declare const OutputComputerCallItemType: {
17
+ readonly ComputerCall: "computer_call";
18
+ };
19
+ export type OutputComputerCallItemType = ClosedEnum<typeof OutputComputerCallItemType>;
16
20
  export type OutputComputerCallItem = {
17
21
  action?: any | null | undefined;
18
22
  callId: string;
19
23
  id?: string | undefined;
20
24
  pendingSafetyChecks: Array<PendingSafetyCheck>;
21
25
  status: OutputComputerCallItemStatus;
22
- type: "computer_call";
26
+ type: OutputComputerCallItemType;
23
27
  };
24
28
  /** @internal */
25
29
  export declare const PendingSafetyCheck$inboundSchema: z.ZodType<PendingSafetyCheck, unknown>;
30
+ /** @internal */
31
+ export type PendingSafetyCheck$Outbound = {
32
+ code: string;
33
+ id: string;
34
+ message: string;
35
+ };
36
+ /** @internal */
37
+ export declare const PendingSafetyCheck$outboundSchema: z.ZodType<PendingSafetyCheck$Outbound, PendingSafetyCheck>;
38
+ export declare function pendingSafetyCheckToJSON(pendingSafetyCheck: PendingSafetyCheck): string;
26
39
  export declare function pendingSafetyCheckFromJSON(jsonString: string): SafeParseResult<PendingSafetyCheck, SDKValidationError>;
27
40
  /** @internal */
28
41
  export declare const OutputComputerCallItemStatus$inboundSchema: z.ZodType<OutputComputerCallItemStatus, unknown>;
29
42
  /** @internal */
43
+ export declare const OutputComputerCallItemStatus$outboundSchema: z.ZodType<string, OutputComputerCallItemStatus>;
44
+ /** @internal */
45
+ export declare const OutputComputerCallItemType$inboundSchema: z.ZodEnum<typeof OutputComputerCallItemType>;
46
+ /** @internal */
47
+ export declare const OutputComputerCallItemType$outboundSchema: z.ZodEnum<typeof OutputComputerCallItemType>;
48
+ /** @internal */
30
49
  export declare const OutputComputerCallItem$inboundSchema: z.ZodType<OutputComputerCallItem, unknown>;
50
+ /** @internal */
51
+ export type OutputComputerCallItem$Outbound = {
52
+ action?: any | null | undefined;
53
+ call_id: string;
54
+ id?: string | undefined;
55
+ pending_safety_checks: Array<PendingSafetyCheck$Outbound>;
56
+ status: string;
57
+ type: string;
58
+ };
59
+ /** @internal */
60
+ export declare const OutputComputerCallItem$outboundSchema: z.ZodType<OutputComputerCallItem$Outbound, OutputComputerCallItem>;
61
+ export declare function outputComputerCallItemToJSON(outputComputerCallItem: OutputComputerCallItem): string;
31
62
  export declare function outputComputerCallItemFromJSON(jsonString: string): SafeParseResult<OutputComputerCallItem, SDKValidationError>;
32
63
  //# sourceMappingURL=outputcomputercallitem.d.ts.map
@@ -11,31 +11,66 @@ export const OutputComputerCallItemStatus = {
11
11
  Incomplete: "incomplete",
12
12
  InProgress: "in_progress",
13
13
  };
14
+ export const OutputComputerCallItemType = {
15
+ ComputerCall: "computer_call",
16
+ };
14
17
  /** @internal */
15
18
  export const PendingSafetyCheck$inboundSchema = z.object({
16
19
  code: z.string(),
17
20
  id: z.string(),
18
21
  message: z.string(),
19
22
  });
23
+ /** @internal */
24
+ export const PendingSafetyCheck$outboundSchema = z.object({
25
+ code: z.string(),
26
+ id: z.string(),
27
+ message: z.string(),
28
+ });
29
+ export function pendingSafetyCheckToJSON(pendingSafetyCheck) {
30
+ return JSON.stringify(PendingSafetyCheck$outboundSchema.parse(pendingSafetyCheck));
31
+ }
20
32
  export function pendingSafetyCheckFromJSON(jsonString) {
21
33
  return safeParse(jsonString, (x) => PendingSafetyCheck$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PendingSafetyCheck' from JSON`);
22
34
  }
23
35
  /** @internal */
24
36
  export const OutputComputerCallItemStatus$inboundSchema = openEnums.inboundSchema(OutputComputerCallItemStatus);
25
37
  /** @internal */
38
+ export const OutputComputerCallItemStatus$outboundSchema = openEnums.outboundSchema(OutputComputerCallItemStatus);
39
+ /** @internal */
40
+ export const OutputComputerCallItemType$inboundSchema = z.enum(OutputComputerCallItemType);
41
+ /** @internal */
42
+ export const OutputComputerCallItemType$outboundSchema = OutputComputerCallItemType$inboundSchema;
43
+ /** @internal */
26
44
  export const OutputComputerCallItem$inboundSchema = z.object({
27
45
  action: z.nullable(z.any()).optional(),
28
46
  call_id: z.string(),
29
47
  id: z.string().optional(),
30
48
  pending_safety_checks: z.array(z.lazy(() => PendingSafetyCheck$inboundSchema)),
31
49
  status: OutputComputerCallItemStatus$inboundSchema,
32
- type: z.literal("computer_call"),
50
+ type: OutputComputerCallItemType$inboundSchema,
33
51
  }).transform((v) => {
34
52
  return remap$(v, {
35
53
  "call_id": "callId",
36
54
  "pending_safety_checks": "pendingSafetyChecks",
37
55
  });
38
56
  });
57
+ /** @internal */
58
+ export const OutputComputerCallItem$outboundSchema = z.object({
59
+ action: z.nullable(z.any()).optional(),
60
+ callId: z.string(),
61
+ id: z.string().optional(),
62
+ pendingSafetyChecks: z.array(z.lazy(() => PendingSafetyCheck$outboundSchema)),
63
+ status: OutputComputerCallItemStatus$outboundSchema,
64
+ type: OutputComputerCallItemType$outboundSchema,
65
+ }).transform((v) => {
66
+ return remap$(v, {
67
+ callId: "call_id",
68
+ pendingSafetyChecks: "pending_safety_checks",
69
+ });
70
+ });
71
+ export function outputComputerCallItemToJSON(outputComputerCallItem) {
72
+ return JSON.stringify(OutputComputerCallItem$outboundSchema.parse(outputComputerCallItem));
73
+ }
39
74
  export function outputComputerCallItemFromJSON(jsonString) {
40
75
  return safeParse(jsonString, (x) => OutputComputerCallItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputComputerCallItem' from JSON`);
41
76
  }
@@ -1,7 +1,12 @@
1
1
  import * as z from "zod/v4";
2
+ import { ClosedEnum } from "../types/enums.js";
2
3
  import { Result as SafeParseResult } from "../types/fp.js";
3
4
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
5
  import { ToolCallStatus } from "./toolcallstatus.js";
6
+ export declare const OutputFileSearchServerToolItemType: {
7
+ readonly OpenrouterFileSearch: "openrouter:file_search";
8
+ };
9
+ export type OutputFileSearchServerToolItemType = ClosedEnum<typeof OutputFileSearchServerToolItemType>;
5
10
  /**
6
11
  * An openrouter:file_search server tool output item
7
12
  */
@@ -9,9 +14,23 @@ export type OutputFileSearchServerToolItem = {
9
14
  id?: string | undefined;
10
15
  queries?: Array<string> | undefined;
11
16
  status: ToolCallStatus;
12
- type: "openrouter:file_search";
17
+ type: OutputFileSearchServerToolItemType;
13
18
  };
14
19
  /** @internal */
20
+ export declare const OutputFileSearchServerToolItemType$inboundSchema: z.ZodEnum<typeof OutputFileSearchServerToolItemType>;
21
+ /** @internal */
22
+ export declare const OutputFileSearchServerToolItemType$outboundSchema: z.ZodEnum<typeof OutputFileSearchServerToolItemType>;
23
+ /** @internal */
15
24
  export declare const OutputFileSearchServerToolItem$inboundSchema: z.ZodType<OutputFileSearchServerToolItem, unknown>;
25
+ /** @internal */
26
+ export type OutputFileSearchServerToolItem$Outbound = {
27
+ id?: string | undefined;
28
+ queries?: Array<string> | undefined;
29
+ status: string;
30
+ type: string;
31
+ };
32
+ /** @internal */
33
+ export declare const OutputFileSearchServerToolItem$outboundSchema: z.ZodType<OutputFileSearchServerToolItem$Outbound, OutputFileSearchServerToolItem>;
34
+ export declare function outputFileSearchServerToolItemToJSON(outputFileSearchServerToolItem: OutputFileSearchServerToolItem): string;
16
35
  export declare function outputFileSearchServerToolItemFromJSON(jsonString: string): SafeParseResult<OutputFileSearchServerToolItem, SDKValidationError>;
17
36
  //# sourceMappingURL=outputfilesearchservertoolitem.d.ts.map
@@ -4,14 +4,31 @@
4
4
  */
5
5
  import * as z from "zod/v4";
6
6
  import { safeParse } from "../lib/schemas.js";
7
- import { ToolCallStatus$inboundSchema, } from "./toolcallstatus.js";
7
+ import { ToolCallStatus$inboundSchema, ToolCallStatus$outboundSchema, } from "./toolcallstatus.js";
8
+ export const OutputFileSearchServerToolItemType = {
9
+ OpenrouterFileSearch: "openrouter:file_search",
10
+ };
11
+ /** @internal */
12
+ export const OutputFileSearchServerToolItemType$inboundSchema = z.enum(OutputFileSearchServerToolItemType);
13
+ /** @internal */
14
+ export const OutputFileSearchServerToolItemType$outboundSchema = OutputFileSearchServerToolItemType$inboundSchema;
8
15
  /** @internal */
9
16
  export const OutputFileSearchServerToolItem$inboundSchema = z.object({
10
17
  id: z.string().optional(),
11
18
  queries: z.array(z.string()).optional(),
12
19
  status: ToolCallStatus$inboundSchema,
13
- type: z.literal("openrouter:file_search"),
20
+ type: OutputFileSearchServerToolItemType$inboundSchema,
14
21
  });
22
+ /** @internal */
23
+ export const OutputFileSearchServerToolItem$outboundSchema = z.object({
24
+ id: z.string().optional(),
25
+ queries: z.array(z.string()).optional(),
26
+ status: ToolCallStatus$outboundSchema,
27
+ type: OutputFileSearchServerToolItemType$outboundSchema,
28
+ });
29
+ export function outputFileSearchServerToolItemToJSON(outputFileSearchServerToolItem) {
30
+ return JSON.stringify(OutputFileSearchServerToolItem$outboundSchema.parse(outputFileSearchServerToolItem));
31
+ }
15
32
  export function outputFileSearchServerToolItemFromJSON(jsonString) {
16
33
  return safeParse(jsonString, (x) => OutputFileSearchServerToolItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputFileSearchServerToolItem' from JSON`);
17
34
  }
@@ -1,7 +1,12 @@
1
1
  import * as z from "zod/v4";
2
+ import { ClosedEnum } from "../types/enums.js";
2
3
  import { Result as SafeParseResult } from "../types/fp.js";
3
4
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
5
  import { ToolCallStatus } from "./toolcallstatus.js";
6
+ export declare const OutputImageGenerationServerToolItemType: {
7
+ readonly OpenrouterImageGeneration: "openrouter:image_generation";
8
+ };
9
+ export type OutputImageGenerationServerToolItemType = ClosedEnum<typeof OutputImageGenerationServerToolItemType>;
5
10
  /**
6
11
  * An openrouter:image_generation server tool output item
7
12
  */
@@ -15,9 +20,26 @@ export type OutputImageGenerationServerToolItem = {
15
20
  result?: string | null | undefined;
16
21
  revisedPrompt?: string | undefined;
17
22
  status: ToolCallStatus;
18
- type: "openrouter:image_generation";
23
+ type: OutputImageGenerationServerToolItemType;
19
24
  };
20
25
  /** @internal */
26
+ export declare const OutputImageGenerationServerToolItemType$inboundSchema: z.ZodEnum<typeof OutputImageGenerationServerToolItemType>;
27
+ /** @internal */
28
+ export declare const OutputImageGenerationServerToolItemType$outboundSchema: z.ZodEnum<typeof OutputImageGenerationServerToolItemType>;
29
+ /** @internal */
21
30
  export declare const OutputImageGenerationServerToolItem$inboundSchema: z.ZodType<OutputImageGenerationServerToolItem, unknown>;
31
+ /** @internal */
32
+ export type OutputImageGenerationServerToolItem$Outbound = {
33
+ id?: string | undefined;
34
+ imageB64?: string | undefined;
35
+ imageUrl?: string | undefined;
36
+ result?: string | null | undefined;
37
+ revisedPrompt?: string | undefined;
38
+ status: string;
39
+ type: string;
40
+ };
41
+ /** @internal */
42
+ export declare const OutputImageGenerationServerToolItem$outboundSchema: z.ZodType<OutputImageGenerationServerToolItem$Outbound, OutputImageGenerationServerToolItem>;
43
+ export declare function outputImageGenerationServerToolItemToJSON(outputImageGenerationServerToolItem: OutputImageGenerationServerToolItem): string;
22
44
  export declare function outputImageGenerationServerToolItemFromJSON(jsonString: string): SafeParseResult<OutputImageGenerationServerToolItem, SDKValidationError>;
23
45
  //# sourceMappingURL=outputimagegenerationservertoolitem.d.ts.map
@@ -4,7 +4,14 @@
4
4
  */
5
5
  import * as z from "zod/v4";
6
6
  import { safeParse } from "../lib/schemas.js";
7
- import { ToolCallStatus$inboundSchema, } from "./toolcallstatus.js";
7
+ import { ToolCallStatus$inboundSchema, ToolCallStatus$outboundSchema, } from "./toolcallstatus.js";
8
+ export const OutputImageGenerationServerToolItemType = {
9
+ OpenrouterImageGeneration: "openrouter:image_generation",
10
+ };
11
+ /** @internal */
12
+ export const OutputImageGenerationServerToolItemType$inboundSchema = z.enum(OutputImageGenerationServerToolItemType);
13
+ /** @internal */
14
+ export const OutputImageGenerationServerToolItemType$outboundSchema = OutputImageGenerationServerToolItemType$inboundSchema;
8
15
  /** @internal */
9
16
  export const OutputImageGenerationServerToolItem$inboundSchema = z.object({
10
17
  id: z.string().optional(),
@@ -13,8 +20,21 @@ export const OutputImageGenerationServerToolItem$inboundSchema = z.object({
13
20
  result: z.nullable(z.string()).optional(),
14
21
  revisedPrompt: z.string().optional(),
15
22
  status: ToolCallStatus$inboundSchema,
16
- type: z.literal("openrouter:image_generation"),
23
+ type: OutputImageGenerationServerToolItemType$inboundSchema,
24
+ });
25
+ /** @internal */
26
+ export const OutputImageGenerationServerToolItem$outboundSchema = z.object({
27
+ id: z.string().optional(),
28
+ imageB64: z.string().optional(),
29
+ imageUrl: z.string().optional(),
30
+ result: z.nullable(z.string()).optional(),
31
+ revisedPrompt: z.string().optional(),
32
+ status: ToolCallStatus$outboundSchema,
33
+ type: OutputImageGenerationServerToolItemType$outboundSchema,
17
34
  });
35
+ export function outputImageGenerationServerToolItemToJSON(outputImageGenerationServerToolItem) {
36
+ return JSON.stringify(OutputImageGenerationServerToolItem$outboundSchema.parse(outputImageGenerationServerToolItem));
37
+ }
18
38
  export function outputImageGenerationServerToolItemFromJSON(jsonString) {
19
39
  return safeParse(jsonString, (x) => OutputImageGenerationServerToolItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputImageGenerationServerToolItem' from JSON`);
20
40
  }
@@ -27,15 +27,43 @@ import { OutputWebSearchServerToolItem } from "./outputwebsearchservertoolitem.j
27
27
  /**
28
28
  * An output item from the response
29
29
  */
30
- export type OutputItems = OutputCodeInterpreterCallItem | OutputComputerCallItem | (OutputFileSearchCallItem & {
30
+ export type OutputItems = (OutputCodeInterpreterCallItem & {
31
+ type: "code_interpreter_call";
32
+ }) | (OutputComputerCallItem & {
33
+ type: "computer_call";
34
+ }) | (OutputFileSearchCallItem & {
31
35
  type: "file_search_call";
32
36
  }) | (OutputFunctionCallItem & {
33
37
  type: "function_call";
34
38
  }) | (OutputImageGenerationCallItem & {
35
39
  type: "image_generation_call";
36
- }) | OutputMessageItem | OutputApplyPatchServerToolItem | OutputBashServerToolItem | OutputBrowserUseServerToolItem | OutputCodeInterpreterServerToolItem | (OutputDatetimeItem & {
40
+ }) | OutputMessageItem | (OutputApplyPatchServerToolItem & {
41
+ type: "openrouter:apply_patch";
42
+ }) | (OutputBashServerToolItem & {
43
+ type: "openrouter:bash";
44
+ }) | (OutputBrowserUseServerToolItem & {
45
+ type: "openrouter:browser_use";
46
+ }) | (OutputCodeInterpreterServerToolItem & {
47
+ type: "openrouter:code_interpreter";
48
+ }) | (OutputDatetimeItem & {
37
49
  type: "openrouter:datetime";
38
- }) | OutputSearchModelsServerToolItem | OutputFileSearchServerToolItem | OutputImageGenerationServerToolItem | OutputMcpServerToolItem | OutputMemoryServerToolItem | OutputTextEditorServerToolItem | OutputToolSearchServerToolItem | OutputWebFetchServerToolItem | (OutputWebSearchServerToolItem & {
50
+ }) | (OutputSearchModelsServerToolItem & {
51
+ type: "openrouter:experimental__search_models";
52
+ }) | (OutputFileSearchServerToolItem & {
53
+ type: "openrouter:file_search";
54
+ }) | (OutputImageGenerationServerToolItem & {
55
+ type: "openrouter:image_generation";
56
+ }) | (OutputMcpServerToolItem & {
57
+ type: "openrouter:mcp";
58
+ }) | (OutputMemoryServerToolItem & {
59
+ type: "openrouter:memory";
60
+ }) | (OutputTextEditorServerToolItem & {
61
+ type: "openrouter:text_editor";
62
+ }) | (OutputToolSearchServerToolItem & {
63
+ type: "openrouter:tool_search";
64
+ }) | (OutputWebFetchServerToolItem & {
65
+ type: "openrouter:web_fetch";
66
+ }) | (OutputWebSearchServerToolItem & {
39
67
  type: "openrouter:web_search";
40
68
  }) | OutputReasoningItem | (OutputWebSearchCallItem & {
41
69
  type: "web_search_call";
@@ -29,25 +29,30 @@ import { OutputWebSearchCallItem$inboundSchema, } from "./outputwebsearchcallite
29
29
  import { OutputWebSearchServerToolItem$inboundSchema, } from "./outputwebsearchservertoolitem.js";
30
30
  /** @internal */
31
31
  export const OutputItems$inboundSchema = discriminatedUnion("type", {
32
- code_interpreter_call: OutputCodeInterpreterCallItem$inboundSchema,
33
- computer_call: OutputComputerCallItem$inboundSchema,
32
+ code_interpreter_call: OutputCodeInterpreterCallItem$inboundSchema.and(z.object({ type: z.literal("code_interpreter_call") })),
33
+ computer_call: OutputComputerCallItem$inboundSchema.and(z.object({ type: z.literal("computer_call") })),
34
34
  file_search_call: OutputFileSearchCallItem$inboundSchema.and(z.object({ type: z.literal("file_search_call") })),
35
35
  function_call: OutputFunctionCallItem$inboundSchema.and(z.object({ type: z.literal("function_call") })),
36
36
  image_generation_call: OutputImageGenerationCallItem$inboundSchema.and(z.object({ type: z.literal("image_generation_call") })),
37
37
  message: OutputMessageItem$inboundSchema,
38
- ["openrouter:apply_patch"]: OutputApplyPatchServerToolItem$inboundSchema,
39
- ["openrouter:bash"]: OutputBashServerToolItem$inboundSchema,
40
- ["openrouter:browser_use"]: OutputBrowserUseServerToolItem$inboundSchema,
41
- ["openrouter:code_interpreter"]: OutputCodeInterpreterServerToolItem$inboundSchema,
38
+ ["openrouter:apply_patch"]: OutputApplyPatchServerToolItem$inboundSchema
39
+ .and(z.object({ type: z.literal("openrouter:apply_patch") })),
40
+ ["openrouter:bash"]: OutputBashServerToolItem$inboundSchema.and(z.object({ type: z.literal("openrouter:bash") })),
41
+ ["openrouter:browser_use"]: OutputBrowserUseServerToolItem$inboundSchema
42
+ .and(z.object({ type: z.literal("openrouter:browser_use") })),
43
+ ["openrouter:code_interpreter"]: OutputCodeInterpreterServerToolItem$inboundSchema.and(z.object({ type: z.literal("openrouter:code_interpreter") })),
42
44
  ["openrouter:datetime"]: OutputDatetimeItem$inboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
43
- ["openrouter:experimental__search_models"]: OutputSearchModelsServerToolItem$inboundSchema,
44
- ["openrouter:file_search"]: OutputFileSearchServerToolItem$inboundSchema,
45
- ["openrouter:image_generation"]: OutputImageGenerationServerToolItem$inboundSchema,
46
- ["openrouter:mcp"]: OutputMcpServerToolItem$inboundSchema,
47
- ["openrouter:memory"]: OutputMemoryServerToolItem$inboundSchema,
48
- ["openrouter:text_editor"]: OutputTextEditorServerToolItem$inboundSchema,
49
- ["openrouter:tool_search"]: OutputToolSearchServerToolItem$inboundSchema,
50
- ["openrouter:web_fetch"]: OutputWebFetchServerToolItem$inboundSchema,
45
+ ["openrouter:experimental__search_models"]: OutputSearchModelsServerToolItem$inboundSchema.and(z.object({ type: z.literal("openrouter:experimental__search_models") })),
46
+ ["openrouter:file_search"]: OutputFileSearchServerToolItem$inboundSchema
47
+ .and(z.object({ type: z.literal("openrouter:file_search") })),
48
+ ["openrouter:image_generation"]: OutputImageGenerationServerToolItem$inboundSchema.and(z.object({ type: z.literal("openrouter:image_generation") })),
49
+ ["openrouter:mcp"]: OutputMcpServerToolItem$inboundSchema.and(z.object({ type: z.literal("openrouter:mcp") })),
50
+ ["openrouter:memory"]: OutputMemoryServerToolItem$inboundSchema.and(z.object({ type: z.literal("openrouter:memory") })),
51
+ ["openrouter:text_editor"]: OutputTextEditorServerToolItem$inboundSchema
52
+ .and(z.object({ type: z.literal("openrouter:text_editor") })),
53
+ ["openrouter:tool_search"]: OutputToolSearchServerToolItem$inboundSchema
54
+ .and(z.object({ type: z.literal("openrouter:tool_search") })),
55
+ ["openrouter:web_fetch"]: OutputWebFetchServerToolItem$inboundSchema.and(z.object({ type: z.literal("openrouter:web_fetch") })),
51
56
  ["openrouter:web_search"]: OutputWebSearchServerToolItem$inboundSchema.and(z.object({ type: z.literal("openrouter:web_search") })),
52
57
  reasoning: OutputReasoningItem$inboundSchema,
53
58
  web_search_call: OutputWebSearchCallItem$inboundSchema.and(z.object({ type: z.literal("web_search_call") })),