@openrouter/sdk 0.0.1-beta.7 → 0.0.1-beta.8
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/esm/core.d.ts +10 -0
- package/esm/core.js +13 -0
- package/esm/funcs/analyticsGetUserActivity.d.ts +18 -0
- package/esm/funcs/analyticsGetUserActivity.js +85 -0
- package/esm/funcs/apiKeysCreate.d.ts +15 -0
- package/esm/funcs/apiKeysCreate.js +79 -0
- package/esm/funcs/apiKeysDelete.d.ts +15 -0
- package/esm/funcs/apiKeysDelete.js +84 -0
- package/esm/funcs/apiKeysGet.d.ts +15 -0
- package/esm/funcs/apiKeysGet.js +84 -0
- package/esm/funcs/apiKeysGetCurrentKeyMetadata.d.ts +18 -0
- package/esm/funcs/apiKeysGetCurrentKeyMetadata.js +72 -0
- package/esm/funcs/apiKeysList.d.ts +15 -0
- package/esm/funcs/apiKeysList.js +83 -0
- package/esm/funcs/apiKeysUpdate.d.ts +15 -0
- package/esm/funcs/apiKeysUpdate.js +85 -0
- package/esm/funcs/betaResponsesSend.d.ts +18 -0
- package/esm/funcs/betaResponsesSend.js +69 -0
- package/esm/funcs/chatSend.d.ts +19 -0
- package/esm/funcs/chatSend.js +83 -0
- package/esm/funcs/completionsGenerate.d.ts +18 -0
- package/esm/funcs/completionsGenerate.js +82 -0
- package/esm/funcs/creditsCreateCoinbaseCharge.d.ts +19 -0
- package/esm/funcs/creditsCreateCoinbaseCharge.js +77 -0
- package/esm/funcs/creditsGetCredits.d.ts +18 -0
- package/esm/funcs/creditsGetCredits.js +72 -0
- package/esm/funcs/endpointsList.d.ts +15 -0
- package/esm/funcs/endpointsList.js +88 -0
- package/esm/funcs/endpointsListZdrEndpoints.d.ts +14 -0
- package/esm/funcs/endpointsListZdrEndpoints.js +65 -0
- package/esm/funcs/generationsGetGeneration.d.ts +15 -0
- package/esm/funcs/generationsGetGeneration.js +82 -0
- package/esm/funcs/modelsCount.d.ts +14 -0
- package/esm/funcs/modelsCount.js +65 -0
- package/esm/funcs/modelsList.d.ts +14 -0
- package/esm/funcs/modelsList.js +83 -0
- package/esm/funcs/modelsListForUser.d.ts +14 -0
- package/esm/funcs/modelsListForUser.js +69 -0
- package/esm/funcs/oAuthCreateAuthorizationUrl.d.ts +43 -0
- package/esm/funcs/oAuthCreateAuthorizationUrl.js +44 -0
- package/esm/funcs/oAuthCreateSHA256CodeChallenge.d.ts +35 -0
- package/esm/funcs/oAuthCreateSHA256CodeChallenge.js +69 -0
- package/esm/funcs/parametersGetParameters.d.ts +15 -0
- package/esm/funcs/parametersGetParameters.js +96 -0
- package/esm/funcs/providersList.d.ts +15 -0
- package/esm/funcs/providersList.js +69 -0
- package/esm/hooks/hooks.d.ts +25 -0
- package/esm/hooks/hooks.js +82 -0
- package/esm/hooks/index.d.ts +3 -0
- package/esm/hooks/index.js +6 -0
- package/esm/hooks/registration.d.ts +3 -0
- package/esm/hooks/registration.js +12 -0
- package/esm/hooks/types.d.ts +76 -0
- package/esm/hooks/types.js +5 -0
- package/esm/index.d.ts +6 -0
- package/esm/index.js +8 -0
- package/esm/lib/base64.d.ts +10 -0
- package/esm/lib/base64.js +29 -0
- package/esm/lib/config.d.ts +44 -0
- package/esm/lib/config.js +32 -0
- package/esm/lib/dlv.d.ts +14 -0
- package/esm/lib/dlv.js +46 -0
- package/esm/lib/encodings.d.ts +52 -0
- package/esm/lib/encodings.js +354 -0
- package/esm/lib/env.d.ts +15 -0
- package/esm/lib/env.js +44 -0
- package/esm/lib/event-streams.d.ts +11 -0
- package/esm/lib/event-streams.js +125 -0
- package/esm/lib/files.d.ts +13 -0
- package/esm/lib/files.js +73 -0
- package/esm/lib/http.d.ts +67 -0
- package/esm/lib/http.js +207 -0
- package/esm/lib/is-plain-object.d.ts +2 -0
- package/esm/lib/is-plain-object.js +38 -0
- package/esm/lib/logger.d.ts +6 -0
- package/esm/lib/logger.js +5 -0
- package/esm/lib/matchers.d.ts +59 -0
- package/esm/lib/matchers.js +203 -0
- package/esm/lib/primitives.d.ts +26 -0
- package/esm/lib/primitives.js +103 -0
- package/esm/lib/retries.d.ts +38 -0
- package/esm/lib/retries.js +147 -0
- package/esm/lib/schemas.d.ts +21 -0
- package/esm/lib/schemas.js +57 -0
- package/esm/lib/sdks.d.ts +63 -0
- package/esm/lib/sdks.js +269 -0
- package/esm/lib/security.d.ts +83 -0
- package/esm/lib/security.js +137 -0
- package/esm/lib/url.d.ts +5 -0
- package/esm/lib/url.js +22 -0
- package/esm/models/activityitem.d.ts +82 -0
- package/esm/models/activityitem.js +73 -0
- package/esm/models/assistantmessage.d.ts +62 -0
- package/esm/models/assistantmessage.js +73 -0
- package/esm/models/chatcompletionfinishreason.d.ts +25 -0
- package/esm/models/chatcompletionfinishreason.js +35 -0
- package/esm/models/chaterror.d.ts +56 -0
- package/esm/models/chaterror.js +64 -0
- package/esm/models/chatgenerationparams.d.ts +249 -0
- package/esm/models/chatgenerationparams.js +301 -0
- package/esm/models/chatgenerationtokenusage.d.ts +95 -0
- package/esm/models/chatgenerationtokenusage.js +142 -0
- package/esm/models/chatmessagecontentitem.d.ts +40 -0
- package/esm/models/chatmessagecontentitem.js +46 -0
- package/esm/models/chatmessagecontentitemaudio.d.ts +83 -0
- package/esm/models/chatmessagecontentitemaudio.js +102 -0
- package/esm/models/chatmessagecontentitemimage.d.ts +79 -0
- package/esm/models/chatmessagecontentitemimage.js +98 -0
- package/esm/models/chatmessagecontentitemtext.d.ts +31 -0
- package/esm/models/chatmessagecontentitemtext.js +33 -0
- package/esm/models/chatmessagetokenlogprob.d.ts +64 -0
- package/esm/models/chatmessagetokenlogprob.js +75 -0
- package/esm/models/chatmessagetokenlogprobs.d.ts +32 -0
- package/esm/models/chatmessagetokenlogprobs.js +34 -0
- package/esm/models/chatmessagetoolcall.d.ts +60 -0
- package/esm/models/chatmessagetoolcall.js +62 -0
- package/esm/models/chatresponse.d.ts +43 -0
- package/esm/models/chatresponse.js +55 -0
- package/esm/models/chatresponsechoice.d.ts +38 -0
- package/esm/models/chatresponsechoice.js +49 -0
- package/esm/models/chatstreamingchoice.d.ts +38 -0
- package/esm/models/chatstreamingchoice.js +49 -0
- package/esm/models/chatstreamingmessagechunk.d.ts +61 -0
- package/esm/models/chatstreamingmessagechunk.js +67 -0
- package/esm/models/chatstreamingmessagetoolcall.d.ts +62 -0
- package/esm/models/chatstreamingmessagetoolcall.js +66 -0
- package/esm/models/chatstreamingresponsechunk.d.ts +97 -0
- package/esm/models/chatstreamingresponsechunk.js +120 -0
- package/esm/models/chatstreamoptions.d.ts +29 -0
- package/esm/models/chatstreamoptions.js +40 -0
- package/esm/models/completionchoice.d.ts +57 -0
- package/esm/models/completionchoice.js +75 -0
- package/esm/models/completioncreateparams.d.ts +240 -0
- package/esm/models/completioncreateparams.js +313 -0
- package/esm/models/completionlogprobs.d.ts +39 -0
- package/esm/models/completionlogprobs.js +50 -0
- package/esm/models/completionresponse.d.ts +43 -0
- package/esm/models/completionresponse.js +54 -0
- package/esm/models/completionusage.d.ts +33 -0
- package/esm/models/completionusage.js +48 -0
- package/esm/models/createchargerequest.d.ts +28 -0
- package/esm/models/createchargerequest.js +27 -0
- package/esm/models/errorresponse.d.ts +155 -0
- package/esm/models/errorresponse.js +167 -0
- package/esm/models/errors/chaterror.d.ts +37 -0
- package/esm/models/errors/chaterror.js +48 -0
- package/esm/models/errors/errorresponse.d.ts +46 -0
- package/esm/models/errors/errorresponse.js +64 -0
- package/esm/models/errors/httpclienterrors.d.ts +44 -0
- package/esm/models/errors/httpclienterrors.js +69 -0
- package/esm/models/errors/index.d.ts +9 -0
- package/esm/models/errors/index.js +12 -0
- package/esm/models/errors/listproviders.d.ts +49 -0
- package/esm/models/errors/listproviders.js +51 -0
- package/esm/models/errors/openrouterdefaulterror.d.ts +10 -0
- package/esm/models/errors/openrouterdefaulterror.js +30 -0
- package/esm/models/errors/openroutererror.d.ts +19 -0
- package/esm/models/errors/openroutererror.js +16 -0
- package/esm/models/errors/responsevalidationerror.d.ts +26 -0
- package/esm/models/errors/responsevalidationerror.js +29 -0
- package/esm/models/errors/sdkvalidationerror.d.ts +21 -0
- package/esm/models/errors/sdkvalidationerror.js +44 -0
- package/esm/models/filecitationannotation.d.ts +58 -0
- package/esm/models/filecitationannotation.js +64 -0
- package/esm/models/filepathannotation.d.ts +56 -0
- package/esm/models/filepathannotation.js +62 -0
- package/esm/models/imagegenerationstatus.d.ts +24 -0
- package/esm/models/imagegenerationstatus.js +34 -0
- package/esm/models/index.d.ts +96 -0
- package/esm/models/index.js +99 -0
- package/esm/models/jsonschemaconfig.d.ts +39 -0
- package/esm/models/jsonschemaconfig.js +37 -0
- package/esm/models/listendpointsresponse.d.ts +28 -0
- package/esm/models/listendpointsresponse.js +27 -0
- package/esm/models/message.d.ts +80 -0
- package/esm/models/message.js +101 -0
- package/esm/models/modelscountresponse.d.ts +28 -0
- package/esm/models/modelscountresponse.js +27 -0
- package/esm/models/modelslistresponse.d.ts +28 -0
- package/esm/models/modelslistresponse.js +27 -0
- package/esm/models/namedtoolchoice.d.ts +56 -0
- package/esm/models/namedtoolchoice.js +58 -0
- package/esm/models/openresponseseasyinputmessage.d.ts +190 -0
- package/esm/models/openresponseseasyinputmessage.js +194 -0
- package/esm/models/openresponsesformatjsonobject.d.ts +55 -0
- package/esm/models/openresponsesformatjsonobject.js +49 -0
- package/esm/models/openresponsesformatjsonschema.d.ts +67 -0
- package/esm/models/openresponsesformatjsonschema.js +57 -0
- package/esm/models/openresponsesformattext.d.ts +55 -0
- package/esm/models/openresponsesformattext.js +49 -0
- package/esm/models/openresponsesformattextconfig.d.ts +31 -0
- package/esm/models/openresponsesformattextconfig.js +38 -0
- package/esm/models/openresponsesfunctioncalloutput.d.ts +64 -0
- package/esm/models/openresponsesfunctioncalloutput.js +67 -0
- package/esm/models/openresponsesfunctiontoolcall.d.ts +66 -0
- package/esm/models/openresponsesfunctiontoolcall.js +69 -0
- package/esm/models/openresponsesinput.d.ts +29 -0
- package/esm/models/openresponsesinput.js +36 -0
- package/esm/models/openresponsesinputcontent.d.ts +43 -0
- package/esm/models/openresponsesinputcontent.js +50 -0
- package/esm/models/openresponsesinputfile.d.ts +63 -0
- package/esm/models/openresponsesinputfile.js +70 -0
- package/esm/models/openresponsesinputimage.d.ts +79 -0
- package/esm/models/openresponsesinputimage.js +90 -0
- package/esm/models/openresponsesinputitem.d.ts +39 -0
- package/esm/models/openresponsesinputitem.js +62 -0
- package/esm/models/openresponsesinputmessageitem.d.ts +149 -0
- package/esm/models/openresponsesinputmessageitem.js +147 -0
- package/esm/models/openresponsesinputtext.d.ts +57 -0
- package/esm/models/openresponsesinputtext.js +51 -0
- package/esm/models/openresponseslogprobs.d.ts +66 -0
- package/esm/models/openresponseslogprobs.js +71 -0
- package/esm/models/openresponsesnonstreamingresponse.d.ts +260 -0
- package/esm/models/openresponsesnonstreamingresponse.js +290 -0
- package/esm/models/openresponsesoutputtext.d.ts +80 -0
- package/esm/models/openresponsesoutputtext.js +93 -0
- package/esm/models/openresponsesprompt.d.ts +39 -0
- package/esm/models/openresponsesprompt.js +34 -0
- package/esm/models/openresponsesreasoning.d.ts +90 -0
- package/esm/models/openresponsesreasoning.js +101 -0
- package/esm/models/openresponsesreasoningconfig.d.ts +61 -0
- package/esm/models/openresponsesreasoningconfig.js +78 -0
- package/esm/models/openresponsesrefusalcontent.d.ts +54 -0
- package/esm/models/openresponsesrefusalcontent.js +51 -0
- package/esm/models/openresponsesrequest.d.ts +28 -0
- package/esm/models/openresponsesrequest.js +27 -0
- package/esm/models/openresponsesstreamevent.d.ts +1683 -0
- package/esm/models/openresponsesstreamevent.js +1944 -0
- package/esm/models/openresponsestextconfig.d.ts +59 -0
- package/esm/models/openresponsestextconfig.js +63 -0
- package/esm/models/openresponsestoolchoice.d.ts +148 -0
- package/esm/models/openresponsestoolchoice.js +139 -0
- package/esm/models/openresponsestoolunion.d.ts +95 -0
- package/esm/models/openresponsestoolunion.js +94 -0
- package/esm/models/openresponseswebsearch20250826tool.d.ts +94 -0
- package/esm/models/openresponseswebsearch20250826tool.js +103 -0
- package/esm/models/openresponseswebsearchpreview20250311tool.d.ts +64 -0
- package/esm/models/openresponseswebsearchpreview20250311tool.js +68 -0
- package/esm/models/openresponseswebsearchpreviewtool.d.ts +64 -0
- package/esm/models/openresponseswebsearchpreviewtool.js +68 -0
- package/esm/models/openresponseswebsearchtool.d.ts +94 -0
- package/esm/models/openresponseswebsearchtool.js +103 -0
- package/esm/models/operations/createapialpharesponses.d.ts +58 -0
- package/esm/models/operations/createapialpharesponses.js +83 -0
- package/esm/models/operations/createcoinbasecharge.d.ts +212 -0
- package/esm/models/operations/createcoinbasecharge.js +267 -0
- package/esm/models/operations/createkeys.d.ts +226 -0
- package/esm/models/operations/createkeys.js +195 -0
- package/esm/models/operations/deletekeys.d.ts +63 -0
- package/esm/models/operations/deletekeys.js +56 -0
- package/esm/models/operations/getcredits.d.ts +28 -0
- package/esm/models/operations/getcredits.js +27 -0
- package/esm/models/operations/getcurrentkey.d.ts +186 -0
- package/esm/models/operations/getcurrentkey.js +148 -0
- package/esm/models/operations/getgeneration.d.ts +272 -0
- package/esm/models/operations/getgeneration.js +230 -0
- package/esm/models/operations/getkey.d.ts +179 -0
- package/esm/models/operations/getkey.js +148 -0
- package/esm/models/operations/getmodels.d.ts +57 -0
- package/esm/models/operations/getmodels.js +80 -0
- package/esm/models/operations/getparameters.d.ts +250 -0
- package/esm/models/operations/getparameters.js +260 -0
- package/esm/models/operations/getuseractivity.d.ts +64 -0
- package/esm/models/operations/getuseractivity.js +57 -0
- package/esm/models/operations/index.d.ts +20 -0
- package/esm/models/operations/index.js +23 -0
- package/esm/models/operations/list.d.ts +181 -0
- package/esm/models/operations/list.js +159 -0
- package/esm/models/operations/listendpoints.d.ts +63 -0
- package/esm/models/operations/listendpoints.js +59 -0
- package/esm/models/operations/listendpointszdr.d.ts +54 -0
- package/esm/models/operations/listendpointszdr.js +59 -0
- package/esm/models/operations/listmodelscount.d.ts +26 -0
- package/esm/models/operations/listmodelscount.js +34 -0
- package/esm/models/operations/listmodelsuser.d.ts +51 -0
- package/esm/models/operations/listmodelsuser.js +59 -0
- package/esm/models/operations/listproviders.d.ts +116 -0
- package/esm/models/operations/listproviders.js +105 -0
- package/esm/models/operations/sendchatcompletionrequest.d.ts +27 -0
- package/esm/models/operations/sendchatcompletionrequest.js +41 -0
- package/esm/models/operations/updatekeys.d.ts +256 -0
- package/esm/models/operations/updatekeys.js +230 -0
- package/esm/models/outputtextcontent.d.ts +80 -0
- package/esm/models/outputtextcontent.js +93 -0
- package/esm/models/publicendpoint.d.ts +28 -0
- package/esm/models/publicendpoint.js +27 -0
- package/esm/models/reasoningsummarytext.d.ts +54 -0
- package/esm/models/reasoningsummarytext.js +51 -0
- package/esm/models/reasoningsummaryverbosity.d.ts +23 -0
- package/esm/models/reasoningsummaryverbosity.js +33 -0
- package/esm/models/reasoningtextcontent.d.ts +54 -0
- package/esm/models/reasoningtextcontent.js +51 -0
- package/esm/models/refusalcontent.d.ts +54 -0
- package/esm/models/refusalcontent.js +51 -0
- package/esm/models/responseformatjsonschema.d.ts +32 -0
- package/esm/models/responseformatjsonschema.js +43 -0
- package/esm/models/responseformattextgrammar.d.ts +31 -0
- package/esm/models/responseformattextgrammar.js +33 -0
- package/esm/models/responseserrorfield.d.ts +55 -0
- package/esm/models/responseserrorfield.js +61 -0
- package/esm/models/responsesimagegenerationcall.d.ts +59 -0
- package/esm/models/responsesimagegenerationcall.js +56 -0
- package/esm/models/responsesoutputitem.d.ts +34 -0
- package/esm/models/responsesoutputitem.js +47 -0
- package/esm/models/responsesoutputitemfilesearchcall.d.ts +59 -0
- package/esm/models/responsesoutputitemfilesearchcall.js +56 -0
- package/esm/models/responsesoutputitemfunctioncall.d.ts +60 -0
- package/esm/models/responsesoutputitemfunctioncall.js +66 -0
- package/esm/models/responsesoutputitemreasoning.d.ts +62 -0
- package/esm/models/responsesoutputitemreasoning.js +68 -0
- package/esm/models/responsesoutputmessage.d.ts +192 -0
- package/esm/models/responsesoutputmessage.js +190 -0
- package/esm/models/responsessearchcontextsize.d.ts +29 -0
- package/esm/models/responsessearchcontextsize.js +36 -0
- package/esm/models/responsesusage.d.ts +131 -0
- package/esm/models/responsesusage.js +174 -0
- package/esm/models/responseswebsearchcalloutput.d.ts +57 -0
- package/esm/models/responseswebsearchcalloutput.js +54 -0
- package/esm/models/responseswebsearchuserlocation.d.ts +63 -0
- package/esm/models/responseswebsearchuserlocation.js +57 -0
- package/esm/models/security.d.ts +29 -0
- package/esm/models/security.js +32 -0
- package/esm/models/systemmessage.d.ts +55 -0
- package/esm/models/systemmessage.js +64 -0
- package/esm/models/tool.d.ts +66 -0
- package/esm/models/tool.js +65 -0
- package/esm/models/toolcallstatus.d.ts +23 -0
- package/esm/models/toolcallstatus.js +33 -0
- package/esm/models/toolchoicetypes.d.ts +164 -0
- package/esm/models/toolchoicetypes.js +167 -0
- package/esm/models/toolresponsemessage.d.ts +55 -0
- package/esm/models/toolresponsemessage.js +69 -0
- package/esm/models/urlcitationannotation.d.ts +60 -0
- package/esm/models/urlcitationannotation.js +68 -0
- package/esm/models/usermessage.d.ts +55 -0
- package/esm/models/usermessage.js +64 -0
- package/esm/models/websearchpreviewtooluserlocation.d.ts +60 -0
- package/esm/models/websearchpreviewtooluserlocation.js +57 -0
- package/esm/models/websearchstatus.d.ts +24 -0
- package/esm/models/websearchstatus.js +34 -0
- package/esm/react-query/_context.d.ts +8 -0
- package/esm/react-query/_context.js +14 -0
- package/esm/react-query/_types.d.ts +27 -0
- package/esm/react-query/_types.js +5 -0
- package/esm/react-query/analyticsGetUserActivity.d.ts +36 -0
- package/esm/react-query/analyticsGetUserActivity.js +77 -0
- package/esm/react-query/apiKeysCreate.d.ts +20 -0
- package/esm/react-query/apiKeysCreate.js +39 -0
- package/esm/react-query/apiKeysDelete.d.ts +20 -0
- package/esm/react-query/apiKeysDelete.js +39 -0
- package/esm/react-query/apiKeysGet.d.ts +24 -0
- package/esm/react-query/apiKeysGet.js +66 -0
- package/esm/react-query/apiKeysGetCurrentKeyMetadata.d.ts +29 -0
- package/esm/react-query/apiKeysGetCurrentKeyMetadata.js +66 -0
- package/esm/react-query/apiKeysList.d.ts +37 -0
- package/esm/react-query/apiKeysList.js +69 -0
- package/esm/react-query/apiKeysUpdate.d.ts +20 -0
- package/esm/react-query/apiKeysUpdate.js +39 -0
- package/esm/react-query/betaResponsesSend.d.ts +24 -0
- package/esm/react-query/betaResponsesSend.js +42 -0
- package/esm/react-query/chatSend.d.ts +24 -0
- package/esm/react-query/chatSend.js +42 -0
- package/esm/react-query/completionsGenerate.d.ts +23 -0
- package/esm/react-query/completionsGenerate.js +42 -0
- package/esm/react-query/creditsCreateCoinbaseCharge.d.ts +25 -0
- package/esm/react-query/creditsCreateCoinbaseCharge.js +42 -0
- package/esm/react-query/creditsGetCredits.d.ts +29 -0
- package/esm/react-query/creditsGetCredits.js +66 -0
- package/esm/react-query/endpointsList.d.ts +24 -0
- package/esm/react-query/endpointsList.js +66 -0
- package/esm/react-query/endpointsListZdrEndpoints.d.ts +23 -0
- package/esm/react-query/endpointsListZdrEndpoints.js +60 -0
- package/esm/react-query/generationsGetGeneration.d.ts +30 -0
- package/esm/react-query/generationsGetGeneration.js +71 -0
- package/esm/react-query/index.d.ts +23 -0
- package/esm/react-query/index.js +26 -0
- package/esm/react-query/modelsCount.d.ts +23 -0
- package/esm/react-query/modelsCount.js +60 -0
- package/esm/react-query/modelsList.d.ts +43 -0
- package/esm/react-query/modelsList.js +71 -0
- package/esm/react-query/modelsListForUser.d.ts +23 -0
- package/esm/react-query/modelsListForUser.js +60 -0
- package/esm/react-query/parametersGetParameters.d.ts +38 -0
- package/esm/react-query/parametersGetParameters.js +80 -0
- package/esm/react-query/providersList.d.ts +23 -0
- package/esm/react-query/providersList.js +60 -0
- package/esm/sdk/analytics.d.ts +12 -0
- package/esm/sdk/analytics.js +18 -0
- package/esm/sdk/apikeys.d.ts +32 -0
- package/esm/sdk/apikeys.js +53 -0
- package/esm/sdk/beta.d.ts +7 -0
- package/esm/sdk/beta.js +11 -0
- package/esm/sdk/chat.d.ts +13 -0
- package/esm/sdk/chat.js +18 -0
- package/esm/sdk/completions.d.ts +12 -0
- package/esm/sdk/completions.js +18 -0
- package/esm/sdk/credits.d.ts +20 -0
- package/esm/sdk/credits.js +28 -0
- package/esm/sdk/endpoints.d.ts +13 -0
- package/esm/sdk/endpoints.js +22 -0
- package/esm/sdk/generations.d.ts +9 -0
- package/esm/sdk/generations.js +15 -0
- package/esm/sdk/index.d.ts +2 -0
- package/esm/sdk/index.js +5 -0
- package/esm/sdk/models.d.ts +17 -0
- package/esm/sdk/models.js +29 -0
- package/esm/sdk/parameters.d.ts +9 -0
- package/esm/sdk/parameters.js +15 -0
- package/esm/sdk/providers.d.ts +9 -0
- package/esm/sdk/providers.js +15 -0
- package/esm/sdk/responses.d.ts +13 -0
- package/esm/sdk/responses.js +18 -0
- package/esm/sdk/sdk.d.ts +37 -0
- package/esm/sdk/sdk.js +51 -0
- package/esm/types/async.d.ts +23 -0
- package/esm/types/async.js +40 -0
- package/esm/types/blobs.d.ts +4 -0
- package/esm/types/blobs.js +25 -0
- package/esm/types/constdatetime.d.ts +3 -0
- package/esm/types/constdatetime.js +10 -0
- package/esm/types/enums.d.ts +12 -0
- package/esm/types/enums.js +7 -0
- package/esm/types/fp.d.ts +31 -0
- package/esm/types/fp.js +31 -0
- package/esm/types/index.d.ts +8 -0
- package/esm/types/index.js +8 -0
- package/esm/types/operations.d.ts +27 -0
- package/esm/types/operations.js +77 -0
- package/esm/types/rfcdate.d.ts +21 -0
- package/esm/types/rfcdate.js +42 -0
- package/esm/types/streams.d.ts +2 -0
- package/esm/types/streams.js +15 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/tsconfig.json +3 -3
- package/core.d.ts +0 -9
- package/core.js +0 -12
- package/funcs/analyticsGetUserActivity.d.ts +0 -17
- package/funcs/analyticsGetUserActivity.js +0 -84
- package/funcs/apiKeysCreate.d.ts +0 -14
- package/funcs/apiKeysCreate.js +0 -78
- package/funcs/apiKeysDelete.d.ts +0 -14
- package/funcs/apiKeysDelete.js +0 -83
- package/funcs/apiKeysGet.d.ts +0 -14
- package/funcs/apiKeysGet.js +0 -83
- package/funcs/apiKeysGetCurrentKeyMetadata.d.ts +0 -17
- package/funcs/apiKeysGetCurrentKeyMetadata.js +0 -71
- package/funcs/apiKeysList.d.ts +0 -14
- package/funcs/apiKeysList.js +0 -82
- package/funcs/apiKeysUpdate.d.ts +0 -14
- package/funcs/apiKeysUpdate.js +0 -84
- package/funcs/betaResponsesSend.d.ts +0 -17
- package/funcs/betaResponsesSend.js +0 -68
- package/funcs/chatSend.d.ts +0 -18
- package/funcs/chatSend.js +0 -82
- package/funcs/completionsGenerate.d.ts +0 -17
- package/funcs/completionsGenerate.js +0 -81
- package/funcs/creditsCreateCoinbaseCharge.d.ts +0 -18
- package/funcs/creditsCreateCoinbaseCharge.js +0 -76
- package/funcs/creditsGetCredits.d.ts +0 -17
- package/funcs/creditsGetCredits.js +0 -71
- package/funcs/endpointsList.d.ts +0 -14
- package/funcs/endpointsList.js +0 -87
- package/funcs/endpointsListZdrEndpoints.d.ts +0 -13
- package/funcs/endpointsListZdrEndpoints.js +0 -64
- package/funcs/generationsGetGeneration.d.ts +0 -14
- package/funcs/generationsGetGeneration.js +0 -81
- package/funcs/modelsCount.d.ts +0 -13
- package/funcs/modelsCount.js +0 -64
- package/funcs/modelsList.d.ts +0 -13
- package/funcs/modelsList.js +0 -82
- package/funcs/modelsListForUser.d.ts +0 -13
- package/funcs/modelsListForUser.js +0 -68
- package/funcs/oAuthCreateAuthorizationUrl.d.ts +0 -42
- package/funcs/oAuthCreateAuthorizationUrl.js +0 -43
- package/funcs/oAuthCreateSHA256CodeChallenge.d.ts +0 -34
- package/funcs/oAuthCreateSHA256CodeChallenge.js +0 -68
- package/funcs/parametersGetParameters.d.ts +0 -14
- package/funcs/parametersGetParameters.js +0 -95
- package/funcs/providersList.d.ts +0 -14
- package/funcs/providersList.js +0 -68
- package/hooks/hooks.d.ts +0 -24
- package/hooks/hooks.js +0 -81
- package/hooks/index.d.ts +0 -2
- package/hooks/index.js +0 -5
- package/hooks/registration.d.ts +0 -2
- package/hooks/registration.js +0 -11
- package/hooks/types.d.ts +0 -75
- package/hooks/types.js +0 -4
- package/index.d.ts +0 -5
- package/index.js +0 -7
- package/lib/base64.d.ts +0 -9
- package/lib/base64.js +0 -28
- package/lib/config.d.ts +0 -43
- package/lib/config.js +0 -31
- package/lib/dlv.d.ts +0 -13
- package/lib/dlv.js +0 -45
- package/lib/encodings.d.ts +0 -51
- package/lib/encodings.js +0 -353
- package/lib/env.d.ts +0 -14
- package/lib/env.js +0 -43
- package/lib/event-streams.d.ts +0 -10
- package/lib/event-streams.js +0 -124
- package/lib/files.d.ts +0 -12
- package/lib/files.js +0 -72
- package/lib/http.d.ts +0 -66
- package/lib/http.js +0 -206
- package/lib/is-plain-object.d.ts +0 -1
- package/lib/is-plain-object.js +0 -37
- package/lib/logger.d.ts +0 -5
- package/lib/logger.js +0 -4
- package/lib/matchers.d.ts +0 -58
- package/lib/matchers.js +0 -202
- package/lib/primitives.d.ts +0 -25
- package/lib/primitives.js +0 -102
- package/lib/retries.d.ts +0 -37
- package/lib/retries.js +0 -146
- package/lib/schemas.d.ts +0 -20
- package/lib/schemas.js +0 -56
- package/lib/sdks.d.ts +0 -62
- package/lib/sdks.js +0 -268
- package/lib/security.d.ts +0 -82
- package/lib/security.js +0 -136
- package/lib/url.d.ts +0 -4
- package/lib/url.js +0 -21
- package/models/activityitem.d.ts +0 -81
- package/models/activityitem.js +0 -72
- package/models/assistantmessage.d.ts +0 -61
- package/models/assistantmessage.js +0 -72
- package/models/chatcompletionfinishreason.d.ts +0 -24
- package/models/chatcompletionfinishreason.js +0 -34
- package/models/chaterror.d.ts +0 -55
- package/models/chaterror.js +0 -63
- package/models/chatgenerationparams.d.ts +0 -248
- package/models/chatgenerationparams.js +0 -300
- package/models/chatgenerationtokenusage.d.ts +0 -94
- package/models/chatgenerationtokenusage.js +0 -141
- package/models/chatmessagecontentitem.d.ts +0 -39
- package/models/chatmessagecontentitem.js +0 -45
- package/models/chatmessagecontentitemaudio.d.ts +0 -82
- package/models/chatmessagecontentitemaudio.js +0 -101
- package/models/chatmessagecontentitemimage.d.ts +0 -78
- package/models/chatmessagecontentitemimage.js +0 -97
- package/models/chatmessagecontentitemtext.d.ts +0 -30
- package/models/chatmessagecontentitemtext.js +0 -32
- package/models/chatmessagetokenlogprob.d.ts +0 -63
- package/models/chatmessagetokenlogprob.js +0 -74
- package/models/chatmessagetokenlogprobs.d.ts +0 -31
- package/models/chatmessagetokenlogprobs.js +0 -33
- package/models/chatmessagetoolcall.d.ts +0 -59
- package/models/chatmessagetoolcall.js +0 -61
- package/models/chatresponse.d.ts +0 -42
- package/models/chatresponse.js +0 -54
- package/models/chatresponsechoice.d.ts +0 -37
- package/models/chatresponsechoice.js +0 -48
- package/models/chatstreamingchoice.d.ts +0 -37
- package/models/chatstreamingchoice.js +0 -48
- package/models/chatstreamingmessagechunk.d.ts +0 -60
- package/models/chatstreamingmessagechunk.js +0 -66
- package/models/chatstreamingmessagetoolcall.d.ts +0 -61
- package/models/chatstreamingmessagetoolcall.js +0 -65
- package/models/chatstreamingresponsechunk.d.ts +0 -96
- package/models/chatstreamingresponsechunk.js +0 -119
- package/models/chatstreamoptions.d.ts +0 -28
- package/models/chatstreamoptions.js +0 -39
- package/models/completionchoice.d.ts +0 -56
- package/models/completionchoice.js +0 -74
- package/models/completioncreateparams.d.ts +0 -239
- package/models/completioncreateparams.js +0 -312
- package/models/completionlogprobs.d.ts +0 -38
- package/models/completionlogprobs.js +0 -49
- package/models/completionresponse.d.ts +0 -42
- package/models/completionresponse.js +0 -53
- package/models/completionusage.d.ts +0 -32
- package/models/completionusage.js +0 -47
- package/models/createchargerequest.d.ts +0 -27
- package/models/createchargerequest.js +0 -26
- package/models/errorresponse.d.ts +0 -154
- package/models/errorresponse.js +0 -166
- package/models/errors/chaterror.d.ts +0 -36
- package/models/errors/chaterror.js +0 -47
- package/models/errors/errorresponse.d.ts +0 -45
- package/models/errors/errorresponse.js +0 -63
- package/models/errors/httpclienterrors.d.ts +0 -43
- package/models/errors/httpclienterrors.js +0 -68
- package/models/errors/index.d.ts +0 -8
- package/models/errors/index.js +0 -11
- package/models/errors/listproviders.d.ts +0 -48
- package/models/errors/listproviders.js +0 -50
- package/models/errors/openrouterdefaulterror.d.ts +0 -9
- package/models/errors/openrouterdefaulterror.js +0 -29
- package/models/errors/openroutererror.d.ts +0 -18
- package/models/errors/openroutererror.js +0 -15
- package/models/errors/responsevalidationerror.d.ts +0 -25
- package/models/errors/responsevalidationerror.js +0 -28
- package/models/errors/sdkvalidationerror.d.ts +0 -20
- package/models/errors/sdkvalidationerror.js +0 -43
- package/models/filecitationannotation.d.ts +0 -57
- package/models/filecitationannotation.js +0 -63
- package/models/filepathannotation.d.ts +0 -55
- package/models/filepathannotation.js +0 -61
- package/models/imagegenerationstatus.d.ts +0 -23
- package/models/imagegenerationstatus.js +0 -33
- package/models/index.d.ts +0 -95
- package/models/index.js +0 -98
- package/models/jsonschemaconfig.d.ts +0 -38
- package/models/jsonschemaconfig.js +0 -36
- package/models/listendpointsresponse.d.ts +0 -27
- package/models/listendpointsresponse.js +0 -26
- package/models/message.d.ts +0 -79
- package/models/message.js +0 -100
- package/models/modelscountresponse.d.ts +0 -27
- package/models/modelscountresponse.js +0 -26
- package/models/modelslistresponse.d.ts +0 -27
- package/models/modelslistresponse.js +0 -26
- package/models/namedtoolchoice.d.ts +0 -55
- package/models/namedtoolchoice.js +0 -57
- package/models/openresponseseasyinputmessage.d.ts +0 -189
- package/models/openresponseseasyinputmessage.js +0 -193
- package/models/openresponsesformatjsonobject.d.ts +0 -54
- package/models/openresponsesformatjsonobject.js +0 -48
- package/models/openresponsesformatjsonschema.d.ts +0 -66
- package/models/openresponsesformatjsonschema.js +0 -56
- package/models/openresponsesformattext.d.ts +0 -54
- package/models/openresponsesformattext.js +0 -48
- package/models/openresponsesformattextconfig.d.ts +0 -30
- package/models/openresponsesformattextconfig.js +0 -37
- package/models/openresponsesfunctioncalloutput.d.ts +0 -63
- package/models/openresponsesfunctioncalloutput.js +0 -66
- package/models/openresponsesfunctiontoolcall.d.ts +0 -65
- package/models/openresponsesfunctiontoolcall.js +0 -68
- package/models/openresponsesinput.d.ts +0 -28
- package/models/openresponsesinput.js +0 -35
- package/models/openresponsesinputcontent.d.ts +0 -42
- package/models/openresponsesinputcontent.js +0 -49
- package/models/openresponsesinputfile.d.ts +0 -62
- package/models/openresponsesinputfile.js +0 -69
- package/models/openresponsesinputimage.d.ts +0 -78
- package/models/openresponsesinputimage.js +0 -89
- package/models/openresponsesinputitem.d.ts +0 -38
- package/models/openresponsesinputitem.js +0 -61
- package/models/openresponsesinputmessageitem.d.ts +0 -148
- package/models/openresponsesinputmessageitem.js +0 -146
- package/models/openresponsesinputtext.d.ts +0 -56
- package/models/openresponsesinputtext.js +0 -50
- package/models/openresponseslogprobs.d.ts +0 -65
- package/models/openresponseslogprobs.js +0 -70
- package/models/openresponsesnonstreamingresponse.d.ts +0 -259
- package/models/openresponsesnonstreamingresponse.js +0 -289
- package/models/openresponsesoutputtext.d.ts +0 -79
- package/models/openresponsesoutputtext.js +0 -92
- package/models/openresponsesprompt.d.ts +0 -38
- package/models/openresponsesprompt.js +0 -33
- package/models/openresponsesreasoning.d.ts +0 -89
- package/models/openresponsesreasoning.js +0 -100
- package/models/openresponsesreasoningconfig.d.ts +0 -60
- package/models/openresponsesreasoningconfig.js +0 -77
- package/models/openresponsesrefusalcontent.d.ts +0 -53
- package/models/openresponsesrefusalcontent.js +0 -50
- package/models/openresponsesrequest.d.ts +0 -27
- package/models/openresponsesrequest.js +0 -26
- package/models/openresponsesstreamevent.d.ts +0 -1682
- package/models/openresponsesstreamevent.js +0 -1943
- package/models/openresponsestextconfig.d.ts +0 -58
- package/models/openresponsestextconfig.js +0 -62
- package/models/openresponsestoolchoice.d.ts +0 -147
- package/models/openresponsestoolchoice.js +0 -138
- package/models/openresponsestoolunion.d.ts +0 -94
- package/models/openresponsestoolunion.js +0 -93
- package/models/openresponseswebsearch20250826tool.d.ts +0 -93
- package/models/openresponseswebsearch20250826tool.js +0 -102
- package/models/openresponseswebsearchpreview20250311tool.d.ts +0 -63
- package/models/openresponseswebsearchpreview20250311tool.js +0 -67
- package/models/openresponseswebsearchpreviewtool.d.ts +0 -63
- package/models/openresponseswebsearchpreviewtool.js +0 -67
- package/models/openresponseswebsearchtool.d.ts +0 -93
- package/models/openresponseswebsearchtool.js +0 -102
- package/models/operations/createapialpharesponses.d.ts +0 -57
- package/models/operations/createapialpharesponses.js +0 -82
- package/models/operations/createcoinbasecharge.d.ts +0 -211
- package/models/operations/createcoinbasecharge.js +0 -266
- package/models/operations/createkeys.d.ts +0 -225
- package/models/operations/createkeys.js +0 -194
- package/models/operations/deletekeys.d.ts +0 -62
- package/models/operations/deletekeys.js +0 -55
- package/models/operations/getcredits.d.ts +0 -27
- package/models/operations/getcredits.js +0 -26
- package/models/operations/getcurrentkey.d.ts +0 -185
- package/models/operations/getcurrentkey.js +0 -147
- package/models/operations/getgeneration.d.ts +0 -271
- package/models/operations/getgeneration.js +0 -229
- package/models/operations/getkey.d.ts +0 -178
- package/models/operations/getkey.js +0 -147
- package/models/operations/getmodels.d.ts +0 -56
- package/models/operations/getmodels.js +0 -79
- package/models/operations/getparameters.d.ts +0 -249
- package/models/operations/getparameters.js +0 -259
- package/models/operations/getuseractivity.d.ts +0 -63
- package/models/operations/getuseractivity.js +0 -56
- package/models/operations/index.d.ts +0 -19
- package/models/operations/index.js +0 -22
- package/models/operations/list.d.ts +0 -180
- package/models/operations/list.js +0 -158
- package/models/operations/listendpoints.d.ts +0 -62
- package/models/operations/listendpoints.js +0 -58
- package/models/operations/listendpointszdr.d.ts +0 -53
- package/models/operations/listendpointszdr.js +0 -58
- package/models/operations/listmodelscount.d.ts +0 -25
- package/models/operations/listmodelscount.js +0 -33
- package/models/operations/listmodelsuser.d.ts +0 -50
- package/models/operations/listmodelsuser.js +0 -58
- package/models/operations/listproviders.d.ts +0 -115
- package/models/operations/listproviders.js +0 -104
- package/models/operations/sendchatcompletionrequest.d.ts +0 -26
- package/models/operations/sendchatcompletionrequest.js +0 -40
- package/models/operations/updatekeys.d.ts +0 -255
- package/models/operations/updatekeys.js +0 -229
- package/models/outputtextcontent.d.ts +0 -79
- package/models/outputtextcontent.js +0 -92
- package/models/publicendpoint.d.ts +0 -27
- package/models/publicendpoint.js +0 -26
- package/models/reasoningsummarytext.d.ts +0 -53
- package/models/reasoningsummarytext.js +0 -50
- package/models/reasoningsummaryverbosity.d.ts +0 -22
- package/models/reasoningsummaryverbosity.js +0 -32
- package/models/reasoningtextcontent.d.ts +0 -53
- package/models/reasoningtextcontent.js +0 -50
- package/models/refusalcontent.d.ts +0 -53
- package/models/refusalcontent.js +0 -50
- package/models/responseformatjsonschema.d.ts +0 -31
- package/models/responseformatjsonschema.js +0 -42
- package/models/responseformattextgrammar.d.ts +0 -30
- package/models/responseformattextgrammar.js +0 -32
- package/models/responseserrorfield.d.ts +0 -54
- package/models/responseserrorfield.js +0 -60
- package/models/responsesimagegenerationcall.d.ts +0 -58
- package/models/responsesimagegenerationcall.js +0 -55
- package/models/responsesoutputitem.d.ts +0 -33
- package/models/responsesoutputitem.js +0 -46
- package/models/responsesoutputitemfilesearchcall.d.ts +0 -58
- package/models/responsesoutputitemfilesearchcall.js +0 -55
- package/models/responsesoutputitemfunctioncall.d.ts +0 -59
- package/models/responsesoutputitemfunctioncall.js +0 -65
- package/models/responsesoutputitemreasoning.d.ts +0 -61
- package/models/responsesoutputitemreasoning.js +0 -67
- package/models/responsesoutputmessage.d.ts +0 -191
- package/models/responsesoutputmessage.js +0 -189
- package/models/responsessearchcontextsize.d.ts +0 -28
- package/models/responsessearchcontextsize.js +0 -35
- package/models/responsesusage.d.ts +0 -130
- package/models/responsesusage.js +0 -173
- package/models/responseswebsearchcalloutput.d.ts +0 -56
- package/models/responseswebsearchcalloutput.js +0 -53
- package/models/responseswebsearchuserlocation.d.ts +0 -62
- package/models/responseswebsearchuserlocation.js +0 -56
- package/models/security.d.ts +0 -28
- package/models/security.js +0 -31
- package/models/systemmessage.d.ts +0 -54
- package/models/systemmessage.js +0 -63
- package/models/tool.d.ts +0 -65
- package/models/tool.js +0 -64
- package/models/toolcallstatus.d.ts +0 -22
- package/models/toolcallstatus.js +0 -32
- package/models/toolchoicetypes.d.ts +0 -163
- package/models/toolchoicetypes.js +0 -166
- package/models/toolresponsemessage.d.ts +0 -54
- package/models/toolresponsemessage.js +0 -68
- package/models/urlcitationannotation.d.ts +0 -59
- package/models/urlcitationannotation.js +0 -67
- package/models/usermessage.d.ts +0 -54
- package/models/usermessage.js +0 -63
- package/models/websearchpreviewtooluserlocation.d.ts +0 -59
- package/models/websearchpreviewtooluserlocation.js +0 -56
- package/models/websearchstatus.d.ts +0 -23
- package/models/websearchstatus.js +0 -33
- package/react-query/_context.d.ts +0 -7
- package/react-query/_context.js +0 -13
- package/react-query/_types.d.ts +0 -26
- package/react-query/_types.js +0 -4
- package/react-query/analyticsGetUserActivity.d.ts +0 -35
- package/react-query/analyticsGetUserActivity.js +0 -76
- package/react-query/apiKeysCreate.d.ts +0 -19
- package/react-query/apiKeysCreate.js +0 -38
- package/react-query/apiKeysDelete.d.ts +0 -19
- package/react-query/apiKeysDelete.js +0 -38
- package/react-query/apiKeysGet.d.ts +0 -23
- package/react-query/apiKeysGet.js +0 -65
- package/react-query/apiKeysGetCurrentKeyMetadata.d.ts +0 -28
- package/react-query/apiKeysGetCurrentKeyMetadata.js +0 -65
- package/react-query/apiKeysList.d.ts +0 -36
- package/react-query/apiKeysList.js +0 -68
- package/react-query/apiKeysUpdate.d.ts +0 -19
- package/react-query/apiKeysUpdate.js +0 -38
- package/react-query/betaResponsesSend.d.ts +0 -23
- package/react-query/betaResponsesSend.js +0 -41
- package/react-query/chatSend.d.ts +0 -23
- package/react-query/chatSend.js +0 -41
- package/react-query/completionsGenerate.d.ts +0 -22
- package/react-query/completionsGenerate.js +0 -41
- package/react-query/creditsCreateCoinbaseCharge.d.ts +0 -24
- package/react-query/creditsCreateCoinbaseCharge.js +0 -41
- package/react-query/creditsGetCredits.d.ts +0 -28
- package/react-query/creditsGetCredits.js +0 -65
- package/react-query/endpointsList.d.ts +0 -23
- package/react-query/endpointsList.js +0 -65
- package/react-query/endpointsListZdrEndpoints.d.ts +0 -22
- package/react-query/endpointsListZdrEndpoints.js +0 -59
- package/react-query/generationsGetGeneration.d.ts +0 -29
- package/react-query/generationsGetGeneration.js +0 -70
- package/react-query/index.d.ts +0 -22
- package/react-query/index.js +0 -25
- package/react-query/modelsCount.d.ts +0 -22
- package/react-query/modelsCount.js +0 -59
- package/react-query/modelsList.d.ts +0 -42
- package/react-query/modelsList.js +0 -70
- package/react-query/modelsListForUser.d.ts +0 -22
- package/react-query/modelsListForUser.js +0 -59
- package/react-query/parametersGetParameters.d.ts +0 -37
- package/react-query/parametersGetParameters.js +0 -79
- package/react-query/providersList.d.ts +0 -22
- package/react-query/providersList.js +0 -59
- package/sdk/analytics.d.ts +0 -11
- package/sdk/analytics.js +0 -17
- package/sdk/apikeys.d.ts +0 -31
- package/sdk/apikeys.js +0 -52
- package/sdk/beta.d.ts +0 -6
- package/sdk/beta.js +0 -10
- package/sdk/chat.d.ts +0 -12
- package/sdk/chat.js +0 -17
- package/sdk/completions.d.ts +0 -11
- package/sdk/completions.js +0 -17
- package/sdk/credits.d.ts +0 -19
- package/sdk/credits.js +0 -27
- package/sdk/endpoints.d.ts +0 -12
- package/sdk/endpoints.js +0 -21
- package/sdk/generations.d.ts +0 -8
- package/sdk/generations.js +0 -14
- package/sdk/index.d.ts +0 -1
- package/sdk/index.js +0 -4
- package/sdk/models.d.ts +0 -16
- package/sdk/models.js +0 -28
- package/sdk/parameters.d.ts +0 -8
- package/sdk/parameters.js +0 -14
- package/sdk/providers.d.ts +0 -8
- package/sdk/providers.js +0 -14
- package/sdk/responses.d.ts +0 -12
- package/sdk/responses.js +0 -17
- package/sdk/sdk.d.ts +0 -36
- package/sdk/sdk.js +0 -50
- package/types/async.d.ts +0 -22
- package/types/async.js +0 -39
- package/types/blobs.d.ts +0 -3
- package/types/blobs.js +0 -24
- package/types/constdatetime.d.ts +0 -2
- package/types/constdatetime.js +0 -9
- package/types/enums.d.ts +0 -11
- package/types/enums.js +0 -6
- package/types/fp.d.ts +0 -30
- package/types/fp.js +0 -30
- package/types/index.d.ts +0 -7
- package/types/index.js +0 -7
- package/types/operations.d.ts +0 -26
- package/types/operations.js +0 -76
- package/types/rfcdate.d.ts +0 -20
- package/types/rfcdate.js +0 -41
- package/types/streams.d.ts +0 -1
- package/types/streams.js +0 -14
package/esm/lib/sdks.js
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
5
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
6
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
7
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
8
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
9
|
+
};
|
|
10
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
11
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
13
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14
|
+
};
|
|
15
|
+
var _ClientSDK_httpClient, _ClientSDK_hooks, _ClientSDK_logger;
|
|
16
|
+
import { SDKHooks } from "../hooks/hooks.js";
|
|
17
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js";
|
|
18
|
+
import { ERR, OK } from "../types/fp.js";
|
|
19
|
+
import { stringToBase64 } from "./base64.js";
|
|
20
|
+
import { SDK_METADATA, serverURLFromOptions } from "./config.js";
|
|
21
|
+
import { encodeForm } from "./encodings.js";
|
|
22
|
+
import { env } from "./env.js";
|
|
23
|
+
import { HTTPClient, isAbortError, isConnectionError, isTimeoutError, matchContentType, matchStatusCode, } from "./http.js";
|
|
24
|
+
import { retry } from "./retries.js";
|
|
25
|
+
const gt = typeof globalThis === "undefined" ? null : globalThis;
|
|
26
|
+
const webWorkerLike = typeof gt === "object"
|
|
27
|
+
&& gt != null
|
|
28
|
+
&& "importScripts" in gt
|
|
29
|
+
&& typeof gt["importScripts"] === "function";
|
|
30
|
+
const isBrowserLike = webWorkerLike
|
|
31
|
+
|| (typeof navigator !== "undefined" && "serviceWorker" in navigator)
|
|
32
|
+
|| (typeof window === "object" && typeof window.document !== "undefined");
|
|
33
|
+
export class ClientSDK {
|
|
34
|
+
constructor(options = {}) {
|
|
35
|
+
_ClientSDK_httpClient.set(this, void 0);
|
|
36
|
+
_ClientSDK_hooks.set(this, void 0);
|
|
37
|
+
_ClientSDK_logger.set(this, void 0);
|
|
38
|
+
const opt = options;
|
|
39
|
+
if (typeof opt === "object"
|
|
40
|
+
&& opt != null
|
|
41
|
+
&& "hooks" in opt
|
|
42
|
+
&& opt.hooks instanceof SDKHooks) {
|
|
43
|
+
__classPrivateFieldSet(this, _ClientSDK_hooks, opt.hooks, "f");
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
__classPrivateFieldSet(this, _ClientSDK_hooks, new SDKHooks(), "f");
|
|
47
|
+
}
|
|
48
|
+
const defaultHttpClient = new HTTPClient();
|
|
49
|
+
options.httpClient = options.httpClient || defaultHttpClient;
|
|
50
|
+
options = __classPrivateFieldGet(this, _ClientSDK_hooks, "f").sdkInit(options);
|
|
51
|
+
const url = serverURLFromOptions(options);
|
|
52
|
+
if (url) {
|
|
53
|
+
url.pathname = url.pathname.replace(/\/+$/, "") + "/";
|
|
54
|
+
}
|
|
55
|
+
this._baseURL = url;
|
|
56
|
+
__classPrivateFieldSet(this, _ClientSDK_httpClient, options.httpClient || defaultHttpClient, "f");
|
|
57
|
+
this._options = { ...options, hooks: __classPrivateFieldGet(this, _ClientSDK_hooks, "f") };
|
|
58
|
+
__classPrivateFieldSet(this, _ClientSDK_logger, this._options.debugLogger, "f");
|
|
59
|
+
if (!__classPrivateFieldGet(this, _ClientSDK_logger, "f") && env().OPENROUTER_DEBUG) {
|
|
60
|
+
__classPrivateFieldSet(this, _ClientSDK_logger, console, "f");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
_createRequest(context, conf, options) {
|
|
64
|
+
const { method, path, query, headers: opHeaders, security } = conf;
|
|
65
|
+
const base = conf.baseURL ?? this._baseURL;
|
|
66
|
+
if (!base) {
|
|
67
|
+
return ERR(new InvalidRequestError("No base URL provided for operation"));
|
|
68
|
+
}
|
|
69
|
+
const reqURL = new URL(base);
|
|
70
|
+
const inputURL = new URL(path, reqURL);
|
|
71
|
+
if (path) {
|
|
72
|
+
reqURL.pathname += reqURL.pathname.endsWith("/") ? "" : "/";
|
|
73
|
+
reqURL.pathname += inputURL.pathname.replace(/^\/+/, "");
|
|
74
|
+
}
|
|
75
|
+
let finalQuery = query || "";
|
|
76
|
+
const secQuery = [];
|
|
77
|
+
for (const [k, v] of Object.entries(security?.queryParams || {})) {
|
|
78
|
+
const q = encodeForm(k, v, { charEncoding: "percent" });
|
|
79
|
+
if (typeof q !== "undefined") {
|
|
80
|
+
secQuery.push(q);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (secQuery.length) {
|
|
84
|
+
finalQuery += `&${secQuery.join("&")}`;
|
|
85
|
+
}
|
|
86
|
+
if (finalQuery) {
|
|
87
|
+
const q = finalQuery.startsWith("&") ? finalQuery.slice(1) : finalQuery;
|
|
88
|
+
reqURL.search = `?${q}`;
|
|
89
|
+
}
|
|
90
|
+
const headers = new Headers(opHeaders);
|
|
91
|
+
const username = security?.basic.username;
|
|
92
|
+
const password = security?.basic.password;
|
|
93
|
+
if (username != null || password != null) {
|
|
94
|
+
const encoded = stringToBase64([username || "", password || ""].join(":"));
|
|
95
|
+
headers.set("Authorization", `Basic ${encoded}`);
|
|
96
|
+
}
|
|
97
|
+
const securityHeaders = new Headers(security?.headers || {});
|
|
98
|
+
for (const [k, v] of securityHeaders) {
|
|
99
|
+
headers.set(k, v);
|
|
100
|
+
}
|
|
101
|
+
let cookie = headers.get("cookie") || "";
|
|
102
|
+
for (const [k, v] of Object.entries(security?.cookies || {})) {
|
|
103
|
+
cookie += `; ${k}=${v}`;
|
|
104
|
+
}
|
|
105
|
+
cookie = cookie.startsWith("; ") ? cookie.slice(2) : cookie;
|
|
106
|
+
headers.set("cookie", cookie);
|
|
107
|
+
const userHeaders = new Headers(options?.headers ?? options?.fetchOptions?.headers);
|
|
108
|
+
for (const [k, v] of userHeaders) {
|
|
109
|
+
headers.set(k, v);
|
|
110
|
+
}
|
|
111
|
+
// Only set user agent header in non-browser-like environments since CORS
|
|
112
|
+
// policy disallows setting it in browsers e.g. Chrome throws an error.
|
|
113
|
+
if (!isBrowserLike) {
|
|
114
|
+
headers.set(conf.uaHeader ?? "user-agent", conf.userAgent ?? SDK_METADATA.userAgent);
|
|
115
|
+
}
|
|
116
|
+
const fetchOptions = {
|
|
117
|
+
...options?.fetchOptions,
|
|
118
|
+
...options,
|
|
119
|
+
};
|
|
120
|
+
if (!fetchOptions?.signal && conf.timeoutMs && conf.timeoutMs > 0) {
|
|
121
|
+
const timeoutSignal = AbortSignal.timeout(conf.timeoutMs);
|
|
122
|
+
fetchOptions.signal = timeoutSignal;
|
|
123
|
+
}
|
|
124
|
+
if (conf.body instanceof ReadableStream) {
|
|
125
|
+
Object.assign(fetchOptions, { duplex: "half" });
|
|
126
|
+
}
|
|
127
|
+
let input;
|
|
128
|
+
try {
|
|
129
|
+
input = __classPrivateFieldGet(this, _ClientSDK_hooks, "f").beforeCreateRequest(context, {
|
|
130
|
+
url: reqURL,
|
|
131
|
+
options: {
|
|
132
|
+
...fetchOptions,
|
|
133
|
+
body: conf.body ?? null,
|
|
134
|
+
headers,
|
|
135
|
+
method,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
catch (err) {
|
|
140
|
+
return ERR(new UnexpectedClientError("Create request hook failed to execute", {
|
|
141
|
+
cause: err,
|
|
142
|
+
}));
|
|
143
|
+
}
|
|
144
|
+
return OK(new Request(input.url, input.options));
|
|
145
|
+
}
|
|
146
|
+
async _do(request, options) {
|
|
147
|
+
const { context, errorCodes } = options;
|
|
148
|
+
return retry(async () => {
|
|
149
|
+
const req = await __classPrivateFieldGet(this, _ClientSDK_hooks, "f").beforeRequest(context, request.clone());
|
|
150
|
+
await logRequest(__classPrivateFieldGet(this, _ClientSDK_logger, "f"), req).catch((e) => __classPrivateFieldGet(this, _ClientSDK_logger, "f")?.log("Failed to log request:", e));
|
|
151
|
+
let response = await __classPrivateFieldGet(this, _ClientSDK_httpClient, "f").request(req);
|
|
152
|
+
try {
|
|
153
|
+
if (matchStatusCode(response, errorCodes)) {
|
|
154
|
+
const result = await __classPrivateFieldGet(this, _ClientSDK_hooks, "f").afterError(context, response, null);
|
|
155
|
+
if (result.error) {
|
|
156
|
+
throw result.error;
|
|
157
|
+
}
|
|
158
|
+
response = result.response || response;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
response = await __classPrivateFieldGet(this, _ClientSDK_hooks, "f").afterSuccess(context, response);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
finally {
|
|
165
|
+
await logResponse(__classPrivateFieldGet(this, _ClientSDK_logger, "f"), response, req)
|
|
166
|
+
.catch(e => __classPrivateFieldGet(this, _ClientSDK_logger, "f")?.log("Failed to log response:", e));
|
|
167
|
+
}
|
|
168
|
+
return response;
|
|
169
|
+
}, { config: options.retryConfig, statusCodes: options.retryCodes }).then((r) => OK(r), (err) => {
|
|
170
|
+
switch (true) {
|
|
171
|
+
case isAbortError(err):
|
|
172
|
+
return ERR(new RequestAbortedError("Request aborted by client", {
|
|
173
|
+
cause: err,
|
|
174
|
+
}));
|
|
175
|
+
case isTimeoutError(err):
|
|
176
|
+
return ERR(new RequestTimeoutError("Request timed out", { cause: err }));
|
|
177
|
+
case isConnectionError(err):
|
|
178
|
+
return ERR(new ConnectionError("Unable to make request", { cause: err }));
|
|
179
|
+
default:
|
|
180
|
+
return ERR(new UnexpectedClientError("Unexpected HTTP client error", {
|
|
181
|
+
cause: err,
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
_ClientSDK_httpClient = new WeakMap(), _ClientSDK_hooks = new WeakMap(), _ClientSDK_logger = new WeakMap();
|
|
188
|
+
const jsonLikeContentTypeRE = /(application|text)\/.*?\+*json.*/;
|
|
189
|
+
const jsonlLikeContentTypeRE = /(application|text)\/(.*?\+*\bjsonl\b.*|.*?\+*\bx-ndjson\b.*)/;
|
|
190
|
+
async function logRequest(logger, req) {
|
|
191
|
+
if (!logger) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const contentType = req.headers.get("content-type");
|
|
195
|
+
const ct = contentType?.split(";")[0] || "";
|
|
196
|
+
logger.group(`> Request: ${req.method} ${req.url}`);
|
|
197
|
+
logger.group("Headers:");
|
|
198
|
+
for (const [k, v] of req.headers.entries()) {
|
|
199
|
+
logger.log(`${k}: ${v}`);
|
|
200
|
+
}
|
|
201
|
+
logger.groupEnd();
|
|
202
|
+
logger.group("Body:");
|
|
203
|
+
switch (true) {
|
|
204
|
+
case jsonLikeContentTypeRE.test(ct):
|
|
205
|
+
logger.log(await req.clone().json());
|
|
206
|
+
break;
|
|
207
|
+
case ct.startsWith("text/"):
|
|
208
|
+
logger.log(await req.clone().text());
|
|
209
|
+
break;
|
|
210
|
+
case ct === "multipart/form-data": {
|
|
211
|
+
const body = await req.clone().formData();
|
|
212
|
+
for (const [k, v] of body) {
|
|
213
|
+
const vlabel = v instanceof Blob ? "<Blob>" : v;
|
|
214
|
+
logger.log(`${k}: ${vlabel}`);
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
default:
|
|
219
|
+
logger.log(`<${contentType}>`);
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
logger.groupEnd();
|
|
223
|
+
logger.groupEnd();
|
|
224
|
+
}
|
|
225
|
+
async function logResponse(logger, res, req) {
|
|
226
|
+
if (!logger) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const contentType = res.headers.get("content-type");
|
|
230
|
+
const ct = contentType?.split(";")[0] || "";
|
|
231
|
+
logger.group(`< Response: ${req.method} ${req.url}`);
|
|
232
|
+
logger.log("Status Code:", res.status, res.statusText);
|
|
233
|
+
logger.group("Headers:");
|
|
234
|
+
for (const [k, v] of res.headers.entries()) {
|
|
235
|
+
logger.log(`${k}: ${v}`);
|
|
236
|
+
}
|
|
237
|
+
logger.groupEnd();
|
|
238
|
+
logger.group("Body:");
|
|
239
|
+
switch (true) {
|
|
240
|
+
case matchContentType(res, "application/json")
|
|
241
|
+
|| jsonLikeContentTypeRE.test(ct) && !jsonlLikeContentTypeRE.test(ct):
|
|
242
|
+
logger.log(await res.clone().json());
|
|
243
|
+
break;
|
|
244
|
+
case matchContentType(res, "application/jsonl")
|
|
245
|
+
|| jsonlLikeContentTypeRE.test(ct):
|
|
246
|
+
logger.log(await res.clone().text());
|
|
247
|
+
break;
|
|
248
|
+
case matchContentType(res, "text/event-stream"):
|
|
249
|
+
logger.log(`<${contentType}>`);
|
|
250
|
+
break;
|
|
251
|
+
case matchContentType(res, "text/*"):
|
|
252
|
+
logger.log(await res.clone().text());
|
|
253
|
+
break;
|
|
254
|
+
case matchContentType(res, "multipart/form-data"): {
|
|
255
|
+
const body = await res.clone().formData();
|
|
256
|
+
for (const [k, v] of body) {
|
|
257
|
+
const vlabel = v instanceof Blob ? "<Blob>" : v;
|
|
258
|
+
logger.log(`${k}: ${vlabel}`);
|
|
259
|
+
}
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
default:
|
|
263
|
+
logger.log(`<${contentType}>`);
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
logger.groupEnd();
|
|
267
|
+
logger.groupEnd();
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=sdks.js.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as models from "../models/index.js";
|
|
2
|
+
type OAuth2PasswordFlow = {
|
|
3
|
+
username: string;
|
|
4
|
+
password: string;
|
|
5
|
+
clientID?: string | undefined;
|
|
6
|
+
clientSecret?: string | undefined;
|
|
7
|
+
tokenURL: string;
|
|
8
|
+
};
|
|
9
|
+
export declare enum SecurityErrorCode {
|
|
10
|
+
Incomplete = "incomplete",
|
|
11
|
+
UnrecognisedSecurityType = "unrecognized_security_type"
|
|
12
|
+
}
|
|
13
|
+
export declare class SecurityError extends Error {
|
|
14
|
+
code: SecurityErrorCode;
|
|
15
|
+
constructor(code: SecurityErrorCode, message: string);
|
|
16
|
+
static incomplete(): SecurityError;
|
|
17
|
+
static unrecognizedType(type: string): SecurityError;
|
|
18
|
+
}
|
|
19
|
+
export type SecurityState = {
|
|
20
|
+
basic: {
|
|
21
|
+
username?: string | undefined;
|
|
22
|
+
password?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
headers: Record<string, string>;
|
|
25
|
+
queryParams: Record<string, string>;
|
|
26
|
+
cookies: Record<string, string>;
|
|
27
|
+
oauth2: ({
|
|
28
|
+
type: "password";
|
|
29
|
+
} & OAuth2PasswordFlow) | {
|
|
30
|
+
type: "none";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
type SecurityInputBasic = {
|
|
34
|
+
type: "http:basic";
|
|
35
|
+
value: {
|
|
36
|
+
username?: string | undefined;
|
|
37
|
+
password?: string | undefined;
|
|
38
|
+
} | null | undefined;
|
|
39
|
+
};
|
|
40
|
+
type SecurityInputBearer = {
|
|
41
|
+
type: "http:bearer";
|
|
42
|
+
value: string | null | undefined;
|
|
43
|
+
fieldName: string;
|
|
44
|
+
};
|
|
45
|
+
type SecurityInputAPIKey = {
|
|
46
|
+
type: "apiKey:header" | "apiKey:query" | "apiKey:cookie";
|
|
47
|
+
value: string | null | undefined;
|
|
48
|
+
fieldName: string;
|
|
49
|
+
};
|
|
50
|
+
type SecurityInputOIDC = {
|
|
51
|
+
type: "openIdConnect";
|
|
52
|
+
value: string | null | undefined;
|
|
53
|
+
fieldName: string;
|
|
54
|
+
};
|
|
55
|
+
type SecurityInputOAuth2 = {
|
|
56
|
+
type: "oauth2";
|
|
57
|
+
value: string | null | undefined;
|
|
58
|
+
fieldName: string;
|
|
59
|
+
};
|
|
60
|
+
type SecurityInputOAuth2ClientCredentials = {
|
|
61
|
+
type: "oauth2:client_credentials";
|
|
62
|
+
value: {
|
|
63
|
+
clientID?: string | undefined;
|
|
64
|
+
clientSecret?: string | undefined;
|
|
65
|
+
} | null | string | undefined;
|
|
66
|
+
fieldName?: string;
|
|
67
|
+
};
|
|
68
|
+
type SecurityInputOAuth2PasswordCredentials = {
|
|
69
|
+
type: "oauth2:password";
|
|
70
|
+
value: string | null | undefined;
|
|
71
|
+
fieldName?: string;
|
|
72
|
+
};
|
|
73
|
+
type SecurityInputCustom = {
|
|
74
|
+
type: "http:custom";
|
|
75
|
+
value: any | null | undefined;
|
|
76
|
+
fieldName?: string;
|
|
77
|
+
};
|
|
78
|
+
export type SecurityInput = SecurityInputBasic | SecurityInputBearer | SecurityInputAPIKey | SecurityInputOAuth2 | SecurityInputOAuth2ClientCredentials | SecurityInputOAuth2PasswordCredentials | SecurityInputOIDC | SecurityInputCustom;
|
|
79
|
+
export declare function resolveSecurity(...options: SecurityInput[][]): SecurityState | null;
|
|
80
|
+
export declare function resolveGlobalSecurity(security: Partial<models.Security> | null | undefined): SecurityState | null;
|
|
81
|
+
export declare function extractSecurity<T extends string | Record<string, unknown>>(sec: T | (() => Promise<T>) | undefined): Promise<T | undefined>;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=security.d.ts.map
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import { env } from "./env.js";
|
|
5
|
+
export var SecurityErrorCode;
|
|
6
|
+
(function (SecurityErrorCode) {
|
|
7
|
+
SecurityErrorCode["Incomplete"] = "incomplete";
|
|
8
|
+
SecurityErrorCode["UnrecognisedSecurityType"] = "unrecognized_security_type";
|
|
9
|
+
})(SecurityErrorCode || (SecurityErrorCode = {}));
|
|
10
|
+
export class SecurityError extends Error {
|
|
11
|
+
constructor(code, message) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.name = "SecurityError";
|
|
15
|
+
}
|
|
16
|
+
static incomplete() {
|
|
17
|
+
return new SecurityError(SecurityErrorCode.Incomplete, "Security requirements not met in order to perform the operation");
|
|
18
|
+
}
|
|
19
|
+
static unrecognizedType(type) {
|
|
20
|
+
return new SecurityError(SecurityErrorCode.UnrecognisedSecurityType, `Unrecognised security type: ${type}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function resolveSecurity(...options) {
|
|
24
|
+
const state = {
|
|
25
|
+
basic: {},
|
|
26
|
+
headers: {},
|
|
27
|
+
queryParams: {},
|
|
28
|
+
cookies: {},
|
|
29
|
+
oauth2: { type: "none" },
|
|
30
|
+
};
|
|
31
|
+
const option = options.find((opts) => {
|
|
32
|
+
return opts.every((o) => {
|
|
33
|
+
if (o.value == null) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
else if (o.type === "http:basic") {
|
|
37
|
+
return o.value.username != null || o.value.password != null;
|
|
38
|
+
}
|
|
39
|
+
else if (o.type === "http:custom") {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
else if (o.type === "oauth2:password") {
|
|
43
|
+
return (typeof o.value === "string" && !!o.value);
|
|
44
|
+
}
|
|
45
|
+
else if (o.type === "oauth2:client_credentials") {
|
|
46
|
+
if (typeof o.value == "string") {
|
|
47
|
+
return !!o.value;
|
|
48
|
+
}
|
|
49
|
+
return o.value.clientID != null || o.value.clientSecret != null;
|
|
50
|
+
}
|
|
51
|
+
else if (typeof o.value === "string") {
|
|
52
|
+
return !!o.value;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
throw new Error(`Unrecognized security type: ${o.type} (value type: ${typeof o
|
|
56
|
+
.value})`);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
if (option == null) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
option.forEach((spec) => {
|
|
64
|
+
if (spec.value == null) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const { type } = spec;
|
|
68
|
+
switch (type) {
|
|
69
|
+
case "apiKey:header":
|
|
70
|
+
state.headers[spec.fieldName] = spec.value;
|
|
71
|
+
break;
|
|
72
|
+
case "apiKey:query":
|
|
73
|
+
state.queryParams[spec.fieldName] = spec.value;
|
|
74
|
+
break;
|
|
75
|
+
case "apiKey:cookie":
|
|
76
|
+
state.cookies[spec.fieldName] = spec.value;
|
|
77
|
+
break;
|
|
78
|
+
case "http:basic":
|
|
79
|
+
applyBasic(state, spec);
|
|
80
|
+
break;
|
|
81
|
+
case "http:custom":
|
|
82
|
+
break;
|
|
83
|
+
case "http:bearer":
|
|
84
|
+
applyBearer(state, spec);
|
|
85
|
+
break;
|
|
86
|
+
case "oauth2":
|
|
87
|
+
applyBearer(state, spec);
|
|
88
|
+
break;
|
|
89
|
+
case "oauth2:password":
|
|
90
|
+
applyBearer(state, spec);
|
|
91
|
+
break;
|
|
92
|
+
case "oauth2:client_credentials":
|
|
93
|
+
break;
|
|
94
|
+
case "openIdConnect":
|
|
95
|
+
applyBearer(state, spec);
|
|
96
|
+
break;
|
|
97
|
+
default:
|
|
98
|
+
spec;
|
|
99
|
+
throw SecurityError.unrecognizedType(type);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
return state;
|
|
103
|
+
}
|
|
104
|
+
function applyBasic(state, spec) {
|
|
105
|
+
if (spec.value == null) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
state.basic = spec.value;
|
|
109
|
+
}
|
|
110
|
+
function applyBearer(state, spec) {
|
|
111
|
+
if (typeof spec.value !== "string" || !spec.value) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
let value = spec.value;
|
|
115
|
+
if (value.slice(0, 7).toLowerCase() !== "bearer ") {
|
|
116
|
+
value = `Bearer ${value}`;
|
|
117
|
+
}
|
|
118
|
+
if (spec.fieldName !== undefined) {
|
|
119
|
+
state.headers[spec.fieldName] = value;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
export function resolveGlobalSecurity(security) {
|
|
123
|
+
return resolveSecurity([
|
|
124
|
+
{
|
|
125
|
+
fieldName: "Authorization",
|
|
126
|
+
type: "http:bearer",
|
|
127
|
+
value: security?.apiKey ?? env().OPENROUTER_API_KEY,
|
|
128
|
+
},
|
|
129
|
+
]);
|
|
130
|
+
}
|
|
131
|
+
export async function extractSecurity(sec) {
|
|
132
|
+
if (sec == null) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
return typeof sec === "function" ? sec() : sec;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=security.js.map
|
package/esm/lib/url.d.ts
ADDED
package/esm/lib/url.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
const hasOwn = Object.prototype.hasOwnProperty;
|
|
5
|
+
export function pathToFunc(pathPattern, options) {
|
|
6
|
+
const paramRE = /\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;
|
|
7
|
+
return function buildURLPath(params = {}) {
|
|
8
|
+
return pathPattern.replace(paramRE, function (_, placeholder) {
|
|
9
|
+
if (!hasOwn.call(params, placeholder)) {
|
|
10
|
+
throw new Error(`Parameter '${placeholder}' is required`);
|
|
11
|
+
}
|
|
12
|
+
const value = params[placeholder];
|
|
13
|
+
if (typeof value !== "string" && typeof value !== "number") {
|
|
14
|
+
throw new Error(`Parameter '${placeholder}' must be a string or number`);
|
|
15
|
+
}
|
|
16
|
+
return options?.charEncoding === "percent"
|
|
17
|
+
? encodeURIComponent(`${value}`)
|
|
18
|
+
: `${value}`;
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=url.js.map
|
|
@@ -0,0 +1,82 @@
|
|
|
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 ActivityItem = {
|
|
5
|
+
/**
|
|
6
|
+
* Date of the activity (YYYY-MM-DD format)
|
|
7
|
+
*/
|
|
8
|
+
date: string;
|
|
9
|
+
/**
|
|
10
|
+
* Model slug (e.g., "openai/gpt-4.1")
|
|
11
|
+
*/
|
|
12
|
+
model: string;
|
|
13
|
+
/**
|
|
14
|
+
* Model permaslug (e.g., "openai/gpt-4.1-2025-04-14")
|
|
15
|
+
*/
|
|
16
|
+
modelPermaslug: string;
|
|
17
|
+
/**
|
|
18
|
+
* Unique identifier for the endpoint
|
|
19
|
+
*/
|
|
20
|
+
endpointId: string;
|
|
21
|
+
/**
|
|
22
|
+
* Name of the provider serving this endpoint
|
|
23
|
+
*/
|
|
24
|
+
providerName: string;
|
|
25
|
+
/**
|
|
26
|
+
* Total cost in USD (OpenRouter credits spent)
|
|
27
|
+
*/
|
|
28
|
+
usage: number;
|
|
29
|
+
/**
|
|
30
|
+
* BYOK inference cost in USD (external credits spent)
|
|
31
|
+
*/
|
|
32
|
+
byokUsageInference: number;
|
|
33
|
+
/**
|
|
34
|
+
* Number of requests made
|
|
35
|
+
*/
|
|
36
|
+
requests: number;
|
|
37
|
+
/**
|
|
38
|
+
* Total prompt tokens used
|
|
39
|
+
*/
|
|
40
|
+
promptTokens: number;
|
|
41
|
+
/**
|
|
42
|
+
* Total completion tokens generated
|
|
43
|
+
*/
|
|
44
|
+
completionTokens: number;
|
|
45
|
+
/**
|
|
46
|
+
* Total reasoning tokens used
|
|
47
|
+
*/
|
|
48
|
+
reasoningTokens: number;
|
|
49
|
+
};
|
|
50
|
+
/** @internal */
|
|
51
|
+
export declare const ActivityItem$inboundSchema: z.ZodType<ActivityItem, unknown>;
|
|
52
|
+
/** @internal */
|
|
53
|
+
export type ActivityItem$Outbound = {
|
|
54
|
+
date: string;
|
|
55
|
+
model: string;
|
|
56
|
+
model_permaslug: string;
|
|
57
|
+
endpoint_id: string;
|
|
58
|
+
provider_name: string;
|
|
59
|
+
usage: number;
|
|
60
|
+
byok_usage_inference: number;
|
|
61
|
+
requests: number;
|
|
62
|
+
prompt_tokens: number;
|
|
63
|
+
completion_tokens: number;
|
|
64
|
+
reasoning_tokens: number;
|
|
65
|
+
};
|
|
66
|
+
/** @internal */
|
|
67
|
+
export declare const ActivityItem$outboundSchema: z.ZodType<ActivityItem$Outbound, ActivityItem>;
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
71
|
+
*/
|
|
72
|
+
export declare namespace ActivityItem$ {
|
|
73
|
+
/** @deprecated use `ActivityItem$inboundSchema` instead. */
|
|
74
|
+
const inboundSchema: z.ZodType<ActivityItem, unknown, z.core.$ZodTypeInternals<ActivityItem, unknown>>;
|
|
75
|
+
/** @deprecated use `ActivityItem$outboundSchema` instead. */
|
|
76
|
+
const outboundSchema: z.ZodType<ActivityItem$Outbound, ActivityItem, z.core.$ZodTypeInternals<ActivityItem$Outbound, ActivityItem>>;
|
|
77
|
+
/** @deprecated use `ActivityItem$Outbound` instead. */
|
|
78
|
+
type Outbound = ActivityItem$Outbound;
|
|
79
|
+
}
|
|
80
|
+
export declare function activityItemToJSON(activityItem: ActivityItem): string;
|
|
81
|
+
export declare function activityItemFromJSON(jsonString: string): SafeParseResult<ActivityItem, SDKValidationError>;
|
|
82
|
+
//# sourceMappingURL=activityitem.d.ts.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4";
|
|
5
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const ActivityItem$inboundSchema = z
|
|
9
|
+
.object({
|
|
10
|
+
date: z.string(),
|
|
11
|
+
model: z.string(),
|
|
12
|
+
model_permaslug: z.string(),
|
|
13
|
+
endpoint_id: z.string(),
|
|
14
|
+
provider_name: z.string(),
|
|
15
|
+
usage: z.number(),
|
|
16
|
+
byok_usage_inference: z.number(),
|
|
17
|
+
requests: z.number(),
|
|
18
|
+
prompt_tokens: z.number(),
|
|
19
|
+
completion_tokens: z.number(),
|
|
20
|
+
reasoning_tokens: z.number(),
|
|
21
|
+
}).transform((v) => {
|
|
22
|
+
return remap$(v, {
|
|
23
|
+
"model_permaslug": "modelPermaslug",
|
|
24
|
+
"endpoint_id": "endpointId",
|
|
25
|
+
"provider_name": "providerName",
|
|
26
|
+
"byok_usage_inference": "byokUsageInference",
|
|
27
|
+
"prompt_tokens": "promptTokens",
|
|
28
|
+
"completion_tokens": "completionTokens",
|
|
29
|
+
"reasoning_tokens": "reasoningTokens",
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
/** @internal */
|
|
33
|
+
export const ActivityItem$outboundSchema = z.object({
|
|
34
|
+
date: z.string(),
|
|
35
|
+
model: z.string(),
|
|
36
|
+
modelPermaslug: z.string(),
|
|
37
|
+
endpointId: z.string(),
|
|
38
|
+
providerName: z.string(),
|
|
39
|
+
usage: z.number(),
|
|
40
|
+
byokUsageInference: z.number(),
|
|
41
|
+
requests: z.number(),
|
|
42
|
+
promptTokens: z.number(),
|
|
43
|
+
completionTokens: z.number(),
|
|
44
|
+
reasoningTokens: z.number(),
|
|
45
|
+
}).transform((v) => {
|
|
46
|
+
return remap$(v, {
|
|
47
|
+
modelPermaslug: "model_permaslug",
|
|
48
|
+
endpointId: "endpoint_id",
|
|
49
|
+
providerName: "provider_name",
|
|
50
|
+
byokUsageInference: "byok_usage_inference",
|
|
51
|
+
promptTokens: "prompt_tokens",
|
|
52
|
+
completionTokens: "completion_tokens",
|
|
53
|
+
reasoningTokens: "reasoning_tokens",
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
59
|
+
*/
|
|
60
|
+
export var ActivityItem$;
|
|
61
|
+
(function (ActivityItem$) {
|
|
62
|
+
/** @deprecated use `ActivityItem$inboundSchema` instead. */
|
|
63
|
+
ActivityItem$.inboundSchema = ActivityItem$inboundSchema;
|
|
64
|
+
/** @deprecated use `ActivityItem$outboundSchema` instead. */
|
|
65
|
+
ActivityItem$.outboundSchema = ActivityItem$outboundSchema;
|
|
66
|
+
})(ActivityItem$ || (ActivityItem$ = {}));
|
|
67
|
+
export function activityItemToJSON(activityItem) {
|
|
68
|
+
return JSON.stringify(ActivityItem$outboundSchema.parse(activityItem));
|
|
69
|
+
}
|
|
70
|
+
export function activityItemFromJSON(jsonString) {
|
|
71
|
+
return safeParse(jsonString, (x) => ActivityItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ActivityItem' from JSON`);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=activityitem.js.map
|