@openrouter/sdk 1.3.29 → 1.3.30

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 (203) hide show
  1. package/README.md +1 -1
  2. package/esm/funcs/batchCreateBatches.d.ts +19 -0
  3. package/esm/funcs/batchCreateBatches.js +98 -0
  4. package/esm/funcs/batchDelete.d.ts +19 -0
  5. package/esm/funcs/batchDelete.js +103 -0
  6. package/esm/funcs/batchGetBatches.d.ts +19 -0
  7. package/esm/funcs/batchGetBatches.js +103 -0
  8. package/esm/funcs/batchList.d.ts +21 -0
  9. package/esm/funcs/batchList.js +134 -0
  10. package/esm/lib/config.d.ts +2 -2
  11. package/esm/lib/config.js +2 -2
  12. package/esm/models/anthropicadvisortoolresult.d.ts +14 -0
  13. package/esm/models/anthropicadvisortoolresult.js +21 -0
  14. package/esm/models/anthropicbase64pdfsource.d.ts +17 -2
  15. package/esm/models/anthropicbase64pdfsource.js +25 -2
  16. package/esm/models/anthropicbashcodeexecutioncontent.d.ts +11 -0
  17. package/esm/models/anthropicbashcodeexecutioncontent.js +17 -0
  18. package/esm/models/anthropicbashcodeexecutionoutput.d.ts +18 -0
  19. package/esm/models/anthropicbashcodeexecutionoutput.js +25 -0
  20. package/esm/models/anthropicbashcodeexecutionresult.d.ts +15 -0
  21. package/esm/models/anthropicbashcodeexecutionresult.js +24 -0
  22. package/esm/models/anthropicbashcodeexecutiontoolresult.d.ts +13 -0
  23. package/esm/models/anthropicbashcodeexecutiontoolresult.js +22 -0
  24. package/esm/models/anthropicbashcodeexecutiontoolresulterror.d.ts +22 -0
  25. package/esm/models/anthropicbashcodeexecutiontoolresulterror.js +30 -0
  26. package/esm/models/anthropiccaller.d.ts +12 -0
  27. package/esm/models/anthropiccaller.js +19 -0
  28. package/esm/models/anthropiccitationcharlocation.d.ts +16 -0
  29. package/esm/models/anthropiccitationcharlocation.js +30 -0
  30. package/esm/models/anthropiccitationcontentblocklocation.d.ts +16 -0
  31. package/esm/models/anthropiccitationcontentblocklocation.js +30 -0
  32. package/esm/models/anthropiccitationpagelocation.d.ts +16 -0
  33. package/esm/models/anthropiccitationpagelocation.js +30 -0
  34. package/esm/models/anthropiccitationsconfig.d.ts +10 -0
  35. package/esm/models/anthropiccitationsconfig.js +14 -0
  36. package/esm/models/anthropiccitationsearchresultlocation.d.ts +16 -0
  37. package/esm/models/anthropiccitationsearchresultlocation.js +28 -0
  38. package/esm/models/anthropiccitationwebsearchresultlocation.d.ts +14 -0
  39. package/esm/models/anthropiccitationwebsearchresultlocation.js +24 -0
  40. package/esm/models/anthropiccodeexecution20250825caller.d.ts +11 -0
  41. package/esm/models/anthropiccodeexecution20250825caller.js +20 -0
  42. package/esm/models/anthropiccodeexecution20260120caller.d.ts +11 -0
  43. package/esm/models/anthropiccodeexecution20260120caller.js +20 -0
  44. package/esm/models/anthropiccodeexecutioncontent.d.ts +12 -0
  45. package/esm/models/anthropiccodeexecutioncontent.js +19 -0
  46. package/esm/models/anthropiccodeexecutionoutput.d.ts +18 -0
  47. package/esm/models/anthropiccodeexecutionoutput.js +25 -0
  48. package/esm/models/anthropiccodeexecutionresult.d.ts +15 -0
  49. package/esm/models/anthropiccodeexecutionresult.js +24 -0
  50. package/esm/models/anthropiccodeexecutiontoolresult.d.ts +13 -0
  51. package/esm/models/anthropiccodeexecutiontoolresult.js +22 -0
  52. package/esm/models/anthropiccodeexecutiontoolresulterror.d.ts +12 -0
  53. package/esm/models/anthropiccodeexecutiontoolresulterror.js +21 -0
  54. package/esm/models/anthropiccompactionblock.d.ts +12 -0
  55. package/esm/models/anthropiccompactionblock.js +21 -0
  56. package/esm/models/anthropiccontainer.d.ts +13 -0
  57. package/esm/models/anthropiccontainer.js +22 -0
  58. package/esm/models/anthropiccontainerskill.d.ts +20 -0
  59. package/esm/models/anthropiccontainerskill.js +28 -0
  60. package/esm/models/anthropiccontainerupload.d.ts +11 -0
  61. package/esm/models/anthropiccontainerupload.js +20 -0
  62. package/esm/models/anthropicdirectcaller.d.ts +10 -0
  63. package/esm/models/anthropicdirectcaller.js +14 -0
  64. package/esm/models/anthropicdocumentblock.d.ts +36 -0
  65. package/esm/models/anthropicdocumentblock.js +45 -0
  66. package/esm/models/anthropicdocumentblockparam.d.ts +20 -4
  67. package/esm/models/anthropicdocumentblockparam.js +4 -4
  68. package/esm/models/anthropicencryptedcodeexecutionresult.d.ts +15 -0
  69. package/esm/models/anthropicencryptedcodeexecutionresult.js +25 -0
  70. package/esm/models/anthropicinputtransformation.d.ts +18 -0
  71. package/esm/models/anthropicinputtransformation.js +16 -0
  72. package/esm/models/anthropicoutputtokensdetails.d.ts +10 -0
  73. package/esm/models/anthropicoutputtokensdetails.js +19 -0
  74. package/esm/models/anthropicplaintextsource.d.ts +17 -2
  75. package/esm/models/anthropicplaintextsource.js +25 -2
  76. package/esm/models/anthropicredactedthinkingblock.d.ts +11 -0
  77. package/esm/models/anthropicredactedthinkingblock.js +15 -0
  78. package/esm/models/anthropicrefusalstopdetails.d.ts +32 -0
  79. package/esm/models/anthropicrefusalstopdetails.js +31 -0
  80. package/esm/models/anthropicservertoolerrorcode.d.ts +12 -0
  81. package/esm/models/anthropicservertoolerrorcode.js +14 -0
  82. package/esm/models/anthropicservertoolusage.d.ts +11 -0
  83. package/esm/models/anthropicservertoolusage.js +21 -0
  84. package/esm/models/anthropicservicetier.d.ts +11 -0
  85. package/esm/models/anthropicservicetier.js +13 -0
  86. package/esm/models/anthropictextblock.d.ts +13 -0
  87. package/esm/models/anthropictextblock.js +17 -0
  88. package/esm/models/anthropictextcitation.d.ts +14 -0
  89. package/esm/models/anthropictextcitation.js +23 -0
  90. package/esm/models/anthropictexteditorcodeexecutioncontent.d.ts +13 -0
  91. package/esm/models/anthropictexteditorcodeexecutioncontent.js +21 -0
  92. package/esm/models/anthropictexteditorcodeexecutioncreateresult.d.ts +11 -0
  93. package/esm/models/anthropictexteditorcodeexecutioncreateresult.js +20 -0
  94. package/esm/models/anthropictexteditorcodeexecutionstrreplaceresult.d.ts +15 -0
  95. package/esm/models/anthropictexteditorcodeexecutionstrreplaceresult.js +28 -0
  96. package/esm/models/anthropictexteditorcodeexecutiontoolresult.d.ts +13 -0
  97. package/esm/models/anthropictexteditorcodeexecutiontoolresult.js +22 -0
  98. package/esm/models/anthropictexteditorcodeexecutiontoolresulterror.d.ts +23 -0
  99. package/esm/models/anthropictexteditorcodeexecutiontoolresulterror.js +33 -0
  100. package/esm/models/anthropictexteditorcodeexecutionviewresult.d.ts +24 -0
  101. package/esm/models/anthropictexteditorcodeexecutionviewresult.js +36 -0
  102. package/esm/models/anthropicthinkingblock.d.ts +12 -0
  103. package/esm/models/anthropicthinkingblock.js +16 -0
  104. package/esm/models/anthropictoolreference.d.ts +18 -0
  105. package/esm/models/anthropictoolreference.js +25 -0
  106. package/esm/models/anthropictoolsearchcontent.d.ts +11 -0
  107. package/esm/models/anthropictoolsearchcontent.js +17 -0
  108. package/esm/models/anthropictoolsearchresult.d.ts +12 -0
  109. package/esm/models/anthropictoolsearchresult.js +21 -0
  110. package/esm/models/anthropictoolsearchresulterror.d.ts +13 -0
  111. package/esm/models/anthropictoolsearchresulterror.js +23 -0
  112. package/esm/models/anthropictoolsearchtoolresult.d.ts +13 -0
  113. package/esm/models/anthropictoolsearchtoolresult.js +22 -0
  114. package/esm/models/anthropictooluseblock.d.ts +15 -0
  115. package/esm/models/anthropictooluseblock.js +19 -0
  116. package/esm/models/anthropicwebfetchblock.d.ts +14 -0
  117. package/esm/models/anthropicwebfetchblock.js +23 -0
  118. package/esm/models/anthropicwebfetchcontent.d.ts +11 -0
  119. package/esm/models/anthropicwebfetchcontent.js +17 -0
  120. package/esm/models/anthropicwebfetchtoolresult.d.ts +15 -0
  121. package/esm/models/anthropicwebfetchtoolresult.js +24 -0
  122. package/esm/models/anthropicwebfetchtoolresulterror.d.ts +25 -0
  123. package/esm/models/anthropicwebfetchtoolresulterror.js +33 -0
  124. package/esm/models/anthropicwebsearchresult.d.ts +21 -0
  125. package/esm/models/anthropicwebsearchresult.js +29 -0
  126. package/esm/models/anthropicwebsearchtoolresult.d.ts +20 -0
  127. package/esm/models/anthropicwebsearchtoolresult.js +36 -0
  128. package/esm/models/anthropicwebsearchtoolresulterror.d.ts +29 -0
  129. package/esm/models/anthropicwebsearchtoolresulterror.js +37 -0
  130. package/esm/models/batchdeletedobject.d.ts +26 -0
  131. package/esm/models/batchdeletedobject.js +22 -0
  132. package/esm/models/batchdeletionoutcome.d.ts +17 -0
  133. package/esm/models/batchdeletionoutcome.js +16 -0
  134. package/esm/models/batchdeletiontargets.d.ts +50 -0
  135. package/esm/models/batchdeletiontargets.js +32 -0
  136. package/esm/models/batcherrorresponse.d.ts +11 -0
  137. package/esm/models/batcherrorresponse.js +15 -0
  138. package/esm/models/batchlistitem.d.ts +181 -0
  139. package/esm/models/batchlistitem.js +159 -0
  140. package/esm/models/batchlistresponse.d.ts +25 -0
  141. package/esm/models/batchlistresponse.js +31 -0
  142. package/esm/models/batchliststatus.d.ts +20 -0
  143. package/esm/models/batchliststatus.js +19 -0
  144. package/esm/models/batchlisttimestamp.d.ts +12 -0
  145. package/esm/models/batchlisttimestamp.js +15 -0
  146. package/esm/models/batchobject.d.ts +750 -0
  147. package/esm/models/batchobject.js +810 -0
  148. package/esm/models/batchpaymentrequiredresponseerror.d.ts +159 -0
  149. package/esm/models/batchpaymentrequiredresponseerror.js +136 -0
  150. package/esm/models/batchproviderpreferences.d.ts +25 -0
  151. package/esm/models/batchproviderpreferences.js +20 -0
  152. package/esm/models/batchsubmitbody.d.ts +62 -0
  153. package/esm/models/batchsubmitbody.js +51 -0
  154. package/esm/models/debugevent.d.ts +12 -12
  155. package/esm/models/debugevent.js +11 -12
  156. package/esm/models/errors/batcherrorresponse.d.ts +19 -0
  157. package/esm/models/errors/batcherrorresponse.js +32 -0
  158. package/esm/models/errors/batchpaymentrequiredresponseerror.d.ts +53 -0
  159. package/esm/models/errors/batchpaymentrequiredresponseerror.js +64 -0
  160. package/esm/models/errors/index.d.ts +2 -0
  161. package/esm/models/errors/index.js +2 -0
  162. package/esm/models/finishreason.d.ts +13 -0
  163. package/esm/models/finishreason.js +15 -0
  164. package/esm/models/imagegenerationusage.d.ts +4 -4
  165. package/esm/models/imagegenerationusage.js +4 -6
  166. package/esm/models/index.d.ts +75 -0
  167. package/esm/models/index.js +75 -0
  168. package/esm/models/internchatchoice.d.ts +4 -4
  169. package/esm/models/internchatchoice.js +3 -3
  170. package/esm/models/messagesmessageparam.d.ts +8 -8
  171. package/esm/models/messagesmessageparam.js +6 -7
  172. package/esm/models/operations/createbatches.d.ts +59 -0
  173. package/esm/models/operations/createbatches.js +23 -0
  174. package/esm/models/operations/deletebatch.d.ts +58 -0
  175. package/esm/models/operations/deletebatch.js +21 -0
  176. package/esm/models/operations/getbatches.d.ts +58 -0
  177. package/esm/models/operations/getbatches.js +21 -0
  178. package/esm/models/operations/index.d.ts +4 -0
  179. package/esm/models/operations/index.js +4 -0
  180. package/esm/models/operations/listbatches.d.ts +87 -0
  181. package/esm/models/operations/listbatches.js +40 -0
  182. package/esm/models/oranthropicbashtoolresult.d.ts +43 -0
  183. package/esm/models/oranthropicbashtoolresult.js +49 -0
  184. package/esm/models/oranthropiccontentblock.d.ts +25 -0
  185. package/esm/models/oranthropiccontentblock.js +45 -0
  186. package/esm/models/oranthropicnullablecaller.d.ts +12 -0
  187. package/esm/models/oranthropicnullablecaller.js +19 -0
  188. package/esm/models/oranthropicservertooluseblock.d.ts +15 -0
  189. package/esm/models/oranthropicservertooluseblock.js +19 -0
  190. package/esm/models/oranthropicshelltoolresult.d.ts +43 -0
  191. package/esm/models/oranthropicshelltoolresult.js +50 -0
  192. package/esm/models/oranthropicstopreason.d.ts +16 -0
  193. package/esm/models/oranthropicstopreason.js +18 -0
  194. package/esm/models/outputfusionservertoolitem.d.ts +8 -8
  195. package/esm/models/outputfusionservertoolitem.js +8 -8
  196. package/esm/models/submitgenerationfeedbackrequest.d.ts +4 -4
  197. package/esm/models/submitgenerationfeedbackrequest.js +3 -4
  198. package/esm/sdk/batch.d.ts +37 -0
  199. package/esm/sdk/batch.js +50 -0
  200. package/esm/sdk/sdk.d.ts +3 -0
  201. package/esm/sdk/sdk.js +4 -0
  202. package/jsr.json +1 -1
  203. package/package.json +6 -6
