@openrouter/sdk 0.0.1-beta.9 → 0.1.0
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/REACT_QUERY.md +3 -12
- 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/.devcontainer/README.md +0 -35
- 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
- package/examples/README.md +0 -31
|
@@ -8,7 +8,7 @@ export type BetaResponsesSendMutationVariables = {
|
|
|
8
8
|
request: models.OpenResponsesRequest;
|
|
9
9
|
options?: RequestOptions;
|
|
10
10
|
};
|
|
11
|
-
export type BetaResponsesSendMutationData = operations.
|
|
11
|
+
export type BetaResponsesSendMutationData = operations.CreateResponsesResponse;
|
|
12
12
|
/**
|
|
13
13
|
* Create a response
|
|
14
14
|
*
|
|
@@ -18,6 +18,8 @@ export * from "./generationsGetGeneration.js";
|
|
|
18
18
|
export * from "./modelsCount.js";
|
|
19
19
|
export * from "./modelsList.js";
|
|
20
20
|
export * from "./modelsListForUser.js";
|
|
21
|
+
export * from "./oAuthCreateAuthCode.js";
|
|
22
|
+
export * from "./oAuthExchangeAuthCodeForAPIKey.js";
|
|
21
23
|
export * from "./parametersGetParameters.js";
|
|
22
24
|
export * from "./providersList.js";
|
|
23
25
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/react-query/index.js
CHANGED
|
@@ -21,6 +21,8 @@ export * from "./generationsGetGeneration.js";
|
|
|
21
21
|
export * from "./modelsCount.js";
|
|
22
22
|
export * from "./modelsList.js";
|
|
23
23
|
export * from "./modelsListForUser.js";
|
|
24
|
+
export * from "./oAuthCreateAuthCode.js";
|
|
25
|
+
export * from "./oAuthExchangeAuthCodeForAPIKey.js";
|
|
24
26
|
export * from "./parametersGetParameters.js";
|
|
25
27
|
export * from "./providersList.js";
|
|
26
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { InvalidateQueryFilters, QueryClient, QueryFunctionContext, QueryKey, UseQueryResult, UseSuspenseQueryResult } from "@tanstack/react-query";
|
|
2
2
|
import { OpenRouterCore } from "../core.js";
|
|
3
3
|
import { RequestOptions } from "../lib/sdks.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as models from "../models/index.js";
|
|
5
5
|
import { QueryHookOptions, SuspenseQueryHookOptions } from "./_types.js";
|
|
6
|
-
export type ModelsCountQueryData =
|
|
6
|
+
export type ModelsCountQueryData = models.ModelsCountResponse;
|
|
7
7
|
/**
|
|
8
8
|
* Get total count of available models
|
|
9
9
|
*/
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { InvalidateQueryFilters, QueryClient, QueryFunctionContext, QueryKey, UseQueryResult, UseSuspenseQueryResult } from "@tanstack/react-query";
|
|
2
2
|
import { OpenRouterCore } from "../core.js";
|
|
3
3
|
import { RequestOptions } from "../lib/sdks.js";
|
|
4
|
+
import * as models from "../models/index.js";
|
|
4
5
|
import * as operations from "../models/operations/index.js";
|
|
5
6
|
import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes } from "./_types.js";
|
|
6
|
-
export type ModelsListQueryData =
|
|
7
|
+
export type ModelsListQueryData = models.ModelsListResponse;
|
|
7
8
|
/**
|
|
8
9
|
* List all models and their properties
|
|
9
10
|
*/
|
|
@@ -17,16 +18,12 @@ export declare function setModelsListData(client: QueryClient, queryKeyBase: [
|
|
|
17
18
|
parameters: {
|
|
18
19
|
category?: string | undefined;
|
|
19
20
|
supportedParameters?: string | undefined;
|
|
20
|
-
useRss?: string | undefined;
|
|
21
|
-
useRssChatLinks?: string | undefined;
|
|
22
21
|
}
|
|
23
22
|
], data: ModelsListQueryData): ModelsListQueryData | undefined;
|
|
24
23
|
export declare function invalidateModelsList(client: QueryClient, queryKeyBase: TupleToPrefixes<[
|
|
25
24
|
parameters: {
|
|
26
25
|
category?: string | undefined;
|
|
27
26
|
supportedParameters?: string | undefined;
|
|
28
|
-
useRss?: string | undefined;
|
|
29
|
-
useRssChatLinks?: string | undefined;
|
|
30
27
|
}
|
|
31
28
|
]>, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
|
|
32
29
|
export declare function invalidateAllModelsList(client: QueryClient, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
|
|
@@ -37,7 +34,5 @@ export declare function buildModelsListQuery(client$: OpenRouterCore, request?:
|
|
|
37
34
|
export declare function queryKeyModelsList(parameters: {
|
|
38
35
|
category?: string | undefined;
|
|
39
36
|
supportedParameters?: string | undefined;
|
|
40
|
-
useRss?: string | undefined;
|
|
41
|
-
useRssChatLinks?: string | undefined;
|
|
42
37
|
}): QueryKey;
|
|
43
38
|
//# sourceMappingURL=modelsList.d.ts.map
|
|
@@ -52,8 +52,6 @@ export function buildModelsListQuery(client$, request, options) {
|
|
|
52
52
|
queryKey: queryKeyModelsList({
|
|
53
53
|
category: request?.category,
|
|
54
54
|
supportedParameters: request?.supportedParameters,
|
|
55
|
-
useRss: request?.useRss,
|
|
56
|
-
useRssChatLinks: request?.useRssChatLinks,
|
|
57
55
|
}),
|
|
58
56
|
queryFn: async function modelsListQueryFn(ctx) {
|
|
59
57
|
const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { InvalidateQueryFilters, QueryClient, QueryFunctionContext, QueryKey, UseQueryResult, UseSuspenseQueryResult } from "@tanstack/react-query";
|
|
2
2
|
import { OpenRouterCore } from "../core.js";
|
|
3
3
|
import { RequestOptions } from "../lib/sdks.js";
|
|
4
|
+
import * as models from "../models/index.js";
|
|
4
5
|
import * as operations from "../models/operations/index.js";
|
|
5
6
|
import { QueryHookOptions, SuspenseQueryHookOptions } from "./_types.js";
|
|
6
|
-
export type ModelsListForUserQueryData =
|
|
7
|
+
export type ModelsListForUserQueryData = models.ModelsListResponse;
|
|
7
8
|
/**
|
|
8
9
|
* List models filtered by user provider preferences
|
|
9
10
|
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MutationKey, UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import { OpenRouterCore } from "../core.js";
|
|
3
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
4
|
+
import * as operations from "../models/operations/index.js";
|
|
5
|
+
import { MutationHookOptions } from "./_types.js";
|
|
6
|
+
export type OAuthCreateAuthCodeMutationVariables = {
|
|
7
|
+
request: operations.CreateAuthKeysCodeRequest;
|
|
8
|
+
options?: RequestOptions;
|
|
9
|
+
};
|
|
10
|
+
export type OAuthCreateAuthCodeMutationData = operations.CreateAuthKeysCodeResponse;
|
|
11
|
+
/**
|
|
12
|
+
* Create authorization code
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Create an authorization code for the PKCE flow to generate a user-controlled API key
|
|
16
|
+
*/
|
|
17
|
+
export declare function useOAuthCreateAuthCodeMutation(options?: MutationHookOptions<OAuthCreateAuthCodeMutationData, Error, OAuthCreateAuthCodeMutationVariables>): UseMutationResult<OAuthCreateAuthCodeMutationData, Error, OAuthCreateAuthCodeMutationVariables>;
|
|
18
|
+
export declare function mutationKeyOAuthCreateAuthCode(): MutationKey;
|
|
19
|
+
export declare function buildOAuthCreateAuthCodeMutation(client$: OpenRouterCore, hookOptions?: RequestOptions): {
|
|
20
|
+
mutationKey: MutationKey;
|
|
21
|
+
mutationFn: (variables: OAuthCreateAuthCodeMutationVariables) => Promise<OAuthCreateAuthCodeMutationData>;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=oAuthCreateAuthCode.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import { useMutation, } from "@tanstack/react-query";
|
|
5
|
+
import { oAuthCreateAuthCode } from "../funcs/oAuthCreateAuthCode.js";
|
|
6
|
+
import { combineSignals } from "../lib/primitives.js";
|
|
7
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
8
|
+
import { useOpenRouterContext } from "./_context.js";
|
|
9
|
+
/**
|
|
10
|
+
* Create authorization code
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Create an authorization code for the PKCE flow to generate a user-controlled API key
|
|
14
|
+
*/
|
|
15
|
+
export function useOAuthCreateAuthCodeMutation(options) {
|
|
16
|
+
const client = useOpenRouterContext();
|
|
17
|
+
return useMutation({
|
|
18
|
+
...buildOAuthCreateAuthCodeMutation(client, options),
|
|
19
|
+
...options,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function mutationKeyOAuthCreateAuthCode() {
|
|
23
|
+
return ["@openrouter/sdk", "OAuth", "createAuthCode"];
|
|
24
|
+
}
|
|
25
|
+
export function buildOAuthCreateAuthCodeMutation(client$, hookOptions) {
|
|
26
|
+
return {
|
|
27
|
+
mutationKey: mutationKeyOAuthCreateAuthCode(),
|
|
28
|
+
mutationFn: function oAuthCreateAuthCodeMutationFn({ request, options, }) {
|
|
29
|
+
const mergedOptions = {
|
|
30
|
+
...hookOptions,
|
|
31
|
+
...options,
|
|
32
|
+
fetchOptions: {
|
|
33
|
+
...hookOptions?.fetchOptions,
|
|
34
|
+
...options?.fetchOptions,
|
|
35
|
+
signal: combineSignals(hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal),
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
return unwrapAsync(oAuthCreateAuthCode(client$, request, mergedOptions));
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=oAuthCreateAuthCode.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MutationKey, UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import { OpenRouterCore } from "../core.js";
|
|
3
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
4
|
+
import * as operations from "../models/operations/index.js";
|
|
5
|
+
import { MutationHookOptions } from "./_types.js";
|
|
6
|
+
export type OAuthExchangeAuthCodeForAPIKeyMutationVariables = {
|
|
7
|
+
request: operations.ExchangeAuthCodeForAPIKeyRequest;
|
|
8
|
+
options?: RequestOptions;
|
|
9
|
+
};
|
|
10
|
+
export type OAuthExchangeAuthCodeForAPIKeyMutationData = operations.ExchangeAuthCodeForAPIKeyResponse;
|
|
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 useOAuthExchangeAuthCodeForAPIKeyMutation(options?: MutationHookOptions<OAuthExchangeAuthCodeForAPIKeyMutationData, Error, OAuthExchangeAuthCodeForAPIKeyMutationVariables>): UseMutationResult<OAuthExchangeAuthCodeForAPIKeyMutationData, Error, OAuthExchangeAuthCodeForAPIKeyMutationVariables>;
|
|
18
|
+
export declare function mutationKeyOAuthExchangeAuthCodeForAPIKey(): MutationKey;
|
|
19
|
+
export declare function buildOAuthExchangeAuthCodeForAPIKeyMutation(client$: OpenRouterCore, hookOptions?: RequestOptions): {
|
|
20
|
+
mutationKey: MutationKey;
|
|
21
|
+
mutationFn: (variables: OAuthExchangeAuthCodeForAPIKeyMutationVariables) => Promise<OAuthExchangeAuthCodeForAPIKeyMutationData>;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=oAuthExchangeAuthCodeForAPIKey.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import { useMutation, } from "@tanstack/react-query";
|
|
5
|
+
import { oAuthExchangeAuthCodeForAPIKey } from "../funcs/oAuthExchangeAuthCodeForAPIKey.js";
|
|
6
|
+
import { combineSignals } from "../lib/primitives.js";
|
|
7
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
8
|
+
import { useOpenRouterContext } from "./_context.js";
|
|
9
|
+
/**
|
|
10
|
+
* Exchange authorization code for API key
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Exchange an authorization code from the PKCE flow for a user-controlled API key
|
|
14
|
+
*/
|
|
15
|
+
export function useOAuthExchangeAuthCodeForAPIKeyMutation(options) {
|
|
16
|
+
const client = useOpenRouterContext();
|
|
17
|
+
return useMutation({
|
|
18
|
+
...buildOAuthExchangeAuthCodeForAPIKeyMutation(client, options),
|
|
19
|
+
...options,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function mutationKeyOAuthExchangeAuthCodeForAPIKey() {
|
|
23
|
+
return ["@openrouter/sdk", "OAuth", "exchangeAuthCodeForAPIKey"];
|
|
24
|
+
}
|
|
25
|
+
export function buildOAuthExchangeAuthCodeForAPIKeyMutation(client$, hookOptions) {
|
|
26
|
+
return {
|
|
27
|
+
mutationKey: mutationKeyOAuthExchangeAuthCodeForAPIKey(),
|
|
28
|
+
mutationFn: function oAuthExchangeAuthCodeForAPIKeyMutationFn({ request, options, }) {
|
|
29
|
+
const mergedOptions = {
|
|
30
|
+
...hookOptions,
|
|
31
|
+
...options,
|
|
32
|
+
fetchOptions: {
|
|
33
|
+
...hookOptions?.fetchOptions,
|
|
34
|
+
...options?.fetchOptions,
|
|
35
|
+
signal: combineSignals(hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal),
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
return unwrapAsync(oAuthExchangeAuthCodeForAPIKey(client$, request, mergedOptions));
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=oAuthExchangeAuthCodeForAPIKey.js.map
|
package/esm/sdk/chat.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EventStream } from "../lib/event-streams.js";
|
|
1
2
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
2
3
|
import * as models from "../models/index.js";
|
|
3
4
|
import * as operations from "../models/operations/index.js";
|
|
@@ -8,6 +9,12 @@ export declare class Chat extends ClientSDK {
|
|
|
8
9
|
* @remarks
|
|
9
10
|
* Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
|
10
11
|
*/
|
|
12
|
+
send(request: models.ChatGenerationParams & {
|
|
13
|
+
stream?: false | undefined;
|
|
14
|
+
}, options?: RequestOptions): Promise<models.ChatResponse>;
|
|
15
|
+
send(request: models.ChatGenerationParams & {
|
|
16
|
+
stream: true;
|
|
17
|
+
}, options?: RequestOptions): Promise<EventStream<models.ChatStreamingResponseChunkData>>;
|
|
11
18
|
send(request: models.ChatGenerationParams, options?: RequestOptions): Promise<operations.SendChatCompletionRequestResponse>;
|
|
12
19
|
}
|
|
13
20
|
//# sourceMappingURL=chat.d.ts.map
|
package/esm/sdk/chat.js
CHANGED
|
@@ -5,12 +5,6 @@ import { chatSend } from "../funcs/chatSend.js";
|
|
|
5
5
|
import { ClientSDK } from "../lib/sdks.js";
|
|
6
6
|
import { unwrapAsync } from "../types/fp.js";
|
|
7
7
|
export class Chat extends ClientSDK {
|
|
8
|
-
/**
|
|
9
|
-
* Create a chat completion
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
* Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
|
13
|
-
*/
|
|
14
8
|
async send(request, options) {
|
|
15
9
|
return unwrapAsync(chatSend(this, request, options));
|
|
16
10
|
}
|
package/esm/sdk/models.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
2
|
+
import * as models from "../models/index.js";
|
|
2
3
|
import * as operations from "../models/operations/index.js";
|
|
3
4
|
export declare class Models extends ClientSDK {
|
|
4
5
|
/**
|
|
5
6
|
* Get total count of available models
|
|
6
7
|
*/
|
|
7
|
-
count(options?: RequestOptions): Promise<
|
|
8
|
+
count(options?: RequestOptions): Promise<models.ModelsCountResponse>;
|
|
8
9
|
/**
|
|
9
10
|
* List all models and their properties
|
|
10
11
|
*/
|
|
11
|
-
list(request?: operations.GetModelsRequest | undefined, options?: RequestOptions): Promise<
|
|
12
|
+
list(request?: operations.GetModelsRequest | undefined, options?: RequestOptions): Promise<models.ModelsListResponse>;
|
|
12
13
|
/**
|
|
13
14
|
* List models filtered by user provider preferences
|
|
14
15
|
*/
|
|
15
|
-
listForUser(security: operations.ListModelsUserSecurity, options?: RequestOptions): Promise<
|
|
16
|
+
listForUser(security: operations.ListModelsUserSecurity, options?: RequestOptions): Promise<models.ModelsListResponse>;
|
|
16
17
|
}
|
|
17
18
|
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
2
|
+
import * as operations from "../models/operations/index.js";
|
|
3
|
+
import { CreateAuthorizationUrlRequest } from "../funcs/oAuthCreateAuthorizationUrl.js";
|
|
4
|
+
import { CreateSHA256CodeChallengeResponse } from "../funcs/oAuthCreateSHA256CodeChallenge.js";
|
|
5
|
+
export declare class OAuth extends ClientSDK {
|
|
6
|
+
/**
|
|
7
|
+
* Generate a OAuth2 authorization URL
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Generates a URL to redirect users to for authorizing your application. The
|
|
11
|
+
* URL includes the provided callback URL and, if applicable, the code
|
|
12
|
+
* challenge parameters for PKCE.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link https://openrouter.ai/docs/use-cases/oauth-pkce}
|
|
15
|
+
*/
|
|
16
|
+
createAuthorizationUrl(request: CreateAuthorizationUrlRequest): Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Generate a SHA-256 code challenge for PKCE
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Generates a SHA-256 code challenge and corresponding code verifier for use
|
|
22
|
+
* in the PKCE extension to OAuth2. If no code verifier is provided, a random
|
|
23
|
+
* one will be generated according to RFC 7636 (32 random bytes, base64url
|
|
24
|
+
* encoded). If a code verifier is provided, it must be 43-128 characters and
|
|
25
|
+
* contain only unreserved characters [A-Za-z0-9-._~].
|
|
26
|
+
*
|
|
27
|
+
* @see {@link https://openrouter.ai/docs/use-cases/oauth-pkce}
|
|
28
|
+
* @see {@link https://datatracker.ietf.org/doc/html/rfc7636}
|
|
29
|
+
*/
|
|
30
|
+
createSHA256CodeChallenge(): Promise<CreateSHA256CodeChallengeResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Exchange authorization code for API key
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* Exchange an authorization code from the PKCE flow for a user-controlled API key
|
|
36
|
+
*/
|
|
37
|
+
exchangeAuthCodeForAPIKey(request: operations.ExchangeAuthCodeForAPIKeyRequest, options?: RequestOptions): Promise<operations.ExchangeAuthCodeForAPIKeyResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Create authorization code
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* Create an authorization code for the PKCE flow to generate a user-controlled API key
|
|
43
|
+
*/
|
|
44
|
+
createAuthCode(request: operations.CreateAuthKeysCodeRequest, options?: RequestOptions): Promise<operations.CreateAuthKeysCodeResponse>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=oauth.d.ts.map
|
package/esm/sdk/oauth.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import { oAuthCreateAuthCode } from "../funcs/oAuthCreateAuthCode.js";
|
|
5
|
+
import { oAuthExchangeAuthCodeForAPIKey } from "../funcs/oAuthExchangeAuthCodeForAPIKey.js";
|
|
6
|
+
import { ClientSDK } from "../lib/sdks.js";
|
|
7
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
8
|
+
// #region imports
|
|
9
|
+
import { oAuthCreateAuthorizationUrl, } from "../funcs/oAuthCreateAuthorizationUrl.js";
|
|
10
|
+
import { oAuthCreateSHA256CodeChallenge, } from "../funcs/oAuthCreateSHA256CodeChallenge.js";
|
|
11
|
+
// #endregion imports
|
|
12
|
+
export class OAuth extends ClientSDK {
|
|
13
|
+
// #region sdk-class-body
|
|
14
|
+
/**
|
|
15
|
+
* Generate a OAuth2 authorization URL
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Generates a URL to redirect users to for authorizing your application. The
|
|
19
|
+
* URL includes the provided callback URL and, if applicable, the code
|
|
20
|
+
* challenge parameters for PKCE.
|
|
21
|
+
*
|
|
22
|
+
* @see {@link https://openrouter.ai/docs/use-cases/oauth-pkce}
|
|
23
|
+
*/
|
|
24
|
+
async createAuthorizationUrl(request) {
|
|
25
|
+
const result = oAuthCreateAuthorizationUrl(this, request);
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
throw result.error;
|
|
28
|
+
}
|
|
29
|
+
return result.value;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Generate a SHA-256 code challenge for PKCE
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* Generates a SHA-256 code challenge and corresponding code verifier for use
|
|
36
|
+
* in the PKCE extension to OAuth2. If no code verifier is provided, a random
|
|
37
|
+
* one will be generated according to RFC 7636 (32 random bytes, base64url
|
|
38
|
+
* encoded). If a code verifier is provided, it must be 43-128 characters and
|
|
39
|
+
* contain only unreserved characters [A-Za-z0-9-._~].
|
|
40
|
+
*
|
|
41
|
+
* @see {@link https://openrouter.ai/docs/use-cases/oauth-pkce}
|
|
42
|
+
* @see {@link https://datatracker.ietf.org/doc/html/rfc7636}
|
|
43
|
+
*/
|
|
44
|
+
async createSHA256CodeChallenge() {
|
|
45
|
+
return unwrapAsync(oAuthCreateSHA256CodeChallenge());
|
|
46
|
+
}
|
|
47
|
+
// #endregion sdk-class-body
|
|
48
|
+
/**
|
|
49
|
+
* Exchange authorization code for API key
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* Exchange an authorization code from the PKCE flow for a user-controlled API key
|
|
53
|
+
*/
|
|
54
|
+
async exchangeAuthCodeForAPIKey(request, options) {
|
|
55
|
+
return unwrapAsync(oAuthExchangeAuthCodeForAPIKey(this, request, options));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Create authorization code
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* Create an authorization code for the PKCE flow to generate a user-controlled API key
|
|
62
|
+
*/
|
|
63
|
+
async createAuthCode(request, options) {
|
|
64
|
+
return unwrapAsync(oAuthCreateAuthCode(this, request, options));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=oauth.js.map
|
package/esm/sdk/responses.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EventStream } from "../lib/event-streams.js";
|
|
1
2
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
2
3
|
import * as models from "../models/index.js";
|
|
3
4
|
import * as operations from "../models/operations/index.js";
|
|
@@ -8,6 +9,12 @@ export declare class Responses extends ClientSDK {
|
|
|
8
9
|
* @remarks
|
|
9
10
|
* Creates a streaming or non-streaming response using OpenResponses API format
|
|
10
11
|
*/
|
|
11
|
-
send(request: models.OpenResponsesRequest
|
|
12
|
+
send(request: models.OpenResponsesRequest & {
|
|
13
|
+
stream?: false | undefined;
|
|
14
|
+
}, options?: RequestOptions): Promise<models.OpenResponsesNonStreamingResponse>;
|
|
15
|
+
send(request: models.OpenResponsesRequest & {
|
|
16
|
+
stream: true;
|
|
17
|
+
}, options?: RequestOptions): Promise<EventStream<models.OpenResponsesStreamEvent>>;
|
|
18
|
+
send(request: models.OpenResponsesRequest, options?: RequestOptions): Promise<operations.CreateResponsesResponse>;
|
|
12
19
|
}
|
|
13
20
|
//# sourceMappingURL=responses.d.ts.map
|
package/esm/sdk/responses.js
CHANGED
|
@@ -5,12 +5,6 @@ import { betaResponsesSend } from "../funcs/betaResponsesSend.js";
|
|
|
5
5
|
import { ClientSDK } from "../lib/sdks.js";
|
|
6
6
|
import { unwrapAsync } from "../types/fp.js";
|
|
7
7
|
export class Responses extends ClientSDK {
|
|
8
|
-
/**
|
|
9
|
-
* Create a response
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
* Creates a streaming or non-streaming response using OpenResponses API format
|
|
13
|
-
*/
|
|
14
8
|
async send(request, options) {
|
|
15
9
|
return unwrapAsync(betaResponsesSend(this, request, options));
|
|
16
10
|
}
|
package/esm/sdk/sdk.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { Credits } from "./credits.js";
|
|
|
8
8
|
import { Endpoints } from "./endpoints.js";
|
|
9
9
|
import { Generations } from "./generations.js";
|
|
10
10
|
import { Models } from "./models.js";
|
|
11
|
+
import { OAuth } from "./oauth.js";
|
|
11
12
|
import { ParametersT } from "./parameters.js";
|
|
12
13
|
import { Providers } from "./providers.js";
|
|
13
14
|
export declare class OpenRouter extends ClientSDK {
|
|
@@ -29,6 +30,8 @@ export declare class OpenRouter extends ClientSDK {
|
|
|
29
30
|
get providers(): Providers;
|
|
30
31
|
private _apiKeys?;
|
|
31
32
|
get apiKeys(): APIKeys;
|
|
33
|
+
private _oAuth?;
|
|
34
|
+
get oAuth(): OAuth;
|
|
32
35
|
private _chat?;
|
|
33
36
|
get chat(): Chat;
|
|
34
37
|
private _completions?;
|
package/esm/sdk/sdk.js
CHANGED
|
@@ -11,6 +11,7 @@ import { Credits } from "./credits.js";
|
|
|
11
11
|
import { Endpoints } from "./endpoints.js";
|
|
12
12
|
import { Generations } from "./generations.js";
|
|
13
13
|
import { Models } from "./models.js";
|
|
14
|
+
import { OAuth } from "./oauth.js";
|
|
14
15
|
import { ParametersT } from "./parameters.js";
|
|
15
16
|
import { Providers } from "./providers.js";
|
|
16
17
|
export class OpenRouter extends ClientSDK {
|
|
@@ -41,6 +42,9 @@ export class OpenRouter extends ClientSDK {
|
|
|
41
42
|
get apiKeys() {
|
|
42
43
|
return (this._apiKeys ?? (this._apiKeys = new APIKeys(this._options)));
|
|
43
44
|
}
|
|
45
|
+
get oAuth() {
|
|
46
|
+
return (this._oAuth ?? (this._oAuth = new OAuth(this._options)));
|
|
47
|
+
}
|
|
44
48
|
get chat() {
|
|
45
49
|
return (this._chat ?? (this._chat = new Chat(this._options)));
|
|
46
50
|
}
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"author": "OpenRouter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./esm/index.js",
|
|
@@ -70,7 +70,9 @@
|
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@eslint/js": "^9.19.0",
|
|
72
72
|
"@tanstack/react-query": "^5.61.4",
|
|
73
|
+
"@types/node": "^22.13.12",
|
|
73
74
|
"@types/react": "^18.3.12",
|
|
75
|
+
"dotenv": "^16.4.7",
|
|
74
76
|
"eslint": "^9.19.0",
|
|
75
77
|
"globals": "^15.14.0",
|
|
76
78
|
"typescript": "~5.8.3",
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { config } from "dotenv";
|
|
2
|
+
import { defineConfig } from "vitest/config";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { dirname, join } from "path";
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = dirname(__filename);
|
|
8
|
+
|
|
9
|
+
// Load environment variables from .env file if it exists
|
|
10
|
+
// This will not override existing environment variables
|
|
11
|
+
config({ path: join(__dirname, ".env") });
|
|
12
|
+
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
test: {
|
|
15
|
+
globals: true,
|
|
16
|
+
environment: "node",
|
|
17
|
+
// Don't override env vars - just let them pass through from the system
|
|
18
|
+
// The env object here will be merged with process.env
|
|
19
|
+
env: {
|
|
20
|
+
OPENROUTER_API_KEY: process.env.OPENROUTER_API_KEY,
|
|
21
|
+
},
|
|
22
|
+
include: ["tests/**/*.test.ts"],
|
|
23
|
+
hookTimeout: 30000,
|
|
24
|
+
testTimeout: 30000,
|
|
25
|
+
},
|
|
26
|
+
});
|
package/.devcontainer/README.md
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<div align="center">
|
|
3
|
-
<a href="https://codespaces.new/OpenRouterTeam/typescript-sdk.git/tree/main"><img src="https://github.com/codespaces/badge.svg" /></a>
|
|
4
|
-
</div>
|
|
5
|
-
<br>
|
|
6
|
-
|
|
7
|
-
> **Remember to shutdown a GitHub Codespace when it is not in use!**
|
|
8
|
-
|
|
9
|
-
# Dev Containers Quick Start
|
|
10
|
-
|
|
11
|
-
The default location for usage snippets is the `samples` directory.
|
|
12
|
-
|
|
13
|
-
## Running a Usage Sample
|
|
14
|
-
|
|
15
|
-
A sample usage example has been provided in a `root.ts` file. As you work with the SDK, it's expected that you will modify these samples to fit your needs. To execute this particular snippet, use the command below.
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
ts-node root.ts
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Generating Additional Usage Samples
|
|
22
|
-
|
|
23
|
-
The speakeasy CLI allows you to generate more usage snippets. Here's how:
|
|
24
|
-
|
|
25
|
-
- To generate a sample for a specific operation by providing an operation ID, use:
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
speakeasy generate usage -s .speakeasy/out.openapi.yaml -l typescript -i {INPUT_OPERATION_ID} -o ./samples
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
- To generate samples for an entire namespace (like a tag or group name), use:
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
speakeasy generate usage -s .speakeasy/out.openapi.yaml -l typescript -n {INPUT_TAG_NAME} -o ./samples
|
|
35
|
-
```
|