@openrouter/sdk 0.9.11 → 0.10.2

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 (274) hide show
  1. package/FUNCTIONS.md +2 -1
  2. package/_speakeasy/.github/action-inputs-config.json +4 -0
  3. package/esm/funcs/analyticsGetUserActivity.js +2 -1
  4. package/esm/funcs/apiKeysCreate.js +2 -1
  5. package/esm/funcs/apiKeysDelete.js +2 -1
  6. package/esm/funcs/apiKeysGet.js +2 -1
  7. package/esm/funcs/apiKeysGetCurrentKeyMetadata.js +2 -1
  8. package/esm/funcs/apiKeysList.js +2 -1
  9. package/esm/funcs/apiKeysUpdate.js +2 -1
  10. package/esm/funcs/betaResponsesSend.js +2 -1
  11. package/esm/funcs/call-model.d.ts +19 -70
  12. package/esm/funcs/call-model.js +29 -71
  13. package/esm/funcs/chatSend.js +2 -1
  14. package/esm/funcs/creditsCreateCoinbaseCharge.js +2 -1
  15. package/esm/funcs/creditsGetCredits.js +2 -1
  16. package/esm/funcs/embeddingsGenerate.js +2 -1
  17. package/esm/funcs/embeddingsListModels.js +2 -1
  18. package/esm/funcs/endpointsList.js +2 -1
  19. package/esm/funcs/endpointsListZdrEndpoints.js +2 -1
  20. package/esm/funcs/generationsGetGeneration.js +2 -1
  21. package/esm/funcs/guardrailsBulkAssignKeys.js +2 -1
  22. package/esm/funcs/guardrailsBulkAssignMembers.js +2 -1
  23. package/esm/funcs/guardrailsBulkUnassignKeys.js +2 -1
  24. package/esm/funcs/guardrailsBulkUnassignMembers.js +2 -1
  25. package/esm/funcs/guardrailsCreate.js +2 -1
  26. package/esm/funcs/guardrailsDelete.js +2 -1
  27. package/esm/funcs/guardrailsGet.js +2 -1
  28. package/esm/funcs/guardrailsList.js +2 -1
  29. package/esm/funcs/guardrailsListGuardrailKeyAssignments.js +2 -1
  30. package/esm/funcs/guardrailsListGuardrailMemberAssignments.js +2 -1
  31. package/esm/funcs/guardrailsListKeyAssignments.js +2 -1
  32. package/esm/funcs/guardrailsListMemberAssignments.js +2 -1
  33. package/esm/funcs/guardrailsUpdate.js +2 -1
  34. package/esm/funcs/modelsCount.d.ts +1 -1
  35. package/esm/funcs/modelsCount.js +9 -4
  36. package/esm/funcs/modelsList.js +3 -1
  37. package/esm/funcs/modelsListForUser.js +2 -1
  38. package/esm/funcs/oAuthCreateAuthCode.d.ts +1 -1
  39. package/esm/funcs/oAuthCreateAuthCode.js +4 -3
  40. package/esm/funcs/oAuthExchangeAuthCodeForAPIKey.js +2 -1
  41. package/esm/funcs/providersList.js +2 -1
  42. package/esm/index.d.ts +22 -23
  43. package/esm/index.js +20 -17
  44. package/esm/lib/anthropic-compat.d.ts +2 -1
  45. package/esm/lib/anthropic-compat.js +1 -2
  46. package/esm/lib/async-params.d.ts +19 -5
  47. package/esm/lib/async-params.js +5 -1
  48. package/esm/lib/chat-compat.d.ts +1 -1
  49. package/esm/lib/chat-compat.js +1 -2
  50. package/esm/lib/claude-type-guards.d.ts +2 -2
  51. package/esm/lib/config.d.ts +8 -10
  52. package/esm/lib/config.js +2 -2
  53. package/esm/lib/conversation-state.d.ts +1 -1
  54. package/esm/lib/conversation-state.js +35 -32
  55. package/esm/lib/env.d.ts +6 -2
  56. package/esm/lib/env.js +7 -3
  57. package/esm/lib/model-result.d.ts +73 -17
  58. package/esm/lib/model-result.js +329 -125
  59. package/esm/lib/sdks.d.ts +1 -1
  60. package/esm/lib/sdks.js +8 -28
  61. package/esm/lib/stream-transformers.d.ts +5 -4
  62. package/esm/lib/stream-transformers.js +24 -29
  63. package/esm/lib/stream-type-guards.js +8 -32
  64. package/esm/lib/tool-context.d.ts +68 -0
  65. package/esm/lib/tool-context.js +175 -0
  66. package/esm/lib/tool-executor.d.ts +9 -5
  67. package/esm/lib/tool-executor.js +26 -16
  68. package/esm/lib/tool-orchestrator.d.ts +2 -2
  69. package/esm/lib/tool-types.d.ts +101 -14
  70. package/esm/lib/tool-types.js +17 -0
  71. package/esm/lib/tool.d.ts +49 -60
  72. package/esm/lib/tool.js +15 -19
  73. package/esm/lib/turn-context.d.ts +1 -1
  74. package/esm/models/assistantmessage.d.ts +6 -0
  75. package/esm/models/assistantmessage.js +3 -0
  76. package/esm/models/chatcompletionaudiooutput.d.ts +38 -0
  77. package/esm/models/chatcompletionaudiooutput.js +36 -0
  78. package/esm/models/chatgenerationparams.d.ts +75 -6
  79. package/esm/models/chatgenerationparams.js +42 -0
  80. package/esm/models/chatmessagecontentitem.d.ts +3 -2
  81. package/esm/models/chatmessagecontentitem.js +3 -0
  82. package/esm/models/chatmessagecontentitemcachecontrol.d.ts +5 -5
  83. package/esm/models/chatmessagecontentitemcachecontrol.js +5 -7
  84. package/esm/models/chatmessagecontentitemfile.d.ts +57 -0
  85. package/esm/models/chatmessagecontentitemfile.js +59 -0
  86. package/esm/models/chatmessagetokenlogprobs.d.ts +1 -1
  87. package/esm/models/chatmessagetokenlogprobs.js +2 -1
  88. package/esm/models/chatresponse.d.ts +1 -1
  89. package/esm/models/chatresponse.js +1 -1
  90. package/esm/models/chatstreamingmessagechunk.d.ts +2 -0
  91. package/esm/models/chatstreamingmessagechunk.js +2 -0
  92. package/esm/models/chatstreamingresponsechunk.d.ts +1 -1
  93. package/esm/models/chatstreamingresponsechunk.js +1 -1
  94. package/esm/models/compoundfilter.d.ts +36 -0
  95. package/esm/models/compoundfilter.js +32 -0
  96. package/esm/models/conflictresponseerrordata.d.ts +17 -0
  97. package/esm/models/conflictresponseerrordata.js +16 -0
  98. package/esm/models/contextcompressionengine.d.ts +15 -0
  99. package/esm/models/contextcompressionengine.js +14 -0
  100. package/esm/models/datetimeservertool.d.ts +30 -0
  101. package/esm/models/datetimeservertool.js +22 -0
  102. package/esm/models/defaultparameters.d.ts +3 -0
  103. package/esm/models/defaultparameters.js +6 -0
  104. package/esm/models/errors/conflictresponseerror.d.ts +33 -0
  105. package/esm/models/errors/conflictresponseerror.js +42 -0
  106. package/esm/models/errors/index.d.ts +1 -0
  107. package/esm/models/errors/index.js +1 -0
  108. package/esm/models/index.d.ts +23 -4
  109. package/esm/models/index.js +23 -4
  110. package/esm/models/openairesponsesinputunion.d.ts +32 -1
  111. package/esm/models/openairesponsesinputunion.js +53 -1
  112. package/esm/models/openresponsesapplypatchtool.d.ts +20 -0
  113. package/esm/models/openresponsesapplypatchtool.js +21 -0
  114. package/esm/models/openresponsescodeinterpretertool.d.ts +68 -0
  115. package/esm/models/openresponsescodeinterpretertool.js +85 -0
  116. package/esm/models/openresponsescomputertool.d.ts +39 -0
  117. package/esm/models/openresponsescomputertool.js +50 -0
  118. package/esm/models/openresponsescustomtool.d.ts +75 -0
  119. package/esm/models/openresponsescustomtool.js +95 -0
  120. package/esm/models/openresponseseasyinputmessage.d.ts +30 -4
  121. package/esm/models/openresponseseasyinputmessage.js +28 -2
  122. package/esm/models/openresponsesfilesearchtool.d.ts +111 -0
  123. package/esm/models/openresponsesfilesearchtool.js +180 -0
  124. package/esm/models/openresponsesfunctioncalloutput.d.ts +46 -7
  125. package/esm/models/openresponsesfunctioncalloutput.js +56 -4
  126. package/esm/models/openresponsesfunctionshelltool.d.ts +20 -0
  127. package/esm/models/openresponsesfunctionshelltool.js +21 -0
  128. package/esm/models/openresponsesimagegenerationtool.d.ts +125 -0
  129. package/esm/models/openresponsesimagegenerationtool.js +153 -0
  130. package/esm/models/openresponsesinputmessageitem.d.ts +2 -2
  131. package/esm/models/openresponsesinputmessageitem.js +2 -2
  132. package/esm/models/openresponsesinputunion.d.ts +207 -0
  133. package/esm/models/openresponsesinputunion.js +225 -0
  134. package/esm/models/openresponseslocalshelltool.d.ts +20 -0
  135. package/esm/models/openresponseslocalshelltool.js +21 -0
  136. package/esm/models/openresponsesmcptool.d.ts +128 -0
  137. package/esm/models/openresponsesmcptool.js +173 -0
  138. package/esm/models/openresponsesnonstreamingresponse.d.ts +11 -2
  139. package/esm/models/openresponsesnonstreamingresponse.js +27 -0
  140. package/esm/models/openresponsesrequest.d.ts +53 -11
  141. package/esm/models/openresponsesrequest.js +51 -2
  142. package/esm/models/openresponsesstreamevent.d.ts +52 -4
  143. package/esm/models/openresponsesstreamevent.js +54 -3
  144. package/esm/models/openresponseswebsearch20250826tool.d.ts +29 -0
  145. package/esm/models/openresponseswebsearch20250826tool.js +23 -0
  146. package/esm/models/openresponseswebsearchcallcompleted.d.ts +16 -0
  147. package/esm/models/openresponseswebsearchcallcompleted.js +24 -0
  148. package/esm/models/openresponseswebsearchcallinprogress.d.ts +16 -0
  149. package/esm/models/openresponseswebsearchcallinprogress.js +24 -0
  150. package/esm/models/openresponseswebsearchcallsearching.d.ts +16 -0
  151. package/esm/models/openresponseswebsearchcallsearching.js +24 -0
  152. package/esm/models/openresponseswebsearchpreview20250311tool.d.ts +44 -0
  153. package/esm/models/openresponseswebsearchpreview20250311tool.js +51 -0
  154. package/esm/models/openresponseswebsearchpreviewtool.d.ts +44 -0
  155. package/esm/models/openresponseswebsearchpreviewtool.js +47 -0
  156. package/esm/models/openresponseswebsearchtool.d.ts +29 -0
  157. package/esm/models/openresponseswebsearchtool.js +23 -0
  158. package/esm/models/operations/bulkassignkeystoguardrail.d.ts +16 -3
  159. package/esm/models/operations/bulkassignkeystoguardrail.js +2 -2
  160. package/esm/models/operations/bulkassignmemberstoguardrail.d.ts +16 -3
  161. package/esm/models/operations/bulkassignmemberstoguardrail.js +2 -2
  162. package/esm/models/operations/bulkunassignkeysfromguardrail.d.ts +16 -3
  163. package/esm/models/operations/bulkunassignkeysfromguardrail.js +2 -2
  164. package/esm/models/operations/bulkunassignmembersfromguardrail.d.ts +16 -3
  165. package/esm/models/operations/bulkunassignmembersfromguardrail.js +2 -2
  166. package/esm/models/operations/createauthkeyscode.d.ts +16 -3
  167. package/esm/models/operations/createauthkeyscode.js +2 -2
  168. package/esm/models/operations/createcoinbasecharge.d.ts +16 -3
  169. package/esm/models/operations/createcoinbasecharge.js +2 -2
  170. package/esm/models/operations/createembeddings.d.ts +16 -3
  171. package/esm/models/operations/createembeddings.js +2 -2
  172. package/esm/models/operations/createguardrail.d.ts +25 -3
  173. package/esm/models/operations/createguardrail.js +6 -2
  174. package/esm/models/operations/createkeys.d.ts +16 -3
  175. package/esm/models/operations/createkeys.js +2 -2
  176. package/esm/models/operations/createresponses.d.ts +16 -3
  177. package/esm/models/operations/createresponses.js +2 -2
  178. package/esm/models/operations/deleteguardrail.d.ts +16 -3
  179. package/esm/models/operations/deleteguardrail.js +2 -2
  180. package/esm/models/operations/deletekeys.d.ts +16 -3
  181. package/esm/models/operations/deletekeys.js +2 -2
  182. package/esm/models/operations/exchangeauthcodeforapikey.d.ts +16 -3
  183. package/esm/models/operations/exchangeauthcodeforapikey.js +2 -2
  184. package/esm/models/operations/getcredits.d.ts +16 -3
  185. package/esm/models/operations/getcredits.js +2 -2
  186. package/esm/models/operations/getcurrentkey.d.ts +16 -3
  187. package/esm/models/operations/getcurrentkey.js +2 -2
  188. package/esm/models/operations/getgeneration.d.ts +25 -3
  189. package/esm/models/operations/getgeneration.js +7 -2
  190. package/esm/models/operations/getguardrail.d.ts +20 -3
  191. package/esm/models/operations/getguardrail.js +4 -2
  192. package/esm/models/operations/getkey.d.ts +16 -3
  193. package/esm/models/operations/getkey.js +2 -2
  194. package/esm/models/operations/getmodels.d.ts +21 -3
  195. package/esm/models/operations/getmodels.js +4 -2
  196. package/esm/models/operations/getuseractivity.d.ts +16 -3
  197. package/esm/models/operations/getuseractivity.js +2 -2
  198. package/esm/models/operations/list.d.ts +16 -3
  199. package/esm/models/operations/list.js +2 -2
  200. package/esm/models/operations/listembeddingsmodels.d.ts +16 -3
  201. package/esm/models/operations/listembeddingsmodels.js +2 -2
  202. package/esm/models/operations/listendpoints.d.ts +16 -3
  203. package/esm/models/operations/listendpoints.js +2 -2
  204. package/esm/models/operations/listendpointszdr.d.ts +16 -3
  205. package/esm/models/operations/listendpointszdr.js +2 -2
  206. package/esm/models/operations/listguardrailkeyassignments.d.ts +16 -3
  207. package/esm/models/operations/listguardrailkeyassignments.js +2 -2
  208. package/esm/models/operations/listguardrailmemberassignments.d.ts +16 -3
  209. package/esm/models/operations/listguardrailmemberassignments.js +2 -2
  210. package/esm/models/operations/listguardrails.d.ts +20 -3
  211. package/esm/models/operations/listguardrails.js +4 -2
  212. package/esm/models/operations/listkeyassignments.d.ts +16 -3
  213. package/esm/models/operations/listkeyassignments.js +2 -2
  214. package/esm/models/operations/listmemberassignments.d.ts +16 -3
  215. package/esm/models/operations/listmemberassignments.js +2 -2
  216. package/esm/models/operations/listmodelscount.d.ts +21 -3
  217. package/esm/models/operations/listmodelscount.js +4 -2
  218. package/esm/models/operations/listmodelsuser.d.ts +16 -3
  219. package/esm/models/operations/listmodelsuser.js +2 -2
  220. package/esm/models/operations/listproviders.d.ts +16 -3
  221. package/esm/models/operations/listproviders.js +2 -2
  222. package/esm/models/operations/sendchatcompletionrequest.d.ts +16 -3
  223. package/esm/models/operations/sendchatcompletionrequest.js +2 -2
  224. package/esm/models/operations/updateguardrail.d.ts +25 -3
  225. package/esm/models/operations/updateguardrail.js +6 -2
  226. package/esm/models/operations/updatekeys.d.ts +16 -3
  227. package/esm/models/operations/updatekeys.js +2 -2
  228. package/esm/models/outputmessage.d.ts +23 -0
  229. package/esm/models/outputmessage.js +24 -0
  230. package/esm/models/outputmodality.d.ts +1 -0
  231. package/esm/models/outputmodality.js +1 -0
  232. package/esm/models/providername.d.ts +1 -0
  233. package/esm/models/providername.js +1 -0
  234. package/esm/models/providerpreferences.d.ts +4 -0
  235. package/esm/models/providerpreferences.js +4 -0
  236. package/esm/models/providersort.d.ts +1 -0
  237. package/esm/models/providersort.js +1 -0
  238. package/esm/models/providersortconfig.d.ts +1 -0
  239. package/esm/models/providersortconfig.js +1 -0
  240. package/esm/models/responseoutputtext.d.ts +8 -8
  241. package/esm/models/responseoutputtext.js +10 -9
  242. package/esm/models/responsesoutputitem.d.ts +2 -13
  243. package/esm/models/responsesoutputitem.js +8 -6
  244. package/esm/models/responsesoutputitemreasoning.d.ts +2 -31
  245. package/esm/models/responsesoutputitemreasoning.js +2 -44
  246. package/esm/models/responsesoutputmessage.d.ts +24 -32
  247. package/esm/models/responsesoutputmessage.js +26 -47
  248. package/esm/models/responsesservertooloutput.d.ts +42 -0
  249. package/esm/models/responsesservertooloutput.js +44 -0
  250. package/esm/models/responseswebsearchcalloutput.d.ts +90 -5
  251. package/esm/models/responseswebsearchcalloutput.js +113 -5
  252. package/esm/models/responseswebsearchservertool.d.ts +35 -0
  253. package/esm/models/responseswebsearchservertool.js +28 -0
  254. package/esm/models/tooldefinitionjson.d.ts +38 -20
  255. package/esm/models/tooldefinitionjson.js +22 -11
  256. package/esm/models/websearchengine.d.ts +2 -0
  257. package/esm/models/websearchengine.js +2 -0
  258. package/esm/models/websearchservertool.d.ts +116 -0
  259. package/esm/models/websearchservertool.js +77 -0
  260. package/esm/models/websearchshorthand.d.ts +215 -0
  261. package/esm/models/websearchshorthand.js +138 -0
  262. package/esm/sdk/sdk.d.ts +4 -1
  263. package/esm/sdk/sdk.js +0 -1
  264. package/esm/types/index.d.ts +0 -2
  265. package/esm/types/index.js +0 -1
  266. package/jsr.json +1 -1
  267. package/package.json +11 -6
  268. package/turbo.json +10 -0
  269. package/esm/models/openresponsesinput.d.ts +0 -28
  270. package/esm/models/openresponsesinput.js +0 -54
  271. package/esm/models/openresponseslogprobs.d.ts +0 -16
  272. package/esm/models/openresponseslogprobs.js +0 -22
  273. package/esm/models/openresponsestoplogprobs.d.ts +0 -14
  274. package/esm/models/openresponsestoplogprobs.js +0 -15
