@openrouter/sdk 0.0.1-beta.9 → 0.0.1
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 +109 -1
- package/REACT_QUERY.md +109 -1
- package/README.md +52 -396
- package/esm/funcs/analyticsGetUserActivity.d.ts +1 -1
- package/esm/funcs/analyticsGetUserActivity.js +2 -2
- package/esm/funcs/apiKeysCreate.d.ts +1 -1
- package/esm/funcs/apiKeysCreate.js +2 -2
- package/esm/funcs/apiKeysDelete.d.ts +1 -1
- package/esm/funcs/apiKeysDelete.js +2 -2
- package/esm/funcs/apiKeysGet.d.ts +1 -1
- package/esm/funcs/apiKeysGet.js +2 -2
- package/esm/funcs/apiKeysGetCurrentKeyMetadata.d.ts +1 -1
- package/esm/funcs/apiKeysGetCurrentKeyMetadata.js +2 -2
- package/esm/funcs/apiKeysList.d.ts +1 -1
- package/esm/funcs/apiKeysList.js +2 -2
- package/esm/funcs/apiKeysUpdate.d.ts +1 -1
- package/esm/funcs/apiKeysUpdate.js +2 -2
- package/esm/funcs/betaResponsesSend.d.ts +9 -1
- package/esm/funcs/betaResponsesSend.js +38 -14
- package/esm/funcs/chatSend.d.ts +7 -0
- package/esm/funcs/chatSend.js +1 -7
- package/esm/funcs/creditsCreateCoinbaseCharge.d.ts +1 -1
- package/esm/funcs/creditsCreateCoinbaseCharge.js +15 -5
- package/esm/funcs/creditsGetCredits.d.ts +1 -1
- package/esm/funcs/creditsGetCredits.js +2 -2
- package/esm/funcs/endpointsList.d.ts +1 -1
- package/esm/funcs/endpointsList.js +2 -2
- package/esm/funcs/endpointsListZdrEndpoints.d.ts +2 -1
- package/esm/funcs/endpointsListZdrEndpoints.js +6 -2
- package/esm/funcs/generationsGetGeneration.d.ts +1 -1
- package/esm/funcs/generationsGetGeneration.js +13 -2
- package/esm/funcs/modelsCount.d.ts +3 -2
- package/esm/funcs/modelsCount.js +7 -3
- package/esm/funcs/modelsList.d.ts +3 -1
- package/esm/funcs/modelsList.js +8 -7
- package/esm/funcs/modelsListForUser.d.ts +3 -1
- package/esm/funcs/modelsListForUser.js +7 -3
- package/esm/funcs/oAuthCreateAuthCode.d.ts +18 -0
- package/esm/funcs/oAuthCreateAuthCode.js +82 -0
- package/esm/funcs/oAuthCreateAuthorizationUrl.d.ts +2 -2
- package/esm/funcs/oAuthExchangeAuthCodeForAPIKey.d.ts +18 -0
- package/esm/funcs/oAuthExchangeAuthCodeForAPIKey.js +82 -0
- package/esm/funcs/parametersGetParameters.d.ts +1 -1
- package/esm/funcs/parametersGetParameters.js +2 -2
- package/esm/funcs/providersList.d.ts +1 -1
- package/esm/funcs/providersList.js +1 -1
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/lib/event-streams.d.ts +1 -1
- package/esm/models/badgatewayresponseerrordata.d.ts +40 -0
- package/esm/models/badgatewayresponseerrordata.js +35 -0
- package/esm/models/badrequestresponseerrordata.d.ts +40 -0
- package/esm/models/badrequestresponseerrordata.js +35 -0
- package/esm/models/chatgenerationparams.d.ts +12 -12
- package/esm/models/chatgenerationparams.js +16 -16
- package/esm/models/chatgenerationtokenusage.d.ts +2 -2
- package/esm/models/chatgenerationtokenusage.js +2 -4
- package/esm/models/chatmessagetokenlogprob.d.ts +15 -15
- package/esm/models/chatmessagetokenlogprob.js +16 -15
- package/esm/models/chatstreamingresponsechunk.d.ts +15 -15
- package/esm/models/chatstreamingresponsechunk.js +15 -15
- package/esm/models/completioncreateparams.d.ts +2 -2
- package/esm/models/completioncreateparams.js +2 -2
- package/esm/models/createchargerequest.d.ts +31 -2
- package/esm/models/createchargerequest.js +47 -2
- package/esm/models/defaultparameters.d.ts +36 -0
- package/esm/models/defaultparameters.js +46 -0
- package/esm/models/edgenetworktimeoutresponseerrordata.d.ts +40 -0
- package/esm/models/edgenetworktimeoutresponseerrordata.js +35 -0
- package/esm/models/endpointstatus.d.ts +26 -0
- package/esm/models/endpointstatus.js +36 -0
- package/esm/models/errors/badgatewayresponseerror.d.ts +52 -0
- package/esm/models/errors/badgatewayresponseerror.js +63 -0
- package/esm/models/errors/badrequestresponseerror.d.ts +52 -0
- package/esm/models/errors/badrequestresponseerror.js +63 -0
- package/esm/models/errors/edgenetworktimeoutresponseerror.d.ts +52 -0
- package/esm/models/errors/edgenetworktimeoutresponseerror.js +63 -0
- package/esm/models/errors/forbiddenresponseerror.d.ts +52 -0
- package/esm/models/errors/forbiddenresponseerror.js +63 -0
- package/esm/models/errors/index.d.ts +14 -2
- package/esm/models/errors/index.js +14 -2
- package/esm/models/errors/internalserverresponseerror.d.ts +52 -0
- package/esm/models/errors/internalserverresponseerror.js +63 -0
- package/esm/models/errors/notfoundresponseerror.d.ts +52 -0
- package/esm/models/errors/{errorresponse.js → notfoundresponseerror.js} +16 -17
- package/esm/models/errors/payloadtoolargeresponseerror.d.ts +52 -0
- package/esm/models/errors/payloadtoolargeresponseerror.js +63 -0
- package/esm/models/errors/paymentrequiredresponseerror.d.ts +52 -0
- package/esm/models/errors/paymentrequiredresponseerror.js +63 -0
- package/esm/models/errors/provideroverloadedresponseerror.d.ts +52 -0
- package/esm/models/errors/provideroverloadedresponseerror.js +63 -0
- package/esm/models/errors/requesttimeoutresponseerror.d.ts +52 -0
- package/esm/models/errors/requesttimeoutresponseerror.js +63 -0
- package/esm/models/errors/serviceunavailableresponseerror.d.ts +52 -0
- package/esm/models/errors/serviceunavailableresponseerror.js +63 -0
- package/esm/models/errors/toomanyrequestsresponseerror.d.ts +52 -0
- package/esm/models/errors/toomanyrequestsresponseerror.js +63 -0
- package/esm/models/errors/unauthorizedresponseerror.d.ts +52 -0
- package/esm/models/errors/unauthorizedresponseerror.js +63 -0
- package/esm/models/errors/unprocessableentityresponseerror.d.ts +52 -0
- package/esm/models/errors/unprocessableentityresponseerror.js +63 -0
- package/esm/models/filecitation.d.ts +58 -0
- package/esm/models/filecitation.js +65 -0
- package/esm/models/filepath.d.ts +56 -0
- package/esm/models/filepath.js +64 -0
- package/esm/models/forbiddenresponseerrordata.d.ts +40 -0
- package/esm/models/forbiddenresponseerrordata.js +35 -0
- package/esm/models/index.d.ts +67 -23
- package/esm/models/index.js +67 -23
- package/esm/models/inputmodality.d.ts +25 -0
- package/esm/models/inputmodality.js +35 -0
- package/esm/models/instructtype.d.ts +48 -0
- package/esm/models/instructtype.js +55 -0
- package/esm/models/internalserverresponseerrordata.d.ts +40 -0
- package/esm/models/internalserverresponseerrordata.js +35 -0
- package/esm/models/listendpointsresponse.d.ts +126 -2
- package/esm/models/listendpointsresponse.js +115 -2
- package/esm/models/model.d.ts +101 -0
- package/esm/models/model.js +82 -0
- package/esm/models/modelarchitecture.d.ts +104 -0
- package/esm/models/modelarchitecture.js +107 -0
- package/esm/models/modelgroup.d.ts +45 -0
- package/esm/models/modelgroup.js +53 -0
- package/esm/models/modelscountresponse.d.ts +40 -2
- package/esm/models/modelscountresponse.js +31 -2
- package/esm/models/modelslistresponse.d.ts +10 -2
- package/esm/models/modelslistresponse.js +7 -2
- package/esm/models/notfoundresponseerrordata.d.ts +40 -0
- package/esm/models/notfoundresponseerrordata.js +35 -0
- package/esm/models/openairesponsesannotation.d.ts +28 -0
- package/esm/models/openairesponsesannotation.js +38 -0
- package/esm/models/openairesponsesincludable.d.ts +25 -0
- package/esm/models/openairesponsesincludable.js +35 -0
- package/esm/models/openairesponsesincompletedetails.d.ts +49 -0
- package/esm/models/openairesponsesincompletedetails.js +58 -0
- package/esm/models/openairesponsesinputunion.d.ts +588 -0
- package/esm/models/openairesponsesinputunion.js +686 -0
- package/esm/models/openairesponsesprompt.d.ts +83 -0
- package/esm/models/openairesponsesprompt.js +97 -0
- package/esm/models/openairesponsesreasoningconfig.d.ts +33 -0
- package/esm/models/openairesponsesreasoningconfig.js +35 -0
- package/esm/models/openairesponsesreasoningeffort.d.ts +24 -0
- package/esm/models/openairesponsesreasoningeffort.js +34 -0
- package/esm/models/openairesponsesrefusalcontent.d.ts +54 -0
- package/esm/models/openairesponsesrefusalcontent.js +51 -0
- package/esm/models/openairesponsesresponsestatus.d.ts +26 -0
- package/esm/models/openairesponsesresponsestatus.js +36 -0
- package/esm/models/openairesponsesservicetier.d.ts +25 -0
- package/esm/models/openairesponsesservicetier.js +35 -0
- package/esm/models/openairesponsestoolchoiceunion.d.ts +231 -0
- package/esm/models/openairesponsestoolchoiceunion.js +233 -0
- package/esm/models/openairesponsestruncation.d.ts +22 -0
- package/esm/models/openairesponsestruncation.js +32 -0
- package/esm/models/openresponseseasyinputmessage.d.ts +75 -19
- package/esm/models/openresponseseasyinputmessage.js +105 -16
- package/esm/models/openresponseserrorevent.d.ts +63 -0
- package/esm/models/openresponseserrorevent.js +66 -0
- package/esm/models/openresponsesimagegencallcompleted.d.ts +61 -0
- package/esm/models/openresponsesimagegencallcompleted.js +68 -0
- package/esm/models/openresponsesimagegencallgenerating.d.ts +61 -0
- package/esm/models/openresponsesimagegencallgenerating.js +68 -0
- package/esm/models/openresponsesimagegencallinprogress.d.ts +61 -0
- package/esm/models/openresponsesimagegencallinprogress.js +68 -0
- package/esm/models/openresponsesimagegencallpartialimage.d.ts +65 -0
- package/esm/models/openresponsesimagegencallpartialimage.js +76 -0
- package/esm/models/openresponsesinput.d.ts +36 -5
- package/esm/models/openresponsesinput.js +82 -5
- package/esm/models/openresponsesinputmessageitem.d.ts +52 -8
- package/esm/models/openresponsesinputmessageitem.js +68 -5
- package/esm/models/openresponseslogprobs.d.ts +3 -32
- package/esm/models/openresponseslogprobs.js +3 -29
- package/esm/models/openresponsesnonstreamingresponse.d.ts +93 -123
- package/esm/models/openresponsesnonstreamingresponse.js +111 -145
- package/esm/models/openresponsesreasoning.d.ts +89 -0
- package/esm/models/openresponsesreasoning.js +93 -0
- package/esm/models/openresponsesreasoningconfig.d.ts +2 -23
- package/esm/models/openresponsesreasoningconfig.js +3 -33
- package/esm/models/openresponsesreasoningdeltaevent.d.ts +65 -0
- package/esm/models/openresponsesreasoningdeltaevent.js +74 -0
- package/esm/models/openresponsesreasoningdoneevent.d.ts +65 -0
- package/esm/models/openresponsesreasoningdoneevent.js +74 -0
- package/esm/models/openresponsesreasoningsummarypartaddedevent.d.ts +66 -0
- package/esm/models/openresponsesreasoningsummarypartaddedevent.js +75 -0
- package/esm/models/openresponsesreasoningsummarytextdeltaevent.d.ts +65 -0
- package/esm/models/openresponsesreasoningsummarytextdeltaevent.js +74 -0
- package/esm/models/openresponsesreasoningsummarytextdoneevent.d.ts +65 -0
- package/esm/models/openresponsesreasoningsummarytextdoneevent.js +74 -0
- package/esm/models/openresponsesrequest.d.ts +736 -2
- package/esm/models/openresponsesrequest.js +789 -2
- package/esm/models/openresponsesresponsetext.d.ts +59 -0
- package/esm/models/openresponsesresponsetext.js +64 -0
- package/esm/models/openresponsesstreamevent.d.ts +25 -612
- package/esm/models/openresponsesstreamevent.js +51 -742
- package/esm/models/openresponsestoplogprobs.d.ts +34 -0
- package/esm/models/openresponsestoplogprobs.js +33 -0
- package/esm/models/{responsesusage.d.ts → openresponsesusage.d.ts} +14 -14
- package/esm/models/{responsesusage.js → openresponsesusage.js} +14 -14
- package/esm/models/operations/createauthkeyscode.d.ts +145 -0
- package/esm/models/operations/createauthkeyscode.js +146 -0
- package/esm/models/operations/createresponses.d.ts +58 -0
- package/esm/models/operations/createresponses.js +80 -0
- package/esm/models/operations/exchangeauthcodeforapikey.d.ts +104 -0
- package/esm/models/operations/exchangeauthcodeforapikey.js +111 -0
- package/esm/models/operations/getmodels.d.ts +0 -26
- package/esm/models/operations/getmodels.js +0 -38
- package/esm/models/operations/getparameters.d.ts +1 -0
- package/esm/models/operations/getparameters.js +1 -0
- package/esm/models/operations/index.d.ts +3 -2
- package/esm/models/operations/index.js +3 -2
- package/esm/models/operations/listendpointszdr.d.ts +3 -24
- package/esm/models/operations/listendpointszdr.js +2 -29
- package/esm/models/operations/listmodelsuser.d.ts +0 -22
- package/esm/models/operations/listmodelsuser.js +0 -28
- package/esm/models/operations/listproviders.d.ts +0 -36
- package/esm/models/operations/listproviders.js +0 -28
- package/esm/models/operations/sendchatcompletionrequest.d.ts +1 -1
- package/esm/models/operations/sendchatcompletionrequest.js +2 -1
- package/esm/models/outputitemimagegenerationcall.d.ts +59 -0
- package/esm/models/outputitemimagegenerationcall.js +56 -0
- package/esm/models/outputmessage.d.ts +192 -0
- package/esm/models/outputmessage.js +202 -0
- package/esm/models/outputmodality.d.ts +23 -0
- package/esm/models/outputmodality.js +33 -0
- package/esm/models/parameter.d.ts +43 -0
- package/esm/models/parameter.js +54 -0
- package/esm/models/payloadtoolargeresponseerrordata.d.ts +40 -0
- package/esm/models/payloadtoolargeresponseerrordata.js +35 -0
- package/esm/models/paymentrequiredresponseerrordata.d.ts +40 -0
- package/esm/models/paymentrequiredresponseerrordata.js +35 -0
- package/esm/models/perrequestlimits.d.ts +40 -0
- package/esm/models/perrequestlimits.js +44 -0
- package/esm/models/providername.d.ts +106 -0
- package/esm/models/providername.js +116 -0
- package/esm/models/provideroverloadedresponseerrordata.d.ts +40 -0
- package/esm/models/provideroverloadedresponseerrordata.js +35 -0
- package/esm/models/publicendpoint.d.ts +140 -2
- package/esm/models/publicendpoint.js +156 -2
- package/esm/models/publicpricing.d.ts +87 -0
- package/esm/models/publicpricing.js +73 -0
- package/esm/models/quantization.d.ts +29 -0
- package/esm/models/quantization.js +39 -0
- package/esm/models/requesttimeoutresponseerrordata.d.ts +40 -0
- package/esm/models/requesttimeoutresponseerrordata.js +35 -0
- package/esm/models/responseformattextconfig.d.ts +31 -0
- package/esm/models/responseformattextconfig.js +38 -0
- package/esm/models/responseinputfile.d.ts +63 -0
- package/esm/models/responseinputfile.js +70 -0
- package/esm/models/responseinputimage.d.ts +79 -0
- package/esm/models/responseinputimage.js +90 -0
- package/esm/models/responseinputtext.d.ts +57 -0
- package/esm/models/responseinputtext.js +51 -0
- package/esm/models/responseoutputtext.d.ts +57 -0
- package/esm/models/responseoutputtext.js +54 -0
- package/esm/models/responseserrorfield.d.ts +25 -10
- package/esm/models/responseserrorfield.js +29 -14
- package/esm/models/responsesformatjsonobject.d.ts +55 -0
- package/esm/models/responsesformatjsonobject.js +49 -0
- package/esm/models/responsesformattext.d.ts +55 -0
- package/esm/models/responsesformattext.js +49 -0
- package/esm/models/responsesformattextjsonschemaconfig.d.ts +67 -0
- package/esm/models/responsesformattextjsonschemaconfig.js +57 -0
- package/esm/models/responsesoutputitemfunctioncall.d.ts +89 -0
- package/esm/models/responsesoutputitemfunctioncall.js +93 -0
- package/esm/models/responsesoutputitemreasoning.d.ts +92 -0
- package/esm/models/responsesoutputitemreasoning.js +93 -0
- package/esm/models/responsesoutputmessage.d.ts +45 -42
- package/esm/models/responsesoutputmessage.js +76 -65
- package/esm/models/responsetextconfig.d.ts +59 -0
- package/esm/models/responsetextconfig.js +62 -0
- package/esm/models/serviceunavailableresponseerrordata.d.ts +40 -0
- package/esm/models/serviceunavailableresponseerrordata.js +35 -0
- package/esm/models/toomanyrequestsresponseerrordata.d.ts +40 -0
- package/esm/models/toomanyrequestsresponseerrordata.js +35 -0
- package/esm/models/topproviderinfo.d.ts +45 -0
- package/esm/models/topproviderinfo.js +48 -0
- package/esm/models/unauthorizedresponseerrordata.d.ts +40 -0
- package/esm/models/unauthorizedresponseerrordata.js +35 -0
- package/esm/models/unprocessableentityresponseerrordata.d.ts +40 -0
- package/esm/models/unprocessableentityresponseerrordata.js +35 -0
- package/esm/models/urlcitation.d.ts +60 -0
- package/esm/models/urlcitation.js +69 -0
- package/esm/react-query/betaResponsesSend.d.ts +1 -1
- package/esm/react-query/index.d.ts +2 -0
- package/esm/react-query/index.js +2 -0
- package/esm/react-query/modelsCount.d.ts +2 -2
- package/esm/react-query/modelsList.d.ts +2 -7
- package/esm/react-query/modelsList.js +0 -2
- package/esm/react-query/modelsListForUser.d.ts +2 -1
- package/esm/react-query/oAuthCreateAuthCode.d.ts +23 -0
- package/esm/react-query/oAuthCreateAuthCode.js +42 -0
- package/esm/react-query/oAuthExchangeAuthCodeForAPIKey.d.ts +23 -0
- package/esm/react-query/oAuthExchangeAuthCodeForAPIKey.js +42 -0
- package/esm/sdk/chat.d.ts +7 -0
- package/esm/sdk/chat.js +0 -6
- package/esm/sdk/models.d.ts +4 -3
- package/esm/sdk/oauth.d.ts +46 -0
- package/esm/sdk/oauth.js +67 -0
- package/esm/sdk/responses.d.ts +8 -1
- package/esm/sdk/responses.js +0 -6
- package/esm/sdk/sdk.d.ts +3 -0
- package/esm/sdk/sdk.js +4 -0
- package/jsr.json +1 -1
- package/package.json +3 -1
- package/vitest.config.ts +26 -0
- package/esm/models/errorresponse.d.ts +0 -155
- package/esm/models/errorresponse.js +0 -167
- package/esm/models/errors/errorresponse.d.ts +0 -46
- package/esm/models/errors/listproviders.d.ts +0 -49
- package/esm/models/errors/listproviders.js +0 -51
- package/esm/models/filecitationannotation.d.ts +0 -58
- package/esm/models/filecitationannotation.js +0 -64
- package/esm/models/filepathannotation.d.ts +0 -56
- package/esm/models/filepathannotation.js +0 -62
- package/esm/models/openresponsesformatjsonobject.d.ts +0 -55
- package/esm/models/openresponsesformatjsonobject.js +0 -49
- package/esm/models/openresponsesformatjsonschema.d.ts +0 -67
- package/esm/models/openresponsesformatjsonschema.js +0 -57
- package/esm/models/openresponsesformattext.d.ts +0 -55
- package/esm/models/openresponsesformattext.js +0 -49
- package/esm/models/openresponsesformattextconfig.d.ts +0 -31
- package/esm/models/openresponsesformattextconfig.js +0 -38
- package/esm/models/openresponsesinputcontent.d.ts +0 -43
- package/esm/models/openresponsesinputcontent.js +0 -50
- package/esm/models/openresponsesinputfile.d.ts +0 -63
- package/esm/models/openresponsesinputfile.js +0 -70
- package/esm/models/openresponsesinputimage.d.ts +0 -79
- package/esm/models/openresponsesinputimage.js +0 -90
- package/esm/models/openresponsesinputitem.d.ts +0 -39
- package/esm/models/openresponsesinputitem.js +0 -62
- package/esm/models/openresponsesinputtext.d.ts +0 -57
- package/esm/models/openresponsesinputtext.js +0 -51
- package/esm/models/openresponsesoutputtext.d.ts +0 -80
- package/esm/models/openresponsesoutputtext.js +0 -93
- package/esm/models/openresponsesprompt.d.ts +0 -39
- package/esm/models/openresponsesprompt.js +0 -34
- package/esm/models/openresponsesrefusalcontent.d.ts +0 -54
- package/esm/models/openresponsesrefusalcontent.js +0 -51
- package/esm/models/openresponsestextconfig.d.ts +0 -59
- package/esm/models/openresponsestextconfig.js +0 -63
- package/esm/models/openresponsestoolchoice.d.ts +0 -148
- package/esm/models/openresponsestoolchoice.js +0 -139
- package/esm/models/openresponsestoolunion.d.ts +0 -95
- package/esm/models/openresponsestoolunion.js +0 -94
- package/esm/models/operations/createapialpharesponses.d.ts +0 -58
- package/esm/models/operations/createapialpharesponses.js +0 -83
- package/esm/models/operations/listmodelscount.d.ts +0 -26
- package/esm/models/operations/listmodelscount.js +0 -34
- package/esm/models/outputtextcontent.d.ts +0 -80
- package/esm/models/outputtextcontent.js +0 -93
- package/esm/models/refusalcontent.d.ts +0 -54
- package/esm/models/refusalcontent.js +0 -51
- package/esm/models/toolchoicetypes.d.ts +0 -164
- package/esm/models/toolchoicetypes.js +0 -167
- package/esm/models/urlcitationannotation.d.ts +0 -60
- package/esm/models/urlcitationannotation.js +0 -68
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
5
|
+
import * as M from "../lib/matchers.js";
|
|
6
|
+
import { compactMap } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
9
|
+
import { pathToFunc } from "../lib/url.js";
|
|
10
|
+
import * as errors from "../models/errors/index.js";
|
|
11
|
+
import * as operations from "../models/operations/index.js";
|
|
12
|
+
import { APIPromise } from "../types/async.js";
|
|
13
|
+
/**
|
|
14
|
+
* Create authorization code
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Create an authorization code for the PKCE flow to generate a user-controlled API key
|
|
18
|
+
*/
|
|
19
|
+
export function oAuthCreateAuthCode(client, request, options) {
|
|
20
|
+
return new APIPromise($do(client, request, options));
|
|
21
|
+
}
|
|
22
|
+
async function $do(client, request, options) {
|
|
23
|
+
const parsed = safeParse(request, (value) => operations.CreateAuthKeysCodeRequest$outboundSchema.parse(value), "Input validation failed");
|
|
24
|
+
if (!parsed.ok) {
|
|
25
|
+
return [parsed, { status: "invalid" }];
|
|
26
|
+
}
|
|
27
|
+
const payload = parsed.value;
|
|
28
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
29
|
+
const path = pathToFunc("/auth/keys/code")();
|
|
30
|
+
const headers = new Headers(compactMap({
|
|
31
|
+
"Content-Type": "application/json",
|
|
32
|
+
Accept: "application/json",
|
|
33
|
+
}));
|
|
34
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
35
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
36
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
37
|
+
const context = {
|
|
38
|
+
options: client._options,
|
|
39
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
40
|
+
operationID: "createAuthKeysCode",
|
|
41
|
+
oAuth2Scopes: null,
|
|
42
|
+
resolvedSecurity: requestSecurity,
|
|
43
|
+
securitySource: client._options.apiKey,
|
|
44
|
+
retryConfig: options?.retries
|
|
45
|
+
|| client._options.retryConfig
|
|
46
|
+
|| { strategy: "none" },
|
|
47
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
48
|
+
};
|
|
49
|
+
const requestRes = client._createRequest(context, {
|
|
50
|
+
security: requestSecurity,
|
|
51
|
+
method: "POST",
|
|
52
|
+
baseURL: options?.serverURL,
|
|
53
|
+
path: path,
|
|
54
|
+
headers: headers,
|
|
55
|
+
body: body,
|
|
56
|
+
userAgent: client._options.userAgent,
|
|
57
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
58
|
+
}, options);
|
|
59
|
+
if (!requestRes.ok) {
|
|
60
|
+
return [requestRes, { status: "invalid" }];
|
|
61
|
+
}
|
|
62
|
+
const req = requestRes.value;
|
|
63
|
+
const doResult = await client._do(req, {
|
|
64
|
+
context,
|
|
65
|
+
errorCodes: ["400", "401", "4XX", "500", "5XX"],
|
|
66
|
+
retryConfig: context.retryConfig,
|
|
67
|
+
retryCodes: context.retryCodes,
|
|
68
|
+
});
|
|
69
|
+
if (!doResult.ok) {
|
|
70
|
+
return [doResult, { status: "request-error", request: req }];
|
|
71
|
+
}
|
|
72
|
+
const response = doResult.value;
|
|
73
|
+
const responseFields = {
|
|
74
|
+
HttpMeta: { Response: response, Request: req },
|
|
75
|
+
};
|
|
76
|
+
const [result] = await M.match(M.json(200, operations.CreateAuthKeysCodeResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
77
|
+
if (!result.ok) {
|
|
78
|
+
return [result, { status: "complete", request: req, response }];
|
|
79
|
+
}
|
|
80
|
+
return [result, { status: "complete", request: req, response }];
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=oAuthCreateAuthCode.js.map
|
|
@@ -9,13 +9,13 @@ declare const CreateAuthorizationurlParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
9
9
|
codeChallenge: z.ZodString;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
11
|
callbackUrl: string | URL;
|
|
12
|
-
codeChallengeMethod: "S256" | "plain";
|
|
13
12
|
codeChallenge: string;
|
|
13
|
+
codeChallengeMethod: "S256" | "plain";
|
|
14
14
|
limit?: number | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
callbackUrl: string | URL;
|
|
17
|
-
codeChallengeMethod: "S256" | "plain";
|
|
18
17
|
codeChallenge: string;
|
|
18
|
+
codeChallengeMethod: "S256" | "plain";
|
|
19
19
|
limit?: number | undefined;
|
|
20
20
|
}>, z.ZodObject<{
|
|
21
21
|
callbackUrl: z.ZodUnion<[z.ZodString, z.ZodType<URL, z.ZodTypeDef, URL>]>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
/**
|
|
12
|
+
* Exchange authorization code for API key
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Exchange an authorization code from the PKCE flow for a user-controlled API key
|
|
16
|
+
*/
|
|
17
|
+
export declare function oAuthExchangeAuthCodeForAPIKey(client: OpenRouterCore, request: operations.ExchangeAuthCodeForAPIKeyRequest, options?: RequestOptions): APIPromise<Result<operations.ExchangeAuthCodeForAPIKeyResponse, errors.BadRequestResponseError | errors.ForbiddenResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
//# sourceMappingURL=oAuthExchangeAuthCodeForAPIKey.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
5
|
+
import * as M from "../lib/matchers.js";
|
|
6
|
+
import { compactMap } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
9
|
+
import { pathToFunc } from "../lib/url.js";
|
|
10
|
+
import * as errors from "../models/errors/index.js";
|
|
11
|
+
import * as operations from "../models/operations/index.js";
|
|
12
|
+
import { APIPromise } from "../types/async.js";
|
|
13
|
+
/**
|
|
14
|
+
* Exchange authorization code for API key
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Exchange an authorization code from the PKCE flow for a user-controlled API key
|
|
18
|
+
*/
|
|
19
|
+
export function oAuthExchangeAuthCodeForAPIKey(client, request, options) {
|
|
20
|
+
return new APIPromise($do(client, request, options));
|
|
21
|
+
}
|
|
22
|
+
async function $do(client, request, options) {
|
|
23
|
+
const parsed = safeParse(request, (value) => operations.ExchangeAuthCodeForAPIKeyRequest$outboundSchema.parse(value), "Input validation failed");
|
|
24
|
+
if (!parsed.ok) {
|
|
25
|
+
return [parsed, { status: "invalid" }];
|
|
26
|
+
}
|
|
27
|
+
const payload = parsed.value;
|
|
28
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
29
|
+
const path = pathToFunc("/auth/keys")();
|
|
30
|
+
const headers = new Headers(compactMap({
|
|
31
|
+
"Content-Type": "application/json",
|
|
32
|
+
Accept: "application/json",
|
|
33
|
+
}));
|
|
34
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
35
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
36
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
37
|
+
const context = {
|
|
38
|
+
options: client._options,
|
|
39
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
40
|
+
operationID: "exchangeAuthCodeForAPIKey",
|
|
41
|
+
oAuth2Scopes: null,
|
|
42
|
+
resolvedSecurity: requestSecurity,
|
|
43
|
+
securitySource: client._options.apiKey,
|
|
44
|
+
retryConfig: options?.retries
|
|
45
|
+
|| client._options.retryConfig
|
|
46
|
+
|| { strategy: "none" },
|
|
47
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
48
|
+
};
|
|
49
|
+
const requestRes = client._createRequest(context, {
|
|
50
|
+
security: requestSecurity,
|
|
51
|
+
method: "POST",
|
|
52
|
+
baseURL: options?.serverURL,
|
|
53
|
+
path: path,
|
|
54
|
+
headers: headers,
|
|
55
|
+
body: body,
|
|
56
|
+
userAgent: client._options.userAgent,
|
|
57
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
58
|
+
}, options);
|
|
59
|
+
if (!requestRes.ok) {
|
|
60
|
+
return [requestRes, { status: "invalid" }];
|
|
61
|
+
}
|
|
62
|
+
const req = requestRes.value;
|
|
63
|
+
const doResult = await client._do(req, {
|
|
64
|
+
context,
|
|
65
|
+
errorCodes: ["400", "403", "4XX", "500", "5XX"],
|
|
66
|
+
retryConfig: context.retryConfig,
|
|
67
|
+
retryCodes: context.retryCodes,
|
|
68
|
+
});
|
|
69
|
+
if (!doResult.ok) {
|
|
70
|
+
return [doResult, { status: "request-error", request: req }];
|
|
71
|
+
}
|
|
72
|
+
const response = doResult.value;
|
|
73
|
+
const responseFields = {
|
|
74
|
+
HttpMeta: { Response: response, Request: req },
|
|
75
|
+
};
|
|
76
|
+
const [result] = await M.match(M.json(200, operations.ExchangeAuthCodeForAPIKeyResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
77
|
+
if (!result.ok) {
|
|
78
|
+
return [result, { status: "complete", request: req, response }];
|
|
79
|
+
}
|
|
80
|
+
return [result, { status: "complete", request: req, response }];
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=oAuthExchangeAuthCodeForAPIKey.js.map
|
|
@@ -11,5 +11,5 @@ import { Result } from "../types/fp.js";
|
|
|
11
11
|
/**
|
|
12
12
|
* Get a model's supported parameters and data about which are most popular
|
|
13
13
|
*/
|
|
14
|
-
export declare function parametersGetParameters(client: OpenRouterCore, security: operations.GetParametersSecurity, request: operations.GetParametersRequest, options?: RequestOptions): APIPromise<Result<operations.GetParametersResponse, errors.
|
|
14
|
+
export declare function parametersGetParameters(client: OpenRouterCore, security: operations.GetParametersSecurity, request: operations.GetParametersRequest, options?: RequestOptions): APIPromise<Result<operations.GetParametersResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
15
15
|
//# sourceMappingURL=parametersGetParameters.d.ts.map
|
|
@@ -76,7 +76,7 @@ async function $do(client, security, request, options) {
|
|
|
76
76
|
const req = requestRes.value;
|
|
77
77
|
const doResult = await client._do(req, {
|
|
78
78
|
context,
|
|
79
|
-
errorCodes: ["4XX", "5XX"],
|
|
79
|
+
errorCodes: ["401", "404", "4XX", "500", "5XX"],
|
|
80
80
|
retryConfig: context.retryConfig,
|
|
81
81
|
retryCodes: context.retryCodes,
|
|
82
82
|
});
|
|
@@ -87,7 +87,7 @@ async function $do(client, security, request, options) {
|
|
|
87
87
|
const responseFields = {
|
|
88
88
|
HttpMeta: { Response: response, Request: req },
|
|
89
89
|
};
|
|
90
|
-
const [result] = await M.match(M.json(200, operations.GetParametersResponse$inboundSchema), M.jsonErr(
|
|
90
|
+
const [result] = await M.match(M.json(200, operations.GetParametersResponse$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
91
91
|
if (!result.ok) {
|
|
92
92
|
return [result, { status: "complete", request: req, response }];
|
|
93
93
|
}
|
|
@@ -11,5 +11,5 @@ import { Result } from "../types/fp.js";
|
|
|
11
11
|
/**
|
|
12
12
|
* List all providers
|
|
13
13
|
*/
|
|
14
|
-
export declare function providersList(client: OpenRouterCore, options?: RequestOptions): APIPromise<Result<operations.ListProvidersResponse, errors.
|
|
14
|
+
export declare function providersList(client: OpenRouterCore, options?: RequestOptions): APIPromise<Result<operations.ListProvidersResponse, errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
15
15
|
//# sourceMappingURL=providersList.d.ts.map
|
|
@@ -60,7 +60,7 @@ async function $do(client, options) {
|
|
|
60
60
|
const responseFields = {
|
|
61
61
|
HttpMeta: { Response: response, Request: req },
|
|
62
62
|
};
|
|
63
|
-
const [result] = await M.match(M.json(200, operations.ListProvidersResponse$inboundSchema), M.jsonErr(500, errors.
|
|
63
|
+
const [result] = await M.match(M.json(200, operations.ListProvidersResponse$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
64
64
|
if (!result.ok) {
|
|
65
65
|
return [result, { status: "complete", request: req, response }];
|
|
66
66
|
}
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -37,8 +37,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
37
37
|
export declare const SDK_METADATA: {
|
|
38
38
|
readonly language: "typescript";
|
|
39
39
|
readonly openapiDocVersion: "1.0.0";
|
|
40
|
-
readonly sdkVersion: "0.0.1
|
|
41
|
-
readonly genVersion: "2.
|
|
42
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.0.1
|
|
40
|
+
readonly sdkVersion: "0.0.1";
|
|
41
|
+
readonly genVersion: "2.731.6";
|
|
42
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.0.1 2.731.6 1.0.0 @openrouter/sdk";
|
|
43
43
|
};
|
|
44
44
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -25,8 +25,8 @@ export function serverURLFromOptions(options) {
|
|
|
25
25
|
export const SDK_METADATA = {
|
|
26
26
|
language: "typescript",
|
|
27
27
|
openapiDocVersion: "1.0.0",
|
|
28
|
-
sdkVersion: "0.0.1
|
|
29
|
-
genVersion: "2.
|
|
30
|
-
userAgent: "speakeasy-sdk/typescript 0.0.1
|
|
28
|
+
sdkVersion: "0.0.1",
|
|
29
|
+
genVersion: "2.731.6",
|
|
30
|
+
userAgent: "speakeasy-sdk/typescript 0.0.1 2.731.6 1.0.0 @openrouter/sdk",
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=config.js.map
|
|
@@ -4,7 +4,7 @@ export type SseMessage<T> = {
|
|
|
4
4
|
id?: string | undefined;
|
|
5
5
|
retry?: number | undefined;
|
|
6
6
|
};
|
|
7
|
-
export declare class EventStream<T extends
|
|
7
|
+
export declare class EventStream<T> extends ReadableStream<T> {
|
|
8
8
|
constructor(responseBody: ReadableStream<Uint8Array>, parse: (x: SseMessage<string>) => IteratorResult<T, undefined>);
|
|
9
9
|
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
|
10
10
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
/**
|
|
5
|
+
* Error data for BadGatewayResponse
|
|
6
|
+
*/
|
|
7
|
+
export type BadGatewayResponseErrorData = {
|
|
8
|
+
code: number;
|
|
9
|
+
message: string;
|
|
10
|
+
metadata?: {
|
|
11
|
+
[k: string]: any | null;
|
|
12
|
+
} | null | undefined;
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare const BadGatewayResponseErrorData$inboundSchema: z.ZodType<BadGatewayResponseErrorData, unknown>;
|
|
16
|
+
/** @internal */
|
|
17
|
+
export type BadGatewayResponseErrorData$Outbound = {
|
|
18
|
+
code: number;
|
|
19
|
+
message: string;
|
|
20
|
+
metadata?: {
|
|
21
|
+
[k: string]: any | null;
|
|
22
|
+
} | null | undefined;
|
|
23
|
+
};
|
|
24
|
+
/** @internal */
|
|
25
|
+
export declare const BadGatewayResponseErrorData$outboundSchema: z.ZodType<BadGatewayResponseErrorData$Outbound, BadGatewayResponseErrorData>;
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
29
|
+
*/
|
|
30
|
+
export declare namespace BadGatewayResponseErrorData$ {
|
|
31
|
+
/** @deprecated use `BadGatewayResponseErrorData$inboundSchema` instead. */
|
|
32
|
+
const inboundSchema: z.ZodType<BadGatewayResponseErrorData, unknown, z.core.$ZodTypeInternals<BadGatewayResponseErrorData, unknown>>;
|
|
33
|
+
/** @deprecated use `BadGatewayResponseErrorData$outboundSchema` instead. */
|
|
34
|
+
const outboundSchema: z.ZodType<BadGatewayResponseErrorData$Outbound, BadGatewayResponseErrorData, z.core.$ZodTypeInternals<BadGatewayResponseErrorData$Outbound, BadGatewayResponseErrorData>>;
|
|
35
|
+
/** @deprecated use `BadGatewayResponseErrorData$Outbound` instead. */
|
|
36
|
+
type Outbound = BadGatewayResponseErrorData$Outbound;
|
|
37
|
+
}
|
|
38
|
+
export declare function badGatewayResponseErrorDataToJSON(badGatewayResponseErrorData: BadGatewayResponseErrorData): string;
|
|
39
|
+
export declare function badGatewayResponseErrorDataFromJSON(jsonString: string): SafeParseResult<BadGatewayResponseErrorData, SDKValidationError>;
|
|
40
|
+
//# sourceMappingURL=badgatewayresponseerrordata.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4";
|
|
5
|
+
import { safeParse } from "../lib/schemas.js";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export const BadGatewayResponseErrorData$inboundSchema = z.object({
|
|
8
|
+
code: z.number().int(),
|
|
9
|
+
message: z.string(),
|
|
10
|
+
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
|
+
});
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const BadGatewayResponseErrorData$outboundSchema = z.object({
|
|
14
|
+
code: z.number().int(),
|
|
15
|
+
message: z.string(),
|
|
16
|
+
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
21
|
+
*/
|
|
22
|
+
export var BadGatewayResponseErrorData$;
|
|
23
|
+
(function (BadGatewayResponseErrorData$) {
|
|
24
|
+
/** @deprecated use `BadGatewayResponseErrorData$inboundSchema` instead. */
|
|
25
|
+
BadGatewayResponseErrorData$.inboundSchema = BadGatewayResponseErrorData$inboundSchema;
|
|
26
|
+
/** @deprecated use `BadGatewayResponseErrorData$outboundSchema` instead. */
|
|
27
|
+
BadGatewayResponseErrorData$.outboundSchema = BadGatewayResponseErrorData$outboundSchema;
|
|
28
|
+
})(BadGatewayResponseErrorData$ || (BadGatewayResponseErrorData$ = {}));
|
|
29
|
+
export function badGatewayResponseErrorDataToJSON(badGatewayResponseErrorData) {
|
|
30
|
+
return JSON.stringify(BadGatewayResponseErrorData$outboundSchema.parse(badGatewayResponseErrorData));
|
|
31
|
+
}
|
|
32
|
+
export function badGatewayResponseErrorDataFromJSON(jsonString) {
|
|
33
|
+
return safeParse(jsonString, (x) => BadGatewayResponseErrorData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BadGatewayResponseErrorData' from JSON`);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=badgatewayresponseerrordata.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
/**
|
|
5
|
+
* Error data for BadRequestResponse
|
|
6
|
+
*/
|
|
7
|
+
export type BadRequestResponseErrorData = {
|
|
8
|
+
code: number;
|
|
9
|
+
message: string;
|
|
10
|
+
metadata?: {
|
|
11
|
+
[k: string]: any | null;
|
|
12
|
+
} | null | undefined;
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare const BadRequestResponseErrorData$inboundSchema: z.ZodType<BadRequestResponseErrorData, unknown>;
|
|
16
|
+
/** @internal */
|
|
17
|
+
export type BadRequestResponseErrorData$Outbound = {
|
|
18
|
+
code: number;
|
|
19
|
+
message: string;
|
|
20
|
+
metadata?: {
|
|
21
|
+
[k: string]: any | null;
|
|
22
|
+
} | null | undefined;
|
|
23
|
+
};
|
|
24
|
+
/** @internal */
|
|
25
|
+
export declare const BadRequestResponseErrorData$outboundSchema: z.ZodType<BadRequestResponseErrorData$Outbound, BadRequestResponseErrorData>;
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
29
|
+
*/
|
|
30
|
+
export declare namespace BadRequestResponseErrorData$ {
|
|
31
|
+
/** @deprecated use `BadRequestResponseErrorData$inboundSchema` instead. */
|
|
32
|
+
const inboundSchema: z.ZodType<BadRequestResponseErrorData, unknown, z.core.$ZodTypeInternals<BadRequestResponseErrorData, unknown>>;
|
|
33
|
+
/** @deprecated use `BadRequestResponseErrorData$outboundSchema` instead. */
|
|
34
|
+
const outboundSchema: z.ZodType<BadRequestResponseErrorData$Outbound, BadRequestResponseErrorData, z.core.$ZodTypeInternals<BadRequestResponseErrorData$Outbound, BadRequestResponseErrorData>>;
|
|
35
|
+
/** @deprecated use `BadRequestResponseErrorData$Outbound` instead. */
|
|
36
|
+
type Outbound = BadRequestResponseErrorData$Outbound;
|
|
37
|
+
}
|
|
38
|
+
export declare function badRequestResponseErrorDataToJSON(badRequestResponseErrorData: BadRequestResponseErrorData): string;
|
|
39
|
+
export declare function badRequestResponseErrorDataFromJSON(jsonString: string): SafeParseResult<BadRequestResponseErrorData, SDKValidationError>;
|
|
40
|
+
//# sourceMappingURL=badrequestresponseerrordata.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4";
|
|
5
|
+
import { safeParse } from "../lib/schemas.js";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export const BadRequestResponseErrorData$inboundSchema = z.object({
|
|
8
|
+
code: z.number().int(),
|
|
9
|
+
message: z.string(),
|
|
10
|
+
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
11
|
+
});
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const BadRequestResponseErrorData$outboundSchema = z.object({
|
|
14
|
+
code: z.number().int(),
|
|
15
|
+
message: z.string(),
|
|
16
|
+
metadata: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
21
|
+
*/
|
|
22
|
+
export var BadRequestResponseErrorData$;
|
|
23
|
+
(function (BadRequestResponseErrorData$) {
|
|
24
|
+
/** @deprecated use `BadRequestResponseErrorData$inboundSchema` instead. */
|
|
25
|
+
BadRequestResponseErrorData$.inboundSchema = BadRequestResponseErrorData$inboundSchema;
|
|
26
|
+
/** @deprecated use `BadRequestResponseErrorData$outboundSchema` instead. */
|
|
27
|
+
BadRequestResponseErrorData$.outboundSchema = BadRequestResponseErrorData$outboundSchema;
|
|
28
|
+
})(BadRequestResponseErrorData$ || (BadRequestResponseErrorData$ = {}));
|
|
29
|
+
export function badRequestResponseErrorDataToJSON(badRequestResponseErrorData) {
|
|
30
|
+
return JSON.stringify(BadRequestResponseErrorData$outboundSchema.parse(badRequestResponseErrorData));
|
|
31
|
+
}
|
|
32
|
+
export function badRequestResponseErrorDataFromJSON(jsonString) {
|
|
33
|
+
return safeParse(jsonString, (x) => BadRequestResponseErrorData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BadRequestResponseErrorData' from JSON`);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=badrequestresponseerrordata.js.map
|
|
@@ -8,15 +8,15 @@ import { ReasoningSummaryVerbosity } from "./reasoningsummaryverbosity.js";
|
|
|
8
8
|
import { ResponseFormatJSONSchema, ResponseFormatJSONSchema$Outbound } from "./responseformatjsonschema.js";
|
|
9
9
|
import { ResponseFormatTextGrammar, ResponseFormatTextGrammar$Outbound } from "./responseformattextgrammar.js";
|
|
10
10
|
import { Tool, Tool$Outbound } from "./tool.js";
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const Effort: {
|
|
12
12
|
readonly Minimal: "minimal";
|
|
13
13
|
readonly Low: "low";
|
|
14
14
|
readonly Medium: "medium";
|
|
15
15
|
readonly High: "high";
|
|
16
16
|
};
|
|
17
|
-
export type
|
|
17
|
+
export type Effort = OpenEnum<typeof Effort>;
|
|
18
18
|
export type Reasoning = {
|
|
19
|
-
effort?:
|
|
19
|
+
effort?: Effort | null | undefined;
|
|
20
20
|
summary?: ReasoningSummaryVerbosity | null | undefined;
|
|
21
21
|
};
|
|
22
22
|
export type ChatGenerationParamsResponseFormatPython = {
|
|
@@ -49,7 +49,7 @@ export type ChatGenerationParams = {
|
|
|
49
49
|
responseFormat?: ResponseFormatJSONSchema | ResponseFormatTextGrammar | ChatGenerationParamsResponseFormatText | ChatGenerationParamsResponseFormatJSONObject | ChatGenerationParamsResponseFormatPython | undefined;
|
|
50
50
|
seed?: number | null | undefined;
|
|
51
51
|
stop?: string | Array<string> | null | undefined;
|
|
52
|
-
stream?: boolean |
|
|
52
|
+
stream?: boolean | undefined;
|
|
53
53
|
streamOptions?: ChatStreamOptions | null | undefined;
|
|
54
54
|
temperature?: number | null | undefined;
|
|
55
55
|
toolChoice?: any | undefined;
|
|
@@ -58,18 +58,18 @@ export type ChatGenerationParams = {
|
|
|
58
58
|
user?: string | undefined;
|
|
59
59
|
};
|
|
60
60
|
/** @internal */
|
|
61
|
-
export declare const
|
|
61
|
+
export declare const Effort$inboundSchema: z.ZodType<Effort, unknown>;
|
|
62
62
|
/** @internal */
|
|
63
|
-
export declare const
|
|
63
|
+
export declare const Effort$outboundSchema: z.ZodType<Effort, Effort>;
|
|
64
64
|
/**
|
|
65
65
|
* @internal
|
|
66
66
|
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
67
67
|
*/
|
|
68
|
-
export declare namespace
|
|
69
|
-
/** @deprecated use `
|
|
70
|
-
const inboundSchema: z.ZodType<
|
|
71
|
-
/** @deprecated use `
|
|
72
|
-
const outboundSchema: z.ZodType<
|
|
68
|
+
export declare namespace Effort$ {
|
|
69
|
+
/** @deprecated use `Effort$inboundSchema` instead. */
|
|
70
|
+
const inboundSchema: z.ZodType<Effort, unknown, z.core.$ZodTypeInternals<Effort, unknown>>;
|
|
71
|
+
/** @deprecated use `Effort$outboundSchema` instead. */
|
|
72
|
+
const outboundSchema: z.ZodType<Effort, Effort, z.core.$ZodTypeInternals<Effort, Effort>>;
|
|
73
73
|
}
|
|
74
74
|
/** @internal */
|
|
75
75
|
export declare const Reasoning$inboundSchema: z.ZodType<Reasoning, unknown>;
|
|
@@ -222,7 +222,7 @@ export type ChatGenerationParams$Outbound = {
|
|
|
222
222
|
response_format?: ResponseFormatJSONSchema$Outbound | ResponseFormatTextGrammar$Outbound | ChatGenerationParamsResponseFormatText$Outbound | ChatGenerationParamsResponseFormatJSONObject$Outbound | ChatGenerationParamsResponseFormatPython$Outbound | undefined;
|
|
223
223
|
seed?: number | null | undefined;
|
|
224
224
|
stop?: string | Array<string> | null | undefined;
|
|
225
|
-
stream
|
|
225
|
+
stream: boolean;
|
|
226
226
|
stream_options?: ChatStreamOptions$Outbound | null | undefined;
|
|
227
227
|
temperature?: number | null | undefined;
|
|
228
228
|
tool_choice?: any | undefined;
|
|
@@ -11,42 +11,42 @@ import { ReasoningSummaryVerbosity$inboundSchema, ReasoningSummaryVerbosity$outb
|
|
|
11
11
|
import { ResponseFormatJSONSchema$inboundSchema, ResponseFormatJSONSchema$outboundSchema, } from "./responseformatjsonschema.js";
|
|
12
12
|
import { ResponseFormatTextGrammar$inboundSchema, ResponseFormatTextGrammar$outboundSchema, } from "./responseformattextgrammar.js";
|
|
13
13
|
import { Tool$inboundSchema, Tool$outboundSchema, } from "./tool.js";
|
|
14
|
-
export const
|
|
14
|
+
export const Effort = {
|
|
15
15
|
Minimal: "minimal",
|
|
16
16
|
Low: "low",
|
|
17
17
|
Medium: "medium",
|
|
18
18
|
High: "high",
|
|
19
19
|
};
|
|
20
20
|
/** @internal */
|
|
21
|
-
export const
|
|
21
|
+
export const Effort$inboundSchema = z
|
|
22
22
|
.union([
|
|
23
|
-
z.enum(
|
|
23
|
+
z.enum(Effort),
|
|
24
24
|
z.string().transform(catchUnrecognizedEnum),
|
|
25
25
|
]);
|
|
26
26
|
/** @internal */
|
|
27
|
-
export const
|
|
28
|
-
z.enum(
|
|
27
|
+
export const Effort$outboundSchema = z.union([
|
|
28
|
+
z.enum(Effort),
|
|
29
29
|
z.string().and(z.custom()),
|
|
30
30
|
]);
|
|
31
31
|
/**
|
|
32
32
|
* @internal
|
|
33
33
|
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
34
34
|
*/
|
|
35
|
-
export var
|
|
36
|
-
(function (
|
|
37
|
-
/** @deprecated use `
|
|
38
|
-
|
|
39
|
-
/** @deprecated use `
|
|
40
|
-
|
|
41
|
-
})(
|
|
35
|
+
export var Effort$;
|
|
36
|
+
(function (Effort$) {
|
|
37
|
+
/** @deprecated use `Effort$inboundSchema` instead. */
|
|
38
|
+
Effort$.inboundSchema = Effort$inboundSchema;
|
|
39
|
+
/** @deprecated use `Effort$outboundSchema` instead. */
|
|
40
|
+
Effort$.outboundSchema = Effort$outboundSchema;
|
|
41
|
+
})(Effort$ || (Effort$ = {}));
|
|
42
42
|
/** @internal */
|
|
43
43
|
export const Reasoning$inboundSchema = z.object({
|
|
44
|
-
effort: z.nullable(
|
|
44
|
+
effort: z.nullable(Effort$inboundSchema).optional(),
|
|
45
45
|
summary: z.nullable(ReasoningSummaryVerbosity$inboundSchema).optional(),
|
|
46
46
|
});
|
|
47
47
|
/** @internal */
|
|
48
48
|
export const Reasoning$outboundSchema = z.object({
|
|
49
|
-
effort: z.nullable(
|
|
49
|
+
effort: z.nullable(Effort$outboundSchema).optional(),
|
|
50
50
|
summary: z.nullable(ReasoningSummaryVerbosity$outboundSchema).optional(),
|
|
51
51
|
});
|
|
52
52
|
/**
|
|
@@ -217,7 +217,7 @@ export const ChatGenerationParams$inboundSchema = z.object({
|
|
|
217
217
|
]).optional(),
|
|
218
218
|
seed: z.nullable(z.number().int()).optional(),
|
|
219
219
|
stop: z.nullable(z.union([z.string(), z.array(z.string())])).optional(),
|
|
220
|
-
stream: z.
|
|
220
|
+
stream: z.boolean().default(false),
|
|
221
221
|
stream_options: z.nullable(ChatStreamOptions$inboundSchema).optional(),
|
|
222
222
|
temperature: z.nullable(z.number()).optional(),
|
|
223
223
|
tool_choice: z.any().optional(),
|
|
@@ -260,7 +260,7 @@ export const ChatGenerationParams$outboundSchema = z.object({
|
|
|
260
260
|
]).optional(),
|
|
261
261
|
seed: z.nullable(z.number().int()).optional(),
|
|
262
262
|
stop: z.nullable(z.union([z.string(), z.array(z.string())])).optional(),
|
|
263
|
-
stream: z.
|
|
263
|
+
stream: z.boolean().default(false),
|
|
264
264
|
streamOptions: z.nullable(ChatStreamOptions$outboundSchema).optional(),
|
|
265
265
|
temperature: z.nullable(z.number()).optional(),
|
|
266
266
|
toolChoice: z.any().optional(),
|
|
@@ -16,7 +16,7 @@ export type ChatGenerationTokenUsage = {
|
|
|
16
16
|
promptTokens: number;
|
|
17
17
|
totalTokens: number;
|
|
18
18
|
completionTokensDetails?: CompletionTokensDetails | undefined;
|
|
19
|
-
promptTokensDetails?: PromptTokensDetails | undefined;
|
|
19
|
+
promptTokensDetails?: PromptTokensDetails | null | undefined;
|
|
20
20
|
};
|
|
21
21
|
/** @internal */
|
|
22
22
|
export declare const CompletionTokensDetails$inboundSchema: z.ZodType<CompletionTokensDetails, unknown>;
|
|
@@ -74,7 +74,7 @@ export type ChatGenerationTokenUsage$Outbound = {
|
|
|
74
74
|
prompt_tokens: number;
|
|
75
75
|
total_tokens: number;
|
|
76
76
|
completion_tokens_details?: CompletionTokensDetails$Outbound | undefined;
|
|
77
|
-
prompt_tokens_details?: PromptTokensDetails$Outbound | undefined;
|
|
77
|
+
prompt_tokens_details?: PromptTokensDetails$Outbound | null | undefined;
|
|
78
78
|
};
|
|
79
79
|
/** @internal */
|
|
80
80
|
export declare const ChatGenerationTokenUsage$outboundSchema: z.ZodType<ChatGenerationTokenUsage$Outbound, ChatGenerationTokenUsage>;
|
|
@@ -93,8 +93,7 @@ export const ChatGenerationTokenUsage$inboundSchema = z.object({
|
|
|
93
93
|
total_tokens: z.number(),
|
|
94
94
|
completion_tokens_details: z.lazy(() => CompletionTokensDetails$inboundSchema)
|
|
95
95
|
.optional(),
|
|
96
|
-
prompt_tokens_details: z.lazy(() => PromptTokensDetails$inboundSchema)
|
|
97
|
-
.optional(),
|
|
96
|
+
prompt_tokens_details: z.nullable(z.lazy(() => PromptTokensDetails$inboundSchema)).optional(),
|
|
98
97
|
}).transform((v) => {
|
|
99
98
|
return remap$(v, {
|
|
100
99
|
"completion_tokens": "completionTokens",
|
|
@@ -111,8 +110,7 @@ export const ChatGenerationTokenUsage$outboundSchema = z.object({
|
|
|
111
110
|
totalTokens: z.number(),
|
|
112
111
|
completionTokensDetails: z.lazy(() => CompletionTokensDetails$outboundSchema)
|
|
113
112
|
.optional(),
|
|
114
|
-
promptTokensDetails: z.lazy(() => PromptTokensDetails$outboundSchema)
|
|
115
|
-
.optional(),
|
|
113
|
+
promptTokensDetails: z.nullable(z.lazy(() => PromptTokensDetails$outboundSchema)).optional(),
|
|
116
114
|
}).transform((v) => {
|
|
117
115
|
return remap$(v, {
|
|
118
116
|
completionTokens: "completion_tokens",
|