@openrouter/sdk 0.8.0 → 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.
- package/FUNCTIONS.md +2 -1
- package/_speakeasy/.github/action-inputs-config.json +4 -0
- package/esm/funcs/analyticsGetUserActivity.js +2 -1
- package/esm/funcs/apiKeysCreate.js +2 -1
- package/esm/funcs/apiKeysDelete.js +2 -1
- package/esm/funcs/apiKeysGet.js +2 -1
- package/esm/funcs/apiKeysGetCurrentKeyMetadata.js +2 -1
- package/esm/funcs/apiKeysList.js +2 -1
- package/esm/funcs/apiKeysUpdate.js +2 -1
- package/esm/funcs/betaResponsesSend.js +2 -1
- package/esm/funcs/call-model.d.ts +19 -70
- package/esm/funcs/call-model.js +29 -71
- package/esm/funcs/chatSend.d.ts +3 -3
- package/esm/funcs/chatSend.js +20 -3
- package/esm/funcs/creditsCreateCoinbaseCharge.js +2 -1
- package/esm/funcs/creditsGetCredits.js +2 -1
- package/esm/funcs/embeddingsGenerate.js +2 -1
- package/esm/funcs/embeddingsListModels.js +2 -1
- package/esm/funcs/endpointsList.js +2 -1
- package/esm/funcs/endpointsListZdrEndpoints.js +2 -1
- package/esm/funcs/generationsGetGeneration.js +2 -1
- package/esm/funcs/guardrailsBulkAssignKeys.js +2 -1
- package/esm/funcs/guardrailsBulkAssignMembers.js +2 -1
- package/esm/funcs/guardrailsBulkUnassignKeys.js +2 -1
- package/esm/funcs/guardrailsBulkUnassignMembers.js +2 -1
- package/esm/funcs/guardrailsCreate.js +2 -1
- package/esm/funcs/guardrailsDelete.js +2 -1
- package/esm/funcs/guardrailsGet.js +2 -1
- package/esm/funcs/guardrailsList.js +2 -1
- package/esm/funcs/guardrailsListGuardrailKeyAssignments.js +2 -1
- package/esm/funcs/guardrailsListGuardrailMemberAssignments.js +2 -1
- package/esm/funcs/guardrailsListKeyAssignments.js +2 -1
- package/esm/funcs/guardrailsListMemberAssignments.js +2 -1
- package/esm/funcs/guardrailsUpdate.js +2 -1
- package/esm/funcs/modelsCount.d.ts +1 -1
- package/esm/funcs/modelsCount.js +9 -4
- package/esm/funcs/modelsList.js +3 -1
- package/esm/funcs/modelsListForUser.js +2 -1
- package/esm/funcs/oAuthCreateAuthCode.d.ts +1 -1
- package/esm/funcs/oAuthCreateAuthCode.js +4 -3
- package/esm/funcs/oAuthExchangeAuthCodeForAPIKey.js +2 -1
- package/esm/funcs/providersList.js +2 -1
- package/esm/index.d.ts +22 -23
- package/esm/index.js +20 -17
- package/esm/lib/anthropic-compat.d.ts +2 -1
- package/esm/lib/anthropic-compat.js +1 -2
- package/esm/lib/async-params.d.ts +19 -5
- package/esm/lib/async-params.js +5 -1
- package/esm/lib/chat-compat.d.ts +1 -1
- package/esm/lib/chat-compat.js +1 -2
- package/esm/lib/claude-type-guards.d.ts +2 -2
- package/esm/lib/config.d.ts +8 -10
- package/esm/lib/config.js +2 -2
- package/esm/lib/conversation-state.d.ts +1 -1
- package/esm/lib/conversation-state.js +35 -32
- package/esm/lib/env.d.ts +6 -2
- package/esm/lib/env.js +7 -3
- package/esm/lib/model-result.d.ts +73 -17
- package/esm/lib/model-result.js +329 -125
- package/esm/lib/sdks.d.ts +1 -1
- package/esm/lib/sdks.js +8 -28
- package/esm/lib/stream-transformers.d.ts +5 -4
- package/esm/lib/stream-transformers.js +24 -29
- package/esm/lib/stream-type-guards.js +8 -32
- package/esm/lib/tool-context.d.ts +68 -0
- package/esm/lib/tool-context.js +175 -0
- package/esm/lib/tool-executor.d.ts +9 -5
- package/esm/lib/tool-executor.js +26 -16
- package/esm/lib/tool-orchestrator.d.ts +2 -2
- package/esm/lib/tool-types.d.ts +101 -14
- package/esm/lib/tool-types.js +17 -0
- package/esm/lib/tool.d.ts +49 -60
- package/esm/lib/tool.js +15 -19
- package/esm/lib/turn-context.d.ts +1 -1
- package/esm/models/assistantmessage.d.ts +53 -36
- package/esm/models/assistantmessage.js +38 -47
- package/esm/models/assistantmessageimages.d.ts +33 -0
- package/esm/models/assistantmessageimages.js +44 -0
- package/esm/models/chatcompletionaudiooutput.d.ts +38 -0
- package/esm/models/chatcompletionaudiooutput.js +36 -0
- package/esm/models/chatgenerationparams.d.ts +527 -131
- package/esm/models/chatgenerationparams.js +280 -97
- package/esm/models/chatgenerationtokenusage.d.ts +48 -0
- package/esm/models/chatmessagecontentitem.d.ts +16 -10
- package/esm/models/chatmessagecontentitem.js +28 -4
- package/esm/models/chatmessagecontentitemaudio.d.ts +20 -2
- package/esm/models/chatmessagecontentitemaudio.js +9 -2
- package/esm/models/chatmessagecontentitemcachecontrol.d.ts +19 -8
- package/esm/models/chatmessagecontentitemcachecontrol.js +14 -9
- package/esm/models/chatmessagecontentitemfile.d.ts +57 -0
- package/esm/models/chatmessagecontentitemfile.js +59 -0
- package/esm/models/chatmessagecontentitemimage.d.ts +26 -3
- package/esm/models/chatmessagecontentitemimage.js +12 -2
- package/esm/models/chatmessagecontentitemtext.d.ts +17 -2
- package/esm/models/chatmessagecontentitemtext.js +9 -2
- package/esm/models/chatmessagecontentitemvideo.d.ts +12 -55
- package/esm/models/chatmessagecontentitemvideo.js +5 -72
- package/esm/models/chatmessagecontentitemvideolegacy.d.ts +28 -0
- package/esm/models/chatmessagecontentitemvideolegacy.js +33 -0
- package/esm/models/chatmessagetokenlogprob.d.ts +15 -0
- package/esm/models/chatmessagetokenlogprobs.d.ts +10 -1
- package/esm/models/chatmessagetokenlogprobs.js +2 -1
- package/esm/models/chatmessagetoolcall.d.ts +23 -2
- package/esm/models/chatmessagetoolcall.js +9 -2
- package/esm/models/chatresponse.d.ts +30 -2
- package/esm/models/chatresponse.js +7 -2
- package/esm/models/chatresponsechoice.d.ts +13 -2
- package/esm/models/chatresponsechoice.js +1 -2
- package/esm/models/chatstreamingchoice.d.ts +13 -2
- package/esm/models/chatstreamingchoice.js +1 -2
- package/esm/models/chatstreamingmessagechunk.d.ts +31 -2
- package/esm/models/chatstreamingmessagechunk.js +7 -2
- package/esm/models/chatstreamingmessagetoolcall.d.ts +38 -1
- package/esm/models/chatstreamingmessagetoolcall.js +9 -1
- package/esm/models/chatstreamingresponsechunk.d.ts +46 -12
- package/esm/models/chatstreamingresponsechunk.js +12 -26
- package/esm/models/chatstreamoptions.d.ts +8 -0
- package/esm/models/compoundfilter.d.ts +36 -0
- package/esm/models/compoundfilter.js +32 -0
- package/esm/models/conflictresponseerrordata.d.ts +17 -0
- package/esm/models/conflictresponseerrordata.js +16 -0
- package/esm/models/contextcompressionengine.d.ts +15 -0
- package/esm/models/contextcompressionengine.js +14 -0
- package/esm/models/datetimeservertool.d.ts +30 -0
- package/esm/models/datetimeservertool.js +22 -0
- package/esm/models/debugoptions.d.ts +18 -0
- package/esm/models/debugoptions.js +18 -0
- package/esm/models/defaultparameters.d.ts +3 -0
- package/esm/models/defaultparameters.js +6 -0
- package/esm/models/developermessage.d.ts +12 -0
- package/esm/models/errors/conflictresponseerror.d.ts +33 -0
- package/esm/models/errors/{chaterror.js → conflictresponseerror.js} +17 -7
- package/esm/models/errors/index.d.ts +1 -1
- package/esm/models/errors/index.js +1 -1
- package/esm/models/index.d.ts +35 -12
- package/esm/models/index.js +35 -12
- package/esm/models/jsonschemaconfig.d.ts +17 -2
- package/esm/models/jsonschemaconfig.js +1 -1
- package/esm/models/message.d.ts +9 -2
- package/esm/models/message.js +1 -1
- package/esm/models/modelscountresponse.d.ts +4 -4
- package/esm/models/modelscountresponse.js +4 -4
- package/esm/models/namedtoolchoice.d.ts +15 -2
- package/esm/models/namedtoolchoice.js +6 -1
- package/esm/models/openairesponsesinputunion.d.ts +32 -1
- package/esm/models/openairesponsesinputunion.js +53 -1
- package/esm/models/openairesponsesreasoningconfig.d.ts +1 -1
- package/esm/models/openairesponsesreasoningconfig.js +1 -1
- package/esm/models/openresponsesapplypatchtool.d.ts +20 -0
- package/esm/models/openresponsesapplypatchtool.js +21 -0
- package/esm/models/openresponsescodeinterpretertool.d.ts +68 -0
- package/esm/models/openresponsescodeinterpretertool.js +85 -0
- package/esm/models/openresponsescomputertool.d.ts +39 -0
- package/esm/models/openresponsescomputertool.js +50 -0
- package/esm/models/openresponsescustomtool.d.ts +75 -0
- package/esm/models/openresponsescustomtool.js +95 -0
- package/esm/models/openresponseseasyinputmessage.d.ts +30 -4
- package/esm/models/openresponseseasyinputmessage.js +28 -2
- package/esm/models/openresponsesfilesearchtool.d.ts +111 -0
- package/esm/models/openresponsesfilesearchtool.js +180 -0
- package/esm/models/openresponsesfunctioncalloutput.d.ts +46 -7
- package/esm/models/openresponsesfunctioncalloutput.js +56 -4
- package/esm/models/openresponsesfunctionshelltool.d.ts +20 -0
- package/esm/models/openresponsesfunctionshelltool.js +21 -0
- package/esm/models/openresponsesimagegenerationtool.d.ts +125 -0
- package/esm/models/openresponsesimagegenerationtool.js +153 -0
- package/esm/models/openresponsesinputmessageitem.d.ts +2 -2
- package/esm/models/openresponsesinputmessageitem.js +2 -2
- package/esm/models/openresponsesinputunion.d.ts +207 -0
- package/esm/models/openresponsesinputunion.js +225 -0
- package/esm/models/openresponseslocalshelltool.d.ts +20 -0
- package/esm/models/openresponseslocalshelltool.js +21 -0
- package/esm/models/openresponsesmcptool.d.ts +128 -0
- package/esm/models/openresponsesmcptool.js +173 -0
- package/esm/models/openresponsesnonstreamingresponse.d.ts +15 -6
- package/esm/models/openresponsesnonstreamingresponse.js +30 -3
- package/esm/models/openresponsesreasoning.d.ts +2 -2
- package/esm/models/openresponsesreasoning.js +1 -1
- package/esm/models/openresponsesreasoningconfig.d.ts +2 -2
- package/esm/models/openresponsesreasoningconfig.js +1 -1
- package/esm/models/openresponsesrequest.d.ts +111 -39
- package/esm/models/openresponsesrequest.js +112 -38
- package/esm/models/openresponsesstreamevent.d.ts +52 -4
- package/esm/models/openresponsesstreamevent.js +54 -3
- package/esm/models/openresponseswebsearch20250826tool.d.ts +29 -0
- package/esm/models/openresponseswebsearch20250826tool.js +23 -0
- package/esm/models/openresponseswebsearchcallcompleted.d.ts +16 -0
- package/esm/models/openresponseswebsearchcallcompleted.js +24 -0
- package/esm/models/openresponseswebsearchcallinprogress.d.ts +16 -0
- package/esm/models/openresponseswebsearchcallinprogress.js +24 -0
- package/esm/models/openresponseswebsearchcallsearching.d.ts +16 -0
- package/esm/models/openresponseswebsearchcallsearching.js +24 -0
- package/esm/models/openresponseswebsearchpreview20250311tool.d.ts +44 -0
- package/esm/models/openresponseswebsearchpreview20250311tool.js +51 -0
- package/esm/models/openresponseswebsearchpreviewtool.d.ts +44 -0
- package/esm/models/openresponseswebsearchpreviewtool.js +47 -0
- package/esm/models/openresponseswebsearchtool.d.ts +29 -0
- package/esm/models/openresponseswebsearchtool.js +23 -0
- package/esm/models/operations/bulkassignkeystoguardrail.d.ts +16 -3
- package/esm/models/operations/bulkassignkeystoguardrail.js +2 -2
- package/esm/models/operations/bulkassignmemberstoguardrail.d.ts +16 -3
- package/esm/models/operations/bulkassignmemberstoguardrail.js +2 -2
- package/esm/models/operations/bulkunassignkeysfromguardrail.d.ts +16 -3
- package/esm/models/operations/bulkunassignkeysfromguardrail.js +2 -2
- package/esm/models/operations/bulkunassignmembersfromguardrail.d.ts +16 -3
- package/esm/models/operations/bulkunassignmembersfromguardrail.js +2 -2
- package/esm/models/operations/createauthkeyscode.d.ts +40 -3
- package/esm/models/operations/createauthkeyscode.js +16 -2
- package/esm/models/operations/createcoinbasecharge.d.ts +16 -3
- package/esm/models/operations/createcoinbasecharge.js +2 -2
- package/esm/models/operations/createembeddings.d.ts +16 -3
- package/esm/models/operations/createembeddings.js +2 -2
- package/esm/models/operations/createguardrail.d.ts +25 -3
- package/esm/models/operations/createguardrail.js +6 -2
- package/esm/models/operations/createkeys.d.ts +16 -3
- package/esm/models/operations/createkeys.js +2 -2
- package/esm/models/operations/createresponses.d.ts +16 -3
- package/esm/models/operations/createresponses.js +2 -2
- package/esm/models/operations/deleteguardrail.d.ts +16 -3
- package/esm/models/operations/deleteguardrail.js +2 -2
- package/esm/models/operations/deletekeys.d.ts +16 -3
- package/esm/models/operations/deletekeys.js +2 -2
- package/esm/models/operations/exchangeauthcodeforapikey.d.ts +16 -3
- package/esm/models/operations/exchangeauthcodeforapikey.js +2 -2
- package/esm/models/operations/getcredits.d.ts +16 -3
- package/esm/models/operations/getcredits.js +2 -2
- package/esm/models/operations/getcurrentkey.d.ts +16 -3
- package/esm/models/operations/getcurrentkey.js +2 -2
- package/esm/models/operations/getgeneration.d.ts +27 -3
- package/esm/models/operations/getgeneration.js +9 -2
- package/esm/models/operations/getguardrail.d.ts +20 -3
- package/esm/models/operations/getguardrail.js +4 -2
- package/esm/models/operations/getkey.d.ts +16 -3
- package/esm/models/operations/getkey.js +2 -2
- package/esm/models/operations/getmodels.d.ts +21 -3
- package/esm/models/operations/getmodels.js +4 -2
- package/esm/models/operations/getuseractivity.d.ts +16 -3
- package/esm/models/operations/getuseractivity.js +2 -2
- package/esm/models/operations/list.d.ts +16 -3
- package/esm/models/operations/list.js +2 -2
- package/esm/models/operations/listembeddingsmodels.d.ts +16 -3
- package/esm/models/operations/listembeddingsmodels.js +2 -2
- package/esm/models/operations/listendpoints.d.ts +16 -3
- package/esm/models/operations/listendpoints.js +2 -2
- package/esm/models/operations/listendpointszdr.d.ts +16 -3
- package/esm/models/operations/listendpointszdr.js +2 -2
- package/esm/models/operations/listguardrailkeyassignments.d.ts +16 -3
- package/esm/models/operations/listguardrailkeyassignments.js +2 -2
- package/esm/models/operations/listguardrailmemberassignments.d.ts +16 -3
- package/esm/models/operations/listguardrailmemberassignments.js +2 -2
- package/esm/models/operations/listguardrails.d.ts +20 -3
- package/esm/models/operations/listguardrails.js +4 -2
- package/esm/models/operations/listkeyassignments.d.ts +16 -3
- package/esm/models/operations/listkeyassignments.js +2 -2
- package/esm/models/operations/listmemberassignments.d.ts +16 -3
- package/esm/models/operations/listmemberassignments.js +2 -2
- package/esm/models/operations/listmodelscount.d.ts +21 -3
- package/esm/models/operations/listmodelscount.js +4 -2
- package/esm/models/operations/listmodelsuser.d.ts +16 -3
- package/esm/models/operations/listmodelsuser.js +2 -2
- package/esm/models/operations/listproviders.d.ts +16 -3
- package/esm/models/operations/listproviders.js +2 -2
- package/esm/models/operations/sendchatcompletionrequest.d.ts +27 -5
- package/esm/models/operations/sendchatcompletionrequest.js +22 -4
- package/esm/models/operations/updateguardrail.d.ts +25 -3
- package/esm/models/operations/updateguardrail.js +6 -2
- package/esm/models/operations/updatekeys.d.ts +16 -3
- package/esm/models/operations/updatekeys.js +2 -2
- package/esm/models/outputmessage.d.ts +23 -0
- package/esm/models/outputmessage.js +24 -0
- package/esm/models/outputmodality.d.ts +1 -0
- package/esm/models/outputmodality.js +1 -0
- package/esm/models/providername.d.ts +3 -0
- package/esm/models/providername.js +3 -0
- package/esm/models/providerpreferences.d.ts +49 -14
- package/esm/models/providerpreferences.js +33 -15
- package/esm/models/providersort.d.ts +7 -0
- package/esm/models/providersort.js +4 -0
- package/esm/models/providersortconfig.d.ts +31 -2
- package/esm/models/providersortconfig.js +16 -2
- package/esm/models/reasoningdetailencrypted.d.ts +42 -0
- package/esm/models/reasoningdetailencrypted.js +42 -0
- package/esm/models/reasoningdetailsummary.d.ts +42 -0
- package/esm/models/reasoningdetailsummary.js +42 -0
- package/esm/models/reasoningdetailtext.d.ts +44 -0
- package/esm/models/reasoningdetailtext.js +44 -0
- package/esm/models/reasoningdetailunion.d.ts +19 -0
- package/esm/models/reasoningdetailunion.js +28 -0
- package/esm/models/responseformatjsonobject.d.ts +20 -0
- package/esm/models/responseformatjsonobject.js +21 -0
- package/esm/models/responseformatjsonschema.d.ts +6 -0
- package/esm/models/responseformattext.d.ts +15 -0
- package/esm/models/responseformattext.js +13 -0
- package/esm/models/responseformattextconfig.d.ts +3 -3
- package/esm/models/responseformattextconfig.js +3 -3
- package/esm/models/responseformattextgrammar.d.ts +6 -0
- package/esm/models/responseformattextpython.d.ts +15 -0
- package/esm/models/responseformattextpython.js +13 -0
- package/esm/models/responseoutputtext.d.ts +8 -8
- package/esm/models/responseoutputtext.js +10 -9
- package/esm/models/responseserrorfield.d.ts +4 -4
- package/esm/models/responseserrorfield.js +4 -4
- package/esm/models/responsesoutputitem.d.ts +2 -13
- package/esm/models/responsesoutputitem.js +8 -6
- package/esm/models/responsesoutputitemreasoning.d.ts +3 -32
- package/esm/models/responsesoutputitemreasoning.js +3 -45
- package/esm/models/responsesoutputmessage.d.ts +24 -32
- package/esm/models/responsesoutputmessage.js +26 -47
- package/esm/models/responsesservertooloutput.d.ts +42 -0
- package/esm/models/responsesservertooloutput.js +44 -0
- package/esm/models/responseswebsearchcalloutput.d.ts +90 -5
- package/esm/models/responseswebsearchcalloutput.js +113 -5
- package/esm/models/responseswebsearchservertool.d.ts +35 -0
- package/esm/models/responseswebsearchservertool.js +28 -0
- package/esm/models/systemmessage.d.ts +12 -0
- package/esm/models/toolchoiceoption.d.ts +31 -0
- package/esm/models/toolchoiceoption.js +32 -0
- package/esm/models/tooldefinitionjson.d.ts +62 -10
- package/esm/models/tooldefinitionjson.js +29 -6
- package/esm/models/toolresponsemessage.d.ts +12 -0
- package/esm/models/usermessage.d.ts +12 -0
- package/esm/models/videoinput.d.ts +23 -0
- package/esm/models/videoinput.js +22 -0
- package/esm/models/websearchengine.d.ts +2 -0
- package/esm/models/websearchengine.js +2 -0
- package/esm/models/websearchservertool.d.ts +116 -0
- package/esm/models/websearchservertool.js +77 -0
- package/esm/models/websearchshorthand.d.ts +215 -0
- package/esm/models/websearchshorthand.js +138 -0
- package/esm/sdk/chat.d.ts +1 -1
- package/esm/sdk/sdk.d.ts +6 -3
- package/esm/sdk/sdk.js +3 -4
- package/esm/types/index.d.ts +0 -2
- package/esm/types/index.js +0 -1
- package/jsr.json +1 -1
- package/package.json +11 -6
- package/turbo.json +10 -0
- package/esm/models/chaterror.d.ts +0 -17
- package/esm/models/chaterror.js +0 -25
- package/esm/models/errors/chaterror.d.ts +0 -19
- package/esm/models/openresponsesinput.d.ts +0 -28
- package/esm/models/openresponsesinput.js +0 -54
- package/esm/models/openresponseslogprobs.d.ts +0 -16
- package/esm/models/openresponseslogprobs.js +0 -22
- package/esm/models/openresponsestoplogprobs.d.ts +0 -14
- package/esm/models/openresponsestoplogprobs.js +0 -15
- package/esm/models/providersortunion.d.ts +0 -10
- package/esm/models/providersortunion.js +0 -13
- package/esm/models/responsesformatjsonobject.d.ts +0 -20
- package/esm/models/responsesformatjsonobject.js +0 -21
- package/esm/models/schema10.d.ts +0 -33
- package/esm/models/schema10.js +0 -30
- package/esm/models/schema14.d.ts +0 -8
- package/esm/models/schema14.js +0 -12
- package/esm/models/schema17.d.ts +0 -102
- package/esm/models/schema17.js +0 -95
- package/esm/models/schema19.d.ts +0 -92
- package/esm/models/schema19.js +0 -109
- package/esm/models/schema5.d.ts +0 -86
- package/esm/models/schema5.js +0 -89
|
@@ -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
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum, OpenEnum } from "../types/enums.js";
|
|
3
|
+
export declare const WebSearchShorthandType: {
|
|
4
|
+
readonly WebSearch: "web_search";
|
|
5
|
+
readonly WebSearchPreview: "web_search_preview";
|
|
6
|
+
readonly WebSearchPreview20250311: "web_search_preview_2025_03_11";
|
|
7
|
+
readonly WebSearch20250826: "web_search_2025_08_26";
|
|
8
|
+
};
|
|
9
|
+
export type WebSearchShorthandType = OpenEnum<typeof WebSearchShorthandType>;
|
|
10
|
+
/**
|
|
11
|
+
* 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.
|
|
12
|
+
*/
|
|
13
|
+
export declare const WebSearchShorthandEngine: {
|
|
14
|
+
readonly Auto: "auto";
|
|
15
|
+
readonly Native: "native";
|
|
16
|
+
readonly Exa: "exa";
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* 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.
|
|
20
|
+
*/
|
|
21
|
+
export type WebSearchShorthandEngine = OpenEnum<typeof WebSearchShorthandEngine>;
|
|
22
|
+
/**
|
|
23
|
+
* How much context to retrieve per result. Defaults to medium (15000 chars).
|
|
24
|
+
*/
|
|
25
|
+
export declare const WebSearchShorthandSearchContextSize: {
|
|
26
|
+
readonly Low: "low";
|
|
27
|
+
readonly Medium: "medium";
|
|
28
|
+
readonly High: "high";
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* How much context to retrieve per result. Defaults to medium (15000 chars).
|
|
32
|
+
*/
|
|
33
|
+
export type WebSearchShorthandSearchContextSize = OpenEnum<typeof WebSearchShorthandSearchContextSize>;
|
|
34
|
+
export declare const WebSearchShorthandTypeApproximate: {
|
|
35
|
+
readonly Approximate: "approximate";
|
|
36
|
+
};
|
|
37
|
+
export type WebSearchShorthandTypeApproximate = ClosedEnum<typeof WebSearchShorthandTypeApproximate>;
|
|
38
|
+
/**
|
|
39
|
+
* Approximate user location for location-biased results.
|
|
40
|
+
*/
|
|
41
|
+
export type WebSearchShorthandUserLocation = {
|
|
42
|
+
type?: WebSearchShorthandTypeApproximate | undefined;
|
|
43
|
+
city?: string | undefined;
|
|
44
|
+
region?: string | undefined;
|
|
45
|
+
country?: string | undefined;
|
|
46
|
+
timezone?: string | undefined;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* 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.
|
|
50
|
+
*/
|
|
51
|
+
export declare const WebSearchShorthandParametersEngine: {
|
|
52
|
+
readonly Auto: "auto";
|
|
53
|
+
readonly Native: "native";
|
|
54
|
+
readonly Exa: "exa";
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* 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.
|
|
58
|
+
*/
|
|
59
|
+
export type WebSearchShorthandParametersEngine = OpenEnum<typeof WebSearchShorthandParametersEngine>;
|
|
60
|
+
/**
|
|
61
|
+
* How much context to retrieve per result. Defaults to medium (15000 chars).
|
|
62
|
+
*/
|
|
63
|
+
export declare const WebSearchShorthandParametersSearchContextSize: {
|
|
64
|
+
readonly Low: "low";
|
|
65
|
+
readonly Medium: "medium";
|
|
66
|
+
readonly High: "high";
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* How much context to retrieve per result. Defaults to medium (15000 chars).
|
|
70
|
+
*/
|
|
71
|
+
export type WebSearchShorthandParametersSearchContextSize = OpenEnum<typeof WebSearchShorthandParametersSearchContextSize>;
|
|
72
|
+
export declare const WebSearchShorthandParametersType: {
|
|
73
|
+
readonly Approximate: "approximate";
|
|
74
|
+
};
|
|
75
|
+
export type WebSearchShorthandParametersType = ClosedEnum<typeof WebSearchShorthandParametersType>;
|
|
76
|
+
/**
|
|
77
|
+
* Approximate user location for location-biased results.
|
|
78
|
+
*/
|
|
79
|
+
export type WebSearchShorthandParametersUserLocation = {
|
|
80
|
+
type?: WebSearchShorthandParametersType | undefined;
|
|
81
|
+
city?: string | undefined;
|
|
82
|
+
region?: string | undefined;
|
|
83
|
+
country?: string | undefined;
|
|
84
|
+
timezone?: string | undefined;
|
|
85
|
+
};
|
|
86
|
+
export type WebSearchShorthandParameters = {
|
|
87
|
+
/**
|
|
88
|
+
* 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.
|
|
89
|
+
*/
|
|
90
|
+
engine?: WebSearchShorthandParametersEngine | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Maximum number of search results to return per search call. Defaults to 5.
|
|
93
|
+
*/
|
|
94
|
+
maxResults?: number | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* 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.
|
|
97
|
+
*/
|
|
98
|
+
maxTotalResults?: number | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* How much context to retrieve per result. Defaults to medium (15000 chars).
|
|
101
|
+
*/
|
|
102
|
+
searchContextSize?: WebSearchShorthandParametersSearchContextSize | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Approximate user location for location-biased results.
|
|
105
|
+
*/
|
|
106
|
+
userLocation?: WebSearchShorthandParametersUserLocation | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Limit search results to these domains.
|
|
109
|
+
*/
|
|
110
|
+
allowedDomains?: Array<string> | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Exclude search results from these domains.
|
|
113
|
+
*/
|
|
114
|
+
excludedDomains?: Array<string> | undefined;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Web search tool using OpenAI Responses API syntax. Automatically converted to openrouter:web_search.
|
|
118
|
+
*/
|
|
119
|
+
export type WebSearchShorthand = {
|
|
120
|
+
type: WebSearchShorthandType;
|
|
121
|
+
/**
|
|
122
|
+
* 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.
|
|
123
|
+
*/
|
|
124
|
+
engine?: WebSearchShorthandEngine | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Maximum number of search results to return per search call. Defaults to 5.
|
|
127
|
+
*/
|
|
128
|
+
maxResults?: number | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* 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.
|
|
131
|
+
*/
|
|
132
|
+
maxTotalResults?: number | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* How much context to retrieve per result. Defaults to medium (15000 chars).
|
|
135
|
+
*/
|
|
136
|
+
searchContextSize?: WebSearchShorthandSearchContextSize | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* Approximate user location for location-biased results.
|
|
139
|
+
*/
|
|
140
|
+
userLocation?: WebSearchShorthandUserLocation | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Limit search results to these domains.
|
|
143
|
+
*/
|
|
144
|
+
allowedDomains?: Array<string> | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Exclude search results from these domains.
|
|
147
|
+
*/
|
|
148
|
+
excludedDomains?: Array<string> | undefined;
|
|
149
|
+
parameters?: WebSearchShorthandParameters | undefined;
|
|
150
|
+
};
|
|
151
|
+
/** @internal */
|
|
152
|
+
export declare const WebSearchShorthandType$outboundSchema: z.ZodType<string, WebSearchShorthandType>;
|
|
153
|
+
/** @internal */
|
|
154
|
+
export declare const WebSearchShorthandEngine$outboundSchema: z.ZodType<string, WebSearchShorthandEngine>;
|
|
155
|
+
/** @internal */
|
|
156
|
+
export declare const WebSearchShorthandSearchContextSize$outboundSchema: z.ZodType<string, WebSearchShorthandSearchContextSize>;
|
|
157
|
+
/** @internal */
|
|
158
|
+
export declare const WebSearchShorthandTypeApproximate$outboundSchema: z.ZodEnum<typeof WebSearchShorthandTypeApproximate>;
|
|
159
|
+
/** @internal */
|
|
160
|
+
export type WebSearchShorthandUserLocation$Outbound = {
|
|
161
|
+
type?: string | undefined;
|
|
162
|
+
city?: string | undefined;
|
|
163
|
+
region?: string | undefined;
|
|
164
|
+
country?: string | undefined;
|
|
165
|
+
timezone?: string | undefined;
|
|
166
|
+
};
|
|
167
|
+
/** @internal */
|
|
168
|
+
export declare const WebSearchShorthandUserLocation$outboundSchema: z.ZodType<WebSearchShorthandUserLocation$Outbound, WebSearchShorthandUserLocation>;
|
|
169
|
+
export declare function webSearchShorthandUserLocationToJSON(webSearchShorthandUserLocation: WebSearchShorthandUserLocation): string;
|
|
170
|
+
/** @internal */
|
|
171
|
+
export declare const WebSearchShorthandParametersEngine$outboundSchema: z.ZodType<string, WebSearchShorthandParametersEngine>;
|
|
172
|
+
/** @internal */
|
|
173
|
+
export declare const WebSearchShorthandParametersSearchContextSize$outboundSchema: z.ZodType<string, WebSearchShorthandParametersSearchContextSize>;
|
|
174
|
+
/** @internal */
|
|
175
|
+
export declare const WebSearchShorthandParametersType$outboundSchema: z.ZodEnum<typeof WebSearchShorthandParametersType>;
|
|
176
|
+
/** @internal */
|
|
177
|
+
export type WebSearchShorthandParametersUserLocation$Outbound = {
|
|
178
|
+
type?: string | undefined;
|
|
179
|
+
city?: string | undefined;
|
|
180
|
+
region?: string | undefined;
|
|
181
|
+
country?: string | undefined;
|
|
182
|
+
timezone?: string | undefined;
|
|
183
|
+
};
|
|
184
|
+
/** @internal */
|
|
185
|
+
export declare const WebSearchShorthandParametersUserLocation$outboundSchema: z.ZodType<WebSearchShorthandParametersUserLocation$Outbound, WebSearchShorthandParametersUserLocation>;
|
|
186
|
+
export declare function webSearchShorthandParametersUserLocationToJSON(webSearchShorthandParametersUserLocation: WebSearchShorthandParametersUserLocation): string;
|
|
187
|
+
/** @internal */
|
|
188
|
+
export type WebSearchShorthandParameters$Outbound = {
|
|
189
|
+
engine?: string | undefined;
|
|
190
|
+
max_results?: number | undefined;
|
|
191
|
+
max_total_results?: number | undefined;
|
|
192
|
+
search_context_size?: string | undefined;
|
|
193
|
+
user_location?: WebSearchShorthandParametersUserLocation$Outbound | undefined;
|
|
194
|
+
allowed_domains?: Array<string> | undefined;
|
|
195
|
+
excluded_domains?: Array<string> | undefined;
|
|
196
|
+
};
|
|
197
|
+
/** @internal */
|
|
198
|
+
export declare const WebSearchShorthandParameters$outboundSchema: z.ZodType<WebSearchShorthandParameters$Outbound, WebSearchShorthandParameters>;
|
|
199
|
+
export declare function webSearchShorthandParametersToJSON(webSearchShorthandParameters: WebSearchShorthandParameters): string;
|
|
200
|
+
/** @internal */
|
|
201
|
+
export type WebSearchShorthand$Outbound = {
|
|
202
|
+
type: string;
|
|
203
|
+
engine?: string | undefined;
|
|
204
|
+
max_results?: number | undefined;
|
|
205
|
+
max_total_results?: number | undefined;
|
|
206
|
+
search_context_size?: string | undefined;
|
|
207
|
+
user_location?: WebSearchShorthandUserLocation$Outbound | undefined;
|
|
208
|
+
allowed_domains?: Array<string> | undefined;
|
|
209
|
+
excluded_domains?: Array<string> | undefined;
|
|
210
|
+
parameters?: WebSearchShorthandParameters$Outbound | undefined;
|
|
211
|
+
};
|
|
212
|
+
/** @internal */
|
|
213
|
+
export declare const WebSearchShorthand$outboundSchema: z.ZodType<WebSearchShorthand$Outbound, WebSearchShorthand>;
|
|
214
|
+
export declare function webSearchShorthandToJSON(webSearchShorthand: WebSearchShorthand): string;
|
|
215
|
+
//# sourceMappingURL=websearchshorthand.d.ts.map
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 1de0cb463e93
|
|
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
|
+
export const WebSearchShorthandType = {
|
|
9
|
+
WebSearch: "web_search",
|
|
10
|
+
WebSearchPreview: "web_search_preview",
|
|
11
|
+
WebSearchPreview20250311: "web_search_preview_2025_03_11",
|
|
12
|
+
WebSearch20250826: "web_search_2025_08_26",
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* 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.
|
|
16
|
+
*/
|
|
17
|
+
export const WebSearchShorthandEngine = {
|
|
18
|
+
Auto: "auto",
|
|
19
|
+
Native: "native",
|
|
20
|
+
Exa: "exa",
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* How much context to retrieve per result. Defaults to medium (15000 chars).
|
|
24
|
+
*/
|
|
25
|
+
export const WebSearchShorthandSearchContextSize = {
|
|
26
|
+
Low: "low",
|
|
27
|
+
Medium: "medium",
|
|
28
|
+
High: "high",
|
|
29
|
+
};
|
|
30
|
+
export const WebSearchShorthandTypeApproximate = {
|
|
31
|
+
Approximate: "approximate",
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* 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.
|
|
35
|
+
*/
|
|
36
|
+
export const WebSearchShorthandParametersEngine = {
|
|
37
|
+
Auto: "auto",
|
|
38
|
+
Native: "native",
|
|
39
|
+
Exa: "exa",
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* How much context to retrieve per result. Defaults to medium (15000 chars).
|
|
43
|
+
*/
|
|
44
|
+
export const WebSearchShorthandParametersSearchContextSize = {
|
|
45
|
+
Low: "low",
|
|
46
|
+
Medium: "medium",
|
|
47
|
+
High: "high",
|
|
48
|
+
};
|
|
49
|
+
export const WebSearchShorthandParametersType = {
|
|
50
|
+
Approximate: "approximate",
|
|
51
|
+
};
|
|
52
|
+
/** @internal */
|
|
53
|
+
export const WebSearchShorthandType$outboundSchema = openEnums.outboundSchema(WebSearchShorthandType);
|
|
54
|
+
/** @internal */
|
|
55
|
+
export const WebSearchShorthandEngine$outboundSchema = openEnums.outboundSchema(WebSearchShorthandEngine);
|
|
56
|
+
/** @internal */
|
|
57
|
+
export const WebSearchShorthandSearchContextSize$outboundSchema = openEnums.outboundSchema(WebSearchShorthandSearchContextSize);
|
|
58
|
+
/** @internal */
|
|
59
|
+
export const WebSearchShorthandTypeApproximate$outboundSchema = z.enum(WebSearchShorthandTypeApproximate);
|
|
60
|
+
/** @internal */
|
|
61
|
+
export const WebSearchShorthandUserLocation$outboundSchema = z.object({
|
|
62
|
+
type: WebSearchShorthandTypeApproximate$outboundSchema.optional(),
|
|
63
|
+
city: z.string().optional(),
|
|
64
|
+
region: z.string().optional(),
|
|
65
|
+
country: z.string().optional(),
|
|
66
|
+
timezone: z.string().optional(),
|
|
67
|
+
});
|
|
68
|
+
export function webSearchShorthandUserLocationToJSON(webSearchShorthandUserLocation) {
|
|
69
|
+
return JSON.stringify(WebSearchShorthandUserLocation$outboundSchema.parse(webSearchShorthandUserLocation));
|
|
70
|
+
}
|
|
71
|
+
/** @internal */
|
|
72
|
+
export const WebSearchShorthandParametersEngine$outboundSchema = openEnums.outboundSchema(WebSearchShorthandParametersEngine);
|
|
73
|
+
/** @internal */
|
|
74
|
+
export const WebSearchShorthandParametersSearchContextSize$outboundSchema = openEnums
|
|
75
|
+
.outboundSchema(WebSearchShorthandParametersSearchContextSize);
|
|
76
|
+
/** @internal */
|
|
77
|
+
export const WebSearchShorthandParametersType$outboundSchema = z.enum(WebSearchShorthandParametersType);
|
|
78
|
+
/** @internal */
|
|
79
|
+
export const WebSearchShorthandParametersUserLocation$outboundSchema = z.object({
|
|
80
|
+
type: WebSearchShorthandParametersType$outboundSchema.optional(),
|
|
81
|
+
city: z.string().optional(),
|
|
82
|
+
region: z.string().optional(),
|
|
83
|
+
country: z.string().optional(),
|
|
84
|
+
timezone: z.string().optional(),
|
|
85
|
+
});
|
|
86
|
+
export function webSearchShorthandParametersUserLocationToJSON(webSearchShorthandParametersUserLocation) {
|
|
87
|
+
return JSON.stringify(WebSearchShorthandParametersUserLocation$outboundSchema.parse(webSearchShorthandParametersUserLocation));
|
|
88
|
+
}
|
|
89
|
+
/** @internal */
|
|
90
|
+
export const WebSearchShorthandParameters$outboundSchema = z.object({
|
|
91
|
+
engine: WebSearchShorthandParametersEngine$outboundSchema.optional(),
|
|
92
|
+
maxResults: z.number().optional(),
|
|
93
|
+
maxTotalResults: z.number().optional(),
|
|
94
|
+
searchContextSize: WebSearchShorthandParametersSearchContextSize$outboundSchema.optional(),
|
|
95
|
+
userLocation: z.lazy(() => WebSearchShorthandParametersUserLocation$outboundSchema).optional(),
|
|
96
|
+
allowedDomains: z.array(z.string()).optional(),
|
|
97
|
+
excludedDomains: z.array(z.string()).optional(),
|
|
98
|
+
}).transform((v) => {
|
|
99
|
+
return remap$(v, {
|
|
100
|
+
maxResults: "max_results",
|
|
101
|
+
maxTotalResults: "max_total_results",
|
|
102
|
+
searchContextSize: "search_context_size",
|
|
103
|
+
userLocation: "user_location",
|
|
104
|
+
allowedDomains: "allowed_domains",
|
|
105
|
+
excludedDomains: "excluded_domains",
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
export function webSearchShorthandParametersToJSON(webSearchShorthandParameters) {
|
|
109
|
+
return JSON.stringify(WebSearchShorthandParameters$outboundSchema.parse(webSearchShorthandParameters));
|
|
110
|
+
}
|
|
111
|
+
/** @internal */
|
|
112
|
+
export const WebSearchShorthand$outboundSchema = z.object({
|
|
113
|
+
type: WebSearchShorthandType$outboundSchema,
|
|
114
|
+
engine: WebSearchShorthandEngine$outboundSchema.optional(),
|
|
115
|
+
maxResults: z.number().optional(),
|
|
116
|
+
maxTotalResults: z.number().optional(),
|
|
117
|
+
searchContextSize: WebSearchShorthandSearchContextSize$outboundSchema
|
|
118
|
+
.optional(),
|
|
119
|
+
userLocation: z.lazy(() => WebSearchShorthandUserLocation$outboundSchema)
|
|
120
|
+
.optional(),
|
|
121
|
+
allowedDomains: z.array(z.string()).optional(),
|
|
122
|
+
excludedDomains: z.array(z.string()).optional(),
|
|
123
|
+
parameters: z.lazy(() => WebSearchShorthandParameters$outboundSchema)
|
|
124
|
+
.optional(),
|
|
125
|
+
}).transform((v) => {
|
|
126
|
+
return remap$(v, {
|
|
127
|
+
maxResults: "max_results",
|
|
128
|
+
maxTotalResults: "max_total_results",
|
|
129
|
+
searchContextSize: "search_context_size",
|
|
130
|
+
userLocation: "user_location",
|
|
131
|
+
allowedDomains: "allowed_domains",
|
|
132
|
+
excludedDomains: "excluded_domains",
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
export function webSearchShorthandToJSON(webSearchShorthand) {
|
|
136
|
+
return JSON.stringify(WebSearchShorthand$outboundSchema.parse(webSearchShorthand));
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=websearchshorthand.js.map
|
package/esm/sdk/chat.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare class Chat extends ClientSDK {
|
|
|
18
18
|
chatGenerationParams: {
|
|
19
19
|
stream: true;
|
|
20
20
|
};
|
|
21
|
-
}, options?: RequestOptions): Promise<EventStream<models.
|
|
21
|
+
}, options?: RequestOptions): Promise<EventStream<models.ChatStreamingResponseChunk>>;
|
|
22
22
|
send(request: operations.SendChatCompletionRequestRequest, options?: RequestOptions): Promise<operations.SendChatCompletionRequestResponse>;
|
|
23
23
|
}
|
|
24
24
|
//# sourceMappingURL=chat.d.ts.map
|
package/esm/sdk/sdk.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { Guardrails } from "./guardrails.js";
|
|
|
11
11
|
import { Models } from "./models.js";
|
|
12
12
|
import { OAuth } from "./oauth.js";
|
|
13
13
|
import { Providers } from "./providers.js";
|
|
14
|
+
import type { $ZodObject, $ZodShape, infer as zodInfer } from "zod/v4/core";
|
|
14
15
|
import { type CallModelInput } from "../funcs/call-model.js";
|
|
15
16
|
import type { ModelResult } from "../lib/model-result.js";
|
|
16
17
|
import type { RequestOptions } from "../lib/sdks.js";
|
|
@@ -21,6 +22,8 @@ export declare class OpenRouter extends ClientSDK {
|
|
|
21
22
|
get beta(): Beta;
|
|
22
23
|
private _analytics?;
|
|
23
24
|
get analytics(): Analytics;
|
|
25
|
+
private _chat?;
|
|
26
|
+
get chat(): Chat;
|
|
24
27
|
private _credits?;
|
|
25
28
|
get credits(): Credits;
|
|
26
29
|
private _embeddings?;
|
|
@@ -39,8 +42,8 @@ export declare class OpenRouter extends ClientSDK {
|
|
|
39
42
|
get guardrails(): Guardrails;
|
|
40
43
|
private _oAuth?;
|
|
41
44
|
get oAuth(): OAuth;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
callModel<TTools extends readonly Tool[], TSharedSchema extends $ZodObject<$ZodShape> | undefined = undefined, TShared extends Record<string, unknown> = TSharedSchema extends $ZodObject<$ZodShape> ? zodInfer<TSharedSchema> : Record<string, never>>(request: CallModelInput<TTools, TShared> & {
|
|
46
|
+
sharedContextSchema?: TSharedSchema;
|
|
47
|
+
}, options?: RequestOptions): ModelResult<TTools, TShared>;
|
|
45
48
|
}
|
|
46
49
|
//# sourceMappingURL=sdk.d.ts.map
|
package/esm/sdk/sdk.js
CHANGED
|
@@ -15,7 +15,6 @@ import { Guardrails } from "./guardrails.js";
|
|
|
15
15
|
import { Models } from "./models.js";
|
|
16
16
|
import { OAuth } from "./oauth.js";
|
|
17
17
|
import { Providers } from "./providers.js";
|
|
18
|
-
// #region imports
|
|
19
18
|
import { callModel as callModelFunc, } from "../funcs/call-model.js";
|
|
20
19
|
import { ToolType } from "../lib/tool-types.js";
|
|
21
20
|
export { ToolType };
|
|
@@ -27,6 +26,9 @@ export class OpenRouter extends ClientSDK {
|
|
|
27
26
|
get analytics() {
|
|
28
27
|
return (this._analytics ?? (this._analytics = new Analytics(this._options)));
|
|
29
28
|
}
|
|
29
|
+
get chat() {
|
|
30
|
+
return (this._chat ?? (this._chat = new Chat(this._options)));
|
|
31
|
+
}
|
|
30
32
|
get credits() {
|
|
31
33
|
return (this._credits ?? (this._credits = new Credits(this._options)));
|
|
32
34
|
}
|
|
@@ -54,9 +56,6 @@ export class OpenRouter extends ClientSDK {
|
|
|
54
56
|
get oAuth() {
|
|
55
57
|
return (this._oAuth ?? (this._oAuth = new OAuth(this._options)));
|
|
56
58
|
}
|
|
57
|
-
get chat() {
|
|
58
|
-
return (this._chat ?? (this._chat = new Chat(this._options)));
|
|
59
|
-
}
|
|
60
59
|
// #region sdk-class-body
|
|
61
60
|
callModel(request, options) {
|
|
62
61
|
return callModelFunc(this, request, options);
|
package/esm/types/index.d.ts
CHANGED
|
@@ -5,6 +5,4 @@ export type { PageIterator, Paginator } from "./operations.js";
|
|
|
5
5
|
export { createPageIterator } from "./operations.js";
|
|
6
6
|
export { RFCDate } from "./rfcdate.js";
|
|
7
7
|
export * from "./unrecognized.js";
|
|
8
|
-
export type { ModelId, Variant, StaticVariant, VirtualVariant } from "./models.js";
|
|
9
|
-
export { MODEL_HASH } from "./models.js";
|
|
10
8
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/types/index.js
CHANGED
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"author": "OpenRouter",
|
|
5
5
|
"description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 300+ language models through a unified API.",
|
|
6
6
|
"keywords": [
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"llm"
|
|
20
20
|
],
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
|
+
"packageManager": "pnpm@10.22.0",
|
|
22
23
|
"type": "module",
|
|
23
24
|
"main": "./esm/index.js",
|
|
24
25
|
"exports": {
|
|
@@ -67,14 +68,19 @@
|
|
|
67
68
|
"scripts": {
|
|
68
69
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
69
70
|
"build": "tsc",
|
|
70
|
-
"typecheck": "tsc --noEmit",
|
|
71
71
|
"prepublishOnly": "npm run build",
|
|
72
|
+
"compile": "tsc",
|
|
72
73
|
"postinstall": "node scripts/check-types.js || true",
|
|
73
74
|
"test": "vitest --run --project unit",
|
|
74
75
|
"test:e2e": "vitest --run --project e2e",
|
|
75
|
-
"test:
|
|
76
|
+
"test:transit": "exit 0",
|
|
77
|
+
"test:watch": "vitest --watch --project unit",
|
|
78
|
+
"typecheck": "tsc --noEmit",
|
|
79
|
+
"typecheck:transit": "exit 0"
|
|
80
|
+
},
|
|
81
|
+
"peerDependencies": {
|
|
82
|
+
|
|
76
83
|
},
|
|
77
|
-
"peerDependencies": {},
|
|
78
84
|
"devDependencies": {
|
|
79
85
|
"@eslint/js": "^9.19.0",
|
|
80
86
|
"@types/node": "^22.13.12",
|
|
@@ -87,6 +93,5 @@
|
|
|
87
93
|
},
|
|
88
94
|
"dependencies": {
|
|
89
95
|
"zod": "^3.25.0 || ^4.0.0"
|
|
90
|
-
}
|
|
91
|
-
"packageManager": "pnpm@10.22.0"
|
|
96
|
+
}
|
|
92
97
|
}
|
package/turbo.json
ADDED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as z from "zod/v4";
|
|
2
|
-
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
-
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
-
export type Code = string | number;
|
|
5
|
-
export type ChatErrorError = {
|
|
6
|
-
code: string | number | null;
|
|
7
|
-
message: string;
|
|
8
|
-
param?: string | null | undefined;
|
|
9
|
-
type?: string | null | undefined;
|
|
10
|
-
};
|
|
11
|
-
/** @internal */
|
|
12
|
-
export declare const Code$inboundSchema: z.ZodType<Code, unknown>;
|
|
13
|
-
export declare function codeFromJSON(jsonString: string): SafeParseResult<Code, SDKValidationError>;
|
|
14
|
-
/** @internal */
|
|
15
|
-
export declare const ChatErrorError$inboundSchema: z.ZodType<ChatErrorError, unknown>;
|
|
16
|
-
export declare function chatErrorErrorFromJSON(jsonString: string): SafeParseResult<ChatErrorError, SDKValidationError>;
|
|
17
|
-
//# sourceMappingURL=chaterror.d.ts.map
|
package/esm/models/chaterror.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
* @generated-id: b107ec938dc1
|
|
4
|
-
*/
|
|
5
|
-
import * as z from "zod/v4";
|
|
6
|
-
import { safeParse } from "../lib/schemas.js";
|
|
7
|
-
/** @internal */
|
|
8
|
-
export const Code$inboundSchema = z.union([
|
|
9
|
-
z.string(),
|
|
10
|
-
z.number(),
|
|
11
|
-
]);
|
|
12
|
-
export function codeFromJSON(jsonString) {
|
|
13
|
-
return safeParse(jsonString, (x) => Code$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Code' from JSON`);
|
|
14
|
-
}
|
|
15
|
-
/** @internal */
|
|
16
|
-
export const ChatErrorError$inboundSchema = z.object({
|
|
17
|
-
code: z.nullable(z.union([z.string(), z.number()])),
|
|
18
|
-
message: z.string(),
|
|
19
|
-
param: z.nullable(z.string()).optional(),
|
|
20
|
-
type: z.nullable(z.string()).optional(),
|
|
21
|
-
});
|
|
22
|
-
export function chatErrorErrorFromJSON(jsonString) {
|
|
23
|
-
return safeParse(jsonString, (x) => ChatErrorError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatErrorError' from JSON`);
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=chaterror.js.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as z from "zod/v4";
|
|
2
|
-
import * as models from "../index.js";
|
|
3
|
-
import { OpenRouterError } from "./openroutererror.js";
|
|
4
|
-
export type ChatErrorData = {
|
|
5
|
-
error: models.ChatErrorError;
|
|
6
|
-
};
|
|
7
|
-
export declare class ChatError extends OpenRouterError {
|
|
8
|
-
error: models.ChatErrorError;
|
|
9
|
-
/** The original data that was passed to this error instance. */
|
|
10
|
-
data$: ChatErrorData;
|
|
11
|
-
constructor(err: ChatErrorData, httpMeta: {
|
|
12
|
-
response: Response;
|
|
13
|
-
request: Request;
|
|
14
|
-
body: string;
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
/** @internal */
|
|
18
|
-
export declare const ChatError$inboundSchema: z.ZodType<ChatError, unknown>;
|
|
19
|
-
//# sourceMappingURL=chaterror.d.ts.map
|