@@ -5,23 +5,131 @@
5
5
  import * as z from "zod/v4";
6
6
  import { safeParse } from "../lib/schemas.js";
7
7
  import { WebSearchStatus$inboundSchema, WebSearchStatus$outboundSchema, } from "./websearchstatus.js";
8
- export const ResponsesWebSearchCallOutputType = {
8
+ export const TypeWebSearchCall = {
9
9
  WebSearchCall: "web_search_call",
10
10
  };
11
+ export const TypeURL = {
12
+ Url: "url",
13
+ };
14
+ /** @internal */
15
+ export const TypeWebSearchCall$inboundSchema = z.enum(TypeWebSearchCall);
16
+ /** @internal */
17
+ export const TypeWebSearchCall$outboundSchema = TypeWebSearchCall$inboundSchema;
18
+ /** @internal */
19
+ export const ActionFindInPage$inboundSchema = z.object({
20
+ type: z.literal("find_in_page"),
21
+ pattern: z.string(),
22
+ url: z.string(),
23
+ });
24
+ /** @internal */
25
+ export const ActionFindInPage$outboundSchema = z.object({
26
+ type: z.literal("find_in_page"),
27
+ pattern: z.string(),
28
+ url: z.string(),
29
+ });
30
+ export function actionFindInPageToJSON(actionFindInPage) {
31
+ return JSON.stringify(ActionFindInPage$outboundSchema.parse(actionFindInPage));
32
+ }
33
+ export function actionFindInPageFromJSON(jsonString) {
34
+ return safeParse(jsonString, (x) => ActionFindInPage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ActionFindInPage' from JSON`);
35
+ }
36
+ /** @internal */
37
+ export const ActionOpenPage$inboundSchema = z.object({
38
+ type: z.literal("open_page"),
39
+ url: z.nullable(z.string()).optional(),
40
+ });
41
+ /** @internal */
42
+ export const ActionOpenPage$outboundSchema = z.object({
43
+ type: z.literal("open_page"),
44
+ url: z.nullable(z.string()).optional(),
45
+ });
46
+ export function actionOpenPageToJSON(actionOpenPage) {
47
+ return JSON.stringify(ActionOpenPage$outboundSchema.parse(actionOpenPage));
48
+ }
49
+ export function actionOpenPageFromJSON(jsonString) {
50
+ return safeParse(jsonString, (x) => ActionOpenPage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ActionOpenPage' from JSON`);
51
+ }
52
+ /** @internal */
53
+ export const TypeURL$inboundSchema = z.enum(TypeURL);
11
54
  /** @internal */
12
- export const ResponsesWebSearchCallOutputType$inboundSchema = z.enum(ResponsesWebSearchCallOutputType);
55
+ export const TypeURL$outboundSchema = TypeURL$inboundSchema;
13
56
  /** @internal */
14
- export const ResponsesWebSearchCallOutputType$outboundSchema = ResponsesWebSearchCallOutputType$inboundSchema;
57
+ export const Source$inboundSchema = z.object({
58
+ type: TypeURL$inboundSchema,
59
+ url: z.string(),
60
+ });
61
+ /** @internal */
62
+ export const Source$outboundSchema = z
63
+ .object({
64
+ type: TypeURL$outboundSchema,
65
+ url: z.string(),
66
+ });
67
+ export function sourceToJSON(source) {
68
+ return JSON.stringify(Source$outboundSchema.parse(source));
69
+ }
70
+ export function sourceFromJSON(jsonString) {
71
+ return safeParse(jsonString, (x) => Source$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Source' from JSON`);
72
+ }
73
+ /** @internal */
74
+ export const ActionSearch$inboundSchema = z
75
+ .object({
76
+ type: z.literal("search"),
77
+ query: z.string(),
78
+ queries: z.array(z.string()).optional(),
79
+ sources: z.array(z.lazy(() => Source$inboundSchema)).optional(),
80
+ });
81
+ /** @internal */
82
+ export const ActionSearch$outboundSchema = z.object({
83
+ type: z.literal("search"),
84
+ query: z.string(),
85
+ queries: z.array(z.string()).optional(),
86
+ sources: z.array(z.lazy(() => Source$outboundSchema)).optional(),
87
+ });
88
+ export function actionSearchToJSON(actionSearch) {
89
+ return JSON.stringify(ActionSearch$outboundSchema.parse(actionSearch));
90
+ }
91
+ export function actionSearchFromJSON(jsonString) {
92
+ return safeParse(jsonString, (x) => ActionSearch$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ActionSearch' from JSON`);
93
+ }
94
+ /** @internal */
95
+ export const Action$inboundSchema = z.union([
96
+ z.lazy(() => ActionSearch$inboundSchema),
97
+ z.lazy(() => ActionOpenPage$inboundSchema),
98
+ z.lazy(() => ActionFindInPage$inboundSchema),
99
+ ]);
100
+ /** @internal */
101
+ export const Action$outboundSchema = z
102
+ .union([
103
+ z.lazy(() => ActionSearch$outboundSchema),
104
+ z.lazy(() => ActionOpenPage$outboundSchema),
105
+ z.lazy(() => ActionFindInPage$outboundSchema),
106
+ ]);
107
+ export function actionToJSON(action) {
108
+ return JSON.stringify(Action$outboundSchema.parse(action));
109
+ }
110
+ export function actionFromJSON(jsonString) {
111
+ return safeParse(jsonString, (x) => Action$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Action' from JSON`);
112
+ }
15
113
  /** @internal */
16
114
  export const ResponsesWebSearchCallOutput$inboundSchema = z.object({
17
- type: ResponsesWebSearchCallOutputType$inboundSchema,
115
+ type: TypeWebSearchCall$inboundSchema,
18
116
  id: z.string(),
117
+ action: z.union([
118
+ z.lazy(() => ActionSearch$inboundSchema),
119
+ z.lazy(() => ActionOpenPage$inboundSchema),
120
+ z.lazy(() => ActionFindInPage$inboundSchema),
121
+ ]),
19
122
  status: WebSearchStatus$inboundSchema,
20
123
  });
21
124
  /** @internal */
22
125
  export const ResponsesWebSearchCallOutput$outboundSchema = z.object({
23
- type: ResponsesWebSearchCallOutputType$outboundSchema,
126
+ type: TypeWebSearchCall$outboundSchema,
24
127
  id: z.string(),
128
+ action: z.union([
129
+ z.lazy(() => ActionSearch$outboundSchema),
130
+ z.lazy(() => ActionOpenPage$outboundSchema),
131
+ z.lazy(() => ActionFindInPage$outboundSchema),
132
+ ]),
25
133
  status: WebSearchStatus$outboundSchema,
26
134
  });
27
135
  export function responsesWebSearchCallOutputToJSON(responsesWebSearchCallOutput) {
@@ -0,0 +1,35 @@
1
+ import * as z from "zod/v4";
2
+ export type ResponsesWebSearchServerToolParameters = {
3
+ /**
4
+ * Maximum number of search results to return per search call. Defaults to 5.
5
+ */
6
+ maxResults?: number | undefined;
7
+ /**
8
+ * Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results.
9
+ */
10
+ maxTotalResults?: number | undefined;
11
+ };
12
+ /**
13
+ * OpenRouter built-in server tool: searches the web for current information
14
+ */
15
+ export type ResponsesWebSearchServerTool = {
16
+ type: "openrouter:web_search";
17
+ parameters?: ResponsesWebSearchServerToolParameters | undefined;
18
+ };
19
+ /** @internal */
20
+ export type ResponsesWebSearchServerToolParameters$Outbound = {
21
+ max_results?: number | undefined;
22
+ max_total_results?: number | undefined;
23
+ };
24
+ /** @internal */
25
+ export declare const ResponsesWebSearchServerToolParameters$outboundSchema: z.ZodType<ResponsesWebSearchServerToolParameters$Outbound, ResponsesWebSearchServerToolParameters>;
26
+ export declare function responsesWebSearchServerToolParametersToJSON(responsesWebSearchServerToolParameters: ResponsesWebSearchServerToolParameters): string;
27
+ /** @internal */
28
+ export type ResponsesWebSearchServerTool$Outbound = {
29
+ type: "openrouter:web_search";
30
+ parameters?: ResponsesWebSearchServerToolParameters$Outbound | undefined;
31
+ };
32
+ /** @internal */
33
+ export declare const ResponsesWebSearchServerTool$outboundSchema: z.ZodType<ResponsesWebSearchServerTool$Outbound, ResponsesWebSearchServerTool>;
34
+ export declare function responsesWebSearchServerToolToJSON(responsesWebSearchServerTool: ResponsesWebSearchServerTool): string;
35
+ //# sourceMappingURL=responseswebsearchservertool.d.ts.map
@@ -0,0 +1,28 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 8ef0e49c5731
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ /** @internal */
8
+ export const ResponsesWebSearchServerToolParameters$outboundSchema = z.object({
9
+ maxResults: z.number().optional(),
10
+ maxTotalResults: z.number().optional(),
11
+ }).transform((v) => {
12
+ return remap$(v, {
13
+ maxResults: "max_results",
14
+ maxTotalResults: "max_total_results",
15
+ });
16
+ });
17
+ export function responsesWebSearchServerToolParametersToJSON(responsesWebSearchServerToolParameters) {
18
+ return JSON.stringify(ResponsesWebSearchServerToolParameters$outboundSchema.parse(responsesWebSearchServerToolParameters));
19
+ }
20
+ /** @internal */
21
+ export const ResponsesWebSearchServerTool$outboundSchema = z.object({
22
+ type: z.literal("openrouter:web_search"),
23
+ parameters: z.lazy(() => ResponsesWebSearchServerToolParameters$outboundSchema).optional(),
24
+ });
25
+ export function responsesWebSearchServerToolToJSON(responsesWebSearchServerTool) {
26
+ return JSON.stringify(ResponsesWebSearchServerTool$outboundSchema.parse(responsesWebSearchServerTool));
27
+ }
28
+ //# sourceMappingURL=responseswebsearchservertool.js.map
@@ -1,14 +1,12 @@
1
1
  import * as z from "zod/v4";
2
- import { ClosedEnum } from "../types/enums.js";
3
2
  import { ChatMessageContentItemCacheControl, ChatMessageContentItemCacheControl$Outbound } from "./chatmessagecontentitemcachecontrol.js";
4
- export declare const ToolDefinitionJsonType: {
5
- readonly Function: "function";
6
- };
7
- export type ToolDefinitionJsonType = ClosedEnum<typeof ToolDefinitionJsonType>;
3
+ import { DatetimeServerTool, DatetimeServerTool$Outbound } from "./datetimeservertool.js";
4
+ import { WebSearchServerTool, WebSearchServerTool$Outbound } from "./websearchservertool.js";
5
+ import { WebSearchShorthand, WebSearchShorthand$Outbound } from "./websearchshorthand.js";
8
6
  /**
9
7
  * Function definition for tool calling
10
8
  */
11
- export type ToolDefinitionJsonFunction = {
9
+ export type ToolDefinitionJsonFunctionFunction = {
12
10
  /**
13
11
  * Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)
14
12
  */
@@ -28,24 +26,31 @@ export type ToolDefinitionJsonFunction = {
28
26
  */
29
27
  strict?: boolean | null | undefined;
30
28
  };
31
- /**
32
- * Tool definition for function calling
33
- */
34
- export type ToolDefinitionJson = {
35
- type: ToolDefinitionJsonType;
29
+ export type ToolDefinitionJsonFunction = {
30
+ type: "function";
36
31
  /**
37
32
  * Function definition for tool calling
38
33
  */
39
- function: ToolDefinitionJsonFunction;
34
+ function: ToolDefinitionJsonFunctionFunction;
40
35
  /**
41
36
  * Cache control for the content part
42
37
  */
43
38
  cacheControl?: ChatMessageContentItemCacheControl | undefined;
44
39
  };
40
+ /**
41
+ * Tool definition for function calling (regular function or OpenRouter built-in server tool)
42
+ */
43
+ export type ToolDefinitionJson = ToolDefinitionJsonFunction | DatetimeServerTool | WebSearchServerTool | (WebSearchShorthand & {
44
+ type: "web_search";
45
+ }) | (WebSearchShorthand & {
46
+ type: "web_search_preview";
47
+ }) | (WebSearchShorthand & {
48
+ type: "web_search_preview_2025_03_11";
49
+ }) | (WebSearchShorthand & {
50
+ type: "web_search_2025_08_26";
51
+ });
45
52
  /** @internal */
46
- export declare const ToolDefinitionJsonType$outboundSchema: z.ZodEnum<typeof ToolDefinitionJsonType>;
47
- /** @internal */
48
- export type ToolDefinitionJsonFunction$Outbound = {
53
+ export type ToolDefinitionJsonFunctionFunction$Outbound = {
49
54
  name: string;
50
55
  description?: string | undefined;
51
56
  parameters?: {
@@ -54,15 +59,28 @@ export type ToolDefinitionJsonFunction$Outbound = {
54
59
  strict?: boolean | null | undefined;
55
60
  };
56
61
  /** @internal */
57
- export declare const ToolDefinitionJsonFunction$outboundSchema: z.ZodType<ToolDefinitionJsonFunction$Outbound, ToolDefinitionJsonFunction>;
58
- export declare function toolDefinitionJsonFunctionToJSON(toolDefinitionJsonFunction: ToolDefinitionJsonFunction): string;
62
+ export declare const ToolDefinitionJsonFunctionFunction$outboundSchema: z.ZodType<ToolDefinitionJsonFunctionFunction$Outbound, ToolDefinitionJsonFunctionFunction>;
63
+ export declare function toolDefinitionJsonFunctionFunctionToJSON(toolDefinitionJsonFunctionFunction: ToolDefinitionJsonFunctionFunction): string;
59
64
  /** @internal */
60
- export type ToolDefinitionJson$Outbound = {
61
- type: string;
62
- function: ToolDefinitionJsonFunction$Outbound;
65
+ export type ToolDefinitionJsonFunction$Outbound = {
66
+ type: "function";
67
+ function: ToolDefinitionJsonFunctionFunction$Outbound;
63
68
  cache_control?: ChatMessageContentItemCacheControl$Outbound | undefined;
64
69
  };
65
70
  /** @internal */
71
+ export declare const ToolDefinitionJsonFunction$outboundSchema: z.ZodType<ToolDefinitionJsonFunction$Outbound, ToolDefinitionJsonFunction>;
72
+ export declare function toolDefinitionJsonFunctionToJSON(toolDefinitionJsonFunction: ToolDefinitionJsonFunction): string;
73
+ /** @internal */
74
+ export type ToolDefinitionJson$Outbound = ToolDefinitionJsonFunction$Outbound | DatetimeServerTool$Outbound | WebSearchServerTool$Outbound | (WebSearchShorthand$Outbound & {
75
+ type: "web_search";
76
+ }) | (WebSearchShorthand$Outbound & {
77
+ type: "web_search_preview";
78
+ }) | (WebSearchShorthand$Outbound & {
79
+ type: "web_search_preview_2025_03_11";
80
+ }) | (WebSearchShorthand$Outbound & {
81
+ type: "web_search_2025_08_26";
82
+ });
83
+ /** @internal */
66
84
  export declare const ToolDefinitionJson$outboundSchema: z.ZodType<ToolDefinitionJson$Outbound, ToolDefinitionJson>;
67
85
  export declare function toolDefinitionJsonToJSON(toolDefinitionJson: ToolDefinitionJson): string;
68
86
  //# sourceMappingURL=tooldefinitionjson.d.ts.map
@@ -5,31 +5,42 @@
5
5
  import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../lib/primitives.js";
7
7
  import { ChatMessageContentItemCacheControl$outboundSchema, } from "./chatmessagecontentitemcachecontrol.js";
8
- export const ToolDefinitionJsonType = {
9
- Function: "function",
10
- };
8
+ import { DatetimeServerTool$outboundSchema, } from "./datetimeservertool.js";
9
+ import { WebSearchServerTool$outboundSchema, } from "./websearchservertool.js";
10
+ import { WebSearchShorthand$outboundSchema, } from "./websearchshorthand.js";
11
11
  /** @internal */
12
- export const ToolDefinitionJsonType$outboundSchema = z.enum(ToolDefinitionJsonType);
13
- /** @internal */
14
- export const ToolDefinitionJsonFunction$outboundSchema = z.object({
12
+ export const ToolDefinitionJsonFunctionFunction$outboundSchema = z.object({
15
13
  name: z.string(),
16
14
  description: z.string().optional(),
17
15
  parameters: z.record(z.string(), z.nullable(z.any())).optional(),
18
16
  strict: z.nullable(z.boolean()).optional(),
19
17
  });
20
- export function toolDefinitionJsonFunctionToJSON(toolDefinitionJsonFunction) {
21
- return JSON.stringify(ToolDefinitionJsonFunction$outboundSchema.parse(toolDefinitionJsonFunction));
18
+ export function toolDefinitionJsonFunctionFunctionToJSON(toolDefinitionJsonFunctionFunction) {
19
+ return JSON.stringify(ToolDefinitionJsonFunctionFunction$outboundSchema.parse(toolDefinitionJsonFunctionFunction));
22
20
  }
23
21
  /** @internal */
24
- export const ToolDefinitionJson$outboundSchema = z.object({
25
- type: ToolDefinitionJsonType$outboundSchema,
26
- function: z.lazy(() => ToolDefinitionJsonFunction$outboundSchema),
22
+ export const ToolDefinitionJsonFunction$outboundSchema = z.object({
23
+ type: z.literal("function"),
24
+ function: z.lazy(() => ToolDefinitionJsonFunctionFunction$outboundSchema),
27
25
  cacheControl: ChatMessageContentItemCacheControl$outboundSchema.optional(),
28
26
  }).transform((v) => {
29
27
  return remap$(v, {
30
28
  cacheControl: "cache_control",
31
29
  });
32
30
  });
31
+ export function toolDefinitionJsonFunctionToJSON(toolDefinitionJsonFunction) {
32
+ return JSON.stringify(ToolDefinitionJsonFunction$outboundSchema.parse(toolDefinitionJsonFunction));
33
+ }
34
+ /** @internal */
35
+ export const ToolDefinitionJson$outboundSchema = z.union([
36
+ z.lazy(() => ToolDefinitionJsonFunction$outboundSchema),
37
+ DatetimeServerTool$outboundSchema,
38
+ WebSearchServerTool$outboundSchema,
39
+ WebSearchShorthand$outboundSchema.and(z.object({ type: z.literal("web_search") })),
40
+ WebSearchShorthand$outboundSchema.and(z.object({ type: z.literal("web_search_preview") })),
41
+ WebSearchShorthand$outboundSchema.and(z.object({ type: z.literal("web_search_preview_2025_03_11") })),
42
+ WebSearchShorthand$outboundSchema.and(z.object({ type: z.literal("web_search_2025_08_26") })),
43
+ ]);
33
44
  export function toolDefinitionJsonToJSON(toolDefinitionJson) {
34
45
  return JSON.stringify(ToolDefinitionJson$outboundSchema.parse(toolDefinitionJson));
35
46
  }
@@ -6,6 +6,8 @@ import { OpenEnum } from "../types/enums.js";
6
6
  export declare const WebSearchEngine: {
7
7
  readonly Native: "native";
8
8
  readonly Exa: "exa";
9
+ readonly Firecrawl: "firecrawl";
10
+ readonly Parallel: "parallel";
9
11
  };
10
12
  /**
11
13
  * The search engine to use for web search.
@@ -9,6 +9,8 @@ import * as openEnums from "../types/enums.js";
9
9
  export const WebSearchEngine = {
10
10
  Native: "native",
11
11
  Exa: "exa",
12
+ Firecrawl: "firecrawl",
13
+ Parallel: "parallel",
12
14
  };
13
15
  /** @internal */
14
16
  export const WebSearchEngine$outboundSchema = openEnums.outboundSchema(WebSearchEngine);
@@ -0,0 +1,116 @@
1
+ import * as z from "zod/v4";
2
+ import { ClosedEnum, OpenEnum } from "../types/enums.js";
3
+ /**
4
+ * Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API.
5
+ */
6
+ export declare const WebSearchServerToolEngine: {
7
+ readonly Auto: "auto";
8
+ readonly Native: "native";
9
+ readonly Exa: "exa";
10
+ };
11
+ /**
12
+ * Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API.
13
+ */
14
+ export type WebSearchServerToolEngine = OpenEnum<typeof WebSearchServerToolEngine>;
15
+ /**
16
+ * How much context to retrieve per result. Defaults to medium (15000 chars).
17
+ */
18
+ export declare const WebSearchServerToolSearchContextSize: {
19
+ readonly Low: "low";
20
+ readonly Medium: "medium";
21
+ readonly High: "high";
22
+ };
23
+ /**
24
+ * How much context to retrieve per result. Defaults to medium (15000 chars).
25
+ */
26
+ export type WebSearchServerToolSearchContextSize = OpenEnum<typeof WebSearchServerToolSearchContextSize>;
27
+ export declare const WebSearchServerToolParametersType: {
28
+ readonly Approximate: "approximate";
29
+ };
30
+ export type WebSearchServerToolParametersType = ClosedEnum<typeof WebSearchServerToolParametersType>;
31
+ /**
32
+ * Approximate user location for location-biased results.
33
+ */
34
+ export type WebSearchServerToolUserLocation = {
35
+ type?: WebSearchServerToolParametersType | undefined;
36
+ city?: string | undefined;
37
+ region?: string | undefined;
38
+ country?: string | undefined;
39
+ timezone?: string | undefined;
40
+ };
41
+ export type WebSearchServerToolParameters = {
42
+ /**
43
+ * Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API.
44
+ */
45
+ engine?: WebSearchServerToolEngine | undefined;
46
+ /**
47
+ * Maximum number of search results to return per search call. Defaults to 5.
48
+ */
49
+ maxResults?: number | undefined;
50
+ /**
51
+ * Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops.
52
+ */
53
+ maxTotalResults?: number | undefined;
54
+ /**
55
+ * How much context to retrieve per result. Defaults to medium (15000 chars).
56
+ */
57
+ searchContextSize?: WebSearchServerToolSearchContextSize | undefined;
58
+ /**
59
+ * Approximate user location for location-biased results.
60
+ */
61
+ userLocation?: WebSearchServerToolUserLocation | undefined;
62
+ /**
63
+ * Limit search results to these domains.
64
+ */
65
+ allowedDomains?: Array<string> | undefined;
66
+ /**
67
+ * Exclude search results from these domains.
68
+ */
69
+ excludedDomains?: Array<string> | undefined;
70
+ };
71
+ /**
72
+ * OpenRouter built-in server tool: searches the web for current information
73
+ */
74
+ export type WebSearchServerTool = {
75
+ type: "openrouter:web_search";
76
+ parameters?: WebSearchServerToolParameters | undefined;
77
+ };
78
+ /** @internal */
79
+ export declare const WebSearchServerToolEngine$outboundSchema: z.ZodType<string, WebSearchServerToolEngine>;
80
+ /** @internal */
81
+ export declare const WebSearchServerToolSearchContextSize$outboundSchema: z.ZodType<string, WebSearchServerToolSearchContextSize>;
82
+ /** @internal */
83
+ export declare const WebSearchServerToolParametersType$outboundSchema: z.ZodEnum<typeof WebSearchServerToolParametersType>;
84
+ /** @internal */
85
+ export type WebSearchServerToolUserLocation$Outbound = {
86
+ type?: string | undefined;
87
+ city?: string | undefined;
88
+ region?: string | undefined;
89
+ country?: string | undefined;
90
+ timezone?: string | undefined;
91
+ };
92
+ /** @internal */
93
+ export declare const WebSearchServerToolUserLocation$outboundSchema: z.ZodType<WebSearchServerToolUserLocation$Outbound, WebSearchServerToolUserLocation>;
94
+ export declare function webSearchServerToolUserLocationToJSON(webSearchServerToolUserLocation: WebSearchServerToolUserLocation): string;
95
+ /** @internal */
96
+ export type WebSearchServerToolParameters$Outbound = {
97
+ engine?: string | undefined;
98
+ max_results?: number | undefined;
99
+ max_total_results?: number | undefined;
100
+ search_context_size?: string | undefined;
101
+ user_location?: WebSearchServerToolUserLocation$Outbound | undefined;
102
+ allowed_domains?: Array<string> | undefined;
103
+ excluded_domains?: Array<string> | undefined;
104
+ };
105
+ /** @internal */
106
+ export declare const WebSearchServerToolParameters$outboundSchema: z.ZodType<WebSearchServerToolParameters$Outbound, WebSearchServerToolParameters>;
107
+ export declare function webSearchServerToolParametersToJSON(webSearchServerToolParameters: WebSearchServerToolParameters): string;
108
+ /** @internal */
109
+ export type WebSearchServerTool$Outbound = {
110
+ type: "openrouter:web_search";
111
+ parameters?: WebSearchServerToolParameters$Outbound | undefined;
112
+ };
113
+ /** @internal */
114
+ export declare const WebSearchServerTool$outboundSchema: z.ZodType<WebSearchServerTool$Outbound, WebSearchServerTool>;
115
+ export declare function webSearchServerToolToJSON(webSearchServerTool: WebSearchServerTool): string;
116
+ //# sourceMappingURL=websearchservertool.d.ts.map
@@ -0,0 +1,77 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 478da2f8e455
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
+ /**
9
+ * Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API.
10
+ */
11
+ export const WebSearchServerToolEngine = {
12
+ Auto: "auto",
13
+ Native: "native",
14
+ Exa: "exa",
15
+ };
16
+ /**
17
+ * How much context to retrieve per result. Defaults to medium (15000 chars).
18
+ */
19
+ export const WebSearchServerToolSearchContextSize = {
20
+ Low: "low",
21
+ Medium: "medium",
22
+ High: "high",
23
+ };
24
+ export const WebSearchServerToolParametersType = {
25
+ Approximate: "approximate",
26
+ };
27
+ /** @internal */
28
+ export const WebSearchServerToolEngine$outboundSchema = openEnums.outboundSchema(WebSearchServerToolEngine);
29
+ /** @internal */
30
+ export const WebSearchServerToolSearchContextSize$outboundSchema = openEnums.outboundSchema(WebSearchServerToolSearchContextSize);
31
+ /** @internal */
32
+ export const WebSearchServerToolParametersType$outboundSchema = z.enum(WebSearchServerToolParametersType);
33
+ /** @internal */
34
+ export const WebSearchServerToolUserLocation$outboundSchema = z.object({
35
+ type: WebSearchServerToolParametersType$outboundSchema.optional(),
36
+ city: z.string().optional(),
37
+ region: z.string().optional(),
38
+ country: z.string().optional(),
39
+ timezone: z.string().optional(),
40
+ });
41
+ export function webSearchServerToolUserLocationToJSON(webSearchServerToolUserLocation) {
42
+ return JSON.stringify(WebSearchServerToolUserLocation$outboundSchema.parse(webSearchServerToolUserLocation));
43
+ }
44
+ /** @internal */
45
+ export const WebSearchServerToolParameters$outboundSchema = z.object({
46
+ engine: WebSearchServerToolEngine$outboundSchema.optional(),
47
+ maxResults: z.number().optional(),
48
+ maxTotalResults: z.number().optional(),
49
+ searchContextSize: WebSearchServerToolSearchContextSize$outboundSchema
50
+ .optional(),
51
+ userLocation: z.lazy(() => WebSearchServerToolUserLocation$outboundSchema)
52
+ .optional(),
53
+ allowedDomains: z.array(z.string()).optional(),
54
+ excludedDomains: z.array(z.string()).optional(),
55
+ }).transform((v) => {
56
+ return remap$(v, {
57
+ maxResults: "max_results",
58
+ maxTotalResults: "max_total_results",
59
+ searchContextSize: "search_context_size",
60
+ userLocation: "user_location",
61
+ allowedDomains: "allowed_domains",
62
+ excludedDomains: "excluded_domains",
63
+ });
64
+ });
65
+ export function webSearchServerToolParametersToJSON(webSearchServerToolParameters) {
66
+ return JSON.stringify(WebSearchServerToolParameters$outboundSchema.parse(webSearchServerToolParameters));
67
+ }
68
+ /** @internal */
69
+ export const WebSearchServerTool$outboundSchema = z.object({
70
+ type: z.literal("openrouter:web_search"),
71
+ parameters: z.lazy(() => WebSearchServerToolParameters$outboundSchema)
72
+ .optional(),
73
+ });
74
+ export function webSearchServerToolToJSON(webSearchServerTool) {
75
+ return JSON.stringify(WebSearchServerTool$outboundSchema.parse(webSearchServerTool));
76
+ }
77
+ //# sourceMappingURL=websearchservertool.js.map