@openrouter/sdk 1.3.29 → 1.3.31

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 (205) 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/imagegenerationrequest.d.ts +3 -0
  165. package/esm/models/imagegenerationrequest.js +3 -0
  166. package/esm/models/imagegenerationusage.d.ts +4 -4
  167. package/esm/models/imagegenerationusage.js +4 -6
  168. package/esm/models/index.d.ts +75 -0
  169. package/esm/models/index.js +75 -0
  170. package/esm/models/internchatchoice.d.ts +4 -4
  171. package/esm/models/internchatchoice.js +3 -3
  172. package/esm/models/messagesmessageparam.d.ts +8 -8
  173. package/esm/models/messagesmessageparam.js +6 -7
  174. package/esm/models/operations/createbatches.d.ts +59 -0
  175. package/esm/models/operations/createbatches.js +23 -0
  176. package/esm/models/operations/deletebatch.d.ts +58 -0
  177. package/esm/models/operations/deletebatch.js +21 -0
  178. package/esm/models/operations/getbatches.d.ts +58 -0
  179. package/esm/models/operations/getbatches.js +21 -0
  180. package/esm/models/operations/index.d.ts +4 -0
  181. package/esm/models/operations/index.js +4 -0
  182. package/esm/models/operations/listbatches.d.ts +87 -0
  183. package/esm/models/operations/listbatches.js +40 -0
  184. package/esm/models/oranthropicbashtoolresult.d.ts +43 -0
  185. package/esm/models/oranthropicbashtoolresult.js +49 -0
  186. package/esm/models/oranthropiccontentblock.d.ts +25 -0
  187. package/esm/models/oranthropiccontentblock.js +45 -0
  188. package/esm/models/oranthropicnullablecaller.d.ts +12 -0
  189. package/esm/models/oranthropicnullablecaller.js +19 -0
  190. package/esm/models/oranthropicservertooluseblock.d.ts +15 -0
  191. package/esm/models/oranthropicservertooluseblock.js +19 -0
  192. package/esm/models/oranthropicshelltoolresult.d.ts +43 -0
  193. package/esm/models/oranthropicshelltoolresult.js +50 -0
  194. package/esm/models/oranthropicstopreason.d.ts +16 -0
  195. package/esm/models/oranthropicstopreason.js +18 -0
  196. package/esm/models/outputfusionservertoolitem.d.ts +8 -8
  197. package/esm/models/outputfusionservertoolitem.js +8 -8
  198. package/esm/models/submitgenerationfeedbackrequest.d.ts +4 -4
  199. package/esm/models/submitgenerationfeedbackrequest.js +3 -4
  200. package/esm/sdk/batch.d.ts +37 -0
  201. package/esm/sdk/batch.js +50 -0
  202. package/esm/sdk/sdk.d.ts +3 -0
  203. package/esm/sdk/sdk.js +4 -0
  204. package/jsr.json +1 -1
  205. package/package.json +7 -7
