openrouter 0.0.14__tar.gz → 0.0.16__tar.gz
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.
- openrouter-0.0.16/LICENSE +201 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/PKG-INFO +4 -3
- openrouter-0.0.16/README-PYPI.md +249 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/README.md +0 -2
- {openrouter-0.0.14 → openrouter-0.0.16}/pyproject.toml +3 -2
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/_version.py +3 -3
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/analytics.py +3 -3
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/api_keys.py +11 -11
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/credits.py +2 -2
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/embeddings.py +3 -3
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/endpoints.py +5 -5
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/generations.py +2 -2
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/models_.py +7 -7
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/oauth.py +2 -2
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/parameters.py +2 -2
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/providers.py +3 -3
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/unmarshal_json_response.py +15 -1
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter.egg-info/PKG-INFO +4 -3
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter.egg-info/SOURCES.txt +2 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/setup.cfg +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/__init__.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/_hooks/__init__.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/_hooks/registration.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/_hooks/sdkhooks.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/_hooks/types.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/basesdk.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/beta.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/chat.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/completions.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/__init__.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/activityitem.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/assistantmessage.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/badgatewayresponseerrordata.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/badrequestresponseerrordata.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatcompletionfinishreason.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chaterror.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatgenerationparams.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatgenerationtokenusage.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatmessagecontentitem.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatmessagecontentitemaudio.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatmessagecontentitemimage.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatmessagecontentitemtext.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatmessagecontentitemvideo.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatmessagetokenlogprob.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatmessagetokenlogprobs.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatmessagetoolcall.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatresponse.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatresponsechoice.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatstreamingchoice.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatstreamingmessagechunk.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatstreamingmessagetoolcall.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatstreamingresponsechunk.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/chatstreamoptions.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/completionchoice.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/completioncreateparams.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/completionlogprobs.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/completionresponse.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/completionusage.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/createchargerequest.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/defaultparameters.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/edgenetworktimeoutresponseerrordata.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/endpointstatus.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/filecitation.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/filepath.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/forbiddenresponseerrordata.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/imagegenerationstatus.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/inputmodality.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/instructtype.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/internalserverresponseerrordata.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/jsonschemaconfig.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/listendpointsresponse.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/message.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/model.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/modelarchitecture.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/modelgroup.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/modelscountresponse.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/modelslistresponse.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/namedtoolchoice.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/notfoundresponseerrordata.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openairesponsesannotation.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openairesponsesincludable.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openairesponsesincompletedetails.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openairesponsesinput_union.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openairesponsesprompt.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openairesponsesreasoningconfig.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openairesponsesreasoningeffort.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openairesponsesrefusalcontent.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openairesponsesresponsestatus.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openairesponsesservicetier.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openairesponsestoolchoice_union.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openairesponsestruncation.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponseseasyinputmessage.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponseserrorevent.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesfunctioncalloutput.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesfunctiontoolcall.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesimagegencallcompleted.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesimagegencallgenerating.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesimagegencallinprogress.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesimagegencallpartialimage.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesinput.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesinputmessageitem.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponseslogprobs.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesnonstreamingresponse.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesreasoning.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesreasoningconfig.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesreasoningdeltaevent.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesreasoningdoneevent.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesreasoningsummarypartaddedevent.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesreasoningsummarytextdeltaevent.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesreasoningsummarytextdoneevent.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesrequest.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesresponsetext.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesstreamevent.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsestoplogprobs.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponsesusage.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponseswebsearch20250826tool.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponseswebsearchpreview20250311tool.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponseswebsearchpreviewtool.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/openresponseswebsearchtool.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/outputitemimagegenerationcall.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/outputmessage.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/outputmodality.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/parameter.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/payloadtoolargeresponseerrordata.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/paymentrequiredresponseerrordata.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/perrequestlimits.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/providername.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/provideroverloadedresponseerrordata.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/publicendpoint.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/publicpricing.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/quantization.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/reasoningsummarytext.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/reasoningsummaryverbosity.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/reasoningtextcontent.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/requesttimeoutresponseerrordata.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responseformatjsonschema.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responseformattextconfig.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responseformattextgrammar.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responseinputaudio.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responseinputfile.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responseinputimage.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responseinputtext.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responseoutputtext.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responseserrorfield.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responsesformatjsonobject.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responsesformattext.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responsesformattextjsonschemaconfig.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responsesimagegenerationcall.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responsesoutputitem.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responsesoutputitemfilesearchcall.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responsesoutputitemfunctioncall.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responsesoutputitemreasoning.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responsesoutputmessage.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responsessearchcontextsize.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responseswebsearchcalloutput.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responseswebsearchuserlocation.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/responsetextconfig.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/security.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/serviceunavailableresponseerrordata.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/systemmessage.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/toolcallstatus.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/tooldefinitionjson.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/toolresponsemessage.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/toomanyrequestsresponseerrordata.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/topproviderinfo.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/unauthorizedresponseerrordata.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/unprocessableentityresponseerrordata.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/urlcitation.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/usermessage.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/websearchpreviewtooluserlocation.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/components/websearchstatus.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/__init__.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/badgatewayresponse_error.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/badrequestresponse_error.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/chaterror.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/edgenetworktimeoutresponse_error.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/forbiddenresponse_error.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/internalserverresponse_error.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/no_response_error.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/notfoundresponse_error.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/openrouterdefaulterror.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/openroutererror.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/payloadtoolargeresponse_error.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/paymentrequiredresponse_error.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/provideroverloadedresponse_error.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/requesttimeoutresponse_error.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/responsevalidationerror.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/serviceunavailableresponse_error.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/toomanyrequestsresponse_error.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/unauthorizedresponse_error.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/errors/unprocessableentityresponse_error.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/httpclient.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/__init__.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/createauthkeyscode.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/createcoinbasecharge.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/createembeddings.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/createkeys.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/createresponses.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/deletekeys.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/exchangeauthcodeforapikey.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/getcredits.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/getcurrentkey.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/getgeneration.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/getkey.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/getmodels.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/getparameters.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/getuseractivity.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/list.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/listendpoints.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/listendpointszdr.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/listmodelsuser.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/listproviders.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/sendchatcompletionrequest.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/operations/updatekeys.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/py.typed +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/responses.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/sdk.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/sdkconfiguration.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/types/__init__.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/types/basemodel.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/__init__.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/annotations.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/datetimes.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/enums.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/eventstreaming.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/forms.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/headers.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/logger.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/metadata.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/oauth_create_authorization_url.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/oauth_create_sha256_code_challenge.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/queryparams.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/requestbodies.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/retries.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/security.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/serializers.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/url.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter/utils/values.py +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter.egg-info/dependency_links.txt +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter.egg-info/requires.txt +0 -0
- {openrouter-0.0.14 → openrouter-0.0.16}/src/openrouter.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openrouter
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.16
|
|
4
4
|
Summary: Official Python Client SDK for OpenRouter.
|
|
5
5
|
Author: OpenRouter
|
|
6
|
+
Project-URL: repository, https://github.com/OpenRouterTeam/python-sdk.git
|
|
6
7
|
Requires-Python: >=3.9.2
|
|
7
8
|
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
8
10
|
Requires-Dist: httpcore>=1.0.9
|
|
9
11
|
Requires-Dist: httpx>=0.28.1
|
|
10
12
|
Requires-Dist: pydantic>=2.11.2
|
|
11
|
-
|
|
12
|
-