@@ -0,0 +1,810 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 8103bc5f4aeb
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { collectExtraKeys as collectExtraKeys$, safeParse, } from "../lib/schemas.js";
8
+ import { discriminatedUnion } from "../types/discriminatedUnion.js";
9
+ import * as openEnums from "../types/enums.js";
10
+ import { AnthropicCacheCreation$inboundSchema, } from "./anthropiccachecreation.js";
11
+ import { AnthropicContainer$inboundSchema, } from "./anthropiccontainer.js";
12
+ import { AnthropicInputTransformation$inboundSchema, } from "./anthropicinputtransformation.js";
13
+ import { AnthropicOutputTokensDetails$inboundSchema, } from "./anthropicoutputtokensdetails.js";
14
+ import { AnthropicRefusalStopDetails$inboundSchema, } from "./anthropicrefusalstopdetails.js";
15
+ import { AnthropicServerToolUsage$inboundSchema, } from "./anthropicservertoolusage.js";
16
+ import { AnthropicServiceTier$inboundSchema, } from "./anthropicservicetier.js";
17
+ import { AnthropicSpeed$inboundSchema, } from "./anthropicspeed.js";
18
+ import { AnthropicUsageIteration$inboundSchema, } from "./anthropicusageiteration.js";
19
+ import { ApiErrorType$inboundSchema } from "./apierrortype.js";
20
+ import { CostDetails$inboundSchema } from "./costdetails.js";
21
+ import { FinishReason$inboundSchema } from "./finishreason.js";
22
+ import { OpenResponsesResult$inboundSchema, } from "./openresponsesresult.js";
23
+ import { OpenRouterMetadata$inboundSchema, } from "./openroutermetadata.js";
24
+ import { ORAnthropicContentBlock$inboundSchema, } from "./oranthropiccontentblock.js";
25
+ import { ORAnthropicStopReason$inboundSchema, } from "./oranthropicstopreason.js";
26
+ import { ReasoningDetailEncrypted$inboundSchema, } from "./reasoningdetailencrypted.js";
27
+ import { ReasoningDetailServerToolCall$inboundSchema, } from "./reasoningdetailservertoolcall.js";
28
+ import { ReasoningDetailSummary$inboundSchema, } from "./reasoningdetailsummary.js";
29
+ import { ReasoningDetailText$inboundSchema, } from "./reasoningdetailtext.js";
30
+ export const BatchObjectCompletionWindow = {
31
+ TwentyFourh: "24h",
32
+ };
33
+ export const BatchObjectObjectBatch = {
34
+ Batch: "batch",
35
+ };
36
+ export const ObjectEmbedding = {
37
+ Embedding: "embedding",
38
+ };
39
+ export const BodyObjectList = {
40
+ List: "list",
41
+ };
42
+ export const BatchObjectRole = {
43
+ Assistant: "assistant",
44
+ };
45
+ export const BatchObjectTypeMessage = {
46
+ Message: "message",
47
+ };
48
+ export const ChoiceTypeImageURLEnum = {
49
+ ImageUrl: "image_url",
50
+ };
51
+ export const ChoiceRole = {
52
+ Assistant: "assistant",
53
+ };
54
+ export const ChoiceTypeFunction = {
55
+ Function: "function",
56
+ };
57
+ export const BatchObjectEvent = {
58
+ AdapterRequest: "adapter_request",
59
+ UpstreamHeadersReceived: "upstream_headers_received",
60
+ FirstTokenReceived: "first_token_received",
61
+ UpstreamBodyEnded: "upstream_body_ended",
62
+ };
63
+ export const BodyObjectChatCompletion = {
64
+ ChatCompletion: "chat.completion",
65
+ };
66
+ export const BatchObjectStatus = {
67
+ Validating: "validating",
68
+ InProgress: "in_progress",
69
+ Finalizing: "finalizing",
70
+ Completed: "completed",
71
+ Failed: "failed",
72
+ Expired: "expired",
73
+ Cancelling: "cancelling",
74
+ Cancelled: "cancelled",
75
+ };
76
+ /** @internal */
77
+ export const BatchObjectCompletionWindow$inboundSchema = z.enum(BatchObjectCompletionWindow);
78
+ /** @internal */
79
+ export const BatchObjectError$inboundSchema = z.object({
80
+ message: z.string(),
81
+ });
82
+ export function batchObjectErrorFromJSON(jsonString) {
83
+ return safeParse(jsonString, (x) => BatchObjectError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectError' from JSON`);
84
+ }
85
+ /** @internal */
86
+ export const BatchObjectObjectBatch$inboundSchema = z.enum(BatchObjectObjectBatch);
87
+ /** @internal */
88
+ export const BatchObjectRequestCounts$inboundSchema = z.object({
89
+ completed: z.int(),
90
+ failed: z.int(),
91
+ total: z.int(),
92
+ });
93
+ export function batchObjectRequestCountsFromJSON(jsonString) {
94
+ return safeParse(jsonString, (x) => BatchObjectRequestCounts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectRequestCounts' from JSON`);
95
+ }
96
+ /** @internal */
97
+ export const ResultError$inboundSchema = z
98
+ .object({
99
+ error_type: ApiErrorType$inboundSchema.optional(),
100
+ message: z.string(),
101
+ param: z.nullable(z.string()),
102
+ type: z.string(),
103
+ }).transform((v) => {
104
+ return remap$(v, {
105
+ "error_type": "errorType",
106
+ });
107
+ });
108
+ export function resultErrorFromJSON(jsonString) {
109
+ return safeParse(jsonString, (x) => ResultError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResultError' from JSON`);
110
+ }
111
+ /** @internal */
112
+ export const Embedding$inboundSchema = z.union([
113
+ z.array(z.number()),
114
+ z.string(),
115
+ ]);
116
+ export function embeddingFromJSON(jsonString) {
117
+ return safeParse(jsonString, (x) => Embedding$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Embedding' from JSON`);
118
+ }
119
+ /** @internal */
120
+ export const ObjectEmbedding$inboundSchema = z.enum(ObjectEmbedding);
121
+ /** @internal */
122
+ export const BatchObjectData$inboundSchema = z.object({
123
+ embedding: z.union([z.array(z.number()), z.string()]),
124
+ index: z.int().optional(),
125
+ object: ObjectEmbedding$inboundSchema,
126
+ });
127
+ export function batchObjectDataFromJSON(jsonString) {
128
+ return safeParse(jsonString, (x) => BatchObjectData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectData' from JSON`);
129
+ }
130
+ /** @internal */
131
+ export const BodyObjectList$inboundSchema = z
132
+ .enum(BodyObjectList);
133
+ /** @internal */
134
+ export const BodyPromptTokensDetails2$inboundSchema = z.object({
135
+ audio_tokens: z.int().optional(),
136
+ file_tokens: z.int().optional(),
137
+ image_tokens: z.int().optional(),
138
+ text_tokens: z.int().optional(),
139
+ video_tokens: z.int().optional(),
140
+ }).transform((v) => {
141
+ return remap$(v, {
142
+ "audio_tokens": "audioTokens",
143
+ "file_tokens": "fileTokens",
144
+ "image_tokens": "imageTokens",
145
+ "text_tokens": "textTokens",
146
+ "video_tokens": "videoTokens",
147
+ });
148
+ });
149
+ export function bodyPromptTokensDetails2FromJSON(jsonString) {
150
+ return safeParse(jsonString, (x) => BodyPromptTokensDetails2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyPromptTokensDetails2' from JSON`);
151
+ }
152
+ /** @internal */
153
+ export const BodyUsage3$inboundSchema = z
154
+ .object({
155
+ cost: z.number().optional(),
156
+ cost_details: z.nullable(CostDetails$inboundSchema).optional(),
157
+ is_byok: z.boolean().optional(),
158
+ prompt_tokens: z.int(),
159
+ prompt_tokens_details: z.lazy(() => BodyPromptTokensDetails2$inboundSchema)
160
+ .optional(),
161
+ total_tokens: z.int(),
162
+ }).transform((v) => {
163
+ return remap$(v, {
164
+ "cost_details": "costDetails",
165
+ "is_byok": "isByok",
166
+ "prompt_tokens": "promptTokens",
167
+ "prompt_tokens_details": "promptTokensDetails",
168
+ "total_tokens": "totalTokens",
169
+ });
170
+ });
171
+ export function bodyUsage3FromJSON(jsonString) {
172
+ return safeParse(jsonString, (x) => BodyUsage3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyUsage3' from JSON`);
173
+ }
174
+ /** @internal */
175
+ export const BodyList$inboundSchema = z.object({
176
+ data: z.array(z.lazy(() => BatchObjectData$inboundSchema)),
177
+ id: z.string().optional(),
178
+ model: z.string(),
179
+ object: BodyObjectList$inboundSchema,
180
+ usage: z.lazy(() => BodyUsage3$inboundSchema).optional(),
181
+ });
182
+ export function bodyListFromJSON(jsonString) {
183
+ return safeParse(jsonString, (x) => BodyList$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyList' from JSON`);
184
+ }
185
+ /** @internal */
186
+ export const BatchObjectRole$inboundSchema = z.enum(BatchObjectRole);
187
+ /** @internal */
188
+ export const BatchObjectTypeMessage$inboundSchema = z.enum(BatchObjectTypeMessage);
189
+ /** @internal */
190
+ export const BodyUsage2$inboundSchema = z
191
+ .object({
192
+ cache_creation: z.nullable(AnthropicCacheCreation$inboundSchema),
193
+ cache_creation_input_tokens: z.nullable(z.int()),
194
+ cache_read_input_tokens: z.nullable(z.int()),
195
+ inference_geo: z.nullable(z.string()),
196
+ input_tokens: z.int(),
197
+ output_tokens: z.int(),
198
+ output_tokens_details: z.nullable(AnthropicOutputTokensDetails$inboundSchema),
199
+ server_tool_use: z.nullable(AnthropicServerToolUsage$inboundSchema),
200
+ service_tier: z.nullable(AnthropicServiceTier$inboundSchema),
201
+ iterations: z.array(AnthropicUsageIteration$inboundSchema).optional(),
202
+ speed: z.nullable(AnthropicSpeed$inboundSchema).optional(),
203
+ }).transform((v) => {
204
+ return remap$(v, {
205
+ "cache_creation": "cacheCreation",
206
+ "cache_creation_input_tokens": "cacheCreationInputTokens",
207
+ "cache_read_input_tokens": "cacheReadInputTokens",
208
+ "inference_geo": "inferenceGeo",
209
+ "input_tokens": "inputTokens",
210
+ "output_tokens": "outputTokens",
211
+ "output_tokens_details": "outputTokensDetails",
212
+ "server_tool_use": "serverToolUse",
213
+ "service_tier": "serviceTier",
214
+ });
215
+ });
216
+ export function bodyUsage2FromJSON(jsonString) {
217
+ return safeParse(jsonString, (x) => BodyUsage2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyUsage2' from JSON`);
218
+ }
219
+ /** @internal */
220
+ export const BodyMessage$inboundSchema = z
221
+ .object({
222
+ container: z.nullable(AnthropicContainer$inboundSchema),
223
+ content: z.array(ORAnthropicContentBlock$inboundSchema),
224
+ id: z.string(),
225
+ input_transformations: z.nullable(z.array(AnthropicInputTransformation$inboundSchema)).optional(),
226
+ model: z.string(),
227
+ role: BatchObjectRole$inboundSchema,
228
+ stop_details: z.nullable(AnthropicRefusalStopDetails$inboundSchema),
229
+ stop_reason: z.nullable(ORAnthropicStopReason$inboundSchema),
230
+ stop_sequence: z.nullable(z.string()),
231
+ type: BatchObjectTypeMessage$inboundSchema,
232
+ usage: z.lazy(() => BodyUsage2$inboundSchema),
233
+ }).transform((v) => {
234
+ return remap$(v, {
235
+ "input_transformations": "inputTransformations",
236
+ "stop_details": "stopDetails",
237
+ "stop_reason": "stopReason",
238
+ "stop_sequence": "stopSequence",
239
+ });
240
+ });
241
+ export function bodyMessageFromJSON(jsonString) {
242
+ return safeParse(jsonString, (x) => BodyMessage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyMessage' from JSON`);
243
+ }
244
+ /** @internal */
245
+ export const ContentTopLogprob$inboundSchema = z.object({
246
+ bytes: z.nullable(z.array(z.int())),
247
+ logprob: z.number(),
248
+ token: z.string(),
249
+ });
250
+ export function contentTopLogprobFromJSON(jsonString) {
251
+ return safeParse(jsonString, (x) => ContentTopLogprob$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentTopLogprob' from JSON`);
252
+ }
253
+ /** @internal */
254
+ export const LogprobsContent$inboundSchema = z.object({
255
+ bytes: z.nullable(z.array(z.int())),
256
+ logprob: z.number(),
257
+ token: z.string(),
258
+ top_logprobs: z.array(z.lazy(() => ContentTopLogprob$inboundSchema)),
259
+ }).transform((v) => {
260
+ return remap$(v, {
261
+ "top_logprobs": "topLogprobs",
262
+ });
263
+ });
264
+ export function logprobsContentFromJSON(jsonString) {
265
+ return safeParse(jsonString, (x) => LogprobsContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LogprobsContent' from JSON`);
266
+ }
267
+ /** @internal */
268
+ export const RefusalTopLogprob$inboundSchema = z.object({
269
+ bytes: z.nullable(z.array(z.int())),
270
+ logprob: z.number(),
271
+ token: z.string(),
272
+ });
273
+ export function refusalTopLogprobFromJSON(jsonString) {
274
+ return safeParse(jsonString, (x) => RefusalTopLogprob$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RefusalTopLogprob' from JSON`);
275
+ }
276
+ /** @internal */
277
+ export const Refusal$inboundSchema = z.object({
278
+ bytes: z.nullable(z.array(z.int())),
279
+ logprob: z.number(),
280
+ token: z.string(),
281
+ top_logprobs: z.array(z.lazy(() => RefusalTopLogprob$inboundSchema)),
282
+ }).transform((v) => {
283
+ return remap$(v, {
284
+ "top_logprobs": "topLogprobs",
285
+ });
286
+ });
287
+ export function refusalFromJSON(jsonString) {
288
+ return safeParse(jsonString, (x) => Refusal$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Refusal' from JSON`);
289
+ }
290
+ /** @internal */
291
+ export const Logprobs$inboundSchema = z.object({
292
+ content: z.nullable(z.array(z.lazy(() => LogprobsContent$inboundSchema))),
293
+ refusal: z.nullable(z.array(z.lazy(() => Refusal$inboundSchema))).optional(),
294
+ });
295
+ export function logprobsFromJSON(jsonString) {
296
+ return safeParse(jsonString, (x) => Logprobs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Logprobs' from JSON`);
297
+ }
298
+ /** @internal */
299
+ export const WebSearchCitation$inboundSchema = z.object({
300
+ cited_text: z.string().optional(),
301
+ encrypted_index: z.string().optional(),
302
+ title: z.nullable(z.string()),
303
+ url: z.string(),
304
+ }).transform((v) => {
305
+ return remap$(v, {
306
+ "cited_text": "citedText",
307
+ "encrypted_index": "encryptedIndex",
308
+ });
309
+ });
310
+ export function webSearchCitationFromJSON(jsonString) {
311
+ return safeParse(jsonString, (x) => WebSearchCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebSearchCitation' from JSON`);
312
+ }
313
+ /** @internal */
314
+ export const AnnotationWebSearchCitation$inboundSchema = z.object({
315
+ type: z.literal("web_search_citation"),
316
+ web_search_citation: z.lazy(() => WebSearchCitation$inboundSchema),
317
+ }).transform((v) => {
318
+ return remap$(v, {
319
+ "web_search_citation": "webSearchCitation",
320
+ });
321
+ });
322
+ export function annotationWebSearchCitationFromJSON(jsonString) {
323
+ return safeParse(jsonString, (x) => AnnotationWebSearchCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnnotationWebSearchCitation' from JSON`);
324
+ }
325
+ /** @internal */
326
+ export const BatchObjectUrlCitation$inboundSchema = z.object({
327
+ content: z.string().optional(),
328
+ end_index: z.int(),
329
+ start_index: z.int(),
330
+ title: z.string(),
331
+ url: z.string(),
332
+ }).transform((v) => {
333
+ return remap$(v, {
334
+ "end_index": "endIndex",
335
+ "start_index": "startIndex",
336
+ });
337
+ });
338
+ export function batchObjectUrlCitationFromJSON(jsonString) {
339
+ return safeParse(jsonString, (x) => BatchObjectUrlCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectUrlCitation' from JSON`);
340
+ }
341
+ /** @internal */
342
+ export const AnnotationURLCitation$inboundSchema = z.object({
343
+ type: z.literal("url_citation"),
344
+ url_citation: z.lazy(() => BatchObjectUrlCitation$inboundSchema),
345
+ }).transform((v) => {
346
+ return remap$(v, {
347
+ "url_citation": "urlCitation",
348
+ });
349
+ });
350
+ export function annotationURLCitationFromJSON(jsonString) {
351
+ return safeParse(jsonString, (x) => AnnotationURLCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnnotationURLCitation' from JSON`);
352
+ }
353
+ /** @internal */
354
+ export const ContentImageUrlImageUrl$inboundSchema = z.object({
355
+ url: z.string(),
356
+ });
357
+ export function contentImageUrlImageUrlFromJSON(jsonString) {
358
+ return safeParse(jsonString, (x) => ContentImageUrlImageUrl$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentImageUrlImageUrl' from JSON`);
359
+ }
360
+ /** @internal */
361
+ export const ContentImageURL$inboundSchema = z.object({
362
+ image_url: z.lazy(() => ContentImageUrlImageUrl$inboundSchema),
363
+ type: z.literal("image_url"),
364
+ }).transform((v) => {
365
+ return remap$(v, {
366
+ "image_url": "imageUrl",
367
+ });
368
+ });
369
+ export function contentImageURLFromJSON(jsonString) {
370
+ return safeParse(jsonString, (x) => ContentImageURL$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentImageURL' from JSON`);
371
+ }
372
+ /** @internal */
373
+ export const ContentText$inboundSchema = z
374
+ .object({
375
+ text: z.string(),
376
+ type: z.literal("text"),
377
+ });
378
+ export function contentTextFromJSON(jsonString) {
379
+ return safeParse(jsonString, (x) => ContentText$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentText' from JSON`);
380
+ }
381
+ /** @internal */
382
+ export const AnnotationContentUnion$inboundSchema = discriminatedUnion("type", {
383
+ text: z.lazy(() => ContentText$inboundSchema),
384
+ image_url: z.lazy(() => ContentImageURL$inboundSchema),
385
+ });
386
+ export function annotationContentUnionFromJSON(jsonString) {
387
+ return safeParse(jsonString, (x) => AnnotationContentUnion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnnotationContentUnion' from JSON`);
388
+ }
389
+ /** @internal */
390
+ export const BatchObjectFile$inboundSchema = z.object({
391
+ content: z.array(discriminatedUnion("type", {
392
+ text: z.lazy(() => ContentText$inboundSchema),
393
+ image_url: z.lazy(() => ContentImageURL$inboundSchema),
394
+ })),
395
+ hash: z.string(),
396
+ name: z.string().optional(),
397
+ });
398
+ export function batchObjectFileFromJSON(jsonString) {
399
+ return safeParse(jsonString, (x) => BatchObjectFile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectFile' from JSON`);
400
+ }
401
+ /** @internal */
402
+ export const AnnotationFile$inboundSchema = z.object({
403
+ file: z.lazy(() => BatchObjectFile$inboundSchema),
404
+ type: z.literal("file"),
405
+ });
406
+ export function annotationFileFromJSON(jsonString) {
407
+ return safeParse(jsonString, (x) => AnnotationFile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnnotationFile' from JSON`);
408
+ }
409
+ /** @internal */
410
+ export const Annotation$inboundSchema = discriminatedUnion("type", {
411
+ file: z.lazy(() => AnnotationFile$inboundSchema),
412
+ url_citation: z.lazy(() => AnnotationURLCitation$inboundSchema),
413
+ web_search_citation: z.lazy(() => AnnotationWebSearchCitation$inboundSchema),
414
+ });
415
+ export function annotationFromJSON(jsonString) {
416
+ return safeParse(jsonString, (x) => Annotation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Annotation' from JSON`);
417
+ }
418
+ /** @internal */
419
+ export const BatchObjectImageUrl$inboundSchema = z.object({
420
+ url: z.string(),
421
+ });
422
+ export function batchObjectImageUrlFromJSON(jsonString) {
423
+ return safeParse(jsonString, (x) => BatchObjectImageUrl$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectImageUrl' from JSON`);
424
+ }
425
+ /** @internal */
426
+ export const ChoiceTypeImageURLEnum$inboundSchema = z.enum(ChoiceTypeImageURLEnum);
427
+ /** @internal */
428
+ export const Image$inboundSchema = z.object({
429
+ image_url: z.lazy(() => BatchObjectImageUrl$inboundSchema),
430
+ type: ChoiceTypeImageURLEnum$inboundSchema,
431
+ }).transform((v) => {
432
+ return remap$(v, {
433
+ "image_url": "imageUrl",
434
+ });
435
+ });
436
+ export function imageFromJSON(jsonString) {
437
+ return safeParse(jsonString, (x) => Image$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Image' from JSON`);
438
+ }
439
+ /** @internal */
440
+ export const ReasoningDetail$inboundSchema = discriminatedUnion("type", {
441
+ ["reasoning.summary"]: ReasoningDetailSummary$inboundSchema,
442
+ ["reasoning.encrypted"]: ReasoningDetailEncrypted$inboundSchema,
443
+ ["reasoning.text"]: ReasoningDetailText$inboundSchema,
444
+ ["reasoning.server_tool_call"]: ReasoningDetailServerToolCall$inboundSchema,
445
+ });
446
+ export function reasoningDetailFromJSON(jsonString) {
447
+ return safeParse(jsonString, (x) => ReasoningDetail$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReasoningDetail' from JSON`);
448
+ }
449
+ /** @internal */
450
+ export const ChoiceRole$inboundSchema = z.enum(ChoiceRole);
451
+ /** @internal */
452
+ export const BatchObjectFunction$inboundSchema = z.object({
453
+ arguments: z.string(),
454
+ name: z.string(),
455
+ });
456
+ export function batchObjectFunctionFromJSON(jsonString) {
457
+ return safeParse(jsonString, (x) => BatchObjectFunction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectFunction' from JSON`);
458
+ }
459
+ /** @internal */
460
+ export const ChoiceTypeFunction$inboundSchema = z.enum(ChoiceTypeFunction);
461
+ /** @internal */
462
+ export const ToolCall$inboundSchema = z.object({
463
+ function: z.lazy(() => BatchObjectFunction$inboundSchema),
464
+ id: z.string(),
465
+ index: z.int(),
466
+ type: ChoiceTypeFunction$inboundSchema,
467
+ });
468
+ export function toolCallFromJSON(jsonString) {
469
+ return safeParse(jsonString, (x) => ToolCall$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ToolCall' from JSON`);
470
+ }
471
+ /** @internal */
472
+ export const Message$inboundSchema = z.object({
473
+ annotations: z.array(discriminatedUnion("type", {
474
+ file: z.lazy(() => AnnotationFile$inboundSchema),
475
+ url_citation: z.lazy(() => AnnotationURLCitation$inboundSchema),
476
+ web_search_citation: z.lazy(() => AnnotationWebSearchCitation$inboundSchema),
477
+ })).optional(),
478
+ content: z.nullable(z.string()),
479
+ images: z.nullable(z.array(z.lazy(() => Image$inboundSchema))).optional(),
480
+ reasoning: z.nullable(z.string()).optional(),
481
+ reasoning_details: z.nullable(z.array(z.nullable(discriminatedUnion("type", {
482
+ ["reasoning.summary"]: ReasoningDetailSummary$inboundSchema,
483
+ ["reasoning.encrypted"]: ReasoningDetailEncrypted$inboundSchema,
484
+ ["reasoning.text"]: ReasoningDetailText$inboundSchema,
485
+ ["reasoning.server_tool_call"]: ReasoningDetailServerToolCall$inboundSchema,
486
+ })))).optional(),
487
+ refusal: z.nullable(z.string()),
488
+ role: ChoiceRole$inboundSchema,
489
+ tool_calls: z.array(z.lazy(() => ToolCall$inboundSchema)).optional(),
490
+ }).transform((v) => {
491
+ return remap$(v, {
492
+ "reasoning_details": "reasoningDetails",
493
+ "tool_calls": "toolCalls",
494
+ });
495
+ });
496
+ export function messageFromJSON(jsonString) {
497
+ return safeParse(jsonString, (x) => Message$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Message' from JSON`);
498
+ }
499
+ /** @internal */
500
+ export const Choice$inboundSchema = z.object({
501
+ finish_reason: FinishReason$inboundSchema,
502
+ index: z.int(),
503
+ logprobs: z.nullable(z.lazy(() => Logprobs$inboundSchema)),
504
+ message: z.lazy(() => Message$inboundSchema),
505
+ native_finish_reason: z.nullable(z.string()),
506
+ }).transform((v) => {
507
+ return remap$(v, {
508
+ "finish_reason": "finishReason",
509
+ "native_finish_reason": "nativeFinishReason",
510
+ });
511
+ });
512
+ export function choiceFromJSON(jsonString) {
513
+ return safeParse(jsonString, (x) => Choice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Choice' from JSON`);
514
+ }
515
+ /** @internal */
516
+ export const BatchObjectEvent$inboundSchema = openEnums.inboundSchema(BatchObjectEvent);
517
+ /** @internal */
518
+ export const BatchObjectTimings$inboundSchema = z.object({
519
+ epoch_ms: z.int(),
520
+ event: BatchObjectEvent$inboundSchema,
521
+ start_ms: z.int(),
522
+ }).transform((v) => {
523
+ return remap$(v, {
524
+ "epoch_ms": "epochMs",
525
+ "start_ms": "startMs",
526
+ });
527
+ });
528
+ export function batchObjectTimingsFromJSON(jsonString) {
529
+ return safeParse(jsonString, (x) => BatchObjectTimings$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectTimings' from JSON`);
530
+ }
531
+ /** @internal */
532
+ export const BatchObjectDebug$inboundSchema = collectExtraKeys$(z.object({
533
+ echo_upstream_body: z.record(z.string(), z.any()).optional(),
534
+ timings: z.lazy(() => BatchObjectTimings$inboundSchema).optional(),
535
+ }).catchall(z.any()), "additionalProperties", true).transform((v) => {
536
+ return remap$(v, {
537
+ "echo_upstream_body": "echoUpstreamBody",
538
+ });
539
+ });
540
+ export function batchObjectDebugFromJSON(jsonString) {
541
+ return safeParse(jsonString, (x) => BatchObjectDebug$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectDebug' from JSON`);
542
+ }
543
+ /** @internal */
544
+ export const BodyObjectChatCompletion$inboundSchema = z.enum(BodyObjectChatCompletion);
545
+ /** @internal */
546
+ export const BodyCompletionTokensDetails$inboundSchema = z.object({
547
+ audio_tokens: z.nullable(z.int()).optional(),
548
+ image_tokens: z.nullable(z.int()).optional(),
549
+ reasoning_tokens: z.nullable(z.int()).optional(),
550
+ }).transform((v) => {
551
+ return remap$(v, {
552
+ "audio_tokens": "audioTokens",
553
+ "image_tokens": "imageTokens",
554
+ "reasoning_tokens": "reasoningTokens",
555
+ });
556
+ });
557
+ export function bodyCompletionTokensDetailsFromJSON(jsonString) {
558
+ return safeParse(jsonString, (x) => BodyCompletionTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyCompletionTokensDetails' from JSON`);
559
+ }
560
+ /** @internal */
561
+ export const BodyPromptTokensDetails1$inboundSchema = z.object({
562
+ audio_tokens: z.nullable(z.int()).optional(),
563
+ cache_write_tokens: z.nullable(z.int()).optional(),
564
+ cached_tokens: z.nullable(z.int()).optional(),
565
+ file_tokens: z.nullable(z.int()).optional(),
566
+ video_tokens: z.nullable(z.int()).optional(),
567
+ }).transform((v) => {
568
+ return remap$(v, {
569
+ "audio_tokens": "audioTokens",
570
+ "cache_write_tokens": "cacheWriteTokens",
571
+ "cached_tokens": "cachedTokens",
572
+ "file_tokens": "fileTokens",
573
+ "video_tokens": "videoTokens",
574
+ });
575
+ });
576
+ export function bodyPromptTokensDetails1FromJSON(jsonString) {
577
+ return safeParse(jsonString, (x) => BodyPromptTokensDetails1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyPromptTokensDetails1' from JSON`);
578
+ }
579
+ /** @internal */
580
+ export const BodyServerToolUse$inboundSchema = z.object({
581
+ tool_calls_executed: z.nullable(z.int()).optional(),
582
+ tool_calls_requested: z.nullable(z.int()).optional(),
583
+ web_search_requests: z.nullable(z.int()).optional(),
584
+ }).transform((v) => {
585
+ return remap$(v, {
586
+ "tool_calls_executed": "toolCallsExecuted",
587
+ "tool_calls_requested": "toolCallsRequested",
588
+ "web_search_requests": "webSearchRequests",
589
+ });
590
+ });
591
+ export function bodyServerToolUseFromJSON(jsonString) {
592
+ return safeParse(jsonString, (x) => BodyServerToolUse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyServerToolUse' from JSON`);
593
+ }
594
+ /** @internal */
595
+ export const BatchObjectServerToolUseDetails$inboundSchema = z.object({
596
+ tool_calls_executed: z.nullable(z.int()).optional(),
597
+ tool_calls_requested: z.nullable(z.int()).optional(),
598
+ web_search_requests: z.nullable(z.int()).optional(),
599
+ }).transform((v) => {
600
+ return remap$(v, {
601
+ "tool_calls_executed": "toolCallsExecuted",
602
+ "tool_calls_requested": "toolCallsRequested",
603
+ "web_search_requests": "webSearchRequests",
604
+ });
605
+ });
606
+ export function batchObjectServerToolUseDetailsFromJSON(jsonString) {
607
+ return safeParse(jsonString, (x) => BatchObjectServerToolUseDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectServerToolUseDetails' from JSON`);
608
+ }
609
+ /** @internal */
610
+ export const BodyUsage1$inboundSchema = z
611
+ .object({
612
+ completion_tokens: z.int(),
613
+ completion_tokens_details: z.nullable(z.lazy(() => BodyCompletionTokensDetails$inboundSchema)).optional(),
614
+ prompt_tokens: z.int(),
615
+ prompt_tokens_details: z.nullable(z.lazy(() => BodyPromptTokensDetails1$inboundSchema)).optional(),
616
+ server_tool_use: z.nullable(z.lazy(() => BodyServerToolUse$inboundSchema))
617
+ .optional(),
618
+ server_tool_use_details: z.nullable(z.lazy(() => BatchObjectServerToolUseDetails$inboundSchema)).optional(),
619
+ total_tokens: z.int(),
620
+ }).transform((v) => {
621
+ return remap$(v, {
622
+ "completion_tokens": "completionTokens",
623
+ "completion_tokens_details": "completionTokensDetails",
624
+ "prompt_tokens": "promptTokens",
625
+ "prompt_tokens_details": "promptTokensDetails",
626
+ "server_tool_use": "serverToolUse",
627
+ "server_tool_use_details": "serverToolUseDetails",
628
+ "total_tokens": "totalTokens",
629
+ });
630
+ });
631
+ export function bodyUsage1FromJSON(jsonString) {
632
+ return safeParse(jsonString, (x) => BodyUsage1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyUsage1' from JSON`);
633
+ }
634
+ /** @internal */
635
+ export const BodyChatCompletion$inboundSchema = z.object({
636
+ choices: z.array(z.lazy(() => Choice$inboundSchema)),
637
+ created: z.int(),
638
+ debug: z.lazy(() => BatchObjectDebug$inboundSchema).optional(),
639
+ id: z.string(),
640
+ model: z.string(),
641
+ object: BodyObjectChatCompletion$inboundSchema,
642
+ openrouter_metadata: OpenRouterMetadata$inboundSchema.optional(),
643
+ provider: z.nullable(z.string()).optional(),
644
+ service_tier: z.nullable(z.string()).optional(),
645
+ system_fingerprint: z.nullable(z.string()).optional(),
646
+ usage: z.lazy(() => BodyUsage1$inboundSchema).optional(),
647
+ }).transform((v) => {
648
+ return remap$(v, {
649
+ "openrouter_metadata": "openrouterMetadata",
650
+ "service_tier": "serviceTier",
651
+ "system_fingerprint": "systemFingerprint",
652
+ });
653
+ });
654
+ export function bodyChatCompletionFromJSON(jsonString) {
655
+ return safeParse(jsonString, (x) => BodyChatCompletion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyChatCompletion' from JSON`);
656
+ }
657
+ /** @internal */
658
+ export const Body$inboundSchema = z.union([
659
+ OpenResponsesResult$inboundSchema,
660
+ z.lazy(() => BodyMessage$inboundSchema),
661
+ z.lazy(() => BodyChatCompletion$inboundSchema),
662
+ z.lazy(() => BodyList$inboundSchema),
663
+ ]);
664
+ export function bodyFromJSON(jsonString) {
665
+ return safeParse(jsonString, (x) => Body$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Body' from JSON`);
666
+ }
667
+ /** @internal */
668
+ export const BatchObjectResponse$inboundSchema = z.object({
669
+ body: z.union([
670
+ OpenResponsesResult$inboundSchema,
671
+ z.lazy(() => BodyMessage$inboundSchema),
672
+ z.lazy(() => BodyChatCompletion$inboundSchema),
673
+ z.lazy(() => BodyList$inboundSchema),
674
+ ]),
675
+ request_id: z.nullable(z.string()),
676
+ status_code: z.int(),
677
+ }).transform((v) => {
678
+ return remap$(v, {
679
+ "request_id": "requestId",
680
+ "status_code": "statusCode",
681
+ });
682
+ });
683
+ export function batchObjectResponseFromJSON(jsonString) {
684
+ return safeParse(jsonString, (x) => BatchObjectResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectResponse' from JSON`);
685
+ }
686
+ /** @internal */
687
+ export const Result$inboundSchema = z.object({
688
+ custom_id: z.string(),
689
+ error: z.nullable(z.lazy(() => ResultError$inboundSchema)),
690
+ id: z.string(),
691
+ response: z.nullable(z.lazy(() => BatchObjectResponse$inboundSchema)),
692
+ }).transform((v) => {
693
+ return remap$(v, {
694
+ "custom_id": "customId",
695
+ });
696
+ });
697
+ export function resultFromJSON(jsonString) {
698
+ return safeParse(jsonString, (x) => Result$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Result' from JSON`);
699
+ }
700
+ /** @internal */
701
+ export const BatchObjectStatus$inboundSchema = openEnums.inboundSchema(BatchObjectStatus);
702
+ /** @internal */
703
+ export const BatchObjectCompletionTokensDetails$inboundSchema = z.object({
704
+ audio_tokens: z.nullable(z.int()).optional(),
705
+ image_tokens: z.nullable(z.int()).optional(),
706
+ reasoning_tokens: z.nullable(z.int()).optional(),
707
+ }).transform((v) => {
708
+ return remap$(v, {
709
+ "audio_tokens": "audioTokens",
710
+ "image_tokens": "imageTokens",
711
+ "reasoning_tokens": "reasoningTokens",
712
+ });
713
+ });
714
+ export function batchObjectCompletionTokensDetailsFromJSON(jsonString) {
715
+ return safeParse(jsonString, (x) => BatchObjectCompletionTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectCompletionTokensDetails' from JSON`);
716
+ }
717
+ /** @internal */
718
+ export const BatchObjectPromptTokensDetails$inboundSchema = z.object({
719
+ audio_tokens: z.nullable(z.int()).optional(),
720
+ cache_write_tokens: z.nullable(z.int()).optional(),
721
+ cached_tokens: z.nullable(z.int()).optional(),
722
+ file_tokens: z.nullable(z.int()).optional(),
723
+ video_tokens: z.nullable(z.int()).optional(),
724
+ }).transform((v) => {
725
+ return remap$(v, {
726
+ "audio_tokens": "audioTokens",
727
+ "cache_write_tokens": "cacheWriteTokens",
728
+ "cached_tokens": "cachedTokens",
729
+ "file_tokens": "fileTokens",
730
+ "video_tokens": "videoTokens",
731
+ });
732
+ });
733
+ export function batchObjectPromptTokensDetailsFromJSON(jsonString) {
734
+ return safeParse(jsonString, (x) => BatchObjectPromptTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectPromptTokensDetails' from JSON`);
735
+ }
736
+ /** @internal */
737
+ export const BatchObjectServerToolUse$inboundSchema = z.object({
738
+ tool_calls_executed: z.nullable(z.int()).optional(),
739
+ tool_calls_requested: z.nullable(z.int()).optional(),
740
+ web_search_requests: z.nullable(z.int()).optional(),
741
+ }).transform((v) => {
742
+ return remap$(v, {
743
+ "tool_calls_executed": "toolCallsExecuted",
744
+ "tool_calls_requested": "toolCallsRequested",
745
+ "web_search_requests": "webSearchRequests",
746
+ });
747
+ });
748
+ export function batchObjectServerToolUseFromJSON(jsonString) {
749
+ return safeParse(jsonString, (x) => BatchObjectServerToolUse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectServerToolUse' from JSON`);
750
+ }
751
+ /** @internal */
752
+ export const BatchObjectUsage$inboundSchema = z.object({
753
+ cache_creation: z.nullable(AnthropicCacheCreation$inboundSchema).optional(),
754
+ completion_tokens: z.int(),
755
+ completion_tokens_details: z.nullable(z.lazy(() => BatchObjectCompletionTokensDetails$inboundSchema)).optional(),
756
+ cost: z.nullable(z.number()).optional(),
757
+ cost_details: z.nullable(CostDetails$inboundSchema).optional(),
758
+ is_byok: z.boolean().optional(),
759
+ iterations: z.nullable(z.array(AnthropicUsageIteration$inboundSchema))
760
+ .optional(),
761
+ prompt_tokens: z.int(),
762
+ prompt_tokens_details: z.nullable(z.lazy(() => BatchObjectPromptTokensDetails$inboundSchema)).optional(),
763
+ server_tool_use: z.nullable(z.lazy(() => BatchObjectServerToolUse$inboundSchema)).optional(),
764
+ service_tier: z.nullable(z.string()).optional(),
765
+ speed: z.nullable(AnthropicSpeed$inboundSchema).optional(),
766
+ total_tokens: z.int(),
767
+ }).transform((v) => {
768
+ return remap$(v, {
769
+ "cache_creation": "cacheCreation",
770
+ "completion_tokens": "completionTokens",
771
+ "completion_tokens_details": "completionTokensDetails",
772
+ "cost_details": "costDetails",
773
+ "is_byok": "isByok",
774
+ "prompt_tokens": "promptTokens",
775
+ "prompt_tokens_details": "promptTokensDetails",
776
+ "server_tool_use": "serverToolUse",
777
+ "service_tier": "serviceTier",
778
+ "total_tokens": "totalTokens",
779
+ });
780
+ });
781
+ export function batchObjectUsageFromJSON(jsonString) {
782
+ return safeParse(jsonString, (x) => BatchObjectUsage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObjectUsage' from JSON`);
783
+ }
784
+ /** @internal */
785
+ export const BatchObject$inboundSchema = z
786
+ .object({
787
+ completion_window: BatchObjectCompletionWindow$inboundSchema,
788
+ created_at: z.int(),
789
+ endpoint: z.string(),
790
+ error: z.nullable(z.lazy(() => BatchObjectError$inboundSchema)),
791
+ finalized_at: z.nullable(z.int()),
792
+ id: z.string(),
793
+ model: z.string(),
794
+ object: BatchObjectObjectBatch$inboundSchema,
795
+ request_counts: z.lazy(() => BatchObjectRequestCounts$inboundSchema),
796
+ results: z.nullable(z.array(z.lazy(() => Result$inboundSchema))),
797
+ status: BatchObjectStatus$inboundSchema,
798
+ usage: z.nullable(z.lazy(() => BatchObjectUsage$inboundSchema)),
799
+ }).transform((v) => {
800
+ return remap$(v, {
801
+ "completion_window": "completionWindow",
802
+ "created_at": "createdAt",
803
+ "finalized_at": "finalizedAt",
804
+ "request_counts": "requestCounts",
805
+ });
806
+ });
807
+ export function batchObjectFromJSON(jsonString) {
808
+ return safeParse(jsonString, (x) => BatchObject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchObject' from JSON`);
809
+ }
810
+ //# sourceMappingURL=batchobject.js.map