@@ -0,0 +1,159 @@
1
+ import * as z from "zod/v4";
2
+ import { ClosedEnum, OpenEnum } from "../types/enums.js";
3
+ import { Result as SafeParseResult } from "../types/fp.js";
4
+ import { AnthropicCacheCreation } from "./anthropiccachecreation.js";
5
+ import { AnthropicSpeed } from "./anthropicspeed.js";
6
+ import { AnthropicUsageIteration } from "./anthropicusageiteration.js";
7
+ import { CostDetails } from "./costdetails.js";
8
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
9
+ export declare const BatchPaymentRequiredResponseCompletionWindow: {
10
+ readonly TwentyFourh: "24h";
11
+ };
12
+ export type BatchPaymentRequiredResponseCompletionWindow = ClosedEnum<typeof BatchPaymentRequiredResponseCompletionWindow>;
13
+ export type BatchPaymentRequiredResponseError = {
14
+ code: number;
15
+ message: string;
16
+ };
17
+ export declare const BatchPaymentRequiredResponseObject: {
18
+ readonly Batch: "batch";
19
+ };
20
+ export type BatchPaymentRequiredResponseObject = ClosedEnum<typeof BatchPaymentRequiredResponseObject>;
21
+ export type BatchPaymentRequiredResponseRequestCounts = {
22
+ completed: number;
23
+ failed: number;
24
+ total: number;
25
+ };
26
+ export declare const BatchPaymentRequiredResponseStatus: {
27
+ readonly Validating: "validating";
28
+ readonly InProgress: "in_progress";
29
+ readonly Finalizing: "finalizing";
30
+ readonly Completed: "completed";
31
+ readonly Failed: "failed";
32
+ readonly Expired: "expired";
33
+ readonly Cancelling: "cancelling";
34
+ readonly Cancelled: "cancelled";
35
+ };
36
+ export type BatchPaymentRequiredResponseStatus = OpenEnum<typeof BatchPaymentRequiredResponseStatus>;
37
+ export type BatchPaymentRequiredResponseCompletionTokensDetails = {
38
+ /**
39
+ * Tokens generated by the model for audio output.
40
+ */
41
+ audioTokens?: number | null | undefined;
42
+ /**
43
+ * Tokens generated by the model for image output.
44
+ */
45
+ imageTokens?: number | null | undefined;
46
+ /**
47
+ * Tokens generated by the model for reasoning.
48
+ */
49
+ reasoningTokens?: number | null | undefined;
50
+ };
51
+ /**
52
+ * Breakdown of tokens used in the prompt.
53
+ */
54
+ export type BatchPaymentRequiredResponsePromptTokensDetails = {
55
+ /**
56
+ * Tokens used for input audio.
57
+ */
58
+ audioTokens?: number | null | undefined;
59
+ /**
60
+ * Tokens written to cache. Only returned for models with explicit caching and cache write pricing.
61
+ */
62
+ cacheWriteTokens?: number | null | undefined;
63
+ /**
64
+ * Tokens cached by the endpoint.
65
+ */
66
+ cachedTokens?: number | null | undefined;
67
+ /**
68
+ * Tokens used for input files/documents.
69
+ */
70
+ fileTokens?: number | null | undefined;
71
+ /**
72
+ * Tokens used for input video.
73
+ */
74
+ videoTokens?: number | null | undefined;
75
+ };
76
+ /**
77
+ * Usage for server-side tool execution (e.g., web search)
78
+ */
79
+ export type BatchPaymentRequiredResponseServerToolUse = {
80
+ /**
81
+ * Number of OpenRouter server tool calls that executed and produced a result.
82
+ */
83
+ toolCallsExecuted?: number | null | undefined;
84
+ /**
85
+ * Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.
86
+ */
87
+ toolCallsRequested?: number | null | undefined;
88
+ /**
89
+ * Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.
90
+ */
91
+ webSearchRequests?: number | null | undefined;
92
+ };
93
+ export type BatchPaymentRequiredResponseUsage = {
94
+ cacheCreation?: AnthropicCacheCreation | null | undefined;
95
+ /**
96
+ * The tokens generated
97
+ */
98
+ completionTokens: number;
99
+ completionTokensDetails?: BatchPaymentRequiredResponseCompletionTokensDetails | null | undefined;
100
+ /**
101
+ * Cost of the completion
102
+ */
103
+ cost?: number | null | undefined;
104
+ /**
105
+ * Breakdown of upstream inference costs
106
+ */
107
+ costDetails?: CostDetails | null | undefined;
108
+ /**
109
+ * Whether a request was made using a Bring Your Own Key configuration
110
+ */
111
+ isByok?: boolean | undefined;
112
+ iterations?: Array<AnthropicUsageIteration> | null | undefined;
113
+ /**
114
+ * Including images, input audio, and tools if any
115
+ */
116
+ promptTokens: number;
117
+ /**
118
+ * Breakdown of tokens used in the prompt.
119
+ */
120
+ promptTokensDetails?: BatchPaymentRequiredResponsePromptTokensDetails | null | undefined;
121
+ /**
122
+ * Usage for server-side tool execution (e.g., web search)
123
+ */
124
+ serverToolUse?: BatchPaymentRequiredResponseServerToolUse | null | undefined;
125
+ /**
126
+ * The service tier used by the upstream provider for this request
127
+ */
128
+ serviceTier?: string | null | undefined;
129
+ speed?: AnthropicSpeed | null | undefined;
130
+ /**
131
+ * Sum of the above two fields
132
+ */
133
+ totalTokens: number;
134
+ };
135
+ /** @internal */
136
+ export declare const BatchPaymentRequiredResponseCompletionWindow$inboundSchema: z.ZodEnum<typeof BatchPaymentRequiredResponseCompletionWindow>;
137
+ /** @internal */
138
+ export declare const BatchPaymentRequiredResponseError$inboundSchema: z.ZodType<BatchPaymentRequiredResponseError, unknown>;
139
+ export declare function batchPaymentRequiredResponseErrorFromJSON(jsonString: string): SafeParseResult<BatchPaymentRequiredResponseError, SDKValidationError>;
140
+ /** @internal */
141
+ export declare const BatchPaymentRequiredResponseObject$inboundSchema: z.ZodEnum<typeof BatchPaymentRequiredResponseObject>;
142
+ /** @internal */
143
+ export declare const BatchPaymentRequiredResponseRequestCounts$inboundSchema: z.ZodType<BatchPaymentRequiredResponseRequestCounts, unknown>;
144
+ export declare function batchPaymentRequiredResponseRequestCountsFromJSON(jsonString: string): SafeParseResult<BatchPaymentRequiredResponseRequestCounts, SDKValidationError>;
145
+ /** @internal */
146
+ export declare const BatchPaymentRequiredResponseStatus$inboundSchema: z.ZodType<BatchPaymentRequiredResponseStatus, unknown>;
147
+ /** @internal */
148
+ export declare const BatchPaymentRequiredResponseCompletionTokensDetails$inboundSchema: z.ZodType<BatchPaymentRequiredResponseCompletionTokensDetails, unknown>;
149
+ export declare function batchPaymentRequiredResponseCompletionTokensDetailsFromJSON(jsonString: string): SafeParseResult<BatchPaymentRequiredResponseCompletionTokensDetails, SDKValidationError>;
150
+ /** @internal */
151
+ export declare const BatchPaymentRequiredResponsePromptTokensDetails$inboundSchema: z.ZodType<BatchPaymentRequiredResponsePromptTokensDetails, unknown>;
152
+ export declare function batchPaymentRequiredResponsePromptTokensDetailsFromJSON(jsonString: string): SafeParseResult<BatchPaymentRequiredResponsePromptTokensDetails, SDKValidationError>;
153
+ /** @internal */
154
+ export declare const BatchPaymentRequiredResponseServerToolUse$inboundSchema: z.ZodType<BatchPaymentRequiredResponseServerToolUse, unknown>;
155
+ export declare function batchPaymentRequiredResponseServerToolUseFromJSON(jsonString: string): SafeParseResult<BatchPaymentRequiredResponseServerToolUse, SDKValidationError>;
156
+ /** @internal */
157
+ export declare const BatchPaymentRequiredResponseUsage$inboundSchema: z.ZodType<BatchPaymentRequiredResponseUsage, unknown>;
158
+ export declare function batchPaymentRequiredResponseUsageFromJSON(jsonString: string): SafeParseResult<BatchPaymentRequiredResponseUsage, SDKValidationError>;
159
+ //# sourceMappingURL=batchpaymentrequiredresponseerror.d.ts.map
@@ -0,0 +1,136 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 9e233f8dd38a
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { safeParse } from "../lib/schemas.js";
8
+ import * as openEnums from "../types/enums.js";
9
+ import { AnthropicCacheCreation$inboundSchema, } from "./anthropiccachecreation.js";
10
+ import { AnthropicSpeed$inboundSchema, } from "./anthropicspeed.js";
11
+ import { AnthropicUsageIteration$inboundSchema, } from "./anthropicusageiteration.js";
12
+ import { CostDetails$inboundSchema } from "./costdetails.js";
13
+ export const BatchPaymentRequiredResponseCompletionWindow = {
14
+ TwentyFourh: "24h",
15
+ };
16
+ export const BatchPaymentRequiredResponseObject = {
17
+ Batch: "batch",
18
+ };
19
+ export const BatchPaymentRequiredResponseStatus = {
20
+ Validating: "validating",
21
+ InProgress: "in_progress",
22
+ Finalizing: "finalizing",
23
+ Completed: "completed",
24
+ Failed: "failed",
25
+ Expired: "expired",
26
+ Cancelling: "cancelling",
27
+ Cancelled: "cancelled",
28
+ };
29
+ /** @internal */
30
+ export const BatchPaymentRequiredResponseCompletionWindow$inboundSchema = z.enum(BatchPaymentRequiredResponseCompletionWindow);
31
+ /** @internal */
32
+ export const BatchPaymentRequiredResponseError$inboundSchema = z.object({
33
+ code: z.int(),
34
+ message: z.string(),
35
+ });
36
+ export function batchPaymentRequiredResponseErrorFromJSON(jsonString) {
37
+ return safeParse(jsonString, (x) => BatchPaymentRequiredResponseError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchPaymentRequiredResponseError' from JSON`);
38
+ }
39
+ /** @internal */
40
+ export const BatchPaymentRequiredResponseObject$inboundSchema = z.enum(BatchPaymentRequiredResponseObject);
41
+ /** @internal */
42
+ export const BatchPaymentRequiredResponseRequestCounts$inboundSchema = z.object({
43
+ completed: z.int(),
44
+ failed: z.int(),
45
+ total: z.int(),
46
+ });
47
+ export function batchPaymentRequiredResponseRequestCountsFromJSON(jsonString) {
48
+ return safeParse(jsonString, (x) => BatchPaymentRequiredResponseRequestCounts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchPaymentRequiredResponseRequestCounts' from JSON`);
49
+ }
50
+ /** @internal */
51
+ export const BatchPaymentRequiredResponseStatus$inboundSchema = openEnums.inboundSchema(BatchPaymentRequiredResponseStatus);
52
+ /** @internal */
53
+ export const BatchPaymentRequiredResponseCompletionTokensDetails$inboundSchema = z
54
+ .object({
55
+ audio_tokens: z.nullable(z.int()).optional(),
56
+ image_tokens: z.nullable(z.int()).optional(),
57
+ reasoning_tokens: z.nullable(z.int()).optional(),
58
+ }).transform((v) => {
59
+ return remap$(v, {
60
+ "audio_tokens": "audioTokens",
61
+ "image_tokens": "imageTokens",
62
+ "reasoning_tokens": "reasoningTokens",
63
+ });
64
+ });
65
+ export function batchPaymentRequiredResponseCompletionTokensDetailsFromJSON(jsonString) {
66
+ return safeParse(jsonString, (x) => BatchPaymentRequiredResponseCompletionTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchPaymentRequiredResponseCompletionTokensDetails' from JSON`);
67
+ }
68
+ /** @internal */
69
+ export const BatchPaymentRequiredResponsePromptTokensDetails$inboundSchema = z
70
+ .object({
71
+ audio_tokens: z.nullable(z.int()).optional(),
72
+ cache_write_tokens: z.nullable(z.int()).optional(),
73
+ cached_tokens: z.nullable(z.int()).optional(),
74
+ file_tokens: z.nullable(z.int()).optional(),
75
+ video_tokens: z.nullable(z.int()).optional(),
76
+ }).transform((v) => {
77
+ return remap$(v, {
78
+ "audio_tokens": "audioTokens",
79
+ "cache_write_tokens": "cacheWriteTokens",
80
+ "cached_tokens": "cachedTokens",
81
+ "file_tokens": "fileTokens",
82
+ "video_tokens": "videoTokens",
83
+ });
84
+ });
85
+ export function batchPaymentRequiredResponsePromptTokensDetailsFromJSON(jsonString) {
86
+ return safeParse(jsonString, (x) => BatchPaymentRequiredResponsePromptTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchPaymentRequiredResponsePromptTokensDetails' from JSON`);
87
+ }
88
+ /** @internal */
89
+ export const BatchPaymentRequiredResponseServerToolUse$inboundSchema = z.object({
90
+ tool_calls_executed: z.nullable(z.int()).optional(),
91
+ tool_calls_requested: z.nullable(z.int()).optional(),
92
+ web_search_requests: z.nullable(z.int()).optional(),
93
+ }).transform((v) => {
94
+ return remap$(v, {
95
+ "tool_calls_executed": "toolCallsExecuted",
96
+ "tool_calls_requested": "toolCallsRequested",
97
+ "web_search_requests": "webSearchRequests",
98
+ });
99
+ });
100
+ export function batchPaymentRequiredResponseServerToolUseFromJSON(jsonString) {
101
+ return safeParse(jsonString, (x) => BatchPaymentRequiredResponseServerToolUse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchPaymentRequiredResponseServerToolUse' from JSON`);
102
+ }
103
+ /** @internal */
104
+ export const BatchPaymentRequiredResponseUsage$inboundSchema = z.object({
105
+ cache_creation: z.nullable(AnthropicCacheCreation$inboundSchema).optional(),
106
+ completion_tokens: z.int(),
107
+ completion_tokens_details: z.nullable(z.lazy(() => BatchPaymentRequiredResponseCompletionTokensDetails$inboundSchema)).optional(),
108
+ cost: z.nullable(z.number()).optional(),
109
+ cost_details: z.nullable(CostDetails$inboundSchema).optional(),
110
+ is_byok: z.boolean().optional(),
111
+ iterations: z.nullable(z.array(AnthropicUsageIteration$inboundSchema))
112
+ .optional(),
113
+ prompt_tokens: z.int(),
114
+ prompt_tokens_details: z.nullable(z.lazy(() => BatchPaymentRequiredResponsePromptTokensDetails$inboundSchema)).optional(),
115
+ server_tool_use: z.nullable(z.lazy(() => BatchPaymentRequiredResponseServerToolUse$inboundSchema)).optional(),
116
+ service_tier: z.nullable(z.string()).optional(),
117
+ speed: z.nullable(AnthropicSpeed$inboundSchema).optional(),
118
+ total_tokens: z.int(),
119
+ }).transform((v) => {
120
+ return remap$(v, {
121
+ "cache_creation": "cacheCreation",
122
+ "completion_tokens": "completionTokens",
123
+ "completion_tokens_details": "completionTokensDetails",
124
+ "cost_details": "costDetails",
125
+ "is_byok": "isByok",
126
+ "prompt_tokens": "promptTokens",
127
+ "prompt_tokens_details": "promptTokensDetails",
128
+ "server_tool_use": "serverToolUse",
129
+ "service_tier": "serviceTier",
130
+ "total_tokens": "totalTokens",
131
+ });
132
+ });
133
+ export function batchPaymentRequiredResponseUsageFromJSON(jsonString) {
134
+ return safeParse(jsonString, (x) => BatchPaymentRequiredResponseUsage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchPaymentRequiredResponseUsage' from JSON`);
135
+ }
136
+ //# sourceMappingURL=batchpaymentrequiredresponseerror.js.map
@@ -0,0 +1,25 @@
1
+ import * as z from "zod/v4";
2
+ import { ProviderName } from "./providername.js";
3
+ export type BatchProviderPreferencesOnly = ProviderName | string;
4
+ /**
5
+ * Batch provider routing preferences. Only `provider.only` is supported.
6
+ */
7
+ export type BatchProviderPreferences = {
8
+ /**
9
+ * List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
10
+ */
11
+ only?: Array<ProviderName | string> | null | undefined;
12
+ };
13
+ /** @internal */
14
+ export type BatchProviderPreferencesOnly$Outbound = string | string;
15
+ /** @internal */
16
+ export declare const BatchProviderPreferencesOnly$outboundSchema: z.ZodType<BatchProviderPreferencesOnly$Outbound, BatchProviderPreferencesOnly>;
17
+ export declare function batchProviderPreferencesOnlyToJSON(batchProviderPreferencesOnly: BatchProviderPreferencesOnly): string;
18
+ /** @internal */
19
+ export type BatchProviderPreferences$Outbound = {
20
+ only?: Array<string | string> | null | undefined;
21
+ };
22
+ /** @internal */
23
+ export declare const BatchProviderPreferences$outboundSchema: z.ZodType<BatchProviderPreferences$Outbound, BatchProviderPreferences>;
24
+ export declare function batchProviderPreferencesToJSON(batchProviderPreferences: BatchProviderPreferences): string;
25
+ //# sourceMappingURL=batchproviderpreferences.d.ts.map
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 250964898edb
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { ProviderName$outboundSchema } from "./providername.js";
7
+ /** @internal */
8
+ export const BatchProviderPreferencesOnly$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
9
+ export function batchProviderPreferencesOnlyToJSON(batchProviderPreferencesOnly) {
10
+ return JSON.stringify(BatchProviderPreferencesOnly$outboundSchema.parse(batchProviderPreferencesOnly));
11
+ }
12
+ /** @internal */
13
+ export const BatchProviderPreferences$outboundSchema = z.object({
14
+ only: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()])))
15
+ .optional(),
16
+ });
17
+ export function batchProviderPreferencesToJSON(batchProviderPreferences) {
18
+ return JSON.stringify(BatchProviderPreferences$outboundSchema.parse(batchProviderPreferences));
19
+ }
20
+ //# sourceMappingURL=batchproviderpreferences.js.map
@@ -0,0 +1,62 @@
1
+ import * as z from "zod/v4";
2
+ import { ClosedEnum, OpenEnum } from "../types/enums.js";
3
+ import { BatchProviderPreferences, BatchProviderPreferences$Outbound } from "./batchproviderpreferences.js";
4
+ export declare const BatchSubmitBodyCompletionWindow: {
5
+ readonly TwentyFourh: "24h";
6
+ };
7
+ export type BatchSubmitBodyCompletionWindow = ClosedEnum<typeof BatchSubmitBodyCompletionWindow>;
8
+ export declare const Endpoint: {
9
+ readonly RootV1ChatCompletions: "/v1/chat/completions";
10
+ readonly RootV1Responses: "/v1/responses";
11
+ readonly RootV1Messages: "/v1/messages";
12
+ readonly RootV1Embeddings: "/v1/embeddings";
13
+ };
14
+ export type Endpoint = OpenEnum<typeof Endpoint>;
15
+ export type RequestT = {
16
+ /**
17
+ * Request payload for the batch `endpoint`.
18
+ */
19
+ body: {
20
+ [k: string]: any;
21
+ };
22
+ customId: string;
23
+ };
24
+ /**
25
+ * Batch submit request body.
26
+ */
27
+ export type BatchSubmitBody = {
28
+ completionWindow?: BatchSubmitBodyCompletionWindow | undefined;
29
+ endpoint: Endpoint;
30
+ model: string;
31
+ /**
32
+ * Batch provider routing preferences. Only `provider.only` is supported.
33
+ */
34
+ provider?: BatchProviderPreferences | null | undefined;
35
+ requests: Array<RequestT>;
36
+ };
37
+ /** @internal */
38
+ export declare const BatchSubmitBodyCompletionWindow$outboundSchema: z.ZodEnum<typeof BatchSubmitBodyCompletionWindow>;
39
+ /** @internal */
40
+ export declare const Endpoint$outboundSchema: z.ZodType<string, Endpoint>;
41
+ /** @internal */
42
+ export type RequestT$Outbound = {
43
+ body: {
44
+ [k: string]: any;
45
+ };
46
+ custom_id: string;
47
+ };
48
+ /** @internal */
49
+ export declare const RequestT$outboundSchema: z.ZodType<RequestT$Outbound, RequestT>;
50
+ export declare function requestToJSON(requestT: RequestT): string;
51
+ /** @internal */
52
+ export type BatchSubmitBody$Outbound = {
53
+ completion_window: string;
54
+ endpoint: string;
55
+ model: string;
56
+ provider?: BatchProviderPreferences$Outbound | null | undefined;
57
+ requests: Array<RequestT$Outbound>;
58
+ };
59
+ /** @internal */
60
+ export declare const BatchSubmitBody$outboundSchema: z.ZodType<BatchSubmitBody$Outbound, BatchSubmitBody>;
61
+ export declare function batchSubmitBodyToJSON(batchSubmitBody: BatchSubmitBody): string;
62
+ //# sourceMappingURL=batchsubmitbody.d.ts.map
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: ae38a7f7eb9d
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import * as openEnums from "../types/enums.js";
8
+ import { BatchProviderPreferences$outboundSchema, } from "./batchproviderpreferences.js";
9
+ export const BatchSubmitBodyCompletionWindow = {
10
+ TwentyFourh: "24h",
11
+ };
12
+ export const Endpoint = {
13
+ RootV1ChatCompletions: "/v1/chat/completions",
14
+ RootV1Responses: "/v1/responses",
15
+ RootV1Messages: "/v1/messages",
16
+ RootV1Embeddings: "/v1/embeddings",
17
+ };
18
+ /** @internal */
19
+ export const BatchSubmitBodyCompletionWindow$outboundSchema = z.enum(BatchSubmitBodyCompletionWindow);
20
+ /** @internal */
21
+ export const Endpoint$outboundSchema = openEnums
22
+ .outboundSchema(Endpoint);
23
+ /** @internal */
24
+ export const RequestT$outboundSchema = z
25
+ .object({
26
+ body: z.record(z.string(), z.any()),
27
+ customId: z.string(),
28
+ }).transform((v) => {
29
+ return remap$(v, {
30
+ customId: "custom_id",
31
+ });
32
+ });
33
+ export function requestToJSON(requestT) {
34
+ return JSON.stringify(RequestT$outboundSchema.parse(requestT));
35
+ }
36
+ /** @internal */
37
+ export const BatchSubmitBody$outboundSchema = z.object({
38
+ completionWindow: BatchSubmitBodyCompletionWindow$outboundSchema.default("24h"),
39
+ endpoint: Endpoint$outboundSchema,
40
+ model: z.string(),
41
+ provider: z.nullable(BatchProviderPreferences$outboundSchema).optional(),
42
+ requests: z.array(z.lazy(() => RequestT$outboundSchema)),
43
+ }).transform((v) => {
44
+ return remap$(v, {
45
+ completionWindow: "completion_window",
46
+ });
47
+ });
48
+ export function batchSubmitBodyToJSON(batchSubmitBody) {
49
+ return JSON.stringify(BatchSubmitBody$outboundSchema.parse(batchSubmitBody));
50
+ }
51
+ //# sourceMappingURL=batchsubmitbody.js.map
@@ -2,40 +2,40 @@ import * as z from "zod/v4";
2
2
  import { OpenEnum } from "../types/enums.js";
3
3
  import { Result as SafeParseResult } from "../types/fp.js";
4
4
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
- export declare const Event: {
5
+ export declare const DebugEventEvent: {
6
6
  readonly AdapterRequest: "adapter_request";
7
7
  readonly UpstreamHeadersReceived: "upstream_headers_received";
8
8
  readonly FirstTokenReceived: "first_token_received";
9
9
  readonly UpstreamBodyEnded: "upstream_body_ended";
10
10
  };
11
- export type Event = OpenEnum<typeof Event>;
12
- export type Timings = {
11
+ export type DebugEventEvent = OpenEnum<typeof DebugEventEvent>;
12
+ export type DebugEventTimings = {
13
13
  epochMs: number;
14
- event: Event;
14
+ event: DebugEventEvent;
15
15
  startMs: number;
16
16
  };
17
- export type Debug = {
17
+ export type DebugEventDebug = {
18
18
  echoUpstreamBody?: {
19
19
  [k: string]: any;
20
20
  } | undefined;
21
- timings?: Timings | undefined;
21
+ timings?: DebugEventTimings | undefined;
22
22
  };
23
23
  /**
24
24
  * Debug event emitted when debug.echo_upstream_body is true. Contains the transformed upstream request body or timing milestones.
25
25
  */
26
26
  export type DebugEvent = {
27
- debug: Debug;
27
+ debug: DebugEventDebug;
28
28
  sequenceNumber: number;
29
29
  type: "response.debug";
30
30
  };
31
31
  /** @internal */
32
- export declare const Event$inboundSchema: z.ZodType<Event, unknown>;
32
+ export declare const DebugEventEvent$inboundSchema: z.ZodType<DebugEventEvent, unknown>;
33
33
  /** @internal */
34
- export declare const Timings$inboundSchema: z.ZodType<Timings, unknown>;
35
- export declare function timingsFromJSON(jsonString: string): SafeParseResult<Timings, SDKValidationError>;
34
+ export declare const DebugEventTimings$inboundSchema: z.ZodType<DebugEventTimings, unknown>;
35
+ export declare function debugEventTimingsFromJSON(jsonString: string): SafeParseResult<DebugEventTimings, SDKValidationError>;
36
36
  /** @internal */
37
- export declare const Debug$inboundSchema: z.ZodType<Debug, unknown>;
38
- export declare function debugFromJSON(jsonString: string): SafeParseResult<Debug, SDKValidationError>;
37
+ export declare const DebugEventDebug$inboundSchema: z.ZodType<DebugEventDebug, unknown>;
38
+ export declare function debugEventDebugFromJSON(jsonString: string): SafeParseResult<DebugEventDebug, SDKValidationError>;
39
39
  /** @internal */
40
40
  export declare const DebugEvent$inboundSchema: z.ZodType<DebugEvent, unknown>;
41
41
  export declare function debugEventFromJSON(jsonString: string): SafeParseResult<DebugEvent, SDKValidationError>;
@@ -6,19 +6,18 @@ 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 * as openEnums from "../types/enums.js";
9
- export const Event = {
9
+ export const DebugEventEvent = {
10
10
  AdapterRequest: "adapter_request",
11
11
  UpstreamHeadersReceived: "upstream_headers_received",
12
12
  FirstTokenReceived: "first_token_received",
13
13
  UpstreamBodyEnded: "upstream_body_ended",
14
14
  };
15
15
  /** @internal */
16
- export const Event$inboundSchema = openEnums
17
- .inboundSchema(Event);
16
+ export const DebugEventEvent$inboundSchema = openEnums.inboundSchema(DebugEventEvent);
18
17
  /** @internal */
19
- export const Timings$inboundSchema = z.object({
18
+ export const DebugEventTimings$inboundSchema = z.object({
20
19
  epoch_ms: z.int(),
21
- event: Event$inboundSchema,
20
+ event: DebugEventEvent$inboundSchema,
22
21
  start_ms: z.int(),
23
22
  }).transform((v) => {
24
23
  return remap$(v, {
@@ -26,25 +25,25 @@ export const Timings$inboundSchema = z.object({
26
25
  "start_ms": "startMs",
27
26
  });
28
27
  });
29
- export function timingsFromJSON(jsonString) {
30
- return safeParse(jsonString, (x) => Timings$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Timings' from JSON`);
28
+ export function debugEventTimingsFromJSON(jsonString) {
29
+ return safeParse(jsonString, (x) => DebugEventTimings$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DebugEventTimings' from JSON`);
31
30
  }
32
31
  /** @internal */
33
- export const Debug$inboundSchema = z.object({
32
+ export const DebugEventDebug$inboundSchema = z.object({
34
33
  echo_upstream_body: z.record(z.string(), z.any()).optional(),
35
- timings: z.lazy(() => Timings$inboundSchema).optional(),
34
+ timings: z.lazy(() => DebugEventTimings$inboundSchema).optional(),
36
35
  }).transform((v) => {
37
36
  return remap$(v, {
38
37
  "echo_upstream_body": "echoUpstreamBody",
39
38
  });
40
39
  });
41
- export function debugFromJSON(jsonString) {
42
- return safeParse(jsonString, (x) => Debug$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Debug' from JSON`);
40
+ export function debugEventDebugFromJSON(jsonString) {
41
+ return safeParse(jsonString, (x) => DebugEventDebug$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DebugEventDebug' from JSON`);
43
42
  }
44
43
  /** @internal */
45
44
  export const DebugEvent$inboundSchema = z
46
45
  .object({
47
- debug: z.lazy(() => Debug$inboundSchema),
46
+ debug: z.lazy(() => DebugEventDebug$inboundSchema),
48
47
  sequence_number: z.int(),
49
48
  type: z.literal("response.debug"),
50
49
  }).transform((v) => {
@@ -0,0 +1,19 @@
1
+ import * as z from "zod/v4";
2
+ import * as models from "../index.js";
3
+ import { OpenRouterError } from "./openroutererror.js";
4
+ export type BatchErrorResponseData = {
5
+ error: models.BatchErrorResponseError;
6
+ };
7
+ export declare class BatchErrorResponse extends OpenRouterError {
8
+ error: models.BatchErrorResponseError;
9
+ /** The original data that was passed to this error instance. */
10
+ data$: BatchErrorResponseData;
11
+ constructor(err: BatchErrorResponseData, httpMeta: {
12
+ response: Response;
13
+ request: Request;
14
+ body: string;
15
+ });
16
+ }
17
+ /** @internal */
18
+ export declare const BatchErrorResponse$inboundSchema: z.ZodType<BatchErrorResponse, unknown>;
19
+ //# sourceMappingURL=batcherrorresponse.d.ts.map
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: f2cce3eb05df
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { BatchErrorResponseError$inboundSchema as models_BatchErrorResponseError$inboundSchema } from "../batcherrorresponse.js";
7
+ import { OpenRouterError } from "./openroutererror.js";
8
+ export class BatchErrorResponse extends OpenRouterError {
9
+ constructor(err, httpMeta) {
10
+ const message = err.error?.message
11
+ || `API error occurred: ${JSON.stringify(err)}`;
12
+ super(message, httpMeta);
13
+ this.data$ = err;
14
+ this.error = err.error;
15
+ this.name = "BatchErrorResponse";
16
+ }
17
+ }
18
+ /** @internal */
19
+ export const BatchErrorResponse$inboundSchema = z.object({
20
+ error: z.lazy(() => models_BatchErrorResponseError$inboundSchema),
21
+ request$: z.custom(x => x instanceof Request),
22
+ response$: z.custom(x => x instanceof Response),
23
+ body$: z.string(),
24
+ })
25
+ .transform((v) => {
26
+ return new BatchErrorResponse(v, {
27
+ request: v.request$,
28
+ response: v.response$,
29
+ body: v.body$,
30
+ });
31
+ });
32
+ //# sourceMappingURL=batcherrorresponse.js.map