|
|
13
|
+
Dynamic: license-file
|
|
13
14
|
|
|
14
15
|
# OpenRouter SDK (Beta)
|
|
15
16
|
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# OpenRouter SDK (Beta)
|
|
2
|
+
|
|
3
|
+
The [OpenRouter SDK](https://openrouter.ai/docs/sdks/python) is a Python toolkit designed to help you build AI-powered features and solutions. Giving you easy access to over 300 models across providers in an easy and type-safe way.
|
|
4
|
+
|
|
5
|
+
To learn more about how to use the OpenRouter SDK, check out our [API Reference](https://openrouter.ai/docs/sdks/python/reference) and [Documentation](https://openrouter.ai/docs/sdks/python).
|
|
6
|
+
|
|
7
|
+
<!-- No Summary [summary] -->
|
|
8
|
+
|
|
9
|
+
<!-- No Table of Contents [toc] -->
|
|
10
|
+
|
|
11
|
+
<!-- Start SDK Installation [installation] -->
|
|
12
|
+
## SDK Installation
|
|
13
|
+
|
|
14
|
+
> [!NOTE]
|
|
15
|
+
> **Python version upgrade policy**
|
|
16
|
+
>
|
|
17
|
+
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
|
|
18
|
+
|
|
19
|
+
The SDK can be installed with *uv*, *pip*, or *poetry* package managers.
|
|
20
|
+
|
|
21
|
+
### uv
|
|
22
|
+
|
|
23
|
+
*uv* is a fast Python package installer and resolver, designed as a drop-in replacement for pip and pip-tools. It's recommended for its speed and modern Python tooling capabilities.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
uv add openrouter
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### PIP
|
|
30
|
+
|
|
31
|
+
*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install openrouter
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Poetry
|
|
38
|
+
|
|
39
|
+
*Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
poetry add openrouter
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Shell and script usage with `uv`
|
|
46
|
+
|
|
47
|
+
You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so:
|
|
48
|
+
|
|
49
|
+
```shell
|
|
50
|
+
uvx --from openrouter python
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
It's also possible to write a standalone Python script without needing to set up a whole project like so:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
#!/usr/bin/env -S uv run --script
|
|
57
|
+
# /// script
|
|
58
|
+
# requires-python = ">=3.9"
|
|
59
|
+
# dependencies = [
|
|
60
|
+
# "openrouter",
|
|
61
|
+
# ]
|
|
62
|
+
# ///
|
|
63
|
+
|
|
64
|
+
from openrouter import OpenRouter
|
|
65
|
+
|
|
66
|
+
sdk = OpenRouter(
|
|
67
|
+
# SDK arguments
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Rest of script here...
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Once that is saved to a file, you can run it with `uv run script.py` where
|
|
74
|
+
`script.py` can be replaced with the actual file name.
|
|
75
|
+
<!-- End SDK Installation [installation] -->
|
|
76
|
+
|
|
77
|
+
<!-- Start Requirements [requirements] -->
|
|
78
|
+
## Requirements
|
|
79
|
+
|
|
80
|
+
This SDK requires Python 3.9 or higher. For Python version support policy, see the SDK Installation section above.
|
|
81
|
+
<!-- End Requirements [requirements] -->
|
|
82
|
+
|
|
83
|
+
<!-- Start IDE Support [idesupport] -->
|
|
84
|
+
## IDE Support
|
|
85
|
+
|
|
86
|
+
### PyCharm
|
|
87
|
+
|
|
88
|
+
Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.
|
|
89
|
+
|
|
90
|
+
- [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
|
|
91
|
+
<!-- End IDE Support [idesupport] -->
|
|
92
|
+
|
|
93
|
+
<!-- No SDK Example Usage [usage] -->
|
|
94
|
+
## SDK Usage
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
# Synchronous Example
|
|
98
|
+
from openrouter import OpenRouter
|
|
99
|
+
import os
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
with OpenRouter(
|
|
103
|
+
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
|
104
|
+
) as open_router:
|
|
105
|
+
|
|
106
|
+
res = open_router.chat.send(messages=[
|
|
107
|
+
{
|
|
108
|
+
"role": "user",
|
|
109
|
+
"content": "Hello, how are you?",
|
|
110
|
+
},
|
|
111
|
+
], model="anthropic/claude-4.5-sonnet", provider={
|
|
112
|
+
"zdr": True,
|
|
113
|
+
"sort": "price",
|
|
114
|
+
}, stream=True)
|
|
115
|
+
|
|
116
|
+
for event in event_stream:
|
|
117
|
+
# handle event
|
|
118
|
+
print(event, flush=True)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
</br>
|
|
122
|
+
|
|
123
|
+
The same SDK client can also be used to make asynchronous requests by importing asyncio.
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
# Asynchronous Example
|
|
127
|
+
import asyncio
|
|
128
|
+
from openrouter import OpenRouter
|
|
129
|
+
import os
|
|
130
|
+
|
|
131
|
+
async def main():
|
|
132
|
+
|
|
133
|
+
async with OpenRouter(
|
|
134
|
+
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
|
135
|
+
) as open_router:
|
|
136
|
+
|
|
137
|
+
res = await open_router.chat.send_async(messages=[
|
|
138
|
+
{
|
|
139
|
+
"role": "user",
|
|
140
|
+
"content": "Hello, how are you?",
|
|
141
|
+
},
|
|
142
|
+
], model="anthropic/claude-4.5-sonnet", provider={
|
|
143
|
+
"zdr": True,
|
|
144
|
+
"sort": "price",
|
|
145
|
+
}, stream=True)
|
|
146
|
+
|
|
147
|
+
async for event in event_stream:
|
|
148
|
+
# handle event
|
|
149
|
+
print(event, flush=True)
|
|
150
|
+
|
|
151
|
+
asyncio.run(main())
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
<!-- No Authentication [security] -->
|
|
155
|
+
|
|
156
|
+
<!-- No Available Resources and Operations [operations] -->
|
|
157
|
+
|
|
158
|
+
<!-- No Standalone functions [standalone-funcs] -->
|
|
159
|
+
|
|
160
|
+
<!-- No React hooks with TanStack Query [react-query] -->
|
|
161
|
+
|
|
162
|
+
<!-- No Server-sent event streaming [eventstream] -->
|
|
163
|
+
|
|
164
|
+
<!-- No Retries [retries] -->
|
|
165
|
+
|
|
166
|
+
<!-- No Error Handling [errors] -->
|
|
167
|
+
|
|
168
|
+
<!-- No Server Selection [server] -->
|
|
169
|
+
|
|
170
|
+
<!-- No Custom HTTP Client [http-client] -->
|
|
171
|
+
|
|
172
|
+
<!-- Start Resource Management [resource-management] -->
|
|
173
|
+
## Resource Management
|
|
174
|
+
|
|
175
|
+
The `OpenRouter` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
|
|
176
|
+
|
|
177
|
+
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
from openrouter import OpenRouter
|
|
181
|
+
import os
|
|
182
|
+
def main():
|
|
183
|
+
|
|
184
|
+
with OpenRouter(
|
|
185
|
+
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
|
186
|
+
) as open_router:
|
|
187
|
+
# Rest of application here...
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
# Or when using async:
|
|
191
|
+
async def amain():
|
|
192
|
+
|
|
193
|
+
async with OpenRouter(
|
|
194
|
+
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
|
195
|
+
) as open_router:
|
|
196
|
+
# Rest of application here...
|
|
197
|
+
```
|
|
198
|
+
<!-- End Resource Management [resource-management] -->
|
|
199
|
+
|
|
200
|
+
<!-- Start Debugging [debug] -->
|
|
201
|
+
## Debugging
|
|
202
|
+
|
|
203
|
+
You can setup your SDK to emit debug logs for SDK requests and responses.
|
|
204
|
+
|
|
205
|
+
You can pass your own logger class directly into your SDK.
|
|
206
|
+
```python
|
|
207
|
+
from openrouter import OpenRouter
|
|
208
|
+
import logging
|
|
209
|
+
|
|
210
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
211
|
+
s = OpenRouter(debug_logger=logging.getLogger("openrouter"))
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
You can also enable a default debug logger by setting an environment variable `OPENROUTER_DEBUG` to true.
|
|
215
|
+
<!-- End Debugging [debug] -->
|
|
216
|
+
|
|
217
|
+
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
218
|
+
|
|
219
|
+
# Development
|
|
220
|
+
|
|
221
|
+
## Running Tests
|
|
222
|
+
|
|
223
|
+
To run the test suite, you'll need to set up your environment with an OpenRouter API key.
|
|
224
|
+
|
|
225
|
+
### Local Development
|
|
226
|
+
|
|
227
|
+
1. Copy the example environment file:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
cp .env.example .env
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
2. Edit `.env` and add your OpenRouter API key:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
OPENROUTER_API_KEY=your_api_key_here
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
3. Run the tests:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
pytest
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Maturity
|
|
246
|
+
|
|
247
|
+
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
|
|
248
|
+
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
|
|
249
|
+
looking for the latest version.
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
1
|
# OpenRouter SDK (Beta)
|
|
4
2
|
|
|
5
3
|
The [OpenRouter SDK](https://openrouter.ai/docs/sdks/python) is a Python toolkit designed to help you build AI-powered features and solutions. Giving you easy access to over 300 models across providers in an easy and type-safe way.
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "openrouter"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.16"
|
|
4
4
|
description = "Official Python Client SDK for OpenRouter."
|
|
5
5
|
authors = [{ name = "OpenRouter" },]
|
|
6
|
-
readme = "README.md"
|
|
6
|
+
readme = "README-PYPI.md"
|
|
7
7
|
requires-python = ">=3.9.2"
|
|
8
8
|
dependencies = [
|
|
9
9
|
"httpcore >=1.0.9",
|
|
10
10
|
"httpx >=0.28.1",
|
|
11
11
|
"pydantic >=2.11.2",
|
|
12
12
|
]
|
|
13
|
+
urls.repository = "https://github.com/OpenRouterTeam/python-sdk.git"
|
|
13
14
|
|
|
14
15
|
[dependency-groups]
|
|
15
16
|
dev = [
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "openrouter"
|
|
6
|
-
__version__: str = "0.0.
|
|
6
|
+
__version__: str = "0.0.16"
|
|
7
7
|
__openapi_doc_version__: str = "1.0.0"
|
|
8
|
-
__gen_version__: str = "2.
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 0.0.
|
|
8
|
+
__gen_version__: str = "2.755.6"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.0.16 2.755.6 1.0.0 openrouter"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
|
@@ -6,7 +6,7 @@ from openrouter._hooks import HookContext
|
|
|
6
6
|
from openrouter.types import OptionalNullable, UNSET
|
|
7
7
|
from openrouter.utils import get_security_from_env
|
|
8
8
|
from openrouter.utils.unmarshal_json_response import unmarshal_json_response
|
|
9
|
-
from typing import Any,
|
|
9
|
+
from typing import Any, Mapping, Optional
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class Analytics(BaseSDK):
|
|
@@ -20,7 +20,7 @@ class Analytics(BaseSDK):
|
|
|
20
20
|
server_url: Optional[str] = None,
|
|
21
21
|
timeout_ms: Optional[int] = None,
|
|
22
22
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
23
|
-
) ->
|
|
23
|
+
) -> operations.GetUserActivityResponse:
|
|
24
24
|
r"""Get user activity grouped by endpoint
|
|
25
25
|
|
|
26
26
|
Returns user activity data grouped by endpoint for the last 30 (completed) UTC days
|
|
@@ -128,7 +128,7 @@ class Analytics(BaseSDK):
|
|
|
128
128
|
server_url: Optional[str] = None,
|
|
129
129
|
timeout_ms: Optional[int] = None,
|
|
130
130
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
131
|
-
) ->
|
|
131
|
+
) -> operations.GetUserActivityResponse:
|
|
132
132
|
r"""Get user activity grouped by endpoint
|
|
133
133
|
|
|
134
134
|
Returns user activity data grouped by endpoint for the last 30 (completed) UTC days
|
|
@@ -7,7 +7,7 @@ from openrouter._hooks import HookContext
|
|
|
7
7
|
from openrouter.types import OptionalNullable, UNSET
|
|
8
8
|
from openrouter.utils import get_security_from_env
|
|
9
9
|
from openrouter.utils.unmarshal_json_response import unmarshal_json_response
|
|
10
|
-
from typing import Any,
|
|
10
|
+
from typing import Any, Mapping, Optional
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class APIKeys(BaseSDK):
|
|
@@ -22,7 +22,7 @@ class APIKeys(BaseSDK):
|
|
|
22
22
|
server_url: Optional[str] = None,
|
|
23
23
|
timeout_ms: Optional[int] = None,
|
|
24
24
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
25
|
-
) ->
|
|
25
|
+
) -> operations.ListResponse:
|
|
26
26
|
r"""List API keys
|
|
27
27
|
|
|
28
28
|
:param include_disabled: Whether to include disabled API keys in the response
|
|
@@ -126,7 +126,7 @@ class APIKeys(BaseSDK):
|
|
|
126
126
|
server_url: Optional[str] = None,
|
|
127
127
|
timeout_ms: Optional[int] = None,
|
|
128
128
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
129
|
-
) ->
|
|
129
|
+
) -> operations.ListResponse:
|
|
130
130
|
r"""List API keys
|
|
131
131
|
|
|
132
132
|
:param include_disabled: Whether to include disabled API keys in the response
|
|
@@ -233,7 +233,7 @@ class APIKeys(BaseSDK):
|
|
|
233
233
|
server_url: Optional[str] = None,
|
|
234
234
|
timeout_ms: Optional[int] = None,
|
|
235
235
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
236
|
-
) -> operations.
|
|
236
|
+
) -> operations.CreateKeysResponse:
|
|
237
237
|
r"""Create a new API key
|
|
238
238
|
|
|
239
239
|
:param name: Name for the new API key
|
|
@@ -354,7 +354,7 @@ class APIKeys(BaseSDK):
|
|
|
354
354
|
server_url: Optional[str] = None,
|
|
355
355
|
timeout_ms: Optional[int] = None,
|
|
356
356
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
357
|
-
) -> operations.
|
|
357
|
+
) -> operations.CreateKeysResponse:
|
|
358
358
|
r"""Create a new API key
|
|
359
359
|
|
|
360
360
|
:param name: Name for the new API key
|
|
@@ -476,7 +476,7 @@ class APIKeys(BaseSDK):
|
|
|
476
476
|
server_url: Optional[str] = None,
|
|
477
477
|
timeout_ms: Optional[int] = None,
|
|
478
478
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
479
|
-
) -> operations.
|
|
479
|
+
) -> operations.UpdateKeysResponse:
|
|
480
480
|
r"""Update an API key
|
|
481
481
|
|
|
482
482
|
:param hash: The hash identifier of the API key to update
|
|
@@ -607,7 +607,7 @@ class APIKeys(BaseSDK):
|
|
|
607
607
|
server_url: Optional[str] = None,
|
|
608
608
|
timeout_ms: Optional[int] = None,
|
|
609
609
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
610
|
-
) -> operations.
|
|
610
|
+
) -> operations.UpdateKeysResponse:
|
|
611
611
|
r"""Update an API key
|
|
612
612
|
|
|
613
613
|
:param hash: The hash identifier of the API key to update
|
|
@@ -945,7 +945,7 @@ class APIKeys(BaseSDK):
|
|
|
945
945
|
server_url: Optional[str] = None,
|
|
946
946
|
timeout_ms: Optional[int] = None,
|
|
947
947
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
948
|
-
) -> operations.
|
|
948
|
+
) -> operations.GetKeyResponse:
|
|
949
949
|
r"""Get a single API key
|
|
950
950
|
|
|
951
951
|
:param hash: The hash identifier of the API key to retrieve
|
|
@@ -1051,7 +1051,7 @@ class APIKeys(BaseSDK):
|
|
|
1051
1051
|
server_url: Optional[str] = None,
|
|
1052
1052
|
timeout_ms: Optional[int] = None,
|
|
1053
1053
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1054
|
-
) -> operations.
|
|
1054
|
+
) -> operations.GetKeyResponse:
|
|
1055
1055
|
r"""Get a single API key
|
|
1056
1056
|
|
|
1057
1057
|
:param hash: The hash identifier of the API key to retrieve
|
|
@@ -1156,7 +1156,7 @@ class APIKeys(BaseSDK):
|
|
|
1156
1156
|
server_url: Optional[str] = None,
|
|
1157
1157
|
timeout_ms: Optional[int] = None,
|
|
1158
1158
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1159
|
-
) -> operations.
|
|
1159
|
+
) -> operations.GetCurrentKeyResponse:
|
|
1160
1160
|
r"""Get current API key
|
|
1161
1161
|
|
|
1162
1162
|
Get information on the API key associated with the current authentication session
|
|
@@ -1247,7 +1247,7 @@ class APIKeys(BaseSDK):
|
|
|
1247
1247
|
server_url: Optional[str] = None,
|
|
1248
1248
|
timeout_ms: Optional[int] = None,
|
|
1249
1249
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1250
|
-
) -> operations.
|
|
1250
|
+
) -> operations.GetCurrentKeyResponse:
|
|
1251
1251
|
r"""Get current API key
|
|
1252
1252
|
|
|
1253
1253
|
Get information on the API key associated with the current authentication session
|
|
@@ -218,7 +218,7 @@ class Credits(BaseSDK):
|
|
|
218
218
|
server_url: Optional[str] = None,
|
|
219
219
|
timeout_ms: Optional[int] = None,
|
|
220
220
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
221
|
-
) -> operations.
|
|
221
|
+
) -> operations.CreateCoinbaseChargeResponse:
|
|
222
222
|
r"""Create a Coinbase charge for crypto payment
|
|
223
223
|
|
|
224
224
|
Create a Coinbase charge for crypto payment
|
|
@@ -342,7 +342,7 @@ class Credits(BaseSDK):
|
|
|
342
342
|
server_url: Optional[str] = None,
|
|
343
343
|
timeout_ms: Optional[int] = None,
|
|
344
344
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
345
|
-
) -> operations.
|
|
345
|
+
) -> operations.CreateCoinbaseChargeResponse:
|
|
346
346
|
r"""Create a Coinbase charge for crypto payment
|
|
347
347
|
|
|
348
348
|
Create a Coinbase charge for crypto payment
|
|
@@ -7,7 +7,7 @@ from openrouter._hooks import HookContext
|
|
|
7
7
|
from openrouter.types import OptionalNullable, UNSET
|
|
8
8
|
from openrouter.utils import get_security_from_env
|
|
9
9
|
from openrouter.utils.unmarshal_json_response import unmarshal_json_response
|
|
10
|
-
from typing import Any,
|
|
10
|
+
from typing import Any, Mapping, Optional, Union
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class GenerateAcceptEnum(str, Enum):
|
|
@@ -391,7 +391,7 @@ class Embeddings(BaseSDK):
|
|
|
391
391
|
server_url: Optional[str] = None,
|
|
392
392
|
timeout_ms: Optional[int] = None,
|
|
393
393
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
394
|
-
) ->
|
|
394
|
+
) -> components.ModelsListResponse:
|
|
395
395
|
r"""List all embeddings models
|
|
396
396
|
|
|
397
397
|
Returns a list of all available embeddings models and their properties
|
|
@@ -482,7 +482,7 @@ class Embeddings(BaseSDK):
|
|
|
482
482
|
server_url: Optional[str] = None,
|
|
483
483
|
timeout_ms: Optional[int] = None,
|
|
484
484
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
485
|
-
) ->
|
|
485
|
+
) -> components.ModelsListResponse:
|
|
486
486
|
r"""List all embeddings models
|
|
487
487
|
|
|
488
488
|
Returns a list of all available embeddings models and their properties
|