diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 1d3a900..4befa6f 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d management: - docChecksum: 7136b263714e485a5a96ee056b6e3f36 + docChecksum: 56062ba1997e25ff8be6529c550e5de9 docVersion: 1.0.0 speakeasyVersion: 1.666.0 generationVersion: 2.768.0 - releaseVersion: 0.1.3 - configChecksum: d03f8606816d7028a10e566c4ff2ac44 + releaseVersion: 0.6.0 + configChecksum: 690b77f47b975e28d7e11a6b96fa1c2f repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true @@ -60,25 +60,7 @@ generatedFiles: - docs/components/chatcompletionfinishreason.md - docs/components/chaterrorerror.md - docs/components/chatgenerationparams.md - - docs/components/chatgenerationparamsdatacollection.md - docs/components/chatgenerationparamsimageconfig.md - - docs/components/chatgenerationparamsmaxprice.md - - docs/components/chatgenerationparamspluginautorouter.md - - docs/components/chatgenerationparamspluginfileparser.md - - docs/components/chatgenerationparamspluginmoderation.md - - docs/components/chatgenerationparamspluginresponsehealing.md - - docs/components/chatgenerationparamspluginunion.md - - docs/components/chatgenerationparamspluginweb.md - - docs/components/chatgenerationparamspreferredmaxlatency.md - - docs/components/chatgenerationparamspreferredmaxlatencyunion.md - - docs/components/chatgenerationparamspreferredminthroughput.md - - docs/components/chatgenerationparamspreferredminthroughputunion.md - - docs/components/chatgenerationparamsprovider.md - - docs/components/chatgenerationparamsresponseformatjsonobject.md - - docs/components/chatgenerationparamsresponseformatpython.md - - docs/components/chatgenerationparamsresponseformattext.md - - docs/components/chatgenerationparamsresponseformatunion.md - - docs/components/chatgenerationparamsstop.md - docs/components/chatgenerationtokenusage.md - docs/components/chatmessagecontentitem.md - docs/components/chatmessagecontentitemaudio.md @@ -109,23 +91,15 @@ generatedFiles: - docs/components/chatstreamoptions.md - docs/components/code.md - docs/components/codeenum.md - - docs/components/completionchoice.md - - docs/components/completioncreateparams.md - - docs/components/completioncreateparamsresponseformatjsonobject.md - - docs/components/completioncreateparamsresponseformatpython.md - - docs/components/completioncreateparamsresponseformattext.md - - docs/components/completioncreateparamsresponseformatunion.md - - docs/components/completioncreateparamsstop.md - - docs/components/completionfinishreason.md - - docs/components/completionlogprobs.md - - docs/components/completionresponse.md + - docs/components/completion.md - docs/components/completiontokensdetails.md - - docs/components/completionusage.md - docs/components/costdetails.md - docs/components/createchargerequest.md - docs/components/datacollection.md - docs/components/debug.md - docs/components/defaultparameters.md + - docs/components/developermessage.md + - docs/components/developermessagecontent.md - docs/components/edgenetworktimeoutresponseerrordata.md - docs/components/effort.md - docs/components/endpointstatus.md @@ -150,8 +124,6 @@ generatedFiles: - docs/components/listendpointsresponse.md - docs/components/logprob.md - docs/components/message.md - - docs/components/messagecontent.md - - docs/components/messagedeveloper.md - docs/components/modality.md - docs/components/model.md - docs/components/modelarchitecture.md @@ -273,13 +245,6 @@ generatedFiles: - docs/components/openresponsesrequestmaxprice.md - docs/components/openresponsesrequestonly.md - docs/components/openresponsesrequestorder.md - - docs/components/openresponsesrequestpluginautorouter.md - - docs/components/openresponsesrequestpluginfileparser.md - - docs/components/openresponsesrequestpluginmoderation.md - - docs/components/openresponsesrequestpluginresponsehealing.md - - docs/components/openresponsesrequestpluginunion.md - - docs/components/openresponsesrequestpluginweb.md - - docs/components/openresponsesrequestprovider.md - docs/components/openresponsesrequestsort.md - docs/components/openresponsesrequesttoolfunction.md - docs/components/openresponsesrequesttoolunion.md @@ -342,11 +307,18 @@ generatedFiles: - docs/components/percentilestats.md - docs/components/percentilethroughputcutoffs.md - docs/components/perrequestlimits.md + - docs/components/plugin.md + - docs/components/pluginautorouter.md + - docs/components/pluginfileparser.md + - docs/components/pluginmoderation.md + - docs/components/pluginresponsehealing.md + - docs/components/pluginweb.md - docs/components/preferredmaxlatency.md - docs/components/preferredminthroughput.md - docs/components/pricing.md - docs/components/prompt.md - docs/components/prompttokensdetails.md + - docs/components/provider.md - docs/components/providername.md - docs/components/provideroverloadedresponseerrordata.md - docs/components/providerpreferences.md @@ -367,7 +339,6 @@ generatedFiles: - docs/components/publicendpointquantization.md - docs/components/publicpricing.md - docs/components/quantization.md - - docs/components/quantizations.md - docs/components/reason.md - docs/components/reasoning.md - docs/components/reasoningsummarytext.md @@ -376,7 +347,11 @@ generatedFiles: - docs/components/reasoningtextcontent.md - docs/components/reasoningtextcontenttype.md - docs/components/requesttimeoutresponseerrordata.md + - docs/components/responseformat.md + - docs/components/responseformatjsonobject.md - docs/components/responseformatjsonschema.md + - docs/components/responseformatpython.md + - docs/components/responseformattext.md - docs/components/responseformattextconfig.md - docs/components/responseformattextgrammar.md - docs/components/responseinputaudio.md @@ -438,17 +413,30 @@ generatedFiles: - docs/components/responsetextconfigverbosity.md - docs/components/route.md - docs/components/schema0.md - - docs/components/schema0enum.md - - docs/components/schema2.md - - docs/components/schema2reasoningencrypted.md - - docs/components/schema2reasoningsummary.md - - docs/components/schema2reasoningtext.md - - docs/components/schema4.md + - docs/components/schema10.md + - docs/components/schema14.md + - docs/components/schema15.md + - docs/components/schema15union.md + - docs/components/schema17.md + - docs/components/schema17autorouter.md + - docs/components/schema17fileparser.md + - docs/components/schema17moderation.md + - docs/components/schema17responsehealing.md + - docs/components/schema17web.md + - docs/components/schema19.md + - docs/components/schema19reasoningencrypted.md + - docs/components/schema19reasoningsummary.md + - docs/components/schema19reasoningtext.md + - docs/components/schema21.md + - docs/components/schema3.md + - docs/components/schema5.md + - docs/components/schema5enum.md + - docs/components/schema8.md - docs/components/security.md - docs/components/servicetier.md - docs/components/serviceunavailableresponseerrordata.md - docs/components/sortenum.md - - docs/components/streamoptions.md + - docs/components/stop.md - docs/components/systemmessage.md - docs/components/systemmessagecontent.md - docs/components/tokenizer.md @@ -510,15 +498,19 @@ generatedFiles: - docs/models/internal/globals.md - docs/models/utils/retryconfig.md - docs/operations/apitype.md + - docs/operations/bulkassignkeystoguardrailglobals.md - docs/operations/bulkassignkeystoguardrailrequest.md - docs/operations/bulkassignkeystoguardrailrequestbody.md - docs/operations/bulkassignkeystoguardrailresponse.md + - docs/operations/bulkassignmemberstoguardrailglobals.md - docs/operations/bulkassignmemberstoguardrailrequest.md - docs/operations/bulkassignmemberstoguardrailrequestbody.md - docs/operations/bulkassignmemberstoguardrailresponse.md + - docs/operations/bulkunassignkeysfromguardrailglobals.md - docs/operations/bulkunassignkeysfromguardrailrequest.md - docs/operations/bulkunassignkeysfromguardrailrequestbody.md - docs/operations/bulkunassignkeysfromguardrailresponse.md + - docs/operations/bulkunassignmembersfromguardrailglobals.md - docs/operations/bulkunassignmembersfromguardrailrequest.md - docs/operations/bulkunassignmembersfromguardrailrequestbody.md - docs/operations/bulkunassignmembersfromguardrailresponse.md @@ -529,95 +521,143 @@ generatedFiles: - docs/operations/contenttext.md - docs/operations/createauthkeyscodecodechallengemethod.md - docs/operations/createauthkeyscodedata.md + - docs/operations/createauthkeyscodeglobals.md - docs/operations/createauthkeyscoderequest.md + - docs/operations/createauthkeyscoderequestbody.md - docs/operations/createauthkeyscoderesponse.md - docs/operations/createcoinbasechargedata.md + - docs/operations/createcoinbasechargeglobals.md + - docs/operations/createcoinbasechargerequest.md - docs/operations/createcoinbasechargeresponse.md - docs/operations/createcoinbasechargesecurity.md - docs/operations/createembeddingsdata.md + - docs/operations/createembeddingsglobals.md - docs/operations/createembeddingsrequest.md + - docs/operations/createembeddingsrequestbody.md - docs/operations/createembeddingsresponse.md - docs/operations/createembeddingsresponsebody.md - docs/operations/createguardraildata.md + - docs/operations/createguardrailglobals.md - docs/operations/createguardrailrequest.md + - docs/operations/createguardrailrequestbody.md - docs/operations/createguardrailresetintervalrequest.md - docs/operations/createguardrailresetintervalresponse.md - docs/operations/createguardrailresponse.md - docs/operations/createkeysdata.md + - docs/operations/createkeysglobals.md - docs/operations/createkeyslimitreset.md - docs/operations/createkeysrequest.md + - docs/operations/createkeysrequestbody.md - docs/operations/createkeysresponse.md + - docs/operations/createresponsesglobals.md + - docs/operations/createresponsesrequest.md - docs/operations/createresponsesresponse.md - docs/operations/createresponsesresponsebody.md + - docs/operations/deleteguardrailglobals.md - docs/operations/deleteguardrailrequest.md - docs/operations/deleteguardrailresponse.md + - docs/operations/deletekeysglobals.md - docs/operations/deletekeysrequest.md - docs/operations/deletekeysresponse.md - docs/operations/embedding.md - docs/operations/encodingformat.md - docs/operations/exchangeauthcodeforapikeycodechallengemethod.md + - docs/operations/exchangeauthcodeforapikeyglobals.md - docs/operations/exchangeauthcodeforapikeyrequest.md + - docs/operations/exchangeauthcodeforapikeyrequestbody.md - docs/operations/exchangeauthcodeforapikeyresponse.md - docs/operations/getcreditsdata.md + - docs/operations/getcreditsglobals.md + - docs/operations/getcreditsrequest.md - docs/operations/getcreditsresponse.md - docs/operations/getcurrentkeydata.md + - docs/operations/getcurrentkeyglobals.md + - docs/operations/getcurrentkeyrequest.md - docs/operations/getcurrentkeyresponse.md - docs/operations/getgenerationdata.md + - docs/operations/getgenerationglobals.md - docs/operations/getgenerationrequest.md - docs/operations/getgenerationresponse.md - docs/operations/getguardraildata.md + - docs/operations/getguardrailglobals.md - docs/operations/getguardrailrequest.md - docs/operations/getguardrailresetinterval.md - docs/operations/getguardrailresponse.md - docs/operations/getkeydata.md + - docs/operations/getkeyglobals.md - docs/operations/getkeyrequest.md - docs/operations/getkeyresponse.md + - docs/operations/getmodelsglobals.md - docs/operations/getmodelsrequest.md + - docs/operations/getuseractivityglobals.md - docs/operations/getuseractivityrequest.md - docs/operations/getuseractivityresponse.md - docs/operations/imageurl.md - docs/operations/input.md - docs/operations/inputunion.md - docs/operations/listdata.md + - docs/operations/listembeddingsmodelsglobals.md + - docs/operations/listembeddingsmodelsrequest.md + - docs/operations/listendpointsglobals.md - docs/operations/listendpointsrequest.md - docs/operations/listendpointsresponse.md + - docs/operations/listendpointszdrglobals.md + - docs/operations/listendpointszdrrequest.md - docs/operations/listendpointszdrresponse.md + - docs/operations/listglobals.md - docs/operations/listguardrailkeyassignmentsdata.md + - docs/operations/listguardrailkeyassignmentsglobals.md - docs/operations/listguardrailkeyassignmentsrequest.md - docs/operations/listguardrailkeyassignmentsresponse.md - docs/operations/listguardrailmemberassignmentsdata.md + - docs/operations/listguardrailmemberassignmentsglobals.md - docs/operations/listguardrailmemberassignmentsrequest.md - docs/operations/listguardrailmemberassignmentsresponse.md - docs/operations/listguardrailsdata.md + - docs/operations/listguardrailsglobals.md - docs/operations/listguardrailsrequest.md - docs/operations/listguardrailsresetinterval.md - docs/operations/listguardrailsresponse.md - docs/operations/listkeyassignmentsdata.md + - docs/operations/listkeyassignmentsglobals.md - docs/operations/listkeyassignmentsrequest.md - docs/operations/listkeyassignmentsresponse.md - docs/operations/listmemberassignmentsdata.md + - docs/operations/listmemberassignmentsglobals.md - docs/operations/listmemberassignmentsrequest.md - docs/operations/listmemberassignmentsresponse.md + - docs/operations/listmodelscountglobals.md + - docs/operations/listmodelscountrequest.md + - docs/operations/listmodelsuserglobals.md + - docs/operations/listmodelsuserrequest.md - docs/operations/listmodelsusersecurity.md - docs/operations/listprovidersdata.md + - docs/operations/listprovidersglobals.md + - docs/operations/listprovidersrequest.md - docs/operations/listprovidersresponse.md - docs/operations/listrequest.md - docs/operations/listresponse.md - docs/operations/metadata.md - docs/operations/object.md - docs/operations/objectembedding.md + - docs/operations/providername.md + - docs/operations/providerresponse.md - docs/operations/ratelimit.md + - docs/operations/sendchatcompletionrequestglobals.md + - docs/operations/sendchatcompletionrequestrequest.md - docs/operations/sendchatcompletionrequestresponse.md - docs/operations/transferintent.md - docs/operations/typeimageurl.md - docs/operations/typetext.md - docs/operations/updateguardraildata.md + - docs/operations/updateguardrailglobals.md - docs/operations/updateguardrailrequest.md - docs/operations/updateguardrailrequestbody.md - docs/operations/updateguardrailresetintervalrequest.md - docs/operations/updateguardrailresetintervalresponse.md - docs/operations/updateguardrailresponse.md - docs/operations/updatekeysdata.md + - docs/operations/updatekeysglobals.md - docs/operations/updatekeyslimitreset.md - docs/operations/updatekeysrequest.md - docs/operations/updatekeysrequestbody.md @@ -627,7 +667,6 @@ generatedFiles: - docs/sdks/analytics/README.md - docs/sdks/apikeys/README.md - docs/sdks/chat/README.md - - docs/sdks/completions/README.md - docs/sdks/credits/README.md - docs/sdks/embeddings/README.md - docs/sdks/endpoints/README.md @@ -651,10 +690,12 @@ generatedFiles: - src/openrouter/basesdk.py - src/openrouter/beta.py - src/openrouter/chat.py - - src/openrouter/completions.py - src/openrouter/components/__init__.py - - src/openrouter/components/_schema0.py - - src/openrouter/components/_schema2.py + - src/openrouter/components/_schema10.py + - src/openrouter/components/_schema14.py + - src/openrouter/components/_schema17.py + - src/openrouter/components/_schema19.py + - src/openrouter/components/_schema5.py - src/openrouter/components/activityitem.py - src/openrouter/components/assistantmessage.py - src/openrouter/components/badgatewayresponseerrordata.py @@ -679,14 +720,10 @@ generatedFiles: - src/openrouter/components/chatstreamingmessagetoolcall.py - src/openrouter/components/chatstreamingresponsechunk.py - src/openrouter/components/chatstreamoptions.py - - src/openrouter/components/completionchoice.py - - src/openrouter/components/completioncreateparams.py - - src/openrouter/components/completionlogprobs.py - - src/openrouter/components/completionresponse.py - - src/openrouter/components/completionusage.py - src/openrouter/components/createchargerequest.py - src/openrouter/components/datacollection.py - src/openrouter/components/defaultparameters.py + - src/openrouter/components/developermessage.py - src/openrouter/components/edgenetworktimeoutresponseerrordata.py - src/openrouter/components/endpointstatus.py - src/openrouter/components/filecitation.py @@ -865,6 +902,7 @@ generatedFiles: - src/openrouter/operations/getmodels.py - src/openrouter/operations/getuseractivity.py - src/openrouter/operations/list.py + - src/openrouter/operations/listembeddingsmodels.py - src/openrouter/operations/listendpoints.py - src/openrouter/operations/listendpointszdr.py - src/openrouter/operations/listguardrailkeyassignments.py @@ -872,6 +910,7 @@ generatedFiles: - src/openrouter/operations/listguardrails.py - src/openrouter/operations/listkeyassignments.py - src/openrouter/operations/listmemberassignments.py + - src/openrouter/operations/listmodelscount.py - src/openrouter/operations/listmodelsuser.py - src/openrouter/operations/listproviders.py - src/openrouter/operations/sendchatcompletionrequest.py @@ -948,7 +987,7 @@ examples: "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "403": - application/json: {"error": {"code": 403, "message": "Only provisioning keys can perform this operation"}} + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} getCredits: @@ -959,7 +998,7 @@ examples: "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "403": - application/json: {"error": {"code": 403, "message": "Only provisioning keys can perform this operation"}} + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} createCoinbaseCharge: @@ -1021,7 +1060,7 @@ examples: id: "" responses: "200": - application/json: {"data": {"id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG", "upstream_id": "chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946", "total_cost": 0.0015, "cache_discount": 0.0002, "upstream_inference_cost": 0.0012, "created_at": "2024-07-15T23:33:19.433273+00:00", "model": "sao10k/l3-stheno-8b", "app_id": 12345, "streamed": true, "cancelled": false, "provider_name": "Infermatic", "latency": 1250, "moderation_latency": 50, "generation_time": 1200, "finish_reason": "stop", "tokens_prompt": 10, "tokens_completion": 25, "native_tokens_prompt": 10, "native_tokens_completion": 25, "native_tokens_completion_images": 0, "native_tokens_reasoning": 5, "native_tokens_cached": 3, "num_media_prompt": 1, "num_input_audio_prompt": 0, "num_media_completion": 0, "num_search_results": 5, "origin": "https://openrouter.ai/", "usage": 0.0015, "is_byok": false, "native_finish_reason": "stop", "external_user": "user-123", "api_type": "completions", "router": "openrouter/auto"}} + application/json: {"data": {"id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG", "upstream_id": "chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946", "total_cost": 0.0015, "cache_discount": 0.0002, "upstream_inference_cost": 0.0012, "created_at": "2024-07-15T23:33:19.433273+00:00", "model": "sao10k/l3-stheno-8b", "app_id": 12345, "streamed": true, "cancelled": false, "provider_name": "Infermatic", "latency": 1250, "moderation_latency": 50, "generation_time": 1200, "finish_reason": "stop", "tokens_prompt": 10, "tokens_completion": 25, "native_tokens_prompt": 10, "native_tokens_completion": 25, "native_tokens_completion_images": 0, "native_tokens_reasoning": 5, "native_tokens_cached": 3, "num_media_prompt": 1, "num_input_audio_prompt": 0, "num_media_completion": 0, "num_search_results": 5, "origin": "https://openrouter.ai/", "usage": 0.0015, "is_byok": false, "native_finish_reason": "stop", "external_user": "user-123", "api_type": "completions", "router": "openrouter/auto", "provider_responses": []}} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "402": @@ -1063,6 +1102,8 @@ examples: application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} listEndpoints: speakeasy-default-list-endpoints: parameters: @@ -1191,7 +1232,7 @@ examples: speakeasy-default-get-current-key: responses: "200": - application/json: {"data": {"label": "sk-or-v1-au7...890", "limit": 100, "usage": 25.5, "usage_daily": 25.5, "usage_weekly": 25.5, "usage_monthly": 25.5, "byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_weekly": 17.38, "byok_usage_monthly": 17.38, "is_free_tier": false, "is_provisioning_key": false, "limit_remaining": 74.5, "limit_reset": "monthly", "include_byok_in_limit": false, "rate_limit": {"requests": 1000, "interval": "1h", "note": "This field is deprecated and safe to ignore."}}} + application/json: {"data": {"label": "sk-or-v1-au7...890", "limit": 100, "usage": 25.5, "usage_daily": 25.5, "usage_weekly": 25.5, "usage_monthly": 25.5, "byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_weekly": 17.38, "byok_usage_monthly": 17.38, "is_free_tier": false, "is_management_key": false, "is_provisioning_key": false, "limit_remaining": 74.5, "limit_reset": "monthly", "include_byok_in_limit": false, "rate_limit": {"requests": 1000, "interval": "1h", "note": "This field is deprecated and safe to ignore."}}} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "500": @@ -1206,7 +1247,7 @@ examples: "400": application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "403": - application/json: {"error": {"code": 403, "message": "Only provisioning keys can perform this operation"}} + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} createAuthKeysCode: diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 81e4708..d10e025 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -31,7 +31,7 @@ generation: skipResponseBodyAssertions: false preApplyUnionDiscriminators: true python: - version: 0.1.3 + version: 0.6.0 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 232f496..cc8e617 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -2,7 +2,7 @@ openapi: 3.1.0 info: title: OpenRouter API version: 1.0.0 - description: OpenAI-compatible Chat Completions and Completions API with additional OpenRouter features + description: OpenAI-compatible API with additional OpenRouter features contact: name: OpenRouter Support url: https://openrouter.ai/docs @@ -3542,6 +3542,7 @@ components: - AI21 - AionLabs - Alibaba + - Ambient - Amazon Bedrock - Amazon Nova - Anthropic @@ -3598,6 +3599,7 @@ components: - Seed - SiliconFlow - Sourceful + - StepFun - Stealth - StreamLake - Switchpoint @@ -3645,7 +3647,7 @@ components: - type: 'null' BigNumberUnion: type: string - description: A value in string format that is a large number + description: Price per million prompt tokens example: 1000 PercentileThroughputCutoffs: type: object @@ -3964,13 +3966,21 @@ components: prompt: $ref: '#/components/schemas/BigNumberUnion' completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per million completion tokens image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per image audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per audio unit request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per request description: >- The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. @@ -4393,7 +4403,6 @@ components: - tool_use - pause_turn - refusal - - model_context_window_exceeded stop_sequence: type: string nullable: true @@ -4421,6 +4430,9 @@ components: required: - ephemeral_5m_input_tokens - ephemeral_1h_input_tokens + inference_geo: + type: string + nullable: true server_tool_use: type: object nullable: true @@ -4442,6 +4454,7 @@ components: - cache_creation_input_tokens - cache_read_input_tokens - cache_creation + - inference_geo - server_tool_use - service_tier required: @@ -4476,6 +4489,7 @@ components: cache_creation_input_tokens: null cache_read_input_tokens: null cache_creation: null + inference_geo: null server_tool_use: null service_tier: standard AnthropicMessagesStreamEvent: @@ -4795,6 +4809,9 @@ components: required: - ephemeral_5m_input_tokens - ephemeral_1h_input_tokens + inference_geo: + type: string + nullable: true server_tool_use: type: object nullable: true @@ -4816,6 +4833,7 @@ components: - cache_creation_input_tokens - cache_read_input_tokens - cache_creation + - inference_geo - server_tool_use - service_tier required: @@ -4849,7 +4867,6 @@ components: - tool_use - pause_turn - refusal - - model_context_window_exceeded stop_sequence: type: string nullable: true @@ -6514,6 +6531,22 @@ components: - role - content description: Anthropic message with OpenRouter extensions + AnthropicOutputConfig: + type: object + properties: + effort: + type: string + nullable: true + enum: + - low + - medium + - high + - max + description: >- + How much effort the model should put into its response. Higher effort levels may result in more thorough + analysis but take longer. Valid values are `low`, `medium`, `high`, or `max`. + example: medium + description: Configuration for controlling output behavior. Currently supports the effort parameter for Claude Opus 4.5. AnthropicMessagesRequest: type: object properties: @@ -6927,6 +6960,14 @@ components: - disabled required: - type + - type: object + properties: + type: + type: string + enum: + - adaptive + required: + - type service_tier: type: string enum: @@ -7022,13 +7063,21 @@ components: prompt: $ref: '#/components/schemas/BigNumberUnion' completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per million completion tokens image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per image audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per audio unit request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per request description: >- The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. @@ -7146,6 +7195,8 @@ components: type: array items: type: string + output_config: + $ref: '#/components/schemas/AnthropicOutputConfig' required: - model - max_tokens @@ -7247,7 +7298,7 @@ components: description: Error data for ForbiddenResponse example: code: 403 - message: Only provisioning keys can perform this operation + message: Only management keys can perform this operation ForbiddenResponse: type: object properties: @@ -7262,7 +7313,7 @@ components: example: error: code: 403 - message: Only provisioning keys can perform this operation + message: Only management keys can perform this operation CreateChargeRequest: type: object properties: @@ -7373,13 +7424,21 @@ components: prompt: $ref: '#/components/schemas/BigNumberUnion' completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per million completion tokens image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per image audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per audio unit request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per request description: >- The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. @@ -7392,31 +7451,57 @@ components: type: object properties: prompt: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_token: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_audio_cache: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number web_search: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number internal_reasoning: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_read: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_write: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number discount: type: number required: @@ -7874,31 +7959,57 @@ components: type: object properties: prompt: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_token: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_audio_cache: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number web_search: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number internal_reasoning: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_read: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_write: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number discount: type: number required: @@ -8102,6 +8213,103 @@ components: p90: 28.3 p99: 15.1 __schema0: + anyOf: + - type: object + properties: + allow_fallbacks: + description: > + Whether to allow backup providers to serve requests + + - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use + the next best provider. + + - false: use only the primary/custom provider, and return the upstream error if it's unavailable. + $ref: '#/components/schemas/__schema1' + require_parameters: + description: >- + Whether to filter providers to only those that support the parameters you've provided. If this setting + is omitted or set to false, then providers will receive only the parameters they support, and ignore the + rest. + $ref: '#/components/schemas/__schema1' + data_collection: + description: >- + Data collection setting. If no available model provider meets the requirement, your request will return + an error. + + - allow: (default) allow providers which store user data non-transiently and may train on it + + + - deny: use only providers which do not collect user data. + $ref: '#/components/schemas/__schema3' + zdr: + anyOf: + - type: boolean + - type: 'null' + enforce_distillable_text: + anyOf: + - type: boolean + - type: 'null' + order: + description: >- + An ordered list of provider slugs. The router will attempt to use the first provider in the subset of + this list that supports your requested model, and fall back to the next if it is unavailable. If no + providers are available, the request will fail with an error message. + $ref: '#/components/schemas/__schema4' + only: + description: >- + List of provider slugs to allow. If provided, this list is merged with your account-wide allowed + provider settings for this request. + $ref: '#/components/schemas/__schema4' + ignore: + description: >- + List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored + provider settings for this request. + $ref: '#/components/schemas/__schema4' + quantizations: + description: A list of quantization levels to filter the provider by. + $ref: '#/components/schemas/__schema8' + sort: + description: >- + The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing + is performed. + $ref: '#/components/schemas/__schema9' + max_price: + description: >- + The object specifying the maximum price you want to pay for this request. USD price per million tokens, + for prompt and completion. + $ref: '#/components/schemas/__schema10' + preferred_min_throughput: + description: >- + Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with + percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized + in routing. When using fallback models, this may cause a fallback model to be used instead of the + primary model if it meets the threshold. + $ref: '#/components/schemas/__schema15' + preferred_max_latency: + description: >- + Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with + percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized + in routing. When using fallback models, this may cause a fallback model to be used instead of the + primary model if it meets the threshold. + $ref: '#/components/schemas/__schema15' + additionalProperties: false + - type: 'null' + __schema1: + anyOf: + - type: boolean + - type: 'null' + __schema3: + anyOf: + - type: string + enum: + - deny + - allow + - type: 'null' + __schema4: + anyOf: + - $ref: '#/components/schemas/__schema5' + - type: 'null' + __schema5: type: array items: anyOf: @@ -8110,6 +8318,7 @@ components: - AI21 - AionLabs - Alibaba + - Ambient - Amazon Bedrock - Amazon Nova - Anthropic @@ -8166,6 +8375,7 @@ components: - Seed - SiliconFlow - Sourceful + - StepFun - Stealth - StreamLake - Switchpoint @@ -8178,12 +8388,150 @@ components: - Z.AI - FakeProvider - type: string - __schema1: + __schema8: anyOf: - - type: number - - type: string - - type: number - __schema2: + - type: array + items: + type: string + enum: + - int4 + - int8 + - fp4 + - fp6 + - fp8 + - fp16 + - bf16 + - fp32 + - unknown + - type: 'null' + __schema9: + anyOf: + - $ref: '#/components/schemas/ProviderSortUnion' + - type: 'null' + __schema10: + type: object + properties: + prompt: + anyOf: + - $ref: '#/components/schemas/__schema11' + - $ref: '#/components/schemas/ModelName' + - $ref: '#/components/schemas/__schema13' + completion: + anyOf: + - $ref: '#/components/schemas/__schema11' + - $ref: '#/components/schemas/ModelName' + - $ref: '#/components/schemas/__schema13' + image: + $ref: '#/components/schemas/__schema14' + audio: + $ref: '#/components/schemas/__schema14' + request: + $ref: '#/components/schemas/__schema14' + __schema11: + type: number + __schema13: {} + __schema14: + anyOf: + - $ref: '#/components/schemas/__schema11' + - $ref: '#/components/schemas/ModelName' + - $ref: '#/components/schemas/__schema13' + __schema15: + anyOf: + - anyOf: + - type: number + - type: object + properties: + p50: + anyOf: + - type: number + - type: 'null' + p75: + anyOf: + - type: number + - type: 'null' + p90: + anyOf: + - type: number + - type: 'null' + p99: + anyOf: + - type: number + - type: 'null' + - type: 'null' + __schema17: + type: array + items: + oneOf: + - type: object + properties: + id: + type: string + const: auto-router + enabled: + type: boolean + allowed_models: + type: array + items: + type: string + required: + - id + - type: object + properties: + id: + type: string + const: moderation + required: + - id + - type: object + properties: + id: + type: string + const: web + enabled: + type: boolean + max_results: + type: number + search_prompt: + type: string + engine: + type: string + enum: + - native + - exa + required: + - id + - type: object + properties: + id: + type: string + const: file-parser + enabled: + type: boolean + pdf: + type: object + properties: + engine: + type: string + enum: + - mistral-ocr + - pdf-text + - native + required: + - id + - type: object + properties: + id: + type: string + const: response-healing + enabled: + type: boolean + required: + - id + type: object + __schema18: + type: string + maxLength: 128 + __schema19: oneOf: - type: object properties: @@ -8193,11 +8541,11 @@ components: summary: type: string id: - $ref: '#/components/schemas/__schema3' + $ref: '#/components/schemas/__schema20' format: - $ref: '#/components/schemas/__schema4' + $ref: '#/components/schemas/__schema21' index: - $ref: '#/components/schemas/__schema5' + $ref: '#/components/schemas/__schema11' required: - type - summary @@ -8209,11 +8557,11 @@ components: data: type: string id: - $ref: '#/components/schemas/__schema3' + $ref: '#/components/schemas/__schema20' format: - $ref: '#/components/schemas/__schema4' + $ref: '#/components/schemas/__schema21' index: - $ref: '#/components/schemas/__schema5' + $ref: '#/components/schemas/__schema11' required: - type - data @@ -8231,19 +8579,19 @@ components: - type: string - type: 'null' id: - $ref: '#/components/schemas/__schema3' + $ref: '#/components/schemas/__schema20' format: - $ref: '#/components/schemas/__schema4' + $ref: '#/components/schemas/__schema21' index: - $ref: '#/components/schemas/__schema5' + $ref: '#/components/schemas/__schema11' required: - type type: object - __schema3: + __schema20: anyOf: - type: string - type: 'null' - __schema4: + __schema21: anyOf: - type: string enum: @@ -8254,9 +8602,7 @@ components: - anthropic-claude-v1 - google-gemini-v1 - type: 'null' - __schema5: - type: number - __schema6: + __schema25: anyOf: - $ref: '#/components/schemas/ChatCompletionFinishReason' - type: 'null' @@ -8584,6 +8930,23 @@ components: required: - role - content + DeveloperMessage: + type: object + properties: + role: + type: string + const: developer + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItemText' + name: + type: string + required: + - role + - content AssistantMessage: type: object properties: @@ -8615,7 +8978,7 @@ components: reasoning_details: type: array items: - $ref: '#/components/schemas/__schema2' + $ref: '#/components/schemas/__schema19' images: type: array items: @@ -8654,25 +9017,18 @@ components: oneOf: - $ref: '#/components/schemas/SystemMessage' - $ref: '#/components/schemas/UserMessage' - - type: object - properties: - role: - type: string - const: developer - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatMessageContentItemText' - name: - type: string - required: - - role - - content + - $ref: '#/components/schemas/DeveloperMessage' - $ref: '#/components/schemas/AssistantMessage' - $ref: '#/components/schemas/ToolResponseMessage' type: object + discriminator: + propertyName: role + mapping: + system: '#/components/schemas/SystemMessage' + user: '#/components/schemas/UserMessage' + developer: '#/components/schemas/DeveloperMessage' + assistant: '#/components/schemas/AssistantMessage' + tool: '#/components/schemas/ToolResponseMessage' ToolDefinitionJson: type: object properties: @@ -8736,242 +9092,10 @@ components: properties: provider: description: When multiple model providers are available, optionally indicate your routing preference. - anyOf: - - type: object - properties: - allow_fallbacks: - description: > - Whether to allow backup providers to serve requests - - - true: (default) when the primary provider (or your custom providers in "order") is unavailable, - use the next best provider. - - - false: use only the primary/custom provider, and return the upstream error if it's unavailable. - anyOf: - - type: boolean - - type: 'null' - require_parameters: - description: >- - Whether to filter providers to only those that support the parameters you've provided. If this - setting is omitted or set to false, then providers will receive only the parameters they support, - and ignore the rest. - anyOf: - - type: boolean - - type: 'null' - data_collection: - description: >- - Data collection setting. If no available model provider meets the requirement, your request will - return an error. - - - allow: (default) allow providers which store user data non-transiently and may train on it - - - - deny: use only providers which do not collect user data. - anyOf: - - type: string - enum: - - deny - - allow - - type: 'null' - zdr: - anyOf: - - type: boolean - - type: 'null' - enforce_distillable_text: - anyOf: - - type: boolean - - type: 'null' - order: - description: >- - An ordered list of provider slugs. The router will attempt to use the first provider in the subset - of this list that supports your requested model, and fall back to the next if it is unavailable. If - no providers are available, the request will fail with an error message. - anyOf: - - $ref: '#/components/schemas/__schema0' - - type: 'null' - only: - description: >- - List of provider slugs to allow. If provided, this list is merged with your account-wide allowed - provider settings for this request. - anyOf: - - $ref: '#/components/schemas/__schema0' - - type: 'null' - ignore: - description: >- - List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored - provider settings for this request. - anyOf: - - $ref: '#/components/schemas/__schema0' - - type: 'null' - quantizations: - description: A list of quantization levels to filter the provider by. - anyOf: - - type: array - items: - type: string - enum: - - int4 - - int8 - - fp4 - - fp6 - - fp8 - - fp16 - - bf16 - - fp32 - - unknown - - type: 'null' - sort: - description: >- - The sorting strategy to use for this request, if "order" is not specified. When set, no load - balancing is performed. - anyOf: - - $ref: '#/components/schemas/ProviderSortUnion' - - type: 'null' - max_price: - description: >- - The object specifying the maximum price you want to pay for this request. USD price per million - tokens, for prompt and completion. - type: object - properties: - prompt: - $ref: '#/components/schemas/__schema1' - completion: - $ref: '#/components/schemas/__schema1' - image: - $ref: '#/components/schemas/__schema1' - audio: - $ref: '#/components/schemas/__schema1' - request: - $ref: '#/components/schemas/__schema1' - preferred_min_throughput: - description: >- - Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object - with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are - deprioritized in routing. When using fallback models, this may cause a fallback model to be used - instead of the primary model if it meets the threshold. - anyOf: - - anyOf: - - type: number - - type: object - properties: - p50: - anyOf: - - type: number - - type: 'null' - p75: - anyOf: - - type: number - - type: 'null' - p90: - anyOf: - - type: number - - type: 'null' - p99: - anyOf: - - type: number - - type: 'null' - - type: 'null' - preferred_max_latency: - description: >- - Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with - percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are - deprioritized in routing. When using fallback models, this may cause a fallback model to be used - instead of the primary model if it meets the threshold. - anyOf: - - anyOf: - - type: number - - type: object - properties: - p50: - anyOf: - - type: number - - type: 'null' - p75: - anyOf: - - type: number - - type: 'null' - p90: - anyOf: - - type: number - - type: 'null' - p99: - anyOf: - - type: number - - type: 'null' - - type: 'null' - additionalProperties: false - - type: 'null' + $ref: '#/components/schemas/__schema0' plugins: description: Plugins you want to enable for this request, including their settings. - type: array - items: - oneOf: - - type: object - properties: - id: - type: string - const: auto-router - enabled: - type: boolean - allowed_models: - type: array - items: - type: string - required: - - id - - type: object - properties: - id: - type: string - const: moderation - required: - - id - - type: object - properties: - id: - type: string - const: web - enabled: - type: boolean - max_results: - type: number - search_prompt: - type: string - engine: - type: string - enum: - - native - - exa - required: - - id - - type: object - properties: - id: - type: string - const: file-parser - enabled: - type: boolean - pdf: - type: object - properties: - engine: - type: string - enum: - - mistral-ocr - - pdf-text - - native - required: - - id - - type: object - properties: - id: - type: string - const: response-healing - enabled: - type: boolean - required: - - id - type: object + $ref: '#/components/schemas/__schema17' route: anyOf: - type: string @@ -8986,8 +9110,7 @@ components: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. - type: string - maxLength: 128 + $ref: '#/components/schemas/__schema18' messages: minItems: 1 type: array @@ -9102,7 +9225,7 @@ components: - maxItems: 4 type: array items: - type: string + $ref: '#/components/schemas/ModelName' - type: 'null' stream: default: false @@ -9144,6 +9267,8 @@ components: anyOf: - type: string - type: number + - type: array + items: {} modalities: type: array items: @@ -9161,7 +9286,7 @@ components: type: object properties: finish_reason: - $ref: '#/components/schemas/__schema6' + $ref: '#/components/schemas/__schema25' index: type: number message: @@ -9219,14 +9344,14 @@ components: reasoning_details: type: array items: - $ref: '#/components/schemas/__schema2' + $ref: '#/components/schemas/__schema19' ChatStreamingChoice: type: object properties: delta: $ref: '#/components/schemas/ChatStreamingMessageChunk' finish_reason: - $ref: '#/components/schemas/__schema6' + $ref: '#/components/schemas/__schema25' index: type: number logprobs: @@ -9341,263 +9466,6 @@ components: required: - data additionalProperties: false - CompletionFinishReason: - anyOf: - - type: string - enum: - - stop - - length - - content_filter - - type: 'null' - CompletionLogprobs: - type: object - properties: - tokens: - type: array - items: - type: string - token_logprobs: - type: array - items: - type: number - top_logprobs: - anyOf: - - type: array - items: - type: object - propertyNames: - type: string - additionalProperties: - type: number - - type: 'null' - text_offset: - type: array - items: - type: number - required: - - tokens - - token_logprobs - - top_logprobs - - text_offset - CompletionUsage: - type: object - properties: - prompt_tokens: - type: number - completion_tokens: - type: number - total_tokens: - type: number - required: - - prompt_tokens - - completion_tokens - - total_tokens - CompletionCreateParams: - type: object - properties: - model: - $ref: '#/components/schemas/ModelName' - models: - type: array - items: - $ref: '#/components/schemas/ModelName' - prompt: - anyOf: - - type: string - - type: array - items: - type: string - - type: array - items: - type: number - - type: array - items: - type: array - items: - type: number - best_of: - anyOf: - - type: integer - minimum: 1 - maximum: 20 - - type: 'null' - echo: - anyOf: - - type: boolean - - type: 'null' - frequency_penalty: - anyOf: - - type: number - minimum: -2 - maximum: 2 - - type: 'null' - logit_bias: - anyOf: - - type: object - propertyNames: - type: string - additionalProperties: - type: number - - type: 'null' - logprobs: - anyOf: - - type: integer - minimum: 0 - maximum: 5 - - type: 'null' - max_tokens: - anyOf: - - type: integer - minimum: 1 - maximum: 9007199254740991 - - type: 'null' - 'n': - anyOf: - - type: integer - minimum: 1 - maximum: 128 - - type: 'null' - presence_penalty: - anyOf: - - type: number - minimum: -2 - maximum: 2 - - type: 'null' - seed: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: 'null' - stop: - anyOf: - - anyOf: - - type: string - - type: array - items: - type: string - - type: 'null' - stream: - default: false - type: boolean - stream_options: - anyOf: - - type: object - properties: - include_usage: - anyOf: - - type: boolean - - type: 'null' - - type: 'null' - suffix: - anyOf: - - type: string - - type: 'null' - temperature: - anyOf: - - type: number - minimum: 0 - maximum: 2 - - type: 'null' - top_p: - anyOf: - - type: number - minimum: 0 - maximum: 1 - - type: 'null' - user: - type: string - metadata: - anyOf: - - type: object - propertyNames: - type: string - additionalProperties: - type: string - - type: 'null' - response_format: - anyOf: - - oneOf: - - type: object - properties: - type: - type: string - const: text - required: - - type - - type: object - properties: - type: - type: string - const: json_object - required: - - type - - $ref: '#/components/schemas/ResponseFormatJSONSchema' - - $ref: '#/components/schemas/ResponseFormatTextGrammar' - - type: object - properties: - type: - type: string - const: python - required: - - type - type: object - - type: 'null' - required: - - prompt - CompletionChoice: - type: object - properties: - text: - type: string - index: - type: number - logprobs: - anyOf: - - $ref: '#/components/schemas/CompletionLogprobs' - - type: 'null' - finish_reason: - $ref: '#/components/schemas/CompletionFinishReason' - native_finish_reason: - type: string - reasoning: - anyOf: - - type: string - - type: 'null' - required: - - text - - index - - logprobs - - finish_reason - CompletionResponse: - type: object - properties: - id: - type: string - object: - type: string - const: text_completion - created: - type: number - model: - type: string - provider: - type: string - system_fingerprint: - type: string - choices: - type: array - items: - $ref: '#/components/schemas/CompletionChoice' - usage: - $ref: '#/components/schemas/CompletionUsage' - required: - - id - - object - - created - - model - - choices - additionalProperties: false parameters: {} securitySchemes: apiKey: @@ -9724,7 +9592,7 @@ paths: x-speakeasy-name-override: create x-speakeasy-stream-request-field: stream tags: - - anthropic.messages + - Anthropic Messages summary: Create a message description: >- Creates a message using the Anthropic Messages API format. Supports text, images, PDFs, tools, and extended @@ -9954,8 +9822,8 @@ paths: operationId: getUserActivity summary: Get user activity grouped by endpoint description: >- - Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Provisioning - key](/docs/guides/overview/auth/provisioning-api-keys) required. + Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management + key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -10006,7 +9874,7 @@ paths: schema: $ref: '#/components/schemas/UnauthorizedResponse' '403': - description: Forbidden - Only provisioning keys can fetch activity + description: Forbidden - Only management keys can fetch activity content: application/json: schema: @@ -10025,8 +9893,8 @@ paths: summary: Get remaining credits operationId: getCredits description: >- - Get total credits purchased and used for the authenticated user. [Provisioning - key](/docs/guides/overview/auth/provisioning-api-keys) required. + Get total credits purchased and used for the authenticated user. [Management + key](/docs/guides/overview/auth/management-api-keys) required. responses: '200': description: Returns the total credits purchased and used @@ -10066,7 +9934,7 @@ paths: schema: $ref: '#/components/schemas/UnauthorizedResponse' '403': - description: Forbidden - Only provisioning keys can fetch credits + description: Forbidden - Only management keys can fetch credits content: application/json: schema: @@ -10612,6 +10480,131 @@ paths: nullable: true description: Router used for the request (e.g., openrouter/auto) example: openrouter/auto + provider_responses: + type: array + nullable: true + items: + type: object + properties: + id: + type: string + endpoint_id: + type: string + model_permaslug: + type: string + provider_name: + type: string + enum: + - AnyScale + - Atoma + - Cent-ML + - CrofAI + - Enfer + - GoPomelo + - HuggingFace + - Hyperbolic 2 + - InoCloud + - Kluster + - Lambda + - Lepton + - Lynn 2 + - Lynn + - Mancer + - Meta + - Modal + - Nineteen + - OctoAI + - Recursal + - Reflection + - Replicate + - SambaNova 2 + - SF Compute + - Targon + - Together 2 + - Ubicloud + - 01.AI + - AI21 + - AionLabs + - Alibaba + - Ambient + - Amazon Bedrock + - Amazon Nova + - Anthropic + - Arcee AI + - AtlasCloud + - Avian + - Azure + - BaseTen + - BytePlus + - Black Forest Labs + - Cerebras + - Chutes + - Cirrascale + - Clarifai + - Cloudflare + - Cohere + - Crusoe + - DeepInfra + - DeepSeek + - Featherless + - Fireworks + - Friendli + - GMICloud + - Google + - Google AI Studio + - Groq + - Hyperbolic + - Inception + - Inceptron + - InferenceNet + - Infermatic + - Inflection + - Liquid + - Mara + - Mancer 2 + - Minimax + - ModelRun + - Mistral + - Modular + - Moonshot AI + - Morph + - NCompass + - Nebius + - NextBit + - Novita + - Nvidia + - OpenAI + - OpenInference + - Parasail + - Perplexity + - Phala + - Relace + - SambaNova + - Seed + - SiliconFlow + - Sourceful + - StepFun + - Stealth + - StreamLake + - Switchpoint + - Together + - Upstage + - Venice + - WandB + - Xiaomi + - xAI + - Z.AI + - FakeProvider + status: + type: number + nullable: true + latency: + type: number + is_byok: + type: boolean + required: + - status + description: List of provider responses for this generation, including fallback attempts required: - id - upstream_id @@ -10646,6 +10639,7 @@ paths: - external_user - api_type - router + - provider_responses description: Generation data required: - data @@ -10790,7 +10784,13 @@ paths: tags: - Models x-speakeasy-name-override: listForUser - summary: List models filtered by user provider preferences + description: >- + List models filtered by user provider preferences, [privacy + settings](https://openrouter.ai/docs/guides/privacy/logging), and + [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through + `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region + routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing). + summary: List models filtered by user provider preferences, privacy settings, and guardrails security: - bearer: [] responses: @@ -10806,6 +10806,12 @@ paths: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + '404': + description: Not Found - No eligible endpoints found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' '500': description: Internal Server Error content: @@ -10951,8 +10957,8 @@ paths: - API Keys summary: List API keys description: >- - List all API keys for the authenticated user. [Provisioning - key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) + required. parameters: - schema: type: string @@ -11152,8 +11158,8 @@ paths: - API Keys summary: Create a new API key description: >- - Create a new API key for the authenticated user. [Provisioning - key](/docs/guides/overview/auth/provisioning-api-keys) required. + Create a new API key for the authenticated user. [Management + key](/docs/guides/overview/auth/management-api-keys) required. requestBody: content: application/json: @@ -11395,7 +11401,7 @@ paths: tags: - API Keys summary: Update an API key - description: Update an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + description: Update an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -11638,7 +11644,7 @@ paths: tags: - API Keys summary: Delete an API key - description: Delete an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + description: Delete an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -11696,7 +11702,7 @@ paths: tags: - API Keys summary: Get a single API key - description: Get a single API key by hash. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + description: Get a single API key by hash. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -11894,8 +11900,8 @@ paths: - Guardrails summary: List guardrails description: >- - List all guardrails for the authenticated user. [Provisioning - key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) + required. parameters: - schema: type: string @@ -12051,8 +12057,8 @@ paths: - Guardrails summary: Create a guardrail description: >- - Create a new guardrail for the authenticated user. [Provisioning - key](/docs/guides/overview/auth/provisioning-api-keys) required. + Create a new guardrail for the authenticated user. [Management + key](/docs/guides/overview/auth/management-api-keys) required. requestBody: content: application/json: @@ -12264,7 +12270,7 @@ paths: tags: - Guardrails summary: Get a guardrail - description: Get a single guardrail by ID. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + description: Get a single guardrail by ID. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -12410,7 +12416,7 @@ paths: tags: - Guardrails summary: Update a guardrail - description: Update an existing guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + description: Update an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -12625,7 +12631,7 @@ paths: tags: - Guardrails summary: Delete a guardrail - description: Delete an existing guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + description: Delete an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -12679,8 +12685,8 @@ paths: - Guardrails summary: List all key assignments description: >- - List all API key guardrail assignments for the authenticated user. [Provisioning - key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all API key guardrail assignments for the authenticated user. [Management + key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -12778,8 +12784,8 @@ paths: - Guardrails summary: List all member assignments description: >- - List all organization member guardrail assignments for the authenticated user. [Provisioning - key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all organization member guardrail assignments for the authenticated user. [Management + key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -12872,8 +12878,8 @@ paths: - Guardrails summary: List key assignments for a guardrail description: >- - List all API key assignments for a specific guardrail. [Provisioning - key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all API key assignments for a specific guardrail. [Management + key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -12985,8 +12991,8 @@ paths: - Guardrails summary: Bulk assign keys to a guardrail description: >- - Assign multiple API keys to a specific guardrail. [Provisioning - key](/docs/guides/overview/auth/provisioning-api-keys) required. + Assign multiple API keys to a specific guardrail. [Management + key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -13061,8 +13067,8 @@ paths: - Guardrails summary: List member assignments for a guardrail description: >- - List all organization member assignments for a specific guardrail. [Provisioning - key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all organization member assignments for a specific guardrail. [Management + key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -13169,8 +13175,8 @@ paths: - Guardrails summary: Bulk assign members to a guardrail description: >- - Assign multiple organization members to a specific guardrail. [Provisioning - key](/docs/guides/overview/auth/provisioning-api-keys) required. + Assign multiple organization members to a specific guardrail. [Management + key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -13246,8 +13252,8 @@ paths: - Guardrails summary: Bulk unassign keys from a guardrail description: >- - Unassign multiple API keys from a specific guardrail. [Provisioning - key](/docs/guides/overview/auth/provisioning-api-keys) required. + Unassign multiple API keys from a specific guardrail. [Management + key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -13322,8 +13328,8 @@ paths: - Guardrails summary: Bulk unassign members from a guardrail description: >- - Unassign multiple organization members from a specific guardrail. [Provisioning - key](/docs/guides/overview/auth/provisioning-api-keys) required. + Unassign multiple organization members from a specific guardrail. [Management + key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -13455,9 +13461,14 @@ paths: type: boolean description: Whether this is a free tier API key example: false + is_management_key: + type: boolean + description: Whether this is a management key + example: false is_provisioning_key: type: boolean - description: Whether this is a provisioning key + description: Whether this is a management key + deprecated: true example: false limit_remaining: type: number @@ -13516,6 +13527,7 @@ paths: - byok_usage_weekly - byok_usage_monthly - is_free_tier + - is_management_key - is_provisioning_key - limit_remaining - limit_reset @@ -13534,6 +13546,7 @@ paths: byok_usage_weekly: 17.38 byok_usage_monthly: 17.38 is_free_tier: false + is_management_key: false is_provisioning_key: false limit_remaining: 74.5 limit_reset: monthly @@ -13558,6 +13571,7 @@ paths: byok_usage_weekly: 17.38 byok_usage_monthly: 17.38 is_free_tier: false + is_management_key: false is_provisioning_key: false limit_remaining: 74.5 limit_reset: monthly @@ -13812,55 +13826,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ChatError' - /completions: - post: - summary: Create a completion - x-speakeasy-group: completions - x-speakeasy-name-override: generate - x-speakeasy-stream-request-field: stream - description: Creates a completion for the provided prompt and parameters. Supports both streaming and non-streaming modes. - tags: - - Completions - requestBody: - required: true - description: Completion request parameters - content: - application/json: - schema: - $ref: '#/components/schemas/CompletionCreateParams' - responses: - '200': - description: Successful completion response - content: - application/json: - schema: - $ref: '#/components/schemas/CompletionResponse' - description: Completion response - '400': - description: Bad request - invalid parameters - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '401': - description: Unauthorized - invalid API key - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '429': - description: Too many requests - rate limit exceeded - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - operationId: createCompletions servers: - url: https://openrouter.ai/api/v1 description: Production server @@ -13875,10 +13840,10 @@ tags: description: API key management endpoints - name: Analytics description: Analytics and usage endpoints + - name: Anthropic Messages + description: Anthropic Messages endpoints - name: Chat description: Chat completion endpoints - - name: Completions - description: Text completion endpoints - name: Credits description: Credit management endpoints - name: Embeddings @@ -13895,8 +13860,6 @@ tags: description: OAuth authentication endpoints - name: Providers description: Provider information endpoints - - name: anthropic.messages - description: anthropic.messages endpoints - name: beta.responses description: beta.responses endpoints x-fern-base-path: / diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index e183d3f..f33f4fa 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -2,7 +2,7 @@ openapi: 3.1.0 info: title: OpenRouter API version: 1.0.0 - description: OpenAI-compatible Chat Completions and Completions API with additional OpenRouter features + description: OpenAI-compatible API with additional OpenRouter features contact: name: OpenRouter Support url: https://openrouter.ai/docs @@ -3561,6 +3561,7 @@ components: - AI21 - AionLabs - Alibaba + - Ambient - Amazon Bedrock - Amazon Nova - Anthropic @@ -3617,6 +3618,7 @@ components: - Seed - SiliconFlow - Sourceful + - StepFun - Stealth - StreamLake - Switchpoint @@ -3668,7 +3670,7 @@ components: - type: 'null' BigNumberUnion: type: string - description: A value in string format that is a large number + description: Price per million prompt tokens example: 1000 PercentileThroughputCutoffs: type: object @@ -3974,13 +3976,21 @@ components: prompt: $ref: '#/components/schemas/BigNumberUnion' completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per million completion tokens image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per image audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per audio unit request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per request description: >- The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. preferred_min_throughput: @@ -4397,7 +4407,6 @@ components: - tool_use - pause_turn - refusal - - model_context_window_exceeded x-speakeasy-unknown-values: allow stop_sequence: type: string @@ -4426,6 +4435,9 @@ components: required: - ephemeral_5m_input_tokens - ephemeral_1h_input_tokens + inference_geo: + type: string + nullable: true server_tool_use: type: object nullable: true @@ -4448,6 +4460,7 @@ components: - cache_creation_input_tokens - cache_read_input_tokens - cache_creation + - inference_geo - server_tool_use - service_tier required: @@ -4482,6 +4495,7 @@ components: cache_creation_input_tokens: null cache_read_input_tokens: null cache_creation: null + inference_geo: null server_tool_use: null service_tier: standard AnthropicMessagesStreamEvent: @@ -4802,6 +4816,9 @@ components: required: - ephemeral_5m_input_tokens - ephemeral_1h_input_tokens + inference_geo: + type: string + nullable: true server_tool_use: type: object nullable: true @@ -4824,6 +4841,7 @@ components: - cache_creation_input_tokens - cache_read_input_tokens - cache_creation + - inference_geo - server_tool_use - service_tier required: @@ -4857,7 +4875,6 @@ components: - tool_use - pause_turn - refusal - - model_context_window_exceeded x-speakeasy-unknown-values: allow stop_sequence: type: string @@ -6542,6 +6559,22 @@ components: - role - content description: Anthropic message with OpenRouter extensions + AnthropicOutputConfig: + type: object + properties: + effort: + type: string + nullable: true + enum: + - low + - medium + - high + - max + description: >- + How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer. Valid values are `low`, `medium`, `high`, or `max`. + example: medium + x-speakeasy-unknown-values: allow + description: Configuration for controlling output behavior. Currently supports the effort parameter for Claude Opus 4.5. AnthropicMessagesRequest: type: object properties: @@ -6960,6 +6993,14 @@ components: - disabled required: - type + - type: object + properties: + type: + type: string + enum: + - adaptive + required: + - type service_tier: type: string enum: @@ -7047,13 +7088,21 @@ components: prompt: $ref: '#/components/schemas/BigNumberUnion' completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per million completion tokens image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per image audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per audio unit request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per request description: >- The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. preferred_min_throughput: @@ -7164,6 +7213,8 @@ components: type: array items: type: string + output_config: + $ref: '#/components/schemas/AnthropicOutputConfig' required: - model - max_tokens @@ -7265,7 +7316,7 @@ components: description: Error data for ForbiddenResponse example: code: 403 - message: Only provisioning keys can perform this operation + message: Only management keys can perform this operation ForbiddenResponse: type: object properties: @@ -7280,7 +7331,7 @@ components: example: error: code: 403 - message: Only provisioning keys can perform this operation + message: Only management keys can perform this operation CreateChargeRequest: type: object properties: @@ -7384,13 +7435,21 @@ components: prompt: $ref: '#/components/schemas/BigNumberUnion' completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per million completion tokens image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per image audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per audio unit request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per request description: >- The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. preferred_min_throughput: @@ -7402,31 +7461,57 @@ components: type: object properties: prompt: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_token: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_audio_cache: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number web_search: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number internal_reasoning: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_read: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_write: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number discount: type: number required: @@ -7890,31 +7975,57 @@ components: type: object properties: prompt: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_token: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_audio_cache: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number web_search: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number internal_reasoning: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_read: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_write: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number discount: type: number required: @@ -8116,6 +8227,89 @@ components: p90: 28.3 p99: 15.1 __schema0: + anyOf: + - type: object + properties: + allow_fallbacks: + description: > + Whether to allow backup providers to serve requests + + - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider. + + - false: use only the primary/custom provider, and return the upstream error if it's unavailable. + + $ref: '#/components/schemas/__schema1' + require_parameters: + description: >- + Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. + $ref: '#/components/schemas/__schema1' + data_collection: + description: >- + Data collection setting. If no available model provider meets the requirement, your request will return an error. + + - allow: (default) allow providers which store user data non-transiently and may train on it + + + - deny: use only providers which do not collect user data. + $ref: '#/components/schemas/__schema3' + zdr: + anyOf: + - type: boolean + - type: 'null' + enforce_distillable_text: + anyOf: + - type: boolean + - type: 'null' + order: + description: >- + An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. + $ref: '#/components/schemas/__schema4' + only: + description: >- + List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. + $ref: '#/components/schemas/__schema4' + ignore: + description: >- + List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. + $ref: '#/components/schemas/__schema4' + quantizations: + description: A list of quantization levels to filter the provider by. + $ref: '#/components/schemas/__schema8' + sort: + description: >- + The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. + $ref: '#/components/schemas/__schema9' + max_price: + description: >- + The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. + $ref: '#/components/schemas/__schema10' + preferred_min_throughput: + description: >- + Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. + $ref: '#/components/schemas/__schema15' + preferred_max_latency: + description: >- + Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. + $ref: '#/components/schemas/__schema15' + additionalProperties: false + - type: 'null' + __schema1: + anyOf: + - type: boolean + - type: 'null' + __schema3: + anyOf: + - type: string + enum: + - deny + - allow + x-speakeasy-unknown-values: allow + - type: 'null' + __schema4: + anyOf: + - $ref: '#/components/schemas/__schema5' + - type: 'null' + __schema5: type: array items: anyOf: @@ -8124,6 +8318,7 @@ components: - AI21 - AionLabs - Alibaba + - Ambient - Amazon Bedrock - Amazon Nova - Anthropic @@ -8180,6 +8375,7 @@ components: - Seed - SiliconFlow - Sourceful + - StepFun - Stealth - StreamLake - Switchpoint @@ -8193,12 +8389,153 @@ components: - FakeProvider x-speakeasy-unknown-values: allow - type: string - __schema1: + __schema8: anyOf: - - type: number - - type: string - - type: number - __schema2: + - type: array + items: + type: string + enum: + - int4 + - int8 + - fp4 + - fp6 + - fp8 + - fp16 + - bf16 + - fp32 + - unknown + x-speakeasy-unknown-values: allow + - type: 'null' + __schema9: + anyOf: + - $ref: '#/components/schemas/ProviderSortUnion' + - type: 'null' + __schema10: + type: object + properties: + prompt: + anyOf: + - $ref: '#/components/schemas/__schema11' + - $ref: '#/components/schemas/ModelName' + - $ref: '#/components/schemas/__schema13' + completion: + anyOf: + - $ref: '#/components/schemas/__schema11' + - $ref: '#/components/schemas/ModelName' + - $ref: '#/components/schemas/__schema13' + image: + $ref: '#/components/schemas/__schema14' + audio: + $ref: '#/components/schemas/__schema14' + request: + $ref: '#/components/schemas/__schema14' + __schema11: + type: number + __schema13: {} + __schema14: + anyOf: + - $ref: '#/components/schemas/__schema11' + - $ref: '#/components/schemas/ModelName' + - $ref: '#/components/schemas/__schema13' + __schema15: + anyOf: + - anyOf: + - type: number + - type: object + properties: + p50: + anyOf: + - type: number + - type: 'null' + p75: + anyOf: + - type: number + - type: 'null' + p90: + anyOf: + - type: number + - type: 'null' + p99: + anyOf: + - type: number + - type: 'null' + - type: 'null' + __schema17: + type: array + items: + oneOf: + - type: object + properties: + id: + type: string + const: auto-router + enabled: + type: boolean + allowed_models: + type: array + items: + type: string + required: + - id + - type: object + properties: + id: + type: string + const: moderation + required: + - id + - type: object + properties: + id: + type: string + const: web + enabled: + type: boolean + max_results: + type: number + search_prompt: + type: string + engine: + type: string + enum: + - native + - exa + x-speakeasy-unknown-values: allow + required: + - id + - type: object + properties: + id: + type: string + const: file-parser + enabled: + type: boolean + pdf: + type: object + properties: + engine: + type: string + enum: + - mistral-ocr + - pdf-text + - native + x-speakeasy-unknown-values: allow + required: + - id + - type: object + properties: + id: + type: string + const: response-healing + enabled: + type: boolean + required: + - id + type: object + __schema18: + type: string + maxLength: 128 + __schema19: oneOf: - type: object properties: @@ -8208,11 +8545,11 @@ components: summary: type: string id: - $ref: '#/components/schemas/__schema3' + $ref: '#/components/schemas/__schema20' format: - $ref: '#/components/schemas/__schema4' + $ref: '#/components/schemas/__schema21' index: - $ref: '#/components/schemas/__schema5' + $ref: '#/components/schemas/__schema11' required: - type - summary @@ -8224,11 +8561,11 @@ components: data: type: string id: - $ref: '#/components/schemas/__schema3' + $ref: '#/components/schemas/__schema20' format: - $ref: '#/components/schemas/__schema4' + $ref: '#/components/schemas/__schema21' index: - $ref: '#/components/schemas/__schema5' + $ref: '#/components/schemas/__schema11' required: - type - data @@ -8246,19 +8583,19 @@ components: - type: string - type: 'null' id: - $ref: '#/components/schemas/__schema3' + $ref: '#/components/schemas/__schema20' format: - $ref: '#/components/schemas/__schema4' + $ref: '#/components/schemas/__schema21' index: - $ref: '#/components/schemas/__schema5' + $ref: '#/components/schemas/__schema11' required: - type type: object - __schema3: + __schema20: anyOf: - type: string - type: 'null' - __schema4: + __schema21: anyOf: - type: string enum: @@ -8270,9 +8607,7 @@ components: - google-gemini-v1 x-speakeasy-unknown-values: allow - type: 'null' - __schema5: - type: number - __schema6: + __schema25: anyOf: - $ref: '#/components/schemas/ChatCompletionFinishReason' - type: 'null' @@ -8603,6 +8938,23 @@ components: required: - role - content + DeveloperMessage: + type: object + properties: + role: + type: string + const: developer + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItemText' + name: + type: string + required: + - role + - content AssistantMessage: type: object properties: @@ -8634,7 +8986,7 @@ components: reasoning_details: type: array items: - $ref: '#/components/schemas/__schema2' + $ref: '#/components/schemas/__schema19' images: type: array items: @@ -8673,25 +9025,18 @@ components: oneOf: - $ref: '#/components/schemas/SystemMessage' - $ref: '#/components/schemas/UserMessage' - - type: object - properties: - role: - type: string - const: developer - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatMessageContentItemText' - name: - type: string - required: - - role - - content + - $ref: '#/components/schemas/DeveloperMessage' - $ref: '#/components/schemas/AssistantMessage' - $ref: '#/components/schemas/ToolResponseMessage' type: object + discriminator: + propertyName: role + mapping: + system: '#/components/schemas/SystemMessage' + user: '#/components/schemas/UserMessage' + developer: '#/components/schemas/DeveloperMessage' + assistant: '#/components/schemas/AssistantMessage' + tool: '#/components/schemas/ToolResponseMessage' ToolDefinitionJson: type: object properties: @@ -8755,231 +9100,10 @@ components: properties: provider: description: When multiple model providers are available, optionally indicate your routing preference. - anyOf: - - type: object - properties: - allow_fallbacks: - description: > - Whether to allow backup providers to serve requests - - - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider. - - - false: use only the primary/custom provider, and return the upstream error if it's unavailable. - - anyOf: - - type: boolean - - type: 'null' - require_parameters: - description: >- - Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. - anyOf: - - type: boolean - - type: 'null' - data_collection: - description: >- - Data collection setting. If no available model provider meets the requirement, your request will return an error. - - - allow: (default) allow providers which store user data non-transiently and may train on it - - - - deny: use only providers which do not collect user data. - anyOf: - - type: string - enum: - - deny - - allow - x-speakeasy-unknown-values: allow - - type: 'null' - zdr: - anyOf: - - type: boolean - - type: 'null' - enforce_distillable_text: - anyOf: - - type: boolean - - type: 'null' - order: - description: >- - An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. - anyOf: - - $ref: '#/components/schemas/__schema0' - - type: 'null' - only: - description: >- - List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. - anyOf: - - $ref: '#/components/schemas/__schema0' - - type: 'null' - ignore: - description: >- - List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. - anyOf: - - $ref: '#/components/schemas/__schema0' - - type: 'null' - quantizations: - description: A list of quantization levels to filter the provider by. - anyOf: - - type: array - items: - type: string - enum: - - int4 - - int8 - - fp4 - - fp6 - - fp8 - - fp16 - - bf16 - - fp32 - - unknown - x-speakeasy-unknown-values: allow - - type: 'null' - sort: - description: >- - The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. - anyOf: - - $ref: '#/components/schemas/ProviderSortUnion' - - type: 'null' - max_price: - description: >- - The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. - type: object - properties: - prompt: - $ref: '#/components/schemas/__schema1' - completion: - $ref: '#/components/schemas/__schema1' - image: - $ref: '#/components/schemas/__schema1' - audio: - $ref: '#/components/schemas/__schema1' - request: - $ref: '#/components/schemas/__schema1' - preferred_min_throughput: - description: >- - Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. - anyOf: - - anyOf: - - type: number - - type: object - properties: - p50: - anyOf: - - type: number - - type: 'null' - p75: - anyOf: - - type: number - - type: 'null' - p90: - anyOf: - - type: number - - type: 'null' - p99: - anyOf: - - type: number - - type: 'null' - - type: 'null' - preferred_max_latency: - description: >- - Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. - anyOf: - - anyOf: - - type: number - - type: object - properties: - p50: - anyOf: - - type: number - - type: 'null' - p75: - anyOf: - - type: number - - type: 'null' - p90: - anyOf: - - type: number - - type: 'null' - p99: - anyOf: - - type: number - - type: 'null' - - type: 'null' - additionalProperties: false - - type: 'null' + $ref: '#/components/schemas/__schema0' plugins: description: Plugins you want to enable for this request, including their settings. - type: array - items: - oneOf: - - type: object - properties: - id: - type: string - const: auto-router - enabled: - type: boolean - allowed_models: - type: array - items: - type: string - required: - - id - - type: object - properties: - id: - type: string - const: moderation - required: - - id - - type: object - properties: - id: - type: string - const: web - enabled: - type: boolean - max_results: - type: number - search_prompt: - type: string - engine: - type: string - enum: - - native - - exa - x-speakeasy-unknown-values: allow - required: - - id - - type: object - properties: - id: - type: string - const: file-parser - enabled: - type: boolean - pdf: - type: object - properties: - engine: - type: string - enum: - - mistral-ocr - - pdf-text - - native - x-speakeasy-unknown-values: allow - required: - - id - - type: object - properties: - id: - type: string - const: response-healing - enabled: - type: boolean - required: - - id - type: object + $ref: '#/components/schemas/__schema17' route: anyOf: - type: string @@ -8993,8 +9117,7 @@ components: session_id: description: >- A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. - type: string - maxLength: 128 + $ref: '#/components/schemas/__schema18' messages: minItems: 1 type: array @@ -9110,7 +9233,7 @@ components: - maxItems: 4 type: array items: - type: string + $ref: '#/components/schemas/ModelName' - type: 'null' stream: default: false @@ -9152,6 +9275,8 @@ components: anyOf: - type: string - type: number + - type: array + items: {} modalities: type: array items: @@ -9170,7 +9295,7 @@ components: type: object properties: finish_reason: - $ref: '#/components/schemas/__schema6' + $ref: '#/components/schemas/__schema25' index: type: number message: @@ -9228,14 +9353,14 @@ components: reasoning_details: type: array items: - $ref: '#/components/schemas/__schema2' + $ref: '#/components/schemas/__schema19' ChatStreamingChoice: type: object properties: delta: $ref: '#/components/schemas/ChatStreamingMessageChunk' finish_reason: - $ref: '#/components/schemas/__schema6' + $ref: '#/components/schemas/__schema25' index: type: number logprobs: @@ -9350,264 +9475,6 @@ components: required: - data additionalProperties: false - CompletionFinishReason: - anyOf: - - type: string - enum: - - stop - - length - - content_filter - x-speakeasy-unknown-values: allow - - type: 'null' - CompletionLogprobs: - type: object - properties: - tokens: - type: array - items: - type: string - token_logprobs: - type: array - items: - type: number - top_logprobs: - anyOf: - - type: array - items: - type: object - propertyNames: - type: string - additionalProperties: - type: number - - type: 'null' - text_offset: - type: array - items: - type: number - required: - - tokens - - token_logprobs - - top_logprobs - - text_offset - CompletionUsage: - type: object - properties: - prompt_tokens: - type: number - completion_tokens: - type: number - total_tokens: - type: number - required: - - prompt_tokens - - completion_tokens - - total_tokens - CompletionCreateParams: - type: object - properties: - model: - $ref: '#/components/schemas/ModelName' - models: - type: array - items: - $ref: '#/components/schemas/ModelName' - prompt: - anyOf: - - type: string - - type: array - items: - type: string - - type: array - items: - type: number - - type: array - items: - type: array - items: - type: number - best_of: - anyOf: - - type: integer - minimum: 1 - maximum: 20 - - type: 'null' - echo: - anyOf: - - type: boolean - - type: 'null' - frequency_penalty: - anyOf: - - type: number - minimum: -2 - maximum: 2 - - type: 'null' - logit_bias: - anyOf: - - type: object - propertyNames: - type: string - additionalProperties: - type: number - - type: 'null' - logprobs: - anyOf: - - type: integer - minimum: 0 - maximum: 5 - - type: 'null' - max_tokens: - anyOf: - - type: integer - minimum: 1 - maximum: 9007199254740991 - - type: 'null' - 'n': - anyOf: - - type: integer - minimum: 1 - maximum: 128 - - type: 'null' - presence_penalty: - anyOf: - - type: number - minimum: -2 - maximum: 2 - - type: 'null' - seed: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: 'null' - stop: - anyOf: - - anyOf: - - type: string - - type: array - items: - type: string - - type: 'null' - stream: - default: false - type: boolean - stream_options: - anyOf: - - type: object - properties: - include_usage: - anyOf: - - type: boolean - - type: 'null' - - type: 'null' - suffix: - anyOf: - - type: string - - type: 'null' - temperature: - anyOf: - - type: number - minimum: 0 - maximum: 2 - - type: 'null' - top_p: - anyOf: - - type: number - minimum: 0 - maximum: 1 - - type: 'null' - user: - type: string - metadata: - anyOf: - - type: object - propertyNames: - type: string - additionalProperties: - type: string - - type: 'null' - response_format: - anyOf: - - oneOf: - - type: object - properties: - type: - type: string - const: text - required: - - type - - type: object - properties: - type: - type: string - const: json_object - required: - - type - - $ref: '#/components/schemas/ResponseFormatJSONSchema' - - $ref: '#/components/schemas/ResponseFormatTextGrammar' - - type: object - properties: - type: - type: string - const: python - required: - - type - type: object - - type: 'null' - required: - - prompt - CompletionChoice: - type: object - properties: - text: - type: string - index: - type: number - logprobs: - anyOf: - - $ref: '#/components/schemas/CompletionLogprobs' - - type: 'null' - finish_reason: - $ref: '#/components/schemas/CompletionFinishReason' - native_finish_reason: - type: string - reasoning: - anyOf: - - type: string - - type: 'null' - required: - - text - - index - - logprobs - - finish_reason - CompletionResponse: - type: object - properties: - id: - type: string - object: - type: string - const: text_completion - created: - type: number - model: - type: string - provider: - type: string - system_fingerprint: - type: string - choices: - type: array - items: - $ref: '#/components/schemas/CompletionChoice' - usage: - $ref: '#/components/schemas/CompletionUsage' - required: - - id - - object - - created - - model - - choices - additionalProperties: false parameters: {AppIdentifier: {name: HTTP-Referer, in: header, schema: {type: string}, description: "The app identifier should be your app's URL and is used as the primary identifier for rankings.\nThis is used to track API usage per application.\n"}, AppDisplayName: {name: X-Title, in: header, schema: {type: string}, description: "The app display name allows you to customize how your app appears in OpenRouter's dashboard.\n"}} securitySchemes: apiKey: @@ -9728,13 +9595,16 @@ paths: schema: $ref: '#/components/schemas/ProviderOverloadedResponse' operationId: createResponses + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /messages: post: x-speakeasy-ignore: true x-speakeasy-name-override: create x-speakeasy-stream-request-field: stream tags: - - anthropic.messages + - Anthropic Messages summary: Create a message description: >- Creates a message using the Anthropic Messages API format. Supports text, images, PDFs, tools, and extended thinking. @@ -9956,6 +9826,9 @@ paths: - type - error operationId: createMessages + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /activity: get: tags: @@ -9963,7 +9836,7 @@ paths: operationId: getUserActivity summary: Get user activity grouped by endpoint description: >- - Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -10014,7 +9887,7 @@ paths: schema: $ref: '#/components/schemas/UnauthorizedResponse' '403': - description: Forbidden - Only provisioning keys can fetch activity + description: Forbidden - Only management keys can fetch activity content: application/json: schema: @@ -10025,6 +9898,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /credits: get: x-speakeasy-name-override: getCredits @@ -10033,7 +9909,7 @@ paths: summary: Get remaining credits operationId: getCredits description: >- - Get total credits purchased and used for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Get total credits purchased and used for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. responses: '200': description: Returns the total credits purchased and used @@ -10073,7 +9949,7 @@ paths: schema: $ref: '#/components/schemas/UnauthorizedResponse' '403': - description: Forbidden - Only provisioning keys can fetch credits + description: Forbidden - Only management keys can fetch credits content: application/json: schema: @@ -10084,6 +9960,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /credits/coinbase: post: security: @@ -10206,6 +10085,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /embeddings: post: x-speakeasy-name-override: generate @@ -10410,6 +10292,9 @@ paths: schema: $ref: '#/components/schemas/ProviderOverloadedResponse' operationId: createEmbeddings + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /embeddings/models: get: tags: @@ -10437,6 +10322,9 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' operationId: listEmbeddingsModels + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /generation: get: tags: @@ -10621,6 +10509,132 @@ paths: nullable: true description: Router used for the request (e.g., openrouter/auto) example: openrouter/auto + provider_responses: + type: array + nullable: true + items: + type: object + properties: + id: + type: string + endpoint_id: + type: string + model_permaslug: + type: string + provider_name: + type: string + enum: + - AnyScale + - Atoma + - Cent-ML + - CrofAI + - Enfer + - GoPomelo + - HuggingFace + - Hyperbolic 2 + - InoCloud + - Kluster + - Lambda + - Lepton + - Lynn 2 + - Lynn + - Mancer + - Meta + - Modal + - Nineteen + - OctoAI + - Recursal + - Reflection + - Replicate + - SambaNova 2 + - SF Compute + - Targon + - Together 2 + - Ubicloud + - 01.AI + - AI21 + - AionLabs + - Alibaba + - Ambient + - Amazon Bedrock + - Amazon Nova + - Anthropic + - Arcee AI + - AtlasCloud + - Avian + - Azure + - BaseTen + - BytePlus + - Black Forest Labs + - Cerebras + - Chutes + - Cirrascale + - Clarifai + - Cloudflare + - Cohere + - Crusoe + - DeepInfra + - DeepSeek + - Featherless + - Fireworks + - Friendli + - GMICloud + - Google + - Google AI Studio + - Groq + - Hyperbolic + - Inception + - Inceptron + - InferenceNet + - Infermatic + - Inflection + - Liquid + - Mara + - Mancer 2 + - Minimax + - ModelRun + - Mistral + - Modular + - Moonshot AI + - Morph + - NCompass + - Nebius + - NextBit + - Novita + - Nvidia + - OpenAI + - OpenInference + - Parasail + - Perplexity + - Phala + - Relace + - SambaNova + - Seed + - SiliconFlow + - Sourceful + - StepFun + - Stealth + - StreamLake + - Switchpoint + - Together + - Upstage + - Venice + - WandB + - Xiaomi + - xAI + - Z.AI + - FakeProvider + x-speakeasy-unknown-values: allow + status: + type: number + nullable: true + latency: + type: number + is_byok: + type: boolean + required: + - status + description: List of provider responses for this generation, including fallback attempts required: - id - upstream_id @@ -10655,6 +10669,7 @@ paths: - external_user - api_type - router + - provider_responses description: Generation data required: - data @@ -10708,6 +10723,9 @@ paths: schema: $ref: '#/components/schemas/ProviderOverloadedResponse' operationId: getGeneration + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /models/count: get: tags: @@ -10728,6 +10746,9 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' operationId: listModelsCount + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /models: get: tags: @@ -10782,12 +10803,17 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' operationId: getModels + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /models/user: get: tags: - Models x-speakeasy-name-override: listForUser - summary: List models filtered by user provider preferences + description: >- + List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing). + summary: List models filtered by user provider preferences, privacy settings, and guardrails security: - bearer: [] responses: @@ -10803,6 +10829,12 @@ paths: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + '404': + description: Not Found - No eligible endpoints found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' '500': description: Internal Server Error content: @@ -10810,6 +10842,9 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' operationId: listModelsUser + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /models/{author}/{slug}/endpoints: get: tags: @@ -10852,6 +10887,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /endpoints/zdr: get: tags: @@ -10879,6 +10917,9 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' operationId: listEndpointsZdr + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /providers: get: tags: @@ -10940,6 +10981,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /keys: get: operationId: list @@ -10948,7 +10992,7 @@ paths: - API Keys summary: List API keys description: >- - List all API keys for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -11148,7 +11192,7 @@ paths: - API Keys summary: Create a new API key description: >- - Create a new API key for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Create a new API key for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. requestBody: content: application/json: @@ -11383,13 +11427,16 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' operationId: createKeys + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /keys/{hash}: patch: x-speakeasy-name-override: update tags: - API Keys summary: Update an API key - description: Update an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + description: Update an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -11632,7 +11679,7 @@ paths: tags: - API Keys summary: Delete an API key - description: Delete an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + description: Delete an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -11690,7 +11737,7 @@ paths: tags: - API Keys summary: Get a single API key - description: Get a single API key by hash. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + description: Get a single API key by hash. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -11880,6 +11927,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /guardrails: get: operationId: listGuardrails @@ -11888,7 +11938,7 @@ paths: - Guardrails summary: List guardrails description: >- - List all guardrails for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -12045,7 +12095,7 @@ paths: - Guardrails summary: Create a guardrail description: >- - Create a new guardrail for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Create a new guardrail for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. requestBody: content: application/json: @@ -12252,6 +12302,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /guardrails/{id}: get: operationId: getGuardrail @@ -12259,7 +12312,7 @@ paths: tags: - Guardrails summary: Get a guardrail - description: Get a single guardrail by ID. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + description: Get a single guardrail by ID. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -12406,7 +12459,7 @@ paths: tags: - Guardrails summary: Update a guardrail - description: Update an existing guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + description: Update an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -12623,7 +12676,7 @@ paths: tags: - Guardrails summary: Delete a guardrail - description: Delete an existing guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + description: Delete an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -12669,6 +12722,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /guardrails/assignments/keys: get: operationId: listKeyAssignments @@ -12677,7 +12733,7 @@ paths: - Guardrails summary: List all key assignments description: >- - List all API key guardrail assignments for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all API key guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -12767,6 +12823,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /guardrails/assignments/members: get: operationId: listMemberAssignments @@ -12775,7 +12834,7 @@ paths: - Guardrails summary: List all member assignments description: >- - List all organization member guardrail assignments for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all organization member guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -12860,6 +12919,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /guardrails/{id}/assignments/keys: get: operationId: listGuardrailKeyAssignments @@ -12868,7 +12930,7 @@ paths: - Guardrails summary: List key assignments for a guardrail description: >- - List all API key assignments for a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all API key assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -12980,7 +13042,7 @@ paths: - Guardrails summary: Bulk assign keys to a guardrail description: >- - Assign multiple API keys to a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Assign multiple API keys to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -13047,6 +13109,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /guardrails/{id}/assignments/members: get: operationId: listGuardrailMemberAssignments @@ -13055,7 +13120,7 @@ paths: - Guardrails summary: List member assignments for a guardrail description: >- - List all organization member assignments for a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all organization member assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -13162,7 +13227,7 @@ paths: - Guardrails summary: Bulk assign members to a guardrail description: >- - Assign multiple organization members to a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Assign multiple organization members to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -13230,6 +13295,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /guardrails/{id}/assignments/keys/remove: post: operationId: bulkUnassignKeysFromGuardrail @@ -13238,7 +13306,7 @@ paths: - Guardrails summary: Bulk unassign keys from a guardrail description: >- - Unassign multiple API keys from a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Unassign multiple API keys from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -13305,6 +13373,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /guardrails/{id}/assignments/members/remove: post: operationId: bulkUnassignMembersFromGuardrail @@ -13313,7 +13384,7 @@ paths: - Guardrails summary: Bulk unassign members from a guardrail description: >- - Unassign multiple organization members from a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Unassign multiple organization members from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. parameters: - schema: type: string @@ -13381,6 +13452,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /key: get: operationId: getCurrentKey @@ -13445,9 +13519,14 @@ paths: type: boolean description: Whether this is a free tier API key example: false + is_management_key: + type: boolean + description: Whether this is a management key + example: false is_provisioning_key: type: boolean - description: Whether this is a provisioning key + description: Whether this is a management key + deprecated: true example: false limit_remaining: type: number @@ -13506,6 +13585,7 @@ paths: - byok_usage_weekly - byok_usage_monthly - is_free_tier + - is_management_key - is_provisioning_key - limit_remaining - limit_reset @@ -13524,6 +13604,7 @@ paths: byok_usage_weekly: 17.38 byok_usage_monthly: 17.38 is_free_tier: false + is_management_key: false is_provisioning_key: false limit_remaining: 74.5 limit_reset: monthly @@ -13548,6 +13629,7 @@ paths: byok_usage_weekly: 17.38 byok_usage_monthly: 17.38 is_free_tier: false + is_management_key: false is_provisioning_key: false limit_remaining: 74.5 limit_reset: monthly @@ -13569,6 +13651,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /auth/keys: post: operationId: exchangeAuthCodeForAPIKey @@ -13647,6 +13732,9 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /auth/keys/code: post: x-speakeasy-name-override: createAuthCode @@ -13748,6 +13836,9 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' operationId: createAuthKeysCode + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /chat/completions: post: summary: Create a chat completion @@ -13802,55 +13893,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ChatError' - /completions: - post: - summary: Create a completion - x-speakeasy-group: completions - x-speakeasy-name-override: generate - x-speakeasy-stream-request-field: stream - description: Creates a completion for the provided prompt and parameters. Supports both streaming and non-streaming modes. - tags: - - Completions - requestBody: - required: true - description: Completion request parameters - content: - application/json: - schema: - $ref: '#/components/schemas/CompletionCreateParams' - responses: - '200': - description: Successful completion response - content: - application/json: - schema: - $ref: '#/components/schemas/CompletionResponse' - description: Completion response - '400': - description: Bad request - invalid parameters - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '401': - description: Unauthorized - invalid API key - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '429': - description: Too many requests - rate limit exceeded - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - operationId: createCompletions + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" servers: - url: https://openrouter.ai/api/v1 description: Production server @@ -13865,10 +13910,10 @@ tags: description: API key management endpoints - name: Analytics description: Analytics and usage endpoints + - name: Anthropic Messages + description: Anthropic Messages endpoints - name: Chat description: Chat completion endpoints - - name: Completions - description: Text completion endpoints - name: Credits description: Credit management endpoints - name: Embeddings @@ -13885,8 +13930,6 @@ tags: description: OAuth authentication endpoints - name: Providers description: Provider information endpoints - - name: anthropic.messages - description: anthropic.messages endpoints - name: beta.responses description: beta.responses endpoints x-fern-base-path: / diff --git a/.speakeasy/overlays/add-headers.overlay.yaml b/.speakeasy/overlays/add-headers.overlay.yaml index 60a2232..a6a3474 100644 --- a/.speakeasy/overlays/add-headers.overlay.yaml +++ b/.speakeasy/overlays/add-headers.overlay.yaml @@ -33,3 +33,11 @@ actions: type: string description: | The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + # Add header parameters to all paths so Speakeasy matches them with globals + - target: $.paths[*] + description: Reference app identification headers on all paths so Speakeasy injects them via globals + update: + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index ff94a13..f0f9a9f 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -8,19 +8,20 @@ sources: - latest OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:291e215687f85db05005d79dd87602a75b8086f39a841700fdbaaff7690b4f76 - sourceBlobDigest: sha256:166639d08f0ae9687cea532ed8a93db59e63293c6a6f4d17d63f015b60d643d2 + sourceRevisionDigest: sha256:2dbe784978f60cb53a0d081e1b5f4cbb42ca86b1ff8f4361869fa78c42e042ee + sourceBlobDigest: sha256:851aadf3180735f9dbfdb2904011de231d3805d187499c24a450a224cacf1ed2 tags: - latest + - main - 1.0.0 targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:291e215687f85db05005d79dd87602a75b8086f39a841700fdbaaff7690b4f76 - sourceBlobDigest: sha256:166639d08f0ae9687cea532ed8a93db59e63293c6a6f4d17d63f015b60d643d2 + sourceRevisionDigest: sha256:2dbe784978f60cb53a0d081e1b5f4cbb42ca86b1ff8f4361869fa78c42e042ee + sourceBlobDigest: sha256:851aadf3180735f9dbfdb2904011de231d3805d187499c24a450a224cacf1ed2 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:f19eae09ec90a23147935f07a86f75dbbc998e6bac3b820351a1e5f147fec590 + codeSamplesRevisionDigest: sha256:cf9f3fd9983864e3c5dd5bc3fa9198efc9493f4fbc671130e8f07e87722c43dd workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.666.0 diff --git a/README.md b/README.md index a15ae66..8dd9349 100644 --- a/README.md +++ b/README.md @@ -182,6 +182,8 @@ import os def main(): with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: # Rest of application here... @@ -191,6 +193,8 @@ def main(): async def amain(): async with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: # Rest of application here... diff --git a/USAGE.md b/USAGE.md index 77a937c..96d2883 100644 --- a/USAGE.md +++ b/USAGE.md @@ -6,6 +6,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -30,6 +32,8 @@ import os async def main(): async with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: diff --git a/docs/components/assistantmessage.md b/docs/components/assistantmessage.md index 532cbb2..127aee3 100644 --- a/docs/components/assistantmessage.md +++ b/docs/components/assistantmessage.md @@ -11,5 +11,5 @@ | `tool_calls` | List[[components.ChatMessageToolCall](../components/chatmessagetoolcall.md)] | :heavy_minus_sign: | N/A | | `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `reasoning_details` | List[[components.Schema2](../components/schema2.md)] | :heavy_minus_sign: | N/A | +| `reasoning_details` | List[[components.Schema19](../components/schema19.md)] | :heavy_minus_sign: | N/A | | `images` | List[[components.Image](../components/image.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatgenerationparams.md b/docs/components/chatgenerationparams.md index f01af13..577c2ab 100644 --- a/docs/components/chatgenerationparams.md +++ b/docs/components/chatgenerationparams.md @@ -3,34 +3,34 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `provider` | [OptionalNullable[components.ChatGenerationParamsProvider]](../components/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | -| `plugins` | List[[components.ChatGenerationParamsPluginUnion](../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | -| `route` | [OptionalNullable[components.Route]](../components/route.md) | :heavy_minus_sign: | N/A | -| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | -| `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | N/A | -| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `models` | List[*str*] | :heavy_minus_sign: | N/A | -| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A | -| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | -| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `reasoning` | [Optional[components.Reasoning]](../components/reasoning.md) | :heavy_minus_sign: | N/A | -| `response_format` | [Optional[components.ChatGenerationParamsResponseFormatUnion]](../components/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A | -| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `stop` | [OptionalNullable[components.ChatGenerationParamsStop]](../components/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A | -| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A | -| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A | -| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `debug` | [Optional[components.Debug]](../components/debug.md) | :heavy_minus_sign: | N/A | -| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A | -| `modalities` | List[[components.Modality](../components/modality.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| `provider` | [OptionalNullable[components.Schema0]](../components/schema0.md) | :heavy_minus_sign: | N/A | +| `plugins` | List[[components.Schema17](../components/schema17.md)] | :heavy_minus_sign: | N/A | +| `route` | [OptionalNullable[components.Route]](../components/route.md) | :heavy_minus_sign: | N/A | +| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `session_id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | N/A | +| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `models` | List[*str*] | :heavy_minus_sign: | N/A | +| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A | +| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | +| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `reasoning` | [Optional[components.Reasoning]](../components/reasoning.md) | :heavy_minus_sign: | N/A | +| `response_format` | [Optional[components.ResponseFormat]](../components/responseformat.md) | :heavy_minus_sign: | N/A | +| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | +| `stop` | [OptionalNullable[components.Stop]](../components/stop.md) | :heavy_minus_sign: | N/A | +| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | +| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A | +| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A | +| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A | +| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `debug` | [Optional[components.Debug]](../components/debug.md) | :heavy_minus_sign: | N/A | +| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A | +| `modalities` | List[[components.Modality](../components/modality.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatgenerationparamsimageconfig.md b/docs/components/chatgenerationparamsimageconfig.md index 18403aa..d5a692a 100644 --- a/docs/components/chatgenerationparamsimageconfig.md +++ b/docs/components/chatgenerationparamsimageconfig.md @@ -15,3 +15,9 @@ value: str = /* values here */ value: float = /* values here */ ``` +### `List[Any]` + +```python +value: List[Any] = /* values here */ +``` + diff --git a/docs/components/chatgenerationparamsmaxprice.md b/docs/components/chatgenerationparamsmaxprice.md deleted file mode 100644 index b3a2bf4..0000000 --- a/docs/components/chatgenerationparamsmaxprice.md +++ /dev/null @@ -1,14 +0,0 @@ -# ChatGenerationParamsMaxPrice - -The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `prompt` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `completion` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `image` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `audio` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `request` | *Optional[Any]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatgenerationparamspluginunion.md b/docs/components/chatgenerationparamspluginunion.md deleted file mode 100644 index 5457d76..0000000 --- a/docs/components/chatgenerationparamspluginunion.md +++ /dev/null @@ -1,35 +0,0 @@ -# ChatGenerationParamsPluginUnion - - -## Supported Types - -### `components.ChatGenerationParamsPluginAutoRouter` - -```python -value: components.ChatGenerationParamsPluginAutoRouter = /* values here */ -``` - -### `components.ChatGenerationParamsPluginModeration` - -```python -value: components.ChatGenerationParamsPluginModeration = /* values here */ -``` - -### `components.ChatGenerationParamsPluginWeb` - -```python -value: components.ChatGenerationParamsPluginWeb = /* values here */ -``` - -### `components.ChatGenerationParamsPluginFileParser` - -```python -value: components.ChatGenerationParamsPluginFileParser = /* values here */ -``` - -### `components.ChatGenerationParamsPluginResponseHealing` - -```python -value: components.ChatGenerationParamsPluginResponseHealing = /* values here */ -``` - diff --git a/docs/components/chatgenerationparamspreferredmaxlatencyunion.md b/docs/components/chatgenerationparamspreferredmaxlatencyunion.md deleted file mode 100644 index 3b22111..0000000 --- a/docs/components/chatgenerationparamspreferredmaxlatencyunion.md +++ /dev/null @@ -1,17 +0,0 @@ -# ChatGenerationParamsPreferredMaxLatencyUnion - - -## Supported Types - -### `float` - -```python -value: float = /* values here */ -``` - -### `components.ChatGenerationParamsPreferredMaxLatency` - -```python -value: components.ChatGenerationParamsPreferredMaxLatency = /* values here */ -``` - diff --git a/docs/components/chatgenerationparamspreferredminthroughput.md b/docs/components/chatgenerationparamspreferredminthroughput.md deleted file mode 100644 index 260394d..0000000 --- a/docs/components/chatgenerationparamspreferredminthroughput.md +++ /dev/null @@ -1,11 +0,0 @@ -# ChatGenerationParamsPreferredMinThroughput - - -## Fields - -| Field | Type | Required | Description | -| ------------------------- | ------------------------- | ------------------------- | ------------------------- | -| `p50` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `p75` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `p90` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `p99` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatgenerationparamspreferredminthroughputunion.md b/docs/components/chatgenerationparamspreferredminthroughputunion.md deleted file mode 100644 index 3803e24..0000000 --- a/docs/components/chatgenerationparamspreferredminthroughputunion.md +++ /dev/null @@ -1,17 +0,0 @@ -# ChatGenerationParamsPreferredMinThroughputUnion - - -## Supported Types - -### `float` - -```python -value: float = /* values here */ -``` - -### `components.ChatGenerationParamsPreferredMinThroughput` - -```python -value: components.ChatGenerationParamsPreferredMinThroughput = /* values here */ -``` - diff --git a/docs/components/chatgenerationparamsprovider.md b/docs/components/chatgenerationparamsprovider.md deleted file mode 100644 index 3d486fa..0000000 --- a/docs/components/chatgenerationparamsprovider.md +++ /dev/null @@ -1,20 +0,0 @@ -# ChatGenerationParamsProvider - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
| -| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. | -| `data_collection` | [OptionalNullable[components.ChatGenerationParamsDataCollection]](../components/chatgenerationparamsdatacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it

- deny: use only providers which do not collect user data. | -| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `order` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | -| `only` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | -| `ignore` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | -| `quantizations` | List[[components.Quantizations](../components/quantizations.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | -| `sort` | [OptionalNullable[components.ProviderSortUnion]](../components/providersortunion.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | -| `max_price` | [Optional[components.ChatGenerationParamsMaxPrice]](../components/chatgenerationparamsmaxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | -| `preferred_min_throughput` | [OptionalNullable[components.ChatGenerationParamsPreferredMinThroughputUnion]](../components/chatgenerationparamspreferredminthroughputunion.md) | :heavy_minus_sign: | Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | -| `preferred_max_latency` | [OptionalNullable[components.ChatGenerationParamsPreferredMaxLatencyUnion]](../components/chatgenerationparamspreferredmaxlatencyunion.md) | :heavy_minus_sign: | Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | \ No newline at end of file diff --git a/docs/components/chatgenerationparamsresponseformatunion.md b/docs/components/chatgenerationparamsresponseformatunion.md deleted file mode 100644 index 19f2e8c..0000000 --- a/docs/components/chatgenerationparamsresponseformatunion.md +++ /dev/null @@ -1,35 +0,0 @@ -# ChatGenerationParamsResponseFormatUnion - - -## Supported Types - -### `components.ChatGenerationParamsResponseFormatText` - -```python -value: components.ChatGenerationParamsResponseFormatText = /* values here */ -``` - -### `components.ChatGenerationParamsResponseFormatJSONObject` - -```python -value: components.ChatGenerationParamsResponseFormatJSONObject = /* values here */ -``` - -### `components.ResponseFormatJSONSchema` - -```python -value: components.ResponseFormatJSONSchema = /* values here */ -``` - -### `components.ResponseFormatTextGrammar` - -```python -value: components.ResponseFormatTextGrammar = /* values here */ -``` - -### `components.ChatGenerationParamsResponseFormatPython` - -```python -value: components.ChatGenerationParamsResponseFormatPython = /* values here */ -``` - diff --git a/docs/components/chatstreamingmessagechunk.md b/docs/components/chatstreamingmessagechunk.md index eb70467..8c62a97 100644 --- a/docs/components/chatstreamingmessagechunk.md +++ b/docs/components/chatstreamingmessagechunk.md @@ -10,4 +10,4 @@ | `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `tool_calls` | List[[components.ChatStreamingMessageToolCall](../components/chatstreamingmessagetoolcall.md)] | :heavy_minus_sign: | N/A | -| `reasoning_details` | List[[components.Schema2](../components/schema2.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| `reasoning_details` | List[[components.Schema19](../components/schema19.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/completion.md b/docs/components/completion.md new file mode 100644 index 0000000..ce9609b --- /dev/null +++ b/docs/components/completion.md @@ -0,0 +1,23 @@ +# Completion + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + +### `Any` + +```python +value: Any = /* values here */ +``` + diff --git a/docs/components/completionchoice.md b/docs/components/completionchoice.md deleted file mode 100644 index cb489be..0000000 --- a/docs/components/completionchoice.md +++ /dev/null @@ -1,13 +0,0 @@ -# CompletionChoice - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `text` | *str* | :heavy_check_mark: | N/A | -| `index` | *float* | :heavy_check_mark: | N/A | -| `logprobs` | [Nullable[components.CompletionLogprobs]](../components/completionlogprobs.md) | :heavy_check_mark: | N/A | -| `finish_reason` | [Nullable[components.CompletionFinishReason]](../components/completionfinishreason.md) | :heavy_check_mark: | N/A | -| `native_finish_reason` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/completioncreateparams.md b/docs/components/completioncreateparams.md deleted file mode 100644 index 7f7c9f4..0000000 --- a/docs/components/completioncreateparams.md +++ /dev/null @@ -1,28 +0,0 @@ -# CompletionCreateParams - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | -| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `models` | List[*str*] | :heavy_minus_sign: | N/A | -| `prompt` | [components.Prompt](../components/prompt.md) | :heavy_check_mark: | N/A | -| `best_of` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `echo` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A | -| `logprobs` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `n` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `stop` | [OptionalNullable[components.CompletionCreateParamsStop]](../components/completioncreateparamsstop.md) | :heavy_minus_sign: | N/A | -| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `stream_options` | [OptionalNullable[components.StreamOptions]](../components/streamoptions.md) | :heavy_minus_sign: | N/A | -| `suffix` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | -| `response_format` | [OptionalNullable[components.CompletionCreateParamsResponseFormatUnion]](../components/completioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/completioncreateparamsresponseformatjsonobject.md b/docs/components/completioncreateparamsresponseformatjsonobject.md deleted file mode 100644 index a5c6d3b..0000000 --- a/docs/components/completioncreateparamsresponseformatjsonobject.md +++ /dev/null @@ -1,8 +0,0 @@ -# CompletionCreateParamsResponseFormatJSONObject - - -## Fields - -| Field | Type | Required | Description | -| ------------------------ | ------------------------ | ------------------------ | ------------------------ | -| `type` | *Literal["json_object"]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/completioncreateparamsresponseformatpython.md b/docs/components/completioncreateparamsresponseformatpython.md deleted file mode 100644 index e0bcf67..0000000 --- a/docs/components/completioncreateparamsresponseformatpython.md +++ /dev/null @@ -1,8 +0,0 @@ -# CompletionCreateParamsResponseFormatPython - - -## Fields - -| Field | Type | Required | Description | -| ------------------- | ------------------- | ------------------- | ------------------- | -| `type` | *Literal["python"]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/completioncreateparamsresponseformattext.md b/docs/components/completioncreateparamsresponseformattext.md deleted file mode 100644 index bb80891..0000000 --- a/docs/components/completioncreateparamsresponseformattext.md +++ /dev/null @@ -1,8 +0,0 @@ -# CompletionCreateParamsResponseFormatText - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `type` | *Literal["text"]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/completioncreateparamsresponseformatunion.md b/docs/components/completioncreateparamsresponseformatunion.md deleted file mode 100644 index 53050dc..0000000 --- a/docs/components/completioncreateparamsresponseformatunion.md +++ /dev/null @@ -1,35 +0,0 @@ -# CompletionCreateParamsResponseFormatUnion - - -## Supported Types - -### `components.CompletionCreateParamsResponseFormatText` - -```python -value: components.CompletionCreateParamsResponseFormatText = /* values here */ -``` - -### `components.CompletionCreateParamsResponseFormatJSONObject` - -```python -value: components.CompletionCreateParamsResponseFormatJSONObject = /* values here */ -``` - -### `components.ResponseFormatJSONSchema` - -```python -value: components.ResponseFormatJSONSchema = /* values here */ -``` - -### `components.ResponseFormatTextGrammar` - -```python -value: components.ResponseFormatTextGrammar = /* values here */ -``` - -### `components.CompletionCreateParamsResponseFormatPython` - -```python -value: components.CompletionCreateParamsResponseFormatPython = /* values here */ -``` - diff --git a/docs/components/completionfinishreason.md b/docs/components/completionfinishreason.md deleted file mode 100644 index 4a4e249..0000000 --- a/docs/components/completionfinishreason.md +++ /dev/null @@ -1,10 +0,0 @@ -# CompletionFinishReason - - -## Values - -| Name | Value | -| ---------------- | ---------------- | -| `STOP` | stop | -| `LENGTH` | length | -| `CONTENT_FILTER` | content_filter | \ No newline at end of file diff --git a/docs/components/completionlogprobs.md b/docs/components/completionlogprobs.md deleted file mode 100644 index 9a8b558..0000000 --- a/docs/components/completionlogprobs.md +++ /dev/null @@ -1,11 +0,0 @@ -# CompletionLogprobs - - -## Fields - -| Field | Type | Required | Description | -| ------------------------ | ------------------------ | ------------------------ | ------------------------ | -| `tokens` | List[*str*] | :heavy_check_mark: | N/A | -| `token_logprobs` | List[*float*] | :heavy_check_mark: | N/A | -| `top_logprobs` | List[Dict[str, *float*]] | :heavy_check_mark: | N/A | -| `text_offset` | List[*float*] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/completionresponse.md b/docs/components/completionresponse.md deleted file mode 100644 index 3e9a9bd..0000000 --- a/docs/components/completionresponse.md +++ /dev/null @@ -1,15 +0,0 @@ -# CompletionResponse - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -| `id` | *str* | :heavy_check_mark: | N/A | -| `object` | *Literal["text_completion"]* | :heavy_check_mark: | N/A | -| `created` | *float* | :heavy_check_mark: | N/A | -| `model` | *str* | :heavy_check_mark: | N/A | -| `provider` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `system_fingerprint` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `choices` | List[[components.CompletionChoice](../components/completionchoice.md)] | :heavy_check_mark: | N/A | -| `usage` | [Optional[components.CompletionUsage]](../components/completionusage.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/completionusage.md b/docs/components/completionusage.md deleted file mode 100644 index e9e3983..0000000 --- a/docs/components/completionusage.md +++ /dev/null @@ -1,10 +0,0 @@ -# CompletionUsage - - -## Fields - -| Field | Type | Required | Description | -| ------------------- | ------------------- | ------------------- | ------------------- | -| `prompt_tokens` | *float* | :heavy_check_mark: | N/A | -| `completion_tokens` | *float* | :heavy_check_mark: | N/A | -| `total_tokens` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/developermessage.md b/docs/components/developermessage.md new file mode 100644 index 0000000..e767787 --- /dev/null +++ b/docs/components/developermessage.md @@ -0,0 +1,10 @@ +# DeveloperMessage + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `role` | *Literal["developer"]* | :heavy_check_mark: | N/A | +| `content` | [components.DeveloperMessageContent](../components/developermessagecontent.md) | :heavy_check_mark: | N/A | +| `name` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/messagecontent.md b/docs/components/developermessagecontent.md similarity index 89% rename from docs/components/messagecontent.md rename to docs/components/developermessagecontent.md index 6bbe93b..6a804dd 100644 --- a/docs/components/messagecontent.md +++ b/docs/components/developermessagecontent.md @@ -1,4 +1,4 @@ -# MessageContent +# DeveloperMessageContent ## Supported Types diff --git a/docs/components/message.md b/docs/components/message.md index 060be6a..fb33171 100644 --- a/docs/components/message.md +++ b/docs/components/message.md @@ -15,10 +15,10 @@ value: components.SystemMessage = /* values here */ value: components.UserMessage = /* values here */ ``` -### `components.MessageDeveloper` +### `components.DeveloperMessage` ```python -value: components.MessageDeveloper = /* values here */ +value: components.DeveloperMessage = /* values here */ ``` ### `components.AssistantMessage` diff --git a/docs/components/messagedeveloper.md b/docs/components/messagedeveloper.md deleted file mode 100644 index 8eb4529..0000000 --- a/docs/components/messagedeveloper.md +++ /dev/null @@ -1,10 +0,0 @@ -# MessageDeveloper - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `role` | *Literal["developer"]* | :heavy_check_mark: | N/A | -| `content` | [components.MessageContent](../components/messagecontent.md) | :heavy_check_mark: | N/A | -| `name` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/openresponsesrequest.md b/docs/components/openresponsesrequest.md index 072b47f..5eb4cc6 100644 --- a/docs/components/openresponsesrequest.md +++ b/docs/components/openresponsesrequest.md @@ -37,7 +37,7 @@ Request schema for Responses endpoint | `service_tier` | [Optional[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | | | `truncation` | [OptionalNullable[components.Truncation]](../components/truncation.md) | :heavy_minus_sign: | N/A | auto | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | -| `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../components/openresponsesrequestprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | -| `plugins` | List[[components.OpenResponsesRequestPluginUnion](../components/openresponsesrequestpluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | +| `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | +| `plugins` | List[[components.Plugin](../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | | | `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | | \ No newline at end of file diff --git a/docs/components/openresponsesrequestmaxprice.md b/docs/components/openresponsesrequestmaxprice.md index e3e7a4c..0b5bbdc 100644 --- a/docs/components/openresponsesrequestmaxprice.md +++ b/docs/components/openresponsesrequestmaxprice.md @@ -5,10 +5,10 @@ The object specifying the maximum price you want to pay for this request. USD pr ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | -| `prompt` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `completion` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `prompt` | *Optional[str]* | :heavy_minus_sign: | Price per million prompt tokens | 1000 | +| `completion` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | \ No newline at end of file diff --git a/docs/components/openresponsesrequestpluginunion.md b/docs/components/openresponsesrequestpluginunion.md deleted file mode 100644 index e164b2e..0000000 --- a/docs/components/openresponsesrequestpluginunion.md +++ /dev/null @@ -1,35 +0,0 @@ -# OpenResponsesRequestPluginUnion - - -## Supported Types - -### `components.OpenResponsesRequestPluginAutoRouter` - -```python -value: components.OpenResponsesRequestPluginAutoRouter = /* values here */ -``` - -### `components.OpenResponsesRequestPluginModeration` - -```python -value: components.OpenResponsesRequestPluginModeration = /* values here */ -``` - -### `components.OpenResponsesRequestPluginWeb` - -```python -value: components.OpenResponsesRequestPluginWeb = /* values here */ -``` - -### `components.OpenResponsesRequestPluginFileParser` - -```python -value: components.OpenResponsesRequestPluginFileParser = /* values here */ -``` - -### `components.OpenResponsesRequestPluginResponseHealing` - -```python -value: components.OpenResponsesRequestPluginResponseHealing = /* values here */ -``` - diff --git a/docs/components/plugin.md b/docs/components/plugin.md new file mode 100644 index 0000000..7fd669e --- /dev/null +++ b/docs/components/plugin.md @@ -0,0 +1,35 @@ +# Plugin + + +## Supported Types + +### `components.PluginAutoRouter` + +```python +value: components.PluginAutoRouter = /* values here */ +``` + +### `components.PluginModeration` + +```python +value: components.PluginModeration = /* values here */ +``` + +### `components.PluginWeb` + +```python +value: components.PluginWeb = /* values here */ +``` + +### `components.PluginFileParser` + +```python +value: components.PluginFileParser = /* values here */ +``` + +### `components.PluginResponseHealing` + +```python +value: components.PluginResponseHealing = /* values here */ +``` + diff --git a/docs/components/openresponsesrequestpluginautorouter.md b/docs/components/pluginautorouter.md similarity index 99% rename from docs/components/openresponsesrequestpluginautorouter.md rename to docs/components/pluginautorouter.md index 21de153..917f1cc 100644 --- a/docs/components/openresponsesrequestpluginautorouter.md +++ b/docs/components/pluginautorouter.md @@ -1,4 +1,4 @@ -# OpenResponsesRequestPluginAutoRouter +# PluginAutoRouter ## Fields diff --git a/docs/components/openresponsesrequestpluginfileparser.md b/docs/components/pluginfileparser.md similarity index 97% rename from docs/components/openresponsesrequestpluginfileparser.md rename to docs/components/pluginfileparser.md index 34d0801..c36d2a1 100644 --- a/docs/components/openresponsesrequestpluginfileparser.md +++ b/docs/components/pluginfileparser.md @@ -1,4 +1,4 @@ -# OpenResponsesRequestPluginFileParser +# PluginFileParser ## Fields diff --git a/docs/components/openresponsesrequestpluginmoderation.md b/docs/components/pluginmoderation.md similarity index 94% rename from docs/components/openresponsesrequestpluginmoderation.md rename to docs/components/pluginmoderation.md index 69b87cc..e1b99e8 100644 --- a/docs/components/openresponsesrequestpluginmoderation.md +++ b/docs/components/pluginmoderation.md @@ -1,4 +1,4 @@ -# OpenResponsesRequestPluginModeration +# PluginModeration ## Fields diff --git a/docs/components/openresponsesrequestpluginresponsehealing.md b/docs/components/pluginresponsehealing.md similarity index 97% rename from docs/components/openresponsesrequestpluginresponsehealing.md rename to docs/components/pluginresponsehealing.md index f99d182..93aa3d7 100644 --- a/docs/components/openresponsesrequestpluginresponsehealing.md +++ b/docs/components/pluginresponsehealing.md @@ -1,4 +1,4 @@ -# OpenResponsesRequestPluginResponseHealing +# PluginResponseHealing ## Fields diff --git a/docs/components/openresponsesrequestpluginweb.md b/docs/components/pluginweb.md similarity index 98% rename from docs/components/openresponsesrequestpluginweb.md rename to docs/components/pluginweb.md index 2223caf..8738bd0 100644 --- a/docs/components/openresponsesrequestpluginweb.md +++ b/docs/components/pluginweb.md @@ -1,4 +1,4 @@ -# OpenResponsesRequestPluginWeb +# PluginWeb ## Fields diff --git a/docs/components/pricing.md b/docs/components/pricing.md index 1c4d87a..a997dda 100644 --- a/docs/components/pricing.md +++ b/docs/components/pricing.md @@ -3,19 +3,19 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | -| `prompt` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 | -| `completion` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 | -| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image_token` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `audio_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `web_search` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------- | -------------------- | -------------------- | -------------------- | -------------------- | +| `prompt` | *str* | :heavy_check_mark: | N/A | 1000 | +| `completion` | *str* | :heavy_check_mark: | N/A | 1000 | +| `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image_token` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `audio_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `web_search` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/components/prompt.md b/docs/components/prompt.md index c700709..f242343 100644 --- a/docs/components/prompt.md +++ b/docs/components/prompt.md @@ -3,27 +3,21 @@ ## Supported Types +### `float` + +```python +value: float = /* values here */ +``` + ### `str` ```python value: str = /* values here */ ``` -### `List[str]` +### `Any` ```python -value: List[str] = /* values here */ -``` - -### `List[float]` - -```python -value: List[float] = /* values here */ -``` - -### `List[List[float]]` - -```python -value: List[List[float]] = /* values here */ +value: Any = /* values here */ ``` diff --git a/docs/components/openresponsesrequestprovider.md b/docs/components/provider.md similarity index 99% rename from docs/components/openresponsesrequestprovider.md rename to docs/components/provider.md index 5fde781..37b891f 100644 --- a/docs/components/openresponsesrequestprovider.md +++ b/docs/components/provider.md @@ -1,4 +1,4 @@ -# OpenResponsesRequestProvider +# Provider When multiple model providers are available, optionally indicate your routing preference. diff --git a/docs/components/providername.md b/docs/components/providername.md index 5b56801..acc3a29 100644 --- a/docs/components/providername.md +++ b/docs/components/providername.md @@ -8,6 +8,7 @@ | `AI21` | AI21 | | `AION_LABS` | AionLabs | | `ALIBABA` | Alibaba | +| `AMBIENT` | Ambient | | `AMAZON_BEDROCK` | Amazon Bedrock | | `AMAZON_NOVA` | Amazon Nova | | `ANTHROPIC` | Anthropic | @@ -64,6 +65,7 @@ | `SEED` | Seed | | `SILICON_FLOW` | SiliconFlow | | `SOURCEFUL` | Sourceful | +| `STEP_FUN` | StepFun | | `STEALTH` | Stealth | | `STREAM_LAKE` | StreamLake | | `SWITCHPOINT` | Switchpoint | diff --git a/docs/components/providerpreferencesmaxprice.md b/docs/components/providerpreferencesmaxprice.md index 99f99dc..fb14872 100644 --- a/docs/components/providerpreferencesmaxprice.md +++ b/docs/components/providerpreferencesmaxprice.md @@ -5,10 +5,10 @@ The object specifying the maximum price you want to pay for this request. USD pr ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | -| `prompt` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `completion` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `prompt` | *Optional[str]* | :heavy_minus_sign: | Price per million prompt tokens | 1000 | +| `completion` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | \ No newline at end of file diff --git a/docs/components/publicpricing.md b/docs/components/publicpricing.md index 7a4eba7..c7ac704 100644 --- a/docs/components/publicpricing.md +++ b/docs/components/publicpricing.md @@ -5,19 +5,19 @@ Pricing information for the model ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | -| `prompt` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 | -| `completion` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 | -| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image_token` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `audio_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `web_search` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------- | -------------------- | -------------------- | -------------------- | -------------------- | +| `prompt` | *str* | :heavy_check_mark: | N/A | 1000 | +| `completion` | *str* | :heavy_check_mark: | N/A | 1000 | +| `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image_token` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `audio_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `web_search` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/components/responseformat.md b/docs/components/responseformat.md new file mode 100644 index 0000000..e9e9fda --- /dev/null +++ b/docs/components/responseformat.md @@ -0,0 +1,35 @@ +# ResponseFormat + + +## Supported Types + +### `components.ResponseFormatText` + +```python +value: components.ResponseFormatText = /* values here */ +``` + +### `components.ResponseFormatJSONObject` + +```python +value: components.ResponseFormatJSONObject = /* values here */ +``` + +### `components.ResponseFormatJSONSchema` + +```python +value: components.ResponseFormatJSONSchema = /* values here */ +``` + +### `components.ResponseFormatTextGrammar` + +```python +value: components.ResponseFormatTextGrammar = /* values here */ +``` + +### `components.ResponseFormatPython` + +```python +value: components.ResponseFormatPython = /* values here */ +``` + diff --git a/docs/components/chatgenerationparamsresponseformatjsonobject.md b/docs/components/responseformatjsonobject.md similarity index 87% rename from docs/components/chatgenerationparamsresponseformatjsonobject.md rename to docs/components/responseformatjsonobject.md index 4c9c696..88c50c4 100644 --- a/docs/components/chatgenerationparamsresponseformatjsonobject.md +++ b/docs/components/responseformatjsonobject.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsResponseFormatJSONObject +# ResponseFormatJSONObject ## Fields diff --git a/docs/components/chatgenerationparamsresponseformatpython.md b/docs/components/responseformatpython.md similarity index 86% rename from docs/components/chatgenerationparamsresponseformatpython.md rename to docs/components/responseformatpython.md index 5b1274c..ca9fc95 100644 --- a/docs/components/chatgenerationparamsresponseformatpython.md +++ b/docs/components/responseformatpython.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsResponseFormatPython +# ResponseFormatPython ## Fields diff --git a/docs/components/chatgenerationparamsresponseformattext.md b/docs/components/responseformattext.md similarity index 86% rename from docs/components/chatgenerationparamsresponseformattext.md rename to docs/components/responseformattext.md index 9efb0d8..1b66a78 100644 --- a/docs/components/chatgenerationparamsresponseformattext.md +++ b/docs/components/responseformattext.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsResponseFormatText +# ResponseFormatText ## Fields diff --git a/docs/components/schema0.md b/docs/components/schema0.md index 3ce25f2..0da3160 100644 --- a/docs/components/schema0.md +++ b/docs/components/schema0.md @@ -1,17 +1,20 @@ # Schema0 -## Supported Types - -### `components.Schema0Enum` - -```python -value: components.Schema0Enum = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` +## Fields +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `data_collection` | [OptionalNullable[components.Schema3]](../components/schema3.md) | :heavy_minus_sign: | N/A | +| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `order` | List[[components.Schema5](../components/schema5.md)] | :heavy_minus_sign: | N/A | +| `only` | List[[components.Schema5](../components/schema5.md)] | :heavy_minus_sign: | N/A | +| `ignore` | List[[components.Schema5](../components/schema5.md)] | :heavy_minus_sign: | N/A | +| `quantizations` | List[[components.Schema8](../components/schema8.md)] | :heavy_minus_sign: | N/A | +| `sort` | [OptionalNullable[components.ProviderSortUnion]](../components/providersortunion.md) | :heavy_minus_sign: | N/A | +| `max_price` | [Optional[components.Schema10]](../components/schema10.md) | :heavy_minus_sign: | N/A | +| `preferred_min_throughput` | [OptionalNullable[components.Schema15Union]](../components/schema15union.md) | :heavy_minus_sign: | N/A | +| `preferred_max_latency` | [OptionalNullable[components.Schema15Union]](../components/schema15union.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema10.md b/docs/components/schema10.md new file mode 100644 index 0000000..5a5bcf1 --- /dev/null +++ b/docs/components/schema10.md @@ -0,0 +1,12 @@ +# Schema10 + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `prompt` | [Optional[components.Prompt]](../components/prompt.md) | :heavy_minus_sign: | N/A | +| `completion` | [Optional[components.Completion]](../components/completion.md) | :heavy_minus_sign: | N/A | +| `image` | [Optional[components.Schema14]](../components/schema14.md) | :heavy_minus_sign: | N/A | +| `audio` | [Optional[components.Schema14]](../components/schema14.md) | :heavy_minus_sign: | N/A | +| `request` | [Optional[components.Schema14]](../components/schema14.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema14.md b/docs/components/schema14.md new file mode 100644 index 0000000..7fdac48 --- /dev/null +++ b/docs/components/schema14.md @@ -0,0 +1,23 @@ +# Schema14 + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + +### `Any` + +```python +value: Any = /* values here */ +``` + diff --git a/docs/components/chatgenerationparamspreferredmaxlatency.md b/docs/components/schema15.md similarity index 94% rename from docs/components/chatgenerationparamspreferredmaxlatency.md rename to docs/components/schema15.md index 323b2f9..dc0a8de 100644 --- a/docs/components/chatgenerationparamspreferredmaxlatency.md +++ b/docs/components/schema15.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsPreferredMaxLatency +# Schema15 ## Fields diff --git a/docs/components/schema15union.md b/docs/components/schema15union.md new file mode 100644 index 0000000..261a8d1 --- /dev/null +++ b/docs/components/schema15union.md @@ -0,0 +1,17 @@ +# Schema15Union + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `components.Schema15` + +```python +value: components.Schema15 = /* values here */ +``` + diff --git a/docs/components/schema17.md b/docs/components/schema17.md new file mode 100644 index 0000000..e166914 --- /dev/null +++ b/docs/components/schema17.md @@ -0,0 +1,35 @@ +# Schema17 + + +## Supported Types + +### `components.Schema17AutoRouter` + +```python +value: components.Schema17AutoRouter = /* values here */ +``` + +### `components.Schema17Moderation` + +```python +value: components.Schema17Moderation = /* values here */ +``` + +### `components.Schema17Web` + +```python +value: components.Schema17Web = /* values here */ +``` + +### `components.Schema17FileParser` + +```python +value: components.Schema17FileParser = /* values here */ +``` + +### `components.Schema17ResponseHealing` + +```python +value: components.Schema17ResponseHealing = /* values here */ +``` + diff --git a/docs/components/chatgenerationparamspluginautorouter.md b/docs/components/schema17autorouter.md similarity index 93% rename from docs/components/chatgenerationparamspluginautorouter.md rename to docs/components/schema17autorouter.md index 7326614..8f53379 100644 --- a/docs/components/chatgenerationparamspluginautorouter.md +++ b/docs/components/schema17autorouter.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsPluginAutoRouter +# Schema17AutoRouter ## Fields diff --git a/docs/components/chatgenerationparamspluginfileparser.md b/docs/components/schema17fileparser.md similarity index 96% rename from docs/components/chatgenerationparamspluginfileparser.md rename to docs/components/schema17fileparser.md index 9d53438..b5a71fd 100644 --- a/docs/components/chatgenerationparamspluginfileparser.md +++ b/docs/components/schema17fileparser.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsPluginFileParser +# Schema17FileParser ## Fields diff --git a/docs/components/chatgenerationparamspluginmoderation.md b/docs/components/schema17moderation.md similarity index 89% rename from docs/components/chatgenerationparamspluginmoderation.md rename to docs/components/schema17moderation.md index 55494d5..6f449d8 100644 --- a/docs/components/chatgenerationparamspluginmoderation.md +++ b/docs/components/schema17moderation.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsPluginModeration +# Schema17Moderation ## Fields diff --git a/docs/components/chatgenerationparamspluginresponsehealing.md b/docs/components/schema17responsehealing.md similarity index 92% rename from docs/components/chatgenerationparamspluginresponsehealing.md rename to docs/components/schema17responsehealing.md index 17faf76..5ef1030 100644 --- a/docs/components/chatgenerationparamspluginresponsehealing.md +++ b/docs/components/schema17responsehealing.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsPluginResponseHealing +# Schema17ResponseHealing ## Fields diff --git a/docs/components/chatgenerationparamspluginweb.md b/docs/components/schema17web.md similarity index 98% rename from docs/components/chatgenerationparamspluginweb.md rename to docs/components/schema17web.md index e495619..beccd42 100644 --- a/docs/components/chatgenerationparamspluginweb.md +++ b/docs/components/schema17web.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsPluginWeb +# Schema17Web ## Fields diff --git a/docs/components/schema19.md b/docs/components/schema19.md new file mode 100644 index 0000000..2d61cb8 --- /dev/null +++ b/docs/components/schema19.md @@ -0,0 +1,23 @@ +# Schema19 + + +## Supported Types + +### `components.Schema19ReasoningSummary` + +```python +value: components.Schema19ReasoningSummary = /* values here */ +``` + +### `components.Schema19ReasoningEncrypted` + +```python +value: components.Schema19ReasoningEncrypted = /* values here */ +``` + +### `components.Schema19ReasoningText` + +```python +value: components.Schema19ReasoningText = /* values here */ +``` + diff --git a/docs/components/schema19reasoningencrypted.md b/docs/components/schema19reasoningencrypted.md new file mode 100644 index 0000000..269b7a5 --- /dev/null +++ b/docs/components/schema19reasoningencrypted.md @@ -0,0 +1,12 @@ +# Schema19ReasoningEncrypted + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `type` | *Literal["reasoning.encrypted"]* | :heavy_check_mark: | N/A | +| `data` | *str* | :heavy_check_mark: | N/A | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A | +| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema19reasoningsummary.md b/docs/components/schema19reasoningsummary.md new file mode 100644 index 0000000..a921b0d --- /dev/null +++ b/docs/components/schema19reasoningsummary.md @@ -0,0 +1,12 @@ +# Schema19ReasoningSummary + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `type` | *Literal["reasoning.summary"]* | :heavy_check_mark: | N/A | +| `summary` | *str* | :heavy_check_mark: | N/A | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A | +| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema19reasoningtext.md b/docs/components/schema19reasoningtext.md new file mode 100644 index 0000000..0790712 --- /dev/null +++ b/docs/components/schema19reasoningtext.md @@ -0,0 +1,13 @@ +# Schema19ReasoningText + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `type` | *Literal["reasoning.text"]* | :heavy_check_mark: | N/A | +| `text` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `signature` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A | +| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema2.md b/docs/components/schema2.md deleted file mode 100644 index 42b74cf..0000000 --- a/docs/components/schema2.md +++ /dev/null @@ -1,23 +0,0 @@ -# Schema2 - - -## Supported Types - -### `components.Schema2ReasoningSummary` - -```python -value: components.Schema2ReasoningSummary = /* values here */ -``` - -### `components.Schema2ReasoningEncrypted` - -```python -value: components.Schema2ReasoningEncrypted = /* values here */ -``` - -### `components.Schema2ReasoningText` - -```python -value: components.Schema2ReasoningText = /* values here */ -``` - diff --git a/docs/components/schema4.md b/docs/components/schema21.md similarity index 97% rename from docs/components/schema4.md rename to docs/components/schema21.md index 9e927db..91687e4 100644 --- a/docs/components/schema4.md +++ b/docs/components/schema21.md @@ -1,4 +1,4 @@ -# Schema4 +# Schema21 ## Values diff --git a/docs/components/schema2reasoningencrypted.md b/docs/components/schema2reasoningencrypted.md deleted file mode 100644 index 0cc8c33..0000000 --- a/docs/components/schema2reasoningencrypted.md +++ /dev/null @@ -1,12 +0,0 @@ -# Schema2ReasoningEncrypted - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `type` | *Literal["reasoning.encrypted"]* | :heavy_check_mark: | N/A | -| `data` | *str* | :heavy_check_mark: | N/A | -| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `format_` | [OptionalNullable[components.Schema4]](../components/schema4.md) | :heavy_minus_sign: | N/A | -| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema2reasoningsummary.md b/docs/components/schema2reasoningsummary.md deleted file mode 100644 index 82ec98d..0000000 --- a/docs/components/schema2reasoningsummary.md +++ /dev/null @@ -1,12 +0,0 @@ -# Schema2ReasoningSummary - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `type` | *Literal["reasoning.summary"]* | :heavy_check_mark: | N/A | -| `summary` | *str* | :heavy_check_mark: | N/A | -| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `format_` | [OptionalNullable[components.Schema4]](../components/schema4.md) | :heavy_minus_sign: | N/A | -| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema2reasoningtext.md b/docs/components/schema2reasoningtext.md deleted file mode 100644 index 3d1ff9a..0000000 --- a/docs/components/schema2reasoningtext.md +++ /dev/null @@ -1,13 +0,0 @@ -# Schema2ReasoningText - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `type` | *Literal["reasoning.text"]* | :heavy_check_mark: | N/A | -| `text` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `signature` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `format_` | [OptionalNullable[components.Schema4]](../components/schema4.md) | :heavy_minus_sign: | N/A | -| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatgenerationparamsdatacollection.md b/docs/components/schema3.md similarity index 72% rename from docs/components/chatgenerationparamsdatacollection.md rename to docs/components/schema3.md index 0546069..53d01d6 100644 --- a/docs/components/chatgenerationparamsdatacollection.md +++ b/docs/components/schema3.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsDataCollection +# Schema3 ## Values diff --git a/docs/components/completioncreateparamsstop.md b/docs/components/schema5.md similarity index 51% rename from docs/components/completioncreateparamsstop.md rename to docs/components/schema5.md index da48725..0c115ca 100644 --- a/docs/components/completioncreateparamsstop.md +++ b/docs/components/schema5.md @@ -1,17 +1,17 @@ -# CompletionCreateParamsStop +# Schema5 ## Supported Types +### `components.Schema5Enum` + +```python +value: components.Schema5Enum = /* values here */ +``` + ### `str` ```python value: str = /* values here */ ``` -### `List[str]` - -```python -value: List[str] = /* values here */ -``` - diff --git a/docs/components/schema0enum.md b/docs/components/schema5enum.md similarity index 96% rename from docs/components/schema0enum.md rename to docs/components/schema5enum.md index f1c6708..d6fa747 100644 --- a/docs/components/schema0enum.md +++ b/docs/components/schema5enum.md @@ -1,4 +1,4 @@ -# Schema0Enum +# Schema5Enum ## Values @@ -8,6 +8,7 @@ | `AI21` | AI21 | | `AION_LABS` | AionLabs | | `ALIBABA` | Alibaba | +| `AMBIENT` | Ambient | | `AMAZON_BEDROCK` | Amazon Bedrock | | `AMAZON_NOVA` | Amazon Nova | | `ANTHROPIC` | Anthropic | @@ -64,6 +65,7 @@ | `SEED` | Seed | | `SILICON_FLOW` | SiliconFlow | | `SOURCEFUL` | Sourceful | +| `STEP_FUN` | StepFun | | `STEALTH` | Stealth | | `STREAM_LAKE` | StreamLake | | `SWITCHPOINT` | Switchpoint | diff --git a/docs/components/quantizations.md b/docs/components/schema8.md similarity index 94% rename from docs/components/quantizations.md rename to docs/components/schema8.md index 5c0aecc..fbf6c51 100644 --- a/docs/components/quantizations.md +++ b/docs/components/schema8.md @@ -1,4 +1,4 @@ -# Quantizations +# Schema8 ## Values diff --git a/docs/components/chatgenerationparamsstop.md b/docs/components/stop.md similarity index 84% rename from docs/components/chatgenerationparamsstop.md rename to docs/components/stop.md index 9725523..9cfdaa0 100644 --- a/docs/components/chatgenerationparamsstop.md +++ b/docs/components/stop.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsStop +# Stop ## Supported Types diff --git a/docs/components/streamoptions.md b/docs/components/streamoptions.md deleted file mode 100644 index a2e5702..0000000 --- a/docs/components/streamoptions.md +++ /dev/null @@ -1,8 +0,0 @@ -# StreamOptions - - -## Fields - -| Field | Type | Required | Description | -| ------------------------ | ------------------------ | ------------------------ | ------------------------ | -| `include_usage` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/errors/forbiddenresponseerror.md b/docs/errors/forbiddenresponseerror.md index c1e93ec..290d3a4 100644 --- a/docs/errors/forbiddenresponseerror.md +++ b/docs/errors/forbiddenresponseerror.md @@ -7,5 +7,5 @@ Forbidden - Authentication successful but insufficient permissions | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `error` | [components.ForbiddenResponseErrorData](../components/forbiddenresponseerrordata.md) | :heavy_check_mark: | Error data for ForbiddenResponse | {
"code": 403,
"message": "Only provisioning keys can perform this operation"
} | +| `error` | [components.ForbiddenResponseErrorData](../components/forbiddenresponseerrordata.md) | :heavy_check_mark: | Error data for ForbiddenResponse | {
"code": 403,
"message": "Only management keys can perform this operation"
} | | `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/operations/bulkassignkeystoguardrailglobals.md b/docs/operations/bulkassignkeystoguardrailglobals.md new file mode 100644 index 0000000..e54eb49 --- /dev/null +++ b/docs/operations/bulkassignkeystoguardrailglobals.md @@ -0,0 +1,9 @@ +# BulkAssignKeysToGuardrailGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/bulkassignkeystoguardrailrequest.md b/docs/operations/bulkassignkeystoguardrailrequest.md index f639a33..61e77dd 100644 --- a/docs/operations/bulkassignkeystoguardrailrequest.md +++ b/docs/operations/bulkassignkeystoguardrailrequest.md @@ -3,7 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | -| `request_body` | [operations.BulkAssignKeysToGuardrailRequestBody](../operations/bulkassignkeystoguardrailrequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | +| `request_body` | [operations.BulkAssignKeysToGuardrailRequestBody](../operations/bulkassignkeystoguardrailrequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/operations/bulkassignmemberstoguardrailglobals.md b/docs/operations/bulkassignmemberstoguardrailglobals.md new file mode 100644 index 0000000..0194980 --- /dev/null +++ b/docs/operations/bulkassignmemberstoguardrailglobals.md @@ -0,0 +1,9 @@ +# BulkAssignMembersToGuardrailGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/bulkassignmemberstoguardrailrequest.md b/docs/operations/bulkassignmemberstoguardrailrequest.md index 6ef2ba2..25ff165 100644 --- a/docs/operations/bulkassignmemberstoguardrailrequest.md +++ b/docs/operations/bulkassignmemberstoguardrailrequest.md @@ -3,7 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | -| `request_body` | [operations.BulkAssignMembersToGuardrailRequestBody](../operations/bulkassignmemberstoguardrailrequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | +| `request_body` | [operations.BulkAssignMembersToGuardrailRequestBody](../operations/bulkassignmemberstoguardrailrequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/operations/bulkunassignkeysfromguardrailglobals.md b/docs/operations/bulkunassignkeysfromguardrailglobals.md new file mode 100644 index 0000000..7241f74 --- /dev/null +++ b/docs/operations/bulkunassignkeysfromguardrailglobals.md @@ -0,0 +1,9 @@ +# BulkUnassignKeysFromGuardrailGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/bulkunassignkeysfromguardrailrequest.md b/docs/operations/bulkunassignkeysfromguardrailrequest.md index 10c7c12..07aa84f 100644 --- a/docs/operations/bulkunassignkeysfromguardrailrequest.md +++ b/docs/operations/bulkunassignkeysfromguardrailrequest.md @@ -3,7 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | -| `request_body` | [operations.BulkUnassignKeysFromGuardrailRequestBody](../operations/bulkunassignkeysfromguardrailrequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | +| `request_body` | [operations.BulkUnassignKeysFromGuardrailRequestBody](../operations/bulkunassignkeysfromguardrailrequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/operations/bulkunassignmembersfromguardrailglobals.md b/docs/operations/bulkunassignmembersfromguardrailglobals.md new file mode 100644 index 0000000..57ed776 --- /dev/null +++ b/docs/operations/bulkunassignmembersfromguardrailglobals.md @@ -0,0 +1,9 @@ +# BulkUnassignMembersFromGuardrailGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/bulkunassignmembersfromguardrailrequest.md b/docs/operations/bulkunassignmembersfromguardrailrequest.md index 4283486..f85e43e 100644 --- a/docs/operations/bulkunassignmembersfromguardrailrequest.md +++ b/docs/operations/bulkunassignmembersfromguardrailrequest.md @@ -3,7 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | -| `request_body` | [operations.BulkUnassignMembersFromGuardrailRequestBody](../operations/bulkunassignmembersfromguardrailrequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | +| `request_body` | [operations.BulkUnassignMembersFromGuardrailRequestBody](../operations/bulkunassignmembersfromguardrailrequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/operations/createauthkeyscodeglobals.md b/docs/operations/createauthkeyscodeglobals.md new file mode 100644 index 0000000..cc084f7 --- /dev/null +++ b/docs/operations/createauthkeyscodeglobals.md @@ -0,0 +1,9 @@ +# CreateAuthKeysCodeGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/createauthkeyscoderequest.md b/docs/operations/createauthkeyscoderequest.md index 39c0650..2fa48ef 100644 --- a/docs/operations/createauthkeyscoderequest.md +++ b/docs/operations/createauthkeyscoderequest.md @@ -3,10 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. | https://myapp.com/auth/callback | -| `code_challenge` | *Optional[str]* | :heavy_minus_sign: | PKCE code challenge for enhanced security | E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM | -| `code_challenge_method` | [Optional[operations.CreateAuthKeysCodeCodeChallengeMethod]](../operations/createauthkeyscodecodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 | -| `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 | -| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `request_body` | [operations.CreateAuthKeysCodeRequestBody](../operations/createauthkeyscoderequestbody.md) | :heavy_check_mark: | N/A | {
"callback_url": "https://myapp.com/auth/callback",
"code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
"code_challenge_method": "S256",
"limit": 100
} | \ No newline at end of file diff --git a/docs/operations/createauthkeyscoderequestbody.md b/docs/operations/createauthkeyscoderequestbody.md new file mode 100644 index 0000000..30f40d0 --- /dev/null +++ b/docs/operations/createauthkeyscoderequestbody.md @@ -0,0 +1,12 @@ +# CreateAuthKeysCodeRequestBody + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. | https://myapp.com/auth/callback | +| `code_challenge` | *Optional[str]* | :heavy_minus_sign: | PKCE code challenge for enhanced security | E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM | +| `code_challenge_method` | [Optional[operations.CreateAuthKeysCodeCodeChallengeMethod]](../operations/createauthkeyscodecodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 | +| `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 | +| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | | \ No newline at end of file diff --git a/docs/operations/createcoinbasechargeglobals.md b/docs/operations/createcoinbasechargeglobals.md new file mode 100644 index 0000000..5287403 --- /dev/null +++ b/docs/operations/createcoinbasechargeglobals.md @@ -0,0 +1,9 @@ +# CreateCoinbaseChargeGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/createcoinbasechargerequest.md b/docs/operations/createcoinbasechargerequest.md new file mode 100644 index 0000000..d90e033 --- /dev/null +++ b/docs/operations/createcoinbasechargerequest.md @@ -0,0 +1,10 @@ +# CreateCoinbaseChargeRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `create_charge_request` | [components.CreateChargeRequest](../components/createchargerequest.md) | :heavy_check_mark: | N/A | {
"amount": 100,
"sender": "0x1234567890123456789012345678901234567890",
"chain_id": 1
} | \ No newline at end of file diff --git a/docs/operations/createembeddingsglobals.md b/docs/operations/createembeddingsglobals.md new file mode 100644 index 0000000..adb19bc --- /dev/null +++ b/docs/operations/createembeddingsglobals.md @@ -0,0 +1,9 @@ +# CreateEmbeddingsGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/createembeddingsrequest.md b/docs/operations/createembeddingsrequest.md index a799bcb..cace1a6 100644 --- a/docs/operations/createembeddingsrequest.md +++ b/docs/operations/createembeddingsrequest.md @@ -3,12 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -| `input` | [operations.InputUnion](../operations/inputunion.md) | :heavy_check_mark: | N/A | -| `model` | *str* | :heavy_check_mark: | N/A | -| `encoding_format` | [Optional[operations.EncodingFormat]](../operations/encodingformat.md) | :heavy_minus_sign: | N/A | -| `dimensions` | *Optional[int]* | :heavy_minus_sign: | N/A | -| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `provider` | [Optional[components.ProviderPreferences]](../components/providerpreferences.md) | :heavy_minus_sign: | Provider routing preferences for the request. | -| `input_type` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `request_body` | [operations.CreateEmbeddingsRequestBody](../operations/createembeddingsrequestbody.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/createembeddingsrequestbody.md b/docs/operations/createembeddingsrequestbody.md new file mode 100644 index 0000000..e4229b3 --- /dev/null +++ b/docs/operations/createembeddingsrequestbody.md @@ -0,0 +1,14 @@ +# CreateEmbeddingsRequestBody + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `input` | [operations.InputUnion](../operations/inputunion.md) | :heavy_check_mark: | N/A | +| `model` | *str* | :heavy_check_mark: | N/A | +| `encoding_format` | [Optional[operations.EncodingFormat]](../operations/encodingformat.md) | :heavy_minus_sign: | N/A | +| `dimensions` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `provider` | [Optional[components.ProviderPreferences]](../components/providerpreferences.md) | :heavy_minus_sign: | Provider routing preferences for the request. | +| `input_type` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/operations/createguardrailglobals.md b/docs/operations/createguardrailglobals.md new file mode 100644 index 0000000..b11f112 --- /dev/null +++ b/docs/operations/createguardrailglobals.md @@ -0,0 +1,9 @@ +# CreateGuardrailGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/createguardrailrequest.md b/docs/operations/createguardrailrequest.md index 507257d..ff71d5e 100644 --- a/docs/operations/createguardrailrequest.md +++ b/docs/operations/createguardrailrequest.md @@ -3,12 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | -| `name` | *str* | :heavy_check_mark: | Name for the new guardrail | My New Guardrail | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | A guardrail for limiting API usage | -| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 50 | -| `reset_interval` | [OptionalNullable[operations.CreateGuardrailResetIntervalRequest]](../operations/createguardrailresetintervalrequest.md) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | -| `enforce_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention | false | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `request_body` | [operations.CreateGuardrailRequestBody](../operations/createguardrailrequestbody.md) | :heavy_check_mark: | N/A | {
"name": "My New Guardrail",
"description": "A guardrail for limiting API usage",
"limit_usd": 50,
"reset_interval": "monthly",
"allowed_providers": [
"openai",
"anthropic",
"deepseek"
],
"allowed_models": null,
"enforce_zdr": false
} | \ No newline at end of file diff --git a/docs/operations/createguardrailrequestbody.md b/docs/operations/createguardrailrequestbody.md new file mode 100644 index 0000000..0dae486 --- /dev/null +++ b/docs/operations/createguardrailrequestbody.md @@ -0,0 +1,14 @@ +# CreateGuardrailRequestBody + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | +| `name` | *str* | :heavy_check_mark: | Name for the new guardrail | My New Guardrail | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | A guardrail for limiting API usage | +| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 50 | +| `reset_interval` | [OptionalNullable[operations.CreateGuardrailResetIntervalRequest]](../operations/createguardrailresetintervalrequest.md) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | +| `enforce_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention | false | \ No newline at end of file diff --git a/docs/operations/createkeysglobals.md b/docs/operations/createkeysglobals.md new file mode 100644 index 0000000..3c02678 --- /dev/null +++ b/docs/operations/createkeysglobals.md @@ -0,0 +1,9 @@ +# CreateKeysGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/createkeysrequest.md b/docs/operations/createkeysrequest.md index ed15c9c..b949a60 100644 --- a/docs/operations/createkeysrequest.md +++ b/docs/operations/createkeysrequest.md @@ -3,10 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `name` | *str* | :heavy_check_mark: | Name for the new API key | My New API Key | -| `limit` | *OptionalNullable[float]* | :heavy_minus_sign: | Optional spending limit for the API key in USD | 50 | -| `limit_reset` | [OptionalNullable[operations.CreateKeysLimitReset]](../operations/createkeyslimitreset.md) | :heavy_minus_sign: | Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday. | monthly | -| `include_byok_in_limit` | *Optional[bool]* | :heavy_minus_sign: | Whether to include BYOK usage in the limit | true | -| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected | 2027-12-31T23:59:59Z | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `request_body` | [operations.CreateKeysRequestBody](../operations/createkeysrequestbody.md) | :heavy_check_mark: | N/A | {
"name": "My New API Key",
"limit": 50,
"limit_reset": "monthly",
"include_byok_in_limit": true,
"expires_at": "2027-12-31T23:59:59Z"
} | \ No newline at end of file diff --git a/docs/operations/createkeysrequestbody.md b/docs/operations/createkeysrequestbody.md new file mode 100644 index 0000000..067a1d5 --- /dev/null +++ b/docs/operations/createkeysrequestbody.md @@ -0,0 +1,12 @@ +# CreateKeysRequestBody + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `name` | *str* | :heavy_check_mark: | Name for the new API key | My New API Key | +| `limit` | *OptionalNullable[float]* | :heavy_minus_sign: | Optional spending limit for the API key in USD | 50 | +| `limit_reset` | [OptionalNullable[operations.CreateKeysLimitReset]](../operations/createkeyslimitreset.md) | :heavy_minus_sign: | Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday. | monthly | +| `include_byok_in_limit` | *Optional[bool]* | :heavy_minus_sign: | Whether to include BYOK usage in the limit | true | +| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected | 2027-12-31T23:59:59Z | \ No newline at end of file diff --git a/docs/operations/createresponsesglobals.md b/docs/operations/createresponsesglobals.md new file mode 100644 index 0000000..6b6ca55 --- /dev/null +++ b/docs/operations/createresponsesglobals.md @@ -0,0 +1,9 @@ +# CreateResponsesGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/createresponsesrequest.md b/docs/operations/createresponsesrequest.md new file mode 100644 index 0000000..1eba6ef --- /dev/null +++ b/docs/operations/createresponsesrequest.md @@ -0,0 +1,10 @@ +# CreateResponsesRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `open_responses_request` | [components.OpenResponsesRequest](../components/openresponsesrequest.md) | :heavy_check_mark: | N/A | {
"model": "anthropic/claude-4.5-sonnet-20250929",
"input": [
{
"type": "message",
"content": "Hello, how are you?",
"role": "user"
}
],
"temperature": 0.7,
"top_p": 0.9,
"tools": [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string"
}
}
}
}
]
} | \ No newline at end of file diff --git a/docs/operations/deleteguardrailglobals.md b/docs/operations/deleteguardrailglobals.md new file mode 100644 index 0000000..f3c784f --- /dev/null +++ b/docs/operations/deleteguardrailglobals.md @@ -0,0 +1,9 @@ +# DeleteGuardrailGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/deleteguardrailrequest.md b/docs/operations/deleteguardrailrequest.md index 4e2181a..148b738 100644 --- a/docs/operations/deleteguardrailrequest.md +++ b/docs/operations/deleteguardrailrequest.md @@ -3,6 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to delete | 550e8400-e29b-41d4-a716-446655440000 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to delete | 550e8400-e29b-41d4-a716-446655440000 | \ No newline at end of file diff --git a/docs/operations/deletekeysglobals.md b/docs/operations/deletekeysglobals.md new file mode 100644 index 0000000..b987a26 --- /dev/null +++ b/docs/operations/deletekeysglobals.md @@ -0,0 +1,9 @@ +# DeleteKeysGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/deletekeysrequest.md b/docs/operations/deletekeysrequest.md index 988c8da..4c6e567 100644 --- a/docs/operations/deletekeysrequest.md +++ b/docs/operations/deletekeysrequest.md @@ -3,6 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to delete | f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to delete | f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 | \ No newline at end of file diff --git a/docs/operations/exchangeauthcodeforapikeyglobals.md b/docs/operations/exchangeauthcodeforapikeyglobals.md new file mode 100644 index 0000000..1f4c2b5 --- /dev/null +++ b/docs/operations/exchangeauthcodeforapikeyglobals.md @@ -0,0 +1,9 @@ +# ExchangeAuthCodeForAPIKeyGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/exchangeauthcodeforapikeyrequest.md b/docs/operations/exchangeauthcodeforapikeyrequest.md index ccb69d2..d175446 100644 --- a/docs/operations/exchangeauthcodeforapikeyrequest.md +++ b/docs/operations/exchangeauthcodeforapikeyrequest.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | -| `code` | *str* | :heavy_check_mark: | The authorization code received from the OAuth redirect | auth_code_abc123def456 | -| `code_verifier` | *Optional[str]* | :heavy_minus_sign: | The code verifier if code_challenge was used in the authorization request | dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk | -| `code_challenge_method` | [OptionalNullable[operations.ExchangeAuthCodeForAPIKeyCodeChallengeMethod]](../operations/exchangeauthcodeforapikeycodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `request_body` | [operations.ExchangeAuthCodeForAPIKeyRequestBody](../operations/exchangeauthcodeforapikeyrequestbody.md) | :heavy_check_mark: | N/A | {
"code": "auth_code_abc123def456",
"code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
"code_challenge_method": "S256"
} | \ No newline at end of file diff --git a/docs/operations/exchangeauthcodeforapikeyrequestbody.md b/docs/operations/exchangeauthcodeforapikeyrequestbody.md new file mode 100644 index 0000000..1543d58 --- /dev/null +++ b/docs/operations/exchangeauthcodeforapikeyrequestbody.md @@ -0,0 +1,10 @@ +# ExchangeAuthCodeForAPIKeyRequestBody + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | +| `code` | *str* | :heavy_check_mark: | The authorization code received from the OAuth redirect | auth_code_abc123def456 | +| `code_verifier` | *Optional[str]* | :heavy_minus_sign: | The code verifier if code_challenge was used in the authorization request | dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk | +| `code_challenge_method` | [OptionalNullable[operations.ExchangeAuthCodeForAPIKeyCodeChallengeMethod]](../operations/exchangeauthcodeforapikeycodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 | \ No newline at end of file diff --git a/docs/operations/getcreditsglobals.md b/docs/operations/getcreditsglobals.md new file mode 100644 index 0000000..ea59176 --- /dev/null +++ b/docs/operations/getcreditsglobals.md @@ -0,0 +1,9 @@ +# GetCreditsGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/getcreditsrequest.md b/docs/operations/getcreditsrequest.md new file mode 100644 index 0000000..e6066dc --- /dev/null +++ b/docs/operations/getcreditsrequest.md @@ -0,0 +1,9 @@ +# GetCreditsRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/getcurrentkeydata.md b/docs/operations/getcurrentkeydata.md index 2269a19..3e11b0c 100644 --- a/docs/operations/getcurrentkeydata.md +++ b/docs/operations/getcurrentkeydata.md @@ -18,7 +18,8 @@ Current API key information | `byok_usage_weekly` | *float* | :heavy_check_mark: | External BYOK usage (in USD) for the current UTC week (Monday-Sunday) | 17.38 | | `byok_usage_monthly` | *float* | :heavy_check_mark: | External BYOK usage (in USD) for current UTC month | 17.38 | | `is_free_tier` | *bool* | :heavy_check_mark: | Whether this is a free tier API key | false | -| `is_provisioning_key` | *bool* | :heavy_check_mark: | Whether this is a provisioning key | false | +| `is_management_key` | *bool* | :heavy_check_mark: | Whether this is a management key | false | +| ~~`is_provisioning_key`~~ | *bool* | :heavy_check_mark: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Whether this is a management key | false | | `limit_remaining` | *Nullable[float]* | :heavy_check_mark: | Remaining spending limit in USD | 74.5 | | `limit_reset` | *Nullable[str]* | :heavy_check_mark: | Type of limit reset for the API key | monthly | | `include_byok_in_limit` | *bool* | :heavy_check_mark: | Whether to include external BYOK usage in the credit limit | false | diff --git a/docs/operations/getcurrentkeyglobals.md b/docs/operations/getcurrentkeyglobals.md new file mode 100644 index 0000000..fd90af9 --- /dev/null +++ b/docs/operations/getcurrentkeyglobals.md @@ -0,0 +1,9 @@ +# GetCurrentKeyGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/getcurrentkeyrequest.md b/docs/operations/getcurrentkeyrequest.md new file mode 100644 index 0000000..fd28cff --- /dev/null +++ b/docs/operations/getcurrentkeyrequest.md @@ -0,0 +1,9 @@ +# GetCurrentKeyRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/getcurrentkeyresponse.md b/docs/operations/getcurrentkeyresponse.md index f84ddb9..b27c3a5 100644 --- a/docs/operations/getcurrentkeyresponse.md +++ b/docs/operations/getcurrentkeyresponse.md @@ -5,6 +5,6 @@ API key details ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [operations.GetCurrentKeyData](../operations/getcurrentkeydata.md) | :heavy_check_mark: | Current API key information | {
"label": "sk-or-v1-au7...890",
"limit": 100,
"usage": 25.5,
"usage_daily": 25.5,
"usage_weekly": 25.5,
"usage_monthly": 25.5,
"byok_usage": 17.38,
"byok_usage_daily": 17.38,
"byok_usage_weekly": 17.38,
"byok_usage_monthly": 17.38,
"is_free_tier": false,
"is_provisioning_key": false,
"limit_remaining": 74.5,
"limit_reset": "monthly",
"include_byok_in_limit": false,
"expires_at": "2027-12-31T23:59:59Z",
"rate_limit": {
"requests": 1000,
"interval": "1h",
"note": "This field is deprecated and safe to ignore."
}
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [operations.GetCurrentKeyData](../operations/getcurrentkeydata.md) | :heavy_check_mark: | Current API key information | {
"label": "sk-or-v1-au7...890",
"limit": 100,
"usage": 25.5,
"usage_daily": 25.5,
"usage_weekly": 25.5,
"usage_monthly": 25.5,
"byok_usage": 17.38,
"byok_usage_daily": 17.38,
"byok_usage_weekly": 17.38,
"byok_usage_monthly": 17.38,
"is_free_tier": false,
"is_management_key": false,
"is_provisioning_key": false,
"limit_remaining": 74.5,
"limit_reset": "monthly",
"include_byok_in_limit": false,
"expires_at": "2027-12-31T23:59:59Z",
"rate_limit": {
"requests": 1000,
"interval": "1h",
"note": "This field is deprecated and safe to ignore."
}
} | \ No newline at end of file diff --git a/docs/operations/getgenerationdata.md b/docs/operations/getgenerationdata.md index 5317aaa..f8c54d1 100644 --- a/docs/operations/getgenerationdata.md +++ b/docs/operations/getgenerationdata.md @@ -5,38 +5,39 @@ Generation data ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | Unique identifier for the generation | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG | -| `upstream_id` | *Nullable[str]* | :heavy_check_mark: | Upstream provider's identifier for this generation | chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 | -| `total_cost` | *float* | :heavy_check_mark: | Total cost of the generation in USD | 0.0015 | -| `cache_discount` | *Nullable[float]* | :heavy_check_mark: | Discount applied due to caching | 0.0002 | -| `upstream_inference_cost` | *Nullable[float]* | :heavy_check_mark: | Cost charged by the upstream provider | 0.0012 | -| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the generation was created | 2024-07-15T23:33:19.433273+00:00 | -| `model` | *str* | :heavy_check_mark: | Model used for the generation | sao10k/l3-stheno-8b | -| `app_id` | *Nullable[float]* | :heavy_check_mark: | ID of the app that made the request | 12345 | -| `streamed` | *Nullable[bool]* | :heavy_check_mark: | Whether the response was streamed | true | -| `cancelled` | *Nullable[bool]* | :heavy_check_mark: | Whether the generation was cancelled | false | -| `provider_name` | *Nullable[str]* | :heavy_check_mark: | Name of the provider that served the request | Infermatic | -| `latency` | *Nullable[float]* | :heavy_check_mark: | Total latency in milliseconds | 1250 | -| `moderation_latency` | *Nullable[float]* | :heavy_check_mark: | Moderation latency in milliseconds | 50 | -| `generation_time` | *Nullable[float]* | :heavy_check_mark: | Time taken for generation in milliseconds | 1200 | -| `finish_reason` | *Nullable[str]* | :heavy_check_mark: | Reason the generation finished | stop | -| `tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the prompt | 10 | -| `tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the completion | 25 | -| `native_tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Native prompt tokens as reported by provider | 10 | -| `native_tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Native completion tokens as reported by provider | 25 | -| `native_tokens_completion_images` | *Nullable[float]* | :heavy_check_mark: | Native completion image tokens as reported by provider | 0 | -| `native_tokens_reasoning` | *Nullable[float]* | :heavy_check_mark: | Native reasoning tokens as reported by provider | 5 | -| `native_tokens_cached` | *Nullable[float]* | :heavy_check_mark: | Native cached tokens as reported by provider | 3 | -| `num_media_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the prompt | 1 | -| `num_input_audio_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of audio inputs in the prompt | 0 | -| `num_media_completion` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the completion | 0 | -| `num_search_results` | *Nullable[float]* | :heavy_check_mark: | Number of search results included | 5 | -| `origin` | *str* | :heavy_check_mark: | Origin URL of the request | https://openrouter.ai/ | -| `usage` | *float* | :heavy_check_mark: | Usage amount in USD | 0.0015 | -| `is_byok` | *bool* | :heavy_check_mark: | Whether this used bring-your-own-key | false | -| `native_finish_reason` | *Nullable[str]* | :heavy_check_mark: | Native finish reason as reported by provider | stop | -| `external_user` | *Nullable[str]* | :heavy_check_mark: | External user identifier | user-123 | -| `api_type` | [Nullable[operations.APIType]](../operations/apitype.md) | :heavy_check_mark: | Type of API used for the generation | | -| `router` | *Nullable[str]* | :heavy_check_mark: | Router used for the request (e.g., openrouter/auto) | openrouter/auto | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Unique identifier for the generation | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG | +| `upstream_id` | *Nullable[str]* | :heavy_check_mark: | Upstream provider's identifier for this generation | chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 | +| `total_cost` | *float* | :heavy_check_mark: | Total cost of the generation in USD | 0.0015 | +| `cache_discount` | *Nullable[float]* | :heavy_check_mark: | Discount applied due to caching | 0.0002 | +| `upstream_inference_cost` | *Nullable[float]* | :heavy_check_mark: | Cost charged by the upstream provider | 0.0012 | +| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the generation was created | 2024-07-15T23:33:19.433273+00:00 | +| `model` | *str* | :heavy_check_mark: | Model used for the generation | sao10k/l3-stheno-8b | +| `app_id` | *Nullable[float]* | :heavy_check_mark: | ID of the app that made the request | 12345 | +| `streamed` | *Nullable[bool]* | :heavy_check_mark: | Whether the response was streamed | true | +| `cancelled` | *Nullable[bool]* | :heavy_check_mark: | Whether the generation was cancelled | false | +| `provider_name` | *Nullable[str]* | :heavy_check_mark: | Name of the provider that served the request | Infermatic | +| `latency` | *Nullable[float]* | :heavy_check_mark: | Total latency in milliseconds | 1250 | +| `moderation_latency` | *Nullable[float]* | :heavy_check_mark: | Moderation latency in milliseconds | 50 | +| `generation_time` | *Nullable[float]* | :heavy_check_mark: | Time taken for generation in milliseconds | 1200 | +| `finish_reason` | *Nullable[str]* | :heavy_check_mark: | Reason the generation finished | stop | +| `tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the prompt | 10 | +| `tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the completion | 25 | +| `native_tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Native prompt tokens as reported by provider | 10 | +| `native_tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Native completion tokens as reported by provider | 25 | +| `native_tokens_completion_images` | *Nullable[float]* | :heavy_check_mark: | Native completion image tokens as reported by provider | 0 | +| `native_tokens_reasoning` | *Nullable[float]* | :heavy_check_mark: | Native reasoning tokens as reported by provider | 5 | +| `native_tokens_cached` | *Nullable[float]* | :heavy_check_mark: | Native cached tokens as reported by provider | 3 | +| `num_media_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the prompt | 1 | +| `num_input_audio_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of audio inputs in the prompt | 0 | +| `num_media_completion` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the completion | 0 | +| `num_search_results` | *Nullable[float]* | :heavy_check_mark: | Number of search results included | 5 | +| `origin` | *str* | :heavy_check_mark: | Origin URL of the request | https://openrouter.ai/ | +| `usage` | *float* | :heavy_check_mark: | Usage amount in USD | 0.0015 | +| `is_byok` | *bool* | :heavy_check_mark: | Whether this used bring-your-own-key | false | +| `native_finish_reason` | *Nullable[str]* | :heavy_check_mark: | Native finish reason as reported by provider | stop | +| `external_user` | *Nullable[str]* | :heavy_check_mark: | External user identifier | user-123 | +| `api_type` | [Nullable[operations.APIType]](../operations/apitype.md) | :heavy_check_mark: | Type of API used for the generation | | +| `router` | *Nullable[str]* | :heavy_check_mark: | Router used for the request (e.g., openrouter/auto) | openrouter/auto | +| `provider_responses` | List[[operations.ProviderResponse](../operations/providerresponse.md)] | :heavy_check_mark: | List of provider responses for this generation, including fallback attempts | | \ No newline at end of file diff --git a/docs/operations/getgenerationglobals.md b/docs/operations/getgenerationglobals.md new file mode 100644 index 0000000..e8e8104 --- /dev/null +++ b/docs/operations/getgenerationglobals.md @@ -0,0 +1,9 @@ +# GetGenerationGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/getgenerationrequest.md b/docs/operations/getgenerationrequest.md index 6c59a6a..ec8100a 100644 --- a/docs/operations/getgenerationrequest.md +++ b/docs/operations/getgenerationrequest.md @@ -3,6 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `id` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `id` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/getguardrailglobals.md b/docs/operations/getguardrailglobals.md new file mode 100644 index 0000000..e9b5b80 --- /dev/null +++ b/docs/operations/getguardrailglobals.md @@ -0,0 +1,9 @@ +# GetGuardrailGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/getguardrailrequest.md b/docs/operations/getguardrailrequest.md index 5e11a52..e8d2af8 100644 --- a/docs/operations/getguardrailrequest.md +++ b/docs/operations/getguardrailrequest.md @@ -3,6 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to retrieve | 550e8400-e29b-41d4-a716-446655440000 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to retrieve | 550e8400-e29b-41d4-a716-446655440000 | \ No newline at end of file diff --git a/docs/operations/getkeyglobals.md b/docs/operations/getkeyglobals.md new file mode 100644 index 0000000..c88bdda --- /dev/null +++ b/docs/operations/getkeyglobals.md @@ -0,0 +1,9 @@ +# GetKeyGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/getkeyrequest.md b/docs/operations/getkeyrequest.md index 7e5d949..519c418 100644 --- a/docs/operations/getkeyrequest.md +++ b/docs/operations/getkeyrequest.md @@ -3,6 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to retrieve | f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to retrieve | f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 | \ No newline at end of file diff --git a/docs/operations/getmodelsglobals.md b/docs/operations/getmodelsglobals.md new file mode 100644 index 0000000..31e9969 --- /dev/null +++ b/docs/operations/getmodelsglobals.md @@ -0,0 +1,9 @@ +# GetModelsGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/getmodelsrequest.md b/docs/operations/getmodelsrequest.md index b30704f..469aeb5 100644 --- a/docs/operations/getmodelsrequest.md +++ b/docs/operations/getmodelsrequest.md @@ -3,7 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `category` | [Optional[operations.Category]](../operations/category.md) | :heavy_minus_sign: | Filter models by use case category | programming | -| `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `category` | [Optional[operations.Category]](../operations/category.md) | :heavy_minus_sign: | Filter models by use case category | programming | +| `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/operations/getuseractivityglobals.md b/docs/operations/getuseractivityglobals.md new file mode 100644 index 0000000..cfcdb0a --- /dev/null +++ b/docs/operations/getuseractivityglobals.md @@ -0,0 +1,9 @@ +# GetUserActivityGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/getuseractivityrequest.md b/docs/operations/getuseractivityrequest.md index 6df2f76..97457f0 100644 --- a/docs/operations/getuseractivityrequest.md +++ b/docs/operations/getuseractivityrequest.md @@ -3,6 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `date_` | *Optional[str]* | :heavy_minus_sign: | Filter by a single UTC date in the last 30 days (YYYY-MM-DD format). | 2025-08-24 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `date_` | *Optional[str]* | :heavy_minus_sign: | Filter by a single UTC date in the last 30 days (YYYY-MM-DD format). | 2025-08-24 | \ No newline at end of file diff --git a/docs/operations/listembeddingsmodelsglobals.md b/docs/operations/listembeddingsmodelsglobals.md new file mode 100644 index 0000000..6cf29a9 --- /dev/null +++ b/docs/operations/listembeddingsmodelsglobals.md @@ -0,0 +1,9 @@ +# ListEmbeddingsModelsGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listembeddingsmodelsrequest.md b/docs/operations/listembeddingsmodelsrequest.md new file mode 100644 index 0000000..1dd1657 --- /dev/null +++ b/docs/operations/listembeddingsmodelsrequest.md @@ -0,0 +1,9 @@ +# ListEmbeddingsModelsRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listendpointsglobals.md b/docs/operations/listendpointsglobals.md new file mode 100644 index 0000000..b00c95a --- /dev/null +++ b/docs/operations/listendpointsglobals.md @@ -0,0 +1,9 @@ +# ListEndpointsGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listendpointsrequest.md b/docs/operations/listendpointsrequest.md index 5d7e3e4..39a1d0d 100644 --- a/docs/operations/listendpointsrequest.md +++ b/docs/operations/listendpointsrequest.md @@ -3,7 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `author` | *str* | :heavy_check_mark: | N/A | -| `slug` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `author` | *str* | :heavy_check_mark: | N/A | +| `slug` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/listendpointszdrglobals.md b/docs/operations/listendpointszdrglobals.md new file mode 100644 index 0000000..a858e43 --- /dev/null +++ b/docs/operations/listendpointszdrglobals.md @@ -0,0 +1,9 @@ +# ListEndpointsZdrGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listendpointszdrrequest.md b/docs/operations/listendpointszdrrequest.md new file mode 100644 index 0000000..ab1f161 --- /dev/null +++ b/docs/operations/listendpointszdrrequest.md @@ -0,0 +1,9 @@ +# ListEndpointsZdrRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listglobals.md b/docs/operations/listglobals.md new file mode 100644 index 0000000..8d10965 --- /dev/null +++ b/docs/operations/listglobals.md @@ -0,0 +1,9 @@ +# ListGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listguardrailkeyassignmentsglobals.md b/docs/operations/listguardrailkeyassignmentsglobals.md new file mode 100644 index 0000000..d431a1d --- /dev/null +++ b/docs/operations/listguardrailkeyassignmentsglobals.md @@ -0,0 +1,9 @@ +# ListGuardrailKeyAssignmentsGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listguardrailkeyassignmentsrequest.md b/docs/operations/listguardrailkeyassignmentsrequest.md index c6bc0f8..bb75011 100644 --- a/docs/operations/listguardrailkeyassignmentsrequest.md +++ b/docs/operations/listguardrailkeyassignmentsrequest.md @@ -3,8 +3,10 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | -| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | -| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | +| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | +| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | \ No newline at end of file diff --git a/docs/operations/listguardrailmemberassignmentsglobals.md b/docs/operations/listguardrailmemberassignmentsglobals.md new file mode 100644 index 0000000..efaa3d9 --- /dev/null +++ b/docs/operations/listguardrailmemberassignmentsglobals.md @@ -0,0 +1,9 @@ +# ListGuardrailMemberAssignmentsGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listguardrailmemberassignmentsrequest.md b/docs/operations/listguardrailmemberassignmentsrequest.md index e3ce4aa..313f1c3 100644 --- a/docs/operations/listguardrailmemberassignmentsrequest.md +++ b/docs/operations/listguardrailmemberassignmentsrequest.md @@ -3,8 +3,10 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | -| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | -| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | +| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | +| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | \ No newline at end of file diff --git a/docs/operations/listguardrailsglobals.md b/docs/operations/listguardrailsglobals.md new file mode 100644 index 0000000..65ea039 --- /dev/null +++ b/docs/operations/listguardrailsglobals.md @@ -0,0 +1,9 @@ +# ListGuardrailsGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listguardrailsrequest.md b/docs/operations/listguardrailsrequest.md index 19317a1..4e3330b 100644 --- a/docs/operations/listguardrailsrequest.md +++ b/docs/operations/listguardrailsrequest.md @@ -3,7 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | -| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | -| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | +| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | \ No newline at end of file diff --git a/docs/operations/listkeyassignmentsglobals.md b/docs/operations/listkeyassignmentsglobals.md new file mode 100644 index 0000000..b606693 --- /dev/null +++ b/docs/operations/listkeyassignmentsglobals.md @@ -0,0 +1,9 @@ +# ListKeyAssignmentsGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listkeyassignmentsrequest.md b/docs/operations/listkeyassignmentsrequest.md index fafdeeb..ce886c0 100644 --- a/docs/operations/listkeyassignmentsrequest.md +++ b/docs/operations/listkeyassignmentsrequest.md @@ -3,7 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | -| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | -| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | +| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | \ No newline at end of file diff --git a/docs/operations/listmemberassignmentsglobals.md b/docs/operations/listmemberassignmentsglobals.md new file mode 100644 index 0000000..9cd0e16 --- /dev/null +++ b/docs/operations/listmemberassignmentsglobals.md @@ -0,0 +1,9 @@ +# ListMemberAssignmentsGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listmemberassignmentsrequest.md b/docs/operations/listmemberassignmentsrequest.md index 083455d..8ec3f2a 100644 --- a/docs/operations/listmemberassignmentsrequest.md +++ b/docs/operations/listmemberassignmentsrequest.md @@ -3,7 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | -| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | -| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | +| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | \ No newline at end of file diff --git a/docs/operations/listmodelscountglobals.md b/docs/operations/listmodelscountglobals.md new file mode 100644 index 0000000..b0ddc73 --- /dev/null +++ b/docs/operations/listmodelscountglobals.md @@ -0,0 +1,9 @@ +# ListModelsCountGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listmodelscountrequest.md b/docs/operations/listmodelscountrequest.md new file mode 100644 index 0000000..95df935 --- /dev/null +++ b/docs/operations/listmodelscountrequest.md @@ -0,0 +1,9 @@ +# ListModelsCountRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listmodelsuserglobals.md b/docs/operations/listmodelsuserglobals.md new file mode 100644 index 0000000..59b2ab0 --- /dev/null +++ b/docs/operations/listmodelsuserglobals.md @@ -0,0 +1,9 @@ +# ListModelsUserGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listmodelsuserrequest.md b/docs/operations/listmodelsuserrequest.md new file mode 100644 index 0000000..9113594 --- /dev/null +++ b/docs/operations/listmodelsuserrequest.md @@ -0,0 +1,9 @@ +# ListModelsUserRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listprovidersglobals.md b/docs/operations/listprovidersglobals.md new file mode 100644 index 0000000..2edb4d2 --- /dev/null +++ b/docs/operations/listprovidersglobals.md @@ -0,0 +1,9 @@ +# ListProvidersGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listprovidersrequest.md b/docs/operations/listprovidersrequest.md new file mode 100644 index 0000000..a06e73d --- /dev/null +++ b/docs/operations/listprovidersrequest.md @@ -0,0 +1,9 @@ +# ListProvidersRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/listrequest.md b/docs/operations/listrequest.md index 4911cc1..d2ab395 100644 --- a/docs/operations/listrequest.md +++ b/docs/operations/listrequest.md @@ -3,7 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `include_disabled` | *Optional[str]* | :heavy_minus_sign: | Whether to include disabled API keys in the response | false | -| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of API keys to skip for pagination | 0 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `include_disabled` | *Optional[str]* | :heavy_minus_sign: | Whether to include disabled API keys in the response | false | +| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of API keys to skip for pagination | 0 | \ No newline at end of file diff --git a/docs/operations/providername.md b/docs/operations/providername.md new file mode 100644 index 0000000..d9111d6 --- /dev/null +++ b/docs/operations/providername.md @@ -0,0 +1,107 @@ +# ProviderName + + +## Values + +| Name | Value | +| ------------------- | ------------------- | +| `ANY_SCALE` | AnyScale | +| `ATOMA` | Atoma | +| `CENT_ML` | Cent-ML | +| `CROF_AI` | CrofAI | +| `ENFER` | Enfer | +| `GO_POMELO` | GoPomelo | +| `HUGGING_FACE` | HuggingFace | +| `HYPERBOLIC_2` | Hyperbolic 2 | +| `INO_CLOUD` | InoCloud | +| `KLUSTER` | Kluster | +| `LAMBDA` | Lambda | +| `LEPTON` | Lepton | +| `LYNN_2` | Lynn 2 | +| `LYNN` | Lynn | +| `MANCER` | Mancer | +| `META` | Meta | +| `MODAL` | Modal | +| `NINETEEN` | Nineteen | +| `OCTO_AI` | OctoAI | +| `RECURSAL` | Recursal | +| `REFLECTION` | Reflection | +| `REPLICATE` | Replicate | +| `SAMBA_NOVA_2` | SambaNova 2 | +| `SF_COMPUTE` | SF Compute | +| `TARGON` | Targon | +| `TOGETHER_2` | Together 2 | +| `UBICLOUD` | Ubicloud | +| `ONE_DOT_AI` | 01.AI | +| `AI21` | AI21 | +| `AION_LABS` | AionLabs | +| `ALIBABA` | Alibaba | +| `AMBIENT` | Ambient | +| `AMAZON_BEDROCK` | Amazon Bedrock | +| `AMAZON_NOVA` | Amazon Nova | +| `ANTHROPIC` | Anthropic | +| `ARCEE_AI` | Arcee AI | +| `ATLAS_CLOUD` | AtlasCloud | +| `AVIAN` | Avian | +| `AZURE` | Azure | +| `BASE_TEN` | BaseTen | +| `BYTE_PLUS` | BytePlus | +| `BLACK_FOREST_LABS` | Black Forest Labs | +| `CEREBRAS` | Cerebras | +| `CHUTES` | Chutes | +| `CIRRASCALE` | Cirrascale | +| `CLARIFAI` | Clarifai | +| `CLOUDFLARE` | Cloudflare | +| `COHERE` | Cohere | +| `CRUSOE` | Crusoe | +| `DEEP_INFRA` | DeepInfra | +| `DEEP_SEEK` | DeepSeek | +| `FEATHERLESS` | Featherless | +| `FIREWORKS` | Fireworks | +| `FRIENDLI` | Friendli | +| `GMI_CLOUD` | GMICloud | +| `GOOGLE` | Google | +| `GOOGLE_AI_STUDIO` | Google AI Studio | +| `GROQ` | Groq | +| `HYPERBOLIC` | Hyperbolic | +| `INCEPTION` | Inception | +| `INCEPTRON` | Inceptron | +| `INFERENCE_NET` | InferenceNet | +| `INFERMATIC` | Infermatic | +| `INFLECTION` | Inflection | +| `LIQUID` | Liquid | +| `MARA` | Mara | +| `MANCER_2` | Mancer 2 | +| `MINIMAX` | Minimax | +| `MODEL_RUN` | ModelRun | +| `MISTRAL` | Mistral | +| `MODULAR` | Modular | +| `MOONSHOT_AI` | Moonshot AI | +| `MORPH` | Morph | +| `N_COMPASS` | NCompass | +| `NEBIUS` | Nebius | +| `NEXT_BIT` | NextBit | +| `NOVITA` | Novita | +| `NVIDIA` | Nvidia | +| `OPEN_AI` | OpenAI | +| `OPEN_INFERENCE` | OpenInference | +| `PARASAIL` | Parasail | +| `PERPLEXITY` | Perplexity | +| `PHALA` | Phala | +| `RELACE` | Relace | +| `SAMBA_NOVA` | SambaNova | +| `SEED` | Seed | +| `SILICON_FLOW` | SiliconFlow | +| `SOURCEFUL` | Sourceful | +| `STEP_FUN` | StepFun | +| `STEALTH` | Stealth | +| `STREAM_LAKE` | StreamLake | +| `SWITCHPOINT` | Switchpoint | +| `TOGETHER` | Together | +| `UPSTAGE` | Upstage | +| `VENICE` | Venice | +| `WAND_B` | WandB | +| `XIAOMI` | Xiaomi | +| `X_AI` | xAI | +| `Z_AI` | Z.AI | +| `FAKE_PROVIDER` | FakeProvider | \ No newline at end of file diff --git a/docs/operations/providerresponse.md b/docs/operations/providerresponse.md new file mode 100644 index 0000000..cd0f8fb --- /dev/null +++ b/docs/operations/providerresponse.md @@ -0,0 +1,14 @@ +# ProviderResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `endpoint_id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `model_permaslug` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `provider_name` | [Optional[operations.ProviderName]](../operations/providername.md) | :heavy_minus_sign: | N/A | +| `status` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `latency` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `is_byok` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/operations/sendchatcompletionrequestglobals.md b/docs/operations/sendchatcompletionrequestglobals.md new file mode 100644 index 0000000..b37d22f --- /dev/null +++ b/docs/operations/sendchatcompletionrequestglobals.md @@ -0,0 +1,9 @@ +# SendChatCompletionRequestGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/sendchatcompletionrequestrequest.md b/docs/operations/sendchatcompletionrequestrequest.md new file mode 100644 index 0000000..f3f4abc --- /dev/null +++ b/docs/operations/sendchatcompletionrequestrequest.md @@ -0,0 +1,10 @@ +# SendChatCompletionRequestRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `chat_generation_params` | [components.ChatGenerationParams](../components/chatgenerationparams.md) | :heavy_check_mark: | Chat completion request parameters | \ No newline at end of file diff --git a/docs/operations/updateguardrailglobals.md b/docs/operations/updateguardrailglobals.md new file mode 100644 index 0000000..fc66661 --- /dev/null +++ b/docs/operations/updateguardrailglobals.md @@ -0,0 +1,9 @@ +# UpdateGuardrailGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/updateguardrailrequest.md b/docs/operations/updateguardrailrequest.md index 2f54d43..04fe91c 100644 --- a/docs/operations/updateguardrailrequest.md +++ b/docs/operations/updateguardrailrequest.md @@ -3,7 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to update | 550e8400-e29b-41d4-a716-446655440000 | -| `request_body` | [operations.UpdateGuardrailRequestBody](../operations/updateguardrailrequestbody.md) | :heavy_check_mark: | N/A | {
"name": "Updated Guardrail Name",
"description": "Updated description",
"limit_usd": 75,
"reset_interval": "weekly"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to update | 550e8400-e29b-41d4-a716-446655440000 | +| `request_body` | [operations.UpdateGuardrailRequestBody](../operations/updateguardrailrequestbody.md) | :heavy_check_mark: | N/A | {
"name": "Updated Guardrail Name",
"description": "Updated description",
"limit_usd": 75,
"reset_interval": "weekly"
} | \ No newline at end of file diff --git a/docs/operations/updatekeysglobals.md b/docs/operations/updatekeysglobals.md new file mode 100644 index 0000000..c13bcc6 --- /dev/null +++ b/docs/operations/updatekeysglobals.md @@ -0,0 +1,9 @@ +# UpdateKeysGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| \ No newline at end of file diff --git a/docs/operations/updatekeysrequest.md b/docs/operations/updatekeysrequest.md index 8ef80cc..c2c5c25 100644 --- a/docs/operations/updatekeysrequest.md +++ b/docs/operations/updatekeysrequest.md @@ -3,7 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | -| `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to update | f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 | -| `request_body` | [operations.UpdateKeysRequestBody](../operations/updatekeysrequestbody.md) | :heavy_check_mark: | N/A | {
"name": "Updated API Key Name",
"disabled": false,
"limit": 75,
"limit_reset": "daily",
"include_byok_in_limit": true
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to update | f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 | +| `request_body` | [operations.UpdateKeysRequestBody](../operations/updatekeysrequestbody.md) | :heavy_check_mark: | N/A | {
"name": "Updated API Key Name",
"disabled": false,
"limit": 75,
"limit_reset": "daily",
"include_byok_in_limit": true
} | \ No newline at end of file diff --git a/docs/sdks/analytics/README.md b/docs/sdks/analytics/README.md index 4530c8f..781dc23 100644 --- a/docs/sdks/analytics/README.md +++ b/docs/sdks/analytics/README.md @@ -11,7 +11,7 @@ Analytics and usage endpoints ## get_user_activity -Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -22,6 +22,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -34,10 +36,12 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `date_` | *Optional[str]* | :heavy_minus_sign: | Filter by a single UTC date in the last 30 days (YYYY-MM-DD format). | 2025-08-24 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `date_` | *Optional[str]* | :heavy_minus_sign: | Filter by a single UTC date in the last 30 days (YYYY-MM-DD format). | 2025-08-24 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/apikeys/README.md b/docs/sdks/apikeys/README.md index aae9b09..eaa58d5 100644 --- a/docs/sdks/apikeys/README.md +++ b/docs/sdks/apikeys/README.md @@ -16,7 +16,7 @@ API key management endpoints ## list -List all API keys for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -27,6 +27,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -39,11 +41,13 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `include_disabled` | *Optional[str]* | :heavy_minus_sign: | Whether to include disabled API keys in the response | false | -| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of API keys to skip for pagination | 0 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `include_disabled` | *Optional[str]* | :heavy_minus_sign: | Whether to include disabled API keys in the response | false | +| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of API keys to skip for pagination | 0 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -60,7 +64,7 @@ with OpenRouter( ## create -Create a new API key for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +Create a new API key for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -71,6 +75,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -86,6 +92,8 @@ with OpenRouter( | Parameter | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `name` | *str* | :heavy_check_mark: | Name for the new API key | My New API Key | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `limit` | *OptionalNullable[float]* | :heavy_minus_sign: | Optional spending limit for the API key in USD | 50 | | `limit_reset` | [OptionalNullable[operations.CreateKeysLimitReset]](../../operations/createkeyslimitreset.md) | :heavy_minus_sign: | Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday. | monthly | | `include_byok_in_limit` | *Optional[bool]* | :heavy_minus_sign: | Whether to include BYOK usage in the limit | true | @@ -108,7 +116,7 @@ with OpenRouter( ## update -Update an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +Update an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -119,6 +127,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -134,6 +144,8 @@ with OpenRouter( | Parameter | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to update | f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `name` | *Optional[str]* | :heavy_minus_sign: | New name for the API key | Updated API Key Name | | `disabled` | *Optional[bool]* | :heavy_minus_sign: | Whether to disable the API key | false | | `limit` | *OptionalNullable[float]* | :heavy_minus_sign: | New spending limit for the API key in USD | 75 | @@ -158,7 +170,7 @@ with OpenRouter( ## delete -Delete an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +Delete an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -169,6 +181,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -181,10 +195,12 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to delete | f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to delete | f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -202,7 +218,7 @@ with OpenRouter( ## get -Get a single API key by hash. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +Get a single API key by hash. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -213,6 +229,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -225,10 +243,12 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to retrieve | f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to retrieve | f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -257,6 +277,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -269,9 +291,11 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response diff --git a/docs/sdks/chat/README.md b/docs/sdks/chat/README.md index 6b781c3..9e30497 100644 --- a/docs/sdks/chat/README.md +++ b/docs/sdks/chat/README.md @@ -20,6 +20,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -34,38 +36,40 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `messages` | List[[components.Message](../../components/message.md)] | :heavy_check_mark: | N/A | -| `provider` | [OptionalNullable[components.ChatGenerationParamsProvider]](../../components/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | -| `plugins` | List[[components.ChatGenerationParamsPluginUnion](../../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | -| `route` | [OptionalNullable[components.Route]](../../components/route.md) | :heavy_minus_sign: | N/A | -| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | -| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `models` | List[*str*] | :heavy_minus_sign: | N/A | -| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A | -| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | -| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `reasoning` | [Optional[components.Reasoning]](../../components/reasoning.md) | :heavy_minus_sign: | N/A | -| `response_format` | [Optional[components.ChatGenerationParamsResponseFormatUnion]](../../components/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A | -| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `stop` | [OptionalNullable[components.ChatGenerationParamsStop]](../../components/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A | -| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A | -| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A | -| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `debug` | [Optional[components.Debug]](../../components/debug.md) | :heavy_minus_sign: | N/A | -| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A | -| `modalities` | List[[components.Modality](../../components/modality.md)] | :heavy_minus_sign: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `messages` | List[[components.Message](../../components/message.md)] | :heavy_check_mark: | N/A | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `provider` | [OptionalNullable[components.Schema0]](../../components/schema0.md) | :heavy_minus_sign: | N/A | +| `plugins` | List[[components.Schema17](../../components/schema17.md)] | :heavy_minus_sign: | N/A | +| `route` | [OptionalNullable[components.Route]](../../components/route.md) | :heavy_minus_sign: | N/A | +| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `session_id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `models` | List[*str*] | :heavy_minus_sign: | N/A | +| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A | +| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | +| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `reasoning` | [Optional[components.Reasoning]](../../components/reasoning.md) | :heavy_minus_sign: | N/A | +| `response_format` | [Optional[components.ResponseFormat]](../../components/responseformat.md) | :heavy_minus_sign: | N/A | +| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | +| `stop` | [OptionalNullable[components.Stop]](../../components/stop.md) | :heavy_minus_sign: | N/A | +| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | +| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A | +| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A | +| `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A | +| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `debug` | [Optional[components.Debug]](../../components/debug.md) | :heavy_minus_sign: | N/A | +| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A | +| `modalities` | List[[components.Modality](../../components/modality.md)] | :heavy_minus_sign: | N/A | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response diff --git a/docs/sdks/completions/README.md b/docs/sdks/completions/README.md deleted file mode 100644 index beeb03e..0000000 --- a/docs/sdks/completions/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# Completions -(*completions*) - -## Overview - -### Available Operations - -* [generate](#generate) - Create a completion - -## generate - -Creates a completion for the provided prompt and parameters. Supports both streaming and non-streaming modes. - -### Example Usage - - -```python -from openrouter import OpenRouter -import os - - -with OpenRouter( - api_key=os.getenv("OPENROUTER_API_KEY", ""), -) as open_router: - - res = open_router.completions.generate(prompt=[], stream=False) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -| `prompt` | [components.Prompt](../../components/prompt.md) | :heavy_check_mark: | N/A | -| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `models` | List[*str*] | :heavy_minus_sign: | N/A | -| `best_of` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `echo` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A | -| `logprobs` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `n` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `stop` | [OptionalNullable[components.CompletionCreateParamsStop]](../../components/completioncreateparamsstop.md) | :heavy_minus_sign: | N/A | -| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `stream_options` | [OptionalNullable[components.StreamOptions]](../../components/streamoptions.md) | :heavy_minus_sign: | N/A | -| `suffix` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | -| `response_format` | [OptionalNullable[components.CompletionCreateParamsResponseFormatUnion]](../../components/completioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[components.CompletionResponse](../../components/completionresponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ----------------------------- | ----------------------------- | ----------------------------- | -| errors.ChatError | 400, 401, 429 | application/json | -| errors.ChatError | 500 | application/json | -| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/credits/README.md b/docs/sdks/credits/README.md index 083195b..5744ee5 100644 --- a/docs/sdks/credits/README.md +++ b/docs/sdks/credits/README.md @@ -12,7 +12,7 @@ Credit management endpoints ## get_credits -Get total credits purchased and used for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +Get total credits purchased and used for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -23,6 +23,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -35,9 +37,11 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response @@ -64,7 +68,10 @@ from openrouter import OpenRouter, operations import os -with OpenRouter() as open_router: +with OpenRouter( + http_referer="", + x_title="", +) as open_router: res = open_router.credits.create_coinbase_charge(security=operations.CreateCoinbaseChargeSecurity( bearer=os.getenv("OPENROUTER_BEARER", ""), @@ -77,13 +84,15 @@ with OpenRouter() as open_router: ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | -| `security` | [operations.CreateCoinbaseChargeSecurity](../../operations/createcoinbasechargesecurity.md) | :heavy_check_mark: | N/A | -| `amount` | *float* | :heavy_check_mark: | N/A | -| `sender` | *str* | :heavy_check_mark: | N/A | -| `chain_id` | [components.ChainID](../../components/chainid.md) | :heavy_check_mark: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `security` | [operations.CreateCoinbaseChargeSecurity](../../operations/createcoinbasechargesecurity.md) | :heavy_check_mark: | N/A | +| `amount` | *float* | :heavy_check_mark: | N/A | +| `sender` | *str* | :heavy_check_mark: | N/A | +| `chain_id` | [components.ChainID](../../components/chainid.md) | :heavy_check_mark: | N/A | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response diff --git a/docs/sdks/embeddings/README.md b/docs/sdks/embeddings/README.md index 9defe9a..5a383c1 100644 --- a/docs/sdks/embeddings/README.md +++ b/docs/sdks/embeddings/README.md @@ -23,6 +23,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -35,16 +37,18 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -| `input` | [operations.InputUnion](../../operations/inputunion.md) | :heavy_check_mark: | N/A | -| `model` | *str* | :heavy_check_mark: | N/A | -| `encoding_format` | [Optional[operations.EncodingFormat]](../../operations/encodingformat.md) | :heavy_minus_sign: | N/A | -| `dimensions` | *Optional[int]* | :heavy_minus_sign: | N/A | -| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `provider` | [Optional[components.ProviderPreferences]](../../components/providerpreferences.md) | :heavy_minus_sign: | Provider routing preferences for the request. | -| `input_type` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `input` | [operations.InputUnion](../../operations/inputunion.md) | :heavy_check_mark: | N/A | +| `model` | *str* | :heavy_check_mark: | N/A | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `encoding_format` | [Optional[operations.EncodingFormat]](../../operations/encodingformat.md) | :heavy_minus_sign: | N/A | +| `dimensions` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `provider` | [Optional[components.ProviderPreferences]](../../components/providerpreferences.md) | :heavy_minus_sign: | Provider routing preferences for the request. | +| `input_type` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response @@ -79,6 +83,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -91,9 +97,11 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response diff --git a/docs/sdks/endpoints/README.md b/docs/sdks/endpoints/README.md index 981bfee..2e74416 100644 --- a/docs/sdks/endpoints/README.md +++ b/docs/sdks/endpoints/README.md @@ -23,6 +23,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -35,11 +37,13 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `author` | *str* | :heavy_check_mark: | N/A | -| `slug` | *str* | :heavy_check_mark: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `author` | *str* | :heavy_check_mark: | N/A | +| `slug` | *str* | :heavy_check_mark: | N/A | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response @@ -66,6 +70,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -78,9 +84,11 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response diff --git a/docs/sdks/generations/README.md b/docs/sdks/generations/README.md index ddc0f51..cc602ad 100644 --- a/docs/sdks/generations/README.md +++ b/docs/sdks/generations/README.md @@ -22,6 +22,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -34,10 +36,12 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | N/A | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response diff --git a/docs/sdks/guardrails/README.md b/docs/sdks/guardrails/README.md index 2b5c029..3e4a07f 100644 --- a/docs/sdks/guardrails/README.md +++ b/docs/sdks/guardrails/README.md @@ -23,7 +23,7 @@ Guardrails endpoints ## list -List all guardrails for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -34,6 +34,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -46,11 +48,13 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | -| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | +| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -66,7 +70,7 @@ with OpenRouter( ## create -Create a new guardrail for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +Create a new guardrail for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -77,6 +81,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -89,16 +95,18 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| `name` | *str* | :heavy_check_mark: | Name for the new guardrail | My New Guardrail | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | A guardrail for limiting API usage | -| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 50 | -| `reset_interval` | [OptionalNullable[operations.CreateGuardrailResetIntervalRequest]](../../operations/createguardrailresetintervalrequest.md) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | -| `enforce_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention | false | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `name` | *str* | :heavy_check_mark: | Name for the new guardrail | My New Guardrail | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | A guardrail for limiting API usage | +| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 50 | +| `reset_interval` | [OptionalNullable[operations.CreateGuardrailResetIntervalRequest]](../../operations/createguardrailresetintervalrequest.md) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | +| `enforce_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention | false | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -115,7 +123,7 @@ with OpenRouter( ## get -Get a single guardrail by ID. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +Get a single guardrail by ID. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -126,6 +134,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -138,10 +148,12 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to retrieve | 550e8400-e29b-41d4-a716-446655440000 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to retrieve | 550e8400-e29b-41d4-a716-446655440000 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -158,7 +170,7 @@ with OpenRouter( ## update -Update an existing guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +Update an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -169,6 +181,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -181,17 +195,19 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to update | 550e8400-e29b-41d4-a716-446655440000 | -| `name` | *Optional[str]* | :heavy_minus_sign: | New name for the guardrail | Updated Guardrail Name | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | New description for the guardrail | Updated description | -| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | New spending limit in USD | 75 | -| `reset_interval` | [OptionalNullable[operations.UpdateGuardrailResetIntervalRequest]](../../operations/updateguardrailresetintervalrequest.md) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `allowed_providers` | List[*str*] | :heavy_minus_sign: | New list of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2"
] | -| `enforce_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention | true | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to update | 550e8400-e29b-41d4-a716-446655440000 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `name` | *Optional[str]* | :heavy_minus_sign: | New name for the guardrail | Updated Guardrail Name | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | New description for the guardrail | Updated description | +| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | New spending limit in USD | 75 | +| `reset_interval` | [OptionalNullable[operations.UpdateGuardrailResetIntervalRequest]](../../operations/updateguardrailresetintervalrequest.md) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `allowed_providers` | List[*str*] | :heavy_minus_sign: | New list of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2"
] | +| `enforce_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention | true | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -209,7 +225,7 @@ with OpenRouter( ## delete -Delete an existing guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +Delete an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -220,6 +236,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -232,10 +250,12 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to delete | 550e8400-e29b-41d4-a716-446655440000 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to delete | 550e8400-e29b-41d4-a716-446655440000 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -252,7 +272,7 @@ with OpenRouter( ## list_key_assignments -List all API key guardrail assignments for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +List all API key guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -263,6 +283,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -275,11 +297,13 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | -| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | +| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -295,7 +319,7 @@ with OpenRouter( ## list_member_assignments -List all organization member guardrail assignments for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +List all organization member guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -306,6 +330,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -318,11 +344,13 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | -| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | +| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -338,7 +366,7 @@ with OpenRouter( ## list_guardrail_key_assignments -List all API key assignments for a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +List all API key assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -349,6 +377,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -361,12 +391,14 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | -| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | -| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | +| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -383,7 +415,7 @@ with OpenRouter( ## bulk_assign_keys -Assign multiple API keys to a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +Assign multiple API keys to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -394,6 +426,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -408,11 +442,13 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | -| `key_hashes` | List[*str*] | :heavy_check_mark: | Array of API key hashes to assign to the guardrail | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | +| `key_hashes` | List[*str*] | :heavy_check_mark: | Array of API key hashes to assign to the guardrail | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -430,7 +466,7 @@ with OpenRouter( ## list_guardrail_member_assignments -List all organization member assignments for a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +List all organization member assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -441,6 +477,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -453,12 +491,14 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | -| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | -| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `offset` | *Optional[str]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | +| `limit` | *Optional[str]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -475,7 +515,7 @@ with OpenRouter( ## bulk_assign_members -Assign multiple organization members to a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +Assign multiple organization members to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -486,6 +526,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -501,11 +543,13 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | -| `member_user_ids` | List[*str*] | :heavy_check_mark: | Array of member user IDs to assign to the guardrail | [
"user_abc123",
"user_def456"
] | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | +| `member_user_ids` | List[*str*] | :heavy_check_mark: | Array of member user IDs to assign to the guardrail | [
"user_abc123",
"user_def456"
] | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -523,7 +567,7 @@ with OpenRouter( ## bulk_unassign_keys -Unassign multiple API keys from a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +Unassign multiple API keys from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -534,6 +578,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -548,11 +594,13 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | -| `key_hashes` | List[*str*] | :heavy_check_mark: | Array of API key hashes to unassign from the guardrail | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | +| `key_hashes` | List[*str*] | :heavy_check_mark: | Array of API key hashes to unassign from the guardrail | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -570,7 +618,7 @@ with OpenRouter( ## bulk_unassign_members -Unassign multiple organization members from a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. +Unassign multiple organization members from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage @@ -581,6 +629,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -596,11 +646,13 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | -| `member_user_ids` | List[*str*] | :heavy_check_mark: | Array of member user IDs to unassign from the guardrail | [
"user_abc123",
"user_def456"
] | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | +| `member_user_ids` | List[*str*] | :heavy_check_mark: | Array of member user IDs to unassign from the guardrail | [
"user_abc123",
"user_def456"
] | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/models/README.md b/docs/sdks/models/README.md index b106323..4140cc6 100644 --- a/docs/sdks/models/README.md +++ b/docs/sdks/models/README.md @@ -9,7 +9,7 @@ Model information endpoints * [count](#count) - Get total count of available models * [list](#list) - List all models and their properties -* [list_for_user](#list_for_user) - List models filtered by user provider preferences +* [list_for_user](#list_for_user) - List models filtered by user provider preferences, privacy settings, and guardrails ## count @@ -24,6 +24,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -36,9 +38,11 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response @@ -64,6 +68,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -76,11 +82,13 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `category` | [Optional[operations.Category]](../../operations/category.md) | :heavy_minus_sign: | Filter models by use case category | programming | -| `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | N/A | | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `category` | [Optional[operations.Category]](../../operations/category.md) | :heavy_minus_sign: | Filter models by use case category | programming | +| `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | N/A | | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -96,7 +104,7 @@ with OpenRouter( ## list_for_user -List models filtered by user provider preferences +List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing). ### Example Usage @@ -106,7 +114,10 @@ from openrouter import OpenRouter, operations import os -with OpenRouter() as open_router: +with OpenRouter( + http_referer="", + x_title="", +) as open_router: res = open_router.models.list_for_user(security=operations.ListModelsUserSecurity( bearer=os.getenv("OPENROUTER_BEARER", ""), @@ -119,10 +130,12 @@ with OpenRouter() as open_router: ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `security` | [operations.ListModelsUserSecurity](../../operations/listmodelsusersecurity.md) | :heavy_check_mark: | The security requirements to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `security` | [operations.ListModelsUserSecurity](../../operations/listmodelsusersecurity.md) | :heavy_check_mark: | N/A | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response @@ -133,5 +146,6 @@ with OpenRouter() as open_router: | Error Type | Status Code | Content Type | | ---------------------------------- | ---------------------------------- | ---------------------------------- | | errors.UnauthorizedResponseError | 401 | application/json | +| errors.NotFoundResponseError | 404 | application/json | | errors.InternalServerResponseError | 500 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/oauth/README.md b/docs/sdks/oauth/README.md index 0c17abc..39af951 100644 --- a/docs/sdks/oauth/README.md +++ b/docs/sdks/oauth/README.md @@ -23,6 +23,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -35,12 +37,14 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -| `code` | *str* | :heavy_check_mark: | The authorization code received from the OAuth redirect | auth_code_abc123def456 | -| `code_verifier` | *Optional[str]* | :heavy_minus_sign: | The code verifier if code_challenge was used in the authorization request | dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk | -| `code_challenge_method` | [OptionalNullable[operations.ExchangeAuthCodeForAPIKeyCodeChallengeMethod]](../../operations/exchangeauthcodeforapikeycodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `code` | *str* | :heavy_check_mark: | The authorization code received from the OAuth redirect | auth_code_abc123def456 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `code_verifier` | *Optional[str]* | :heavy_minus_sign: | The code verifier if code_challenge was used in the authorization request | dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk | +| `code_challenge_method` | [OptionalNullable[operations.ExchangeAuthCodeForAPIKeyCodeChallengeMethod]](../../operations/exchangeauthcodeforapikeycodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -68,6 +72,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -80,14 +86,16 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -| `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. | https://myapp.com/auth/callback | -| `code_challenge` | *Optional[str]* | :heavy_minus_sign: | PKCE code challenge for enhanced security | E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM | -| `code_challenge_method` | [Optional[operations.CreateAuthKeysCodeCodeChallengeMethod]](../../operations/createauthkeyscodecodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 | -| `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 | -| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. | https://myapp.com/auth/callback | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `code_challenge` | *Optional[str]* | :heavy_minus_sign: | PKCE code challenge for enhanced security | E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM | +| `code_challenge_method` | [Optional[operations.CreateAuthKeysCodeCodeChallengeMethod]](../../operations/createauthkeyscodecodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 | +| `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 | +| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/providers/README.md b/docs/sdks/providers/README.md index 8654a37..fcec440 100644 --- a/docs/sdks/providers/README.md +++ b/docs/sdks/providers/README.md @@ -22,6 +22,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -34,9 +36,11 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response diff --git a/docs/sdks/responses/README.md b/docs/sdks/responses/README.md index 3f71774..e8199a7 100644 --- a/docs/sdks/responses/README.md +++ b/docs/sdks/responses/README.md @@ -22,6 +22,8 @@ import os with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: @@ -38,6 +40,8 @@ with OpenRouter( | Parameter | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `input` | [Optional[components.OpenResponsesInput]](../../components/openresponsesinput.md) | :heavy_minus_sign: | Input for a response request - can be a string or array of items | [
{
"role": "user",
"content": "What is the weather today?"
}
] | | `instructions` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | | `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed. | {
"user_id": "123",
"session_id": "abc-def-ghi"
} | @@ -67,8 +71,8 @@ with OpenRouter( | `service_tier` | [Optional[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | | | `truncation` | [OptionalNullable[components.Truncation]](../../components/truncation.md) | :heavy_minus_sign: | N/A | auto | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | -| `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../../components/openresponsesrequestprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | -| `plugins` | List[[components.OpenResponsesRequestPluginUnion](../../components/openresponsesrequestpluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | +| `provider` | [OptionalNullable[components.Provider]](../../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | +| `plugins` | List[[components.Plugin](../../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | | | `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | diff --git a/pyproject.toml b/pyproject.toml index 09db2ac..c8cdf36 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.1.3" +version = "0.6.0" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index 59cb4ed..8023550 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.1.3" +__version__: str = "0.6.0" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.768.0" -__user_agent__: str = "speakeasy-sdk/python 0.1.3 2.768.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.6.0 2.768.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/analytics.py b/src/openrouter/analytics.py index ac1280b..1e6a8c1 100644 --- a/src/openrouter/analytics.py +++ b/src/openrouter/analytics.py @@ -15,6 +15,8 @@ class Analytics(BaseSDK): def get_user_activity( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, date_: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -23,7 +25,12 @@ class Analytics(BaseSDK): ) -> operations.GetUserActivityResponse: r"""Get user activity grouped by endpoint - Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. :param date_: Filter by a single UTC date in the last 30 days (YYYY-MM-DD format). :param retries: Override the default retry configuration for this method @@ -42,6 +49,8 @@ class Analytics(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.GetUserActivityRequest( + http_referer=http_referer, + x_title=x_title, date_=date_, ) @@ -57,6 +66,10 @@ class Analytics(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.GetUserActivityGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -124,6 +137,8 @@ class Analytics(BaseSDK): async def get_user_activity_async( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, date_: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -132,7 +147,12 @@ class Analytics(BaseSDK): ) -> operations.GetUserActivityResponse: r"""Get user activity grouped by endpoint - Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. :param date_: Filter by a single UTC date in the last 30 days (YYYY-MM-DD format). :param retries: Override the default retry configuration for this method @@ -151,6 +171,8 @@ class Analytics(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.GetUserActivityRequest( + http_referer=http_referer, + x_title=x_title, date_=date_, ) @@ -166,6 +188,10 @@ class Analytics(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.GetUserActivityGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, diff --git a/src/openrouter/api_keys.py b/src/openrouter/api_keys.py index 9615b37..c87c6f1 100644 --- a/src/openrouter/api_keys.py +++ b/src/openrouter/api_keys.py @@ -16,6 +16,8 @@ class APIKeys(BaseSDK): def list( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, include_disabled: Optional[str] = None, offset: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -25,7 +27,12 @@ class APIKeys(BaseSDK): ) -> operations.ListResponse: r"""List API keys - List all API keys for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. :param include_disabled: Whether to include disabled API keys in the response :param offset: Number of API keys to skip for pagination @@ -45,6 +52,8 @@ class APIKeys(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ListRequest( + http_referer=http_referer, + x_title=x_title, include_disabled=include_disabled, offset=offset, ) @@ -61,6 +70,10 @@ class APIKeys(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -123,6 +136,8 @@ class APIKeys(BaseSDK): async def list_async( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, include_disabled: Optional[str] = None, offset: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -132,7 +147,12 @@ class APIKeys(BaseSDK): ) -> operations.ListResponse: r"""List API keys - List all API keys for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. :param include_disabled: Whether to include disabled API keys in the response :param offset: Number of API keys to skip for pagination @@ -152,6 +172,8 @@ class APIKeys(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ListRequest( + http_referer=http_referer, + x_title=x_title, include_disabled=include_disabled, offset=offset, ) @@ -168,6 +190,10 @@ class APIKeys(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -231,6 +257,8 @@ class APIKeys(BaseSDK): self, *, name: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, limit: OptionalNullable[float] = UNSET, limit_reset: OptionalNullable[operations.CreateKeysLimitReset] = UNSET, include_byok_in_limit: Optional[bool] = None, @@ -242,9 +270,14 @@ class APIKeys(BaseSDK): ) -> operations.CreateKeysResponse: r"""Create a new API key - Create a new API key for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Create a new API key for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param name: Name for the new API key + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param limit: Optional spending limit for the API key in USD :param limit_reset: Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday. :param include_byok_in_limit: Whether to include BYOK usage in the limit @@ -265,11 +298,15 @@ class APIKeys(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.CreateKeysRequest( - name=name, - limit=limit, - limit_reset=limit_reset, - include_byok_in_limit=include_byok_in_limit, - expires_at=expires_at, + http_referer=http_referer, + x_title=x_title, + request_body=operations.CreateKeysRequestBody( + name=name, + limit=limit, + limit_reset=limit_reset, + include_byok_in_limit=include_byok_in_limit, + expires_at=expires_at, + ), ) req = self._build_request( @@ -284,9 +321,17 @@ class APIKeys(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.CreateKeysGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", operations.CreateKeysRequest + request.request_body, + False, + False, + "json", + operations.CreateKeysRequestBody, ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -355,6 +400,8 @@ class APIKeys(BaseSDK): self, *, name: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, limit: OptionalNullable[float] = UNSET, limit_reset: OptionalNullable[operations.CreateKeysLimitReset] = UNSET, include_byok_in_limit: Optional[bool] = None, @@ -366,9 +413,14 @@ class APIKeys(BaseSDK): ) -> operations.CreateKeysResponse: r"""Create a new API key - Create a new API key for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Create a new API key for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param name: Name for the new API key + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param limit: Optional spending limit for the API key in USD :param limit_reset: Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday. :param include_byok_in_limit: Whether to include BYOK usage in the limit @@ -389,11 +441,15 @@ class APIKeys(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.CreateKeysRequest( - name=name, - limit=limit, - limit_reset=limit_reset, - include_byok_in_limit=include_byok_in_limit, - expires_at=expires_at, + http_referer=http_referer, + x_title=x_title, + request_body=operations.CreateKeysRequestBody( + name=name, + limit=limit, + limit_reset=limit_reset, + include_byok_in_limit=include_byok_in_limit, + expires_at=expires_at, + ), ) req = self._build_request_async( @@ -408,9 +464,17 @@ class APIKeys(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.CreateKeysGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", operations.CreateKeysRequest + request.request_body, + False, + False, + "json", + operations.CreateKeysRequestBody, ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -479,6 +543,8 @@ class APIKeys(BaseSDK): self, *, hash: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, name: Optional[str] = None, disabled: Optional[bool] = None, limit: OptionalNullable[float] = UNSET, @@ -491,9 +557,14 @@ class APIKeys(BaseSDK): ) -> operations.UpdateKeysResponse: r"""Update an API key - Update an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Update an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param hash: The hash identifier of the API key to update + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param name: New name for the API key :param disabled: Whether to disable the API key :param limit: New spending limit for the API key in USD @@ -515,6 +586,8 @@ class APIKeys(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.UpdateKeysRequest( + http_referer=http_referer, + x_title=x_title, hash=hash, request_body=operations.UpdateKeysRequestBody( name=name, @@ -537,6 +610,10 @@ class APIKeys(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.UpdateKeysGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request.request_body, @@ -617,6 +694,8 @@ class APIKeys(BaseSDK): self, *, hash: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, name: Optional[str] = None, disabled: Optional[bool] = None, limit: OptionalNullable[float] = UNSET, @@ -629,9 +708,14 @@ class APIKeys(BaseSDK): ) -> operations.UpdateKeysResponse: r"""Update an API key - Update an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Update an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param hash: The hash identifier of the API key to update + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param name: New name for the API key :param disabled: Whether to disable the API key :param limit: New spending limit for the API key in USD @@ -653,6 +737,8 @@ class APIKeys(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.UpdateKeysRequest( + http_referer=http_referer, + x_title=x_title, hash=hash, request_body=operations.UpdateKeysRequestBody( name=name, @@ -675,6 +761,10 @@ class APIKeys(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.UpdateKeysGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request.request_body, @@ -755,6 +845,8 @@ class APIKeys(BaseSDK): self, *, hash: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -762,9 +854,14 @@ class APIKeys(BaseSDK): ) -> operations.DeleteKeysResponse: r"""Delete an API key - Delete an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Delete an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param hash: The hash identifier of the API key to delete + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -781,6 +878,8 @@ class APIKeys(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.DeleteKeysRequest( + http_referer=http_referer, + x_title=x_title, hash=hash, ) @@ -796,6 +895,10 @@ class APIKeys(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.DeleteKeysGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -864,6 +967,8 @@ class APIKeys(BaseSDK): self, *, hash: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -871,9 +976,14 @@ class APIKeys(BaseSDK): ) -> operations.DeleteKeysResponse: r"""Delete an API key - Delete an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Delete an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param hash: The hash identifier of the API key to delete + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -890,6 +1000,8 @@ class APIKeys(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.DeleteKeysRequest( + http_referer=http_referer, + x_title=x_title, hash=hash, ) @@ -905,6 +1017,10 @@ class APIKeys(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.DeleteKeysGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -973,6 +1089,8 @@ class APIKeys(BaseSDK): self, *, hash: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -980,9 +1098,14 @@ class APIKeys(BaseSDK): ) -> operations.GetKeyResponse: r"""Get a single API key - Get a single API key by hash. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Get a single API key by hash. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param hash: The hash identifier of the API key to retrieve + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -999,6 +1122,8 @@ class APIKeys(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.GetKeyRequest( + http_referer=http_referer, + x_title=x_title, hash=hash, ) @@ -1014,6 +1139,10 @@ class APIKeys(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.GetKeyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -1082,6 +1211,8 @@ class APIKeys(BaseSDK): self, *, hash: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -1089,9 +1220,14 @@ class APIKeys(BaseSDK): ) -> operations.GetKeyResponse: r"""Get a single API key - Get a single API key by hash. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Get a single API key by hash. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param hash: The hash identifier of the API key to retrieve + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -1108,6 +1244,8 @@ class APIKeys(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.GetKeyRequest( + http_referer=http_referer, + x_title=x_title, hash=hash, ) @@ -1123,6 +1261,10 @@ class APIKeys(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.GetKeyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -1190,6 +1332,8 @@ class APIKeys(BaseSDK): def get_current_key_metadata( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -1199,6 +1343,11 @@ class APIKeys(BaseSDK): Get information on the API key associated with the current authentication session + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -1213,18 +1362,28 @@ class APIKeys(BaseSDK): base_url = server_url else: base_url = self._get_url(base_url, url_variables) + + request = operations.GetCurrentKeyRequest( + http_referer=http_referer, + x_title=x_title, + ) + req = self._build_request( method="GET", path="/key", base_url=base_url, url_variables=url_variables, - request=None, + request=request, request_body_required=False, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.GetCurrentKeyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -1282,6 +1441,8 @@ class APIKeys(BaseSDK): async def get_current_key_metadata_async( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -1291,6 +1452,11 @@ class APIKeys(BaseSDK): Get information on the API key associated with the current authentication session + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -1305,18 +1471,28 @@ class APIKeys(BaseSDK): base_url = server_url else: base_url = self._get_url(base_url, url_variables) + + request = operations.GetCurrentKeyRequest( + http_referer=http_referer, + x_title=x_title, + ) + req = self._build_request_async( method="GET", path="/key", base_url=base_url, url_variables=url_variables, - request=None, + request=request, request_body_required=False, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.GetCurrentKeyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, diff --git a/src/openrouter/chat.py b/src/openrouter/chat.py index d75dbd2..027d898 100644 --- a/src/openrouter/chat.py +++ b/src/openrouter/chat.py @@ -21,17 +21,13 @@ class Chat(BaseSDK): self, *, messages: Union[List[components.Message], List[components.MessageTypedDict]], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, provider: OptionalNullable[ - Union[ - components.ChatGenerationParamsProvider, - components.ChatGenerationParamsProviderTypedDict, - ] + Union[components.Schema0, components.Schema0TypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.ChatGenerationParamsPluginUnion], - List[components.ChatGenerationParamsPluginUnionTypedDict], - ] + Union[List[components.Schema17], List[components.Schema17TypedDict]] ] = None, route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, @@ -50,17 +46,11 @@ class Chat(BaseSDK): Union[components.Reasoning, components.ReasoningTypedDict] ] = None, response_format: Optional[ - Union[ - components.ChatGenerationParamsResponseFormatUnion, - components.ChatGenerationParamsResponseFormatUnionTypedDict, - ] + Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, seed: OptionalNullable[int] = UNSET, stop: OptionalNullable[ - Union[ - components.ChatGenerationParamsStop, - components.ChatGenerationParamsStopTypedDict, - ] + Union[components.Stop, components.StopTypedDict] ] = UNSET, stream: Union[Literal[False], None] = None, stream_options: OptionalNullable[ @@ -93,11 +83,16 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. :param messages: - :param provider: When multiple model providers are available, optionally indicate your routing preference. - :param plugins: Plugins you want to enable for this request, including their settings. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param provider: + :param plugins: :param route: :param user: - :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param session_id: :param model: :param models: :param frequency_penalty: @@ -133,17 +128,13 @@ class Chat(BaseSDK): self, *, messages: Union[List[components.Message], List[components.MessageTypedDict]], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, provider: OptionalNullable[ - Union[ - components.ChatGenerationParamsProvider, - components.ChatGenerationParamsProviderTypedDict, - ] + Union[components.Schema0, components.Schema0TypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.ChatGenerationParamsPluginUnion], - List[components.ChatGenerationParamsPluginUnionTypedDict], - ] + Union[List[components.Schema17], List[components.Schema17TypedDict]] ] = None, route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, @@ -162,17 +153,11 @@ class Chat(BaseSDK): Union[components.Reasoning, components.ReasoningTypedDict] ] = None, response_format: Optional[ - Union[ - components.ChatGenerationParamsResponseFormatUnion, - components.ChatGenerationParamsResponseFormatUnionTypedDict, - ] + Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, seed: OptionalNullable[int] = UNSET, stop: OptionalNullable[ - Union[ - components.ChatGenerationParamsStop, - components.ChatGenerationParamsStopTypedDict, - ] + Union[components.Stop, components.StopTypedDict] ] = UNSET, stream: Literal[True], stream_options: OptionalNullable[ @@ -205,11 +190,16 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. :param messages: - :param provider: When multiple model providers are available, optionally indicate your routing preference. - :param plugins: Plugins you want to enable for this request, including their settings. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param provider: + :param plugins: :param route: :param user: - :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param session_id: :param model: :param models: :param frequency_penalty: @@ -244,17 +234,13 @@ class Chat(BaseSDK): self, *, messages: Union[List[components.Message], List[components.MessageTypedDict]], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, provider: OptionalNullable[ - Union[ - components.ChatGenerationParamsProvider, - components.ChatGenerationParamsProviderTypedDict, - ] + Union[components.Schema0, components.Schema0TypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.ChatGenerationParamsPluginUnion], - List[components.ChatGenerationParamsPluginUnionTypedDict], - ] + Union[List[components.Schema17], List[components.Schema17TypedDict]] ] = None, route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, @@ -273,17 +259,11 @@ class Chat(BaseSDK): Union[components.Reasoning, components.ReasoningTypedDict] ] = None, response_format: Optional[ - Union[ - components.ChatGenerationParamsResponseFormatUnion, - components.ChatGenerationParamsResponseFormatUnionTypedDict, - ] + Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, seed: OptionalNullable[int] = UNSET, stop: OptionalNullable[ - Union[ - components.ChatGenerationParamsStop, - components.ChatGenerationParamsStopTypedDict, - ] + Union[components.Stop, components.StopTypedDict] ] = UNSET, stream: Optional[bool] = False, stream_options: OptionalNullable[ @@ -316,11 +296,16 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. :param messages: - :param provider: When multiple model providers are available, optionally indicate your routing preference. - :param plugins: Plugins you want to enable for this request, including their settings. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param provider: + :param plugins: :param route: :param user: - :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param session_id: :param model: :param models: :param frequency_penalty: @@ -360,49 +345,52 @@ class Chat(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = components.ChatGenerationParams( - provider=utils.get_pydantic_model( - provider, OptionalNullable[components.ChatGenerationParamsProvider] + request = operations.SendChatCompletionRequestRequest( + http_referer=http_referer, + x_title=x_title, + chat_generation_params=components.ChatGenerationParams( + provider=utils.get_pydantic_model( + provider, OptionalNullable[components.Schema0] + ), + plugins=utils.get_pydantic_model( + plugins, Optional[List[components.Schema17]] + ), + route=route, + user=user, + session_id=session_id, + messages=utils.get_pydantic_model(messages, List[components.Message]), + model=model, + models=models, + frequency_penalty=frequency_penalty, + logit_bias=logit_bias, + logprobs=logprobs, + top_logprobs=top_logprobs, + max_completion_tokens=max_completion_tokens, + max_tokens=max_tokens, + metadata=metadata, + presence_penalty=presence_penalty, + reasoning=utils.get_pydantic_model( + reasoning, Optional[components.Reasoning] + ), + response_format=utils.get_pydantic_model( + response_format, Optional[components.ResponseFormat] + ), + seed=seed, + stop=stop, + stream=stream, + stream_options=utils.get_pydantic_model( + stream_options, OptionalNullable[components.ChatStreamOptions] + ), + temperature=temperature, + tool_choice=tool_choice, + tools=utils.get_pydantic_model( + tools, Optional[List[components.ToolDefinitionJSON]] + ), + top_p=top_p, + debug=utils.get_pydantic_model(debug, Optional[components.Debug]), + image_config=image_config, + modalities=modalities, ), - plugins=utils.get_pydantic_model( - plugins, Optional[List[components.ChatGenerationParamsPluginUnion]] - ), - route=route, - user=user, - session_id=session_id, - messages=utils.get_pydantic_model(messages, List[components.Message]), - model=model, - models=models, - frequency_penalty=frequency_penalty, - logit_bias=logit_bias, - logprobs=logprobs, - top_logprobs=top_logprobs, - max_completion_tokens=max_completion_tokens, - max_tokens=max_tokens, - metadata=metadata, - presence_penalty=presence_penalty, - reasoning=utils.get_pydantic_model( - reasoning, Optional[components.Reasoning] - ), - response_format=utils.get_pydantic_model( - response_format, - Optional[components.ChatGenerationParamsResponseFormatUnion], - ), - seed=seed, - stop=stop, - stream=stream, - stream_options=utils.get_pydantic_model( - stream_options, OptionalNullable[components.ChatStreamOptions] - ), - temperature=temperature, - tool_choice=tool_choice, - tools=utils.get_pydantic_model( - tools, Optional[List[components.ToolDefinitionJSON]] - ), - top_p=top_p, - debug=utils.get_pydantic_model(debug, Optional[components.Debug]), - image_config=image_config, - modalities=modalities, ) req = self._build_request( @@ -417,9 +405,17 @@ class Chat(BaseSDK): user_agent_header="user-agent", accept_header_value="text/event-stream" if stream else "application/json", http_headers=http_headers, + _globals=operations.SendChatCompletionRequestGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", components.ChatGenerationParams + request.chat_generation_params, + False, + False, + "json", + components.ChatGenerationParams, ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -497,17 +493,13 @@ class Chat(BaseSDK): self, *, messages: Union[List[components.Message], List[components.MessageTypedDict]], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, provider: OptionalNullable[ - Union[ - components.ChatGenerationParamsProvider, - components.ChatGenerationParamsProviderTypedDict, - ] + Union[components.Schema0, components.Schema0TypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.ChatGenerationParamsPluginUnion], - List[components.ChatGenerationParamsPluginUnionTypedDict], - ] + Union[List[components.Schema17], List[components.Schema17TypedDict]] ] = None, route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, @@ -526,17 +518,11 @@ class Chat(BaseSDK): Union[components.Reasoning, components.ReasoningTypedDict] ] = None, response_format: Optional[ - Union[ - components.ChatGenerationParamsResponseFormatUnion, - components.ChatGenerationParamsResponseFormatUnionTypedDict, - ] + Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, seed: OptionalNullable[int] = UNSET, stop: OptionalNullable[ - Union[ - components.ChatGenerationParamsStop, - components.ChatGenerationParamsStopTypedDict, - ] + Union[components.Stop, components.StopTypedDict] ] = UNSET, stream: Union[Literal[False], None] = None, stream_options: OptionalNullable[ @@ -569,11 +555,16 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. :param messages: - :param provider: When multiple model providers are available, optionally indicate your routing preference. - :param plugins: Plugins you want to enable for this request, including their settings. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param provider: + :param plugins: :param route: :param user: - :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param session_id: :param model: :param models: :param frequency_penalty: @@ -609,17 +600,13 @@ class Chat(BaseSDK): self, *, messages: Union[List[components.Message], List[components.MessageTypedDict]], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, provider: OptionalNullable[ - Union[ - components.ChatGenerationParamsProvider, - components.ChatGenerationParamsProviderTypedDict, - ] + Union[components.Schema0, components.Schema0TypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.ChatGenerationParamsPluginUnion], - List[components.ChatGenerationParamsPluginUnionTypedDict], - ] + Union[List[components.Schema17], List[components.Schema17TypedDict]] ] = None, route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, @@ -638,17 +625,11 @@ class Chat(BaseSDK): Union[components.Reasoning, components.ReasoningTypedDict] ] = None, response_format: Optional[ - Union[ - components.ChatGenerationParamsResponseFormatUnion, - components.ChatGenerationParamsResponseFormatUnionTypedDict, - ] + Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, seed: OptionalNullable[int] = UNSET, stop: OptionalNullable[ - Union[ - components.ChatGenerationParamsStop, - components.ChatGenerationParamsStopTypedDict, - ] + Union[components.Stop, components.StopTypedDict] ] = UNSET, stream: Literal[True], stream_options: OptionalNullable[ @@ -681,11 +662,16 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. :param messages: - :param provider: When multiple model providers are available, optionally indicate your routing preference. - :param plugins: Plugins you want to enable for this request, including their settings. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param provider: + :param plugins: :param route: :param user: - :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param session_id: :param model: :param models: :param frequency_penalty: @@ -720,17 +706,13 @@ class Chat(BaseSDK): self, *, messages: Union[List[components.Message], List[components.MessageTypedDict]], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, provider: OptionalNullable[ - Union[ - components.ChatGenerationParamsProvider, - components.ChatGenerationParamsProviderTypedDict, - ] + Union[components.Schema0, components.Schema0TypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.ChatGenerationParamsPluginUnion], - List[components.ChatGenerationParamsPluginUnionTypedDict], - ] + Union[List[components.Schema17], List[components.Schema17TypedDict]] ] = None, route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, @@ -749,17 +731,11 @@ class Chat(BaseSDK): Union[components.Reasoning, components.ReasoningTypedDict] ] = None, response_format: Optional[ - Union[ - components.ChatGenerationParamsResponseFormatUnion, - components.ChatGenerationParamsResponseFormatUnionTypedDict, - ] + Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, seed: OptionalNullable[int] = UNSET, stop: OptionalNullable[ - Union[ - components.ChatGenerationParamsStop, - components.ChatGenerationParamsStopTypedDict, - ] + Union[components.Stop, components.StopTypedDict] ] = UNSET, stream: Optional[bool] = False, stream_options: OptionalNullable[ @@ -792,11 +768,16 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. :param messages: - :param provider: When multiple model providers are available, optionally indicate your routing preference. - :param plugins: Plugins you want to enable for this request, including their settings. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param provider: + :param plugins: :param route: :param user: - :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param session_id: :param model: :param models: :param frequency_penalty: @@ -836,49 +817,52 @@ class Chat(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = components.ChatGenerationParams( - provider=utils.get_pydantic_model( - provider, OptionalNullable[components.ChatGenerationParamsProvider] + request = operations.SendChatCompletionRequestRequest( + http_referer=http_referer, + x_title=x_title, + chat_generation_params=components.ChatGenerationParams( + provider=utils.get_pydantic_model( + provider, OptionalNullable[components.Schema0] + ), + plugins=utils.get_pydantic_model( + plugins, Optional[List[components.Schema17]] + ), + route=route, + user=user, + session_id=session_id, + messages=utils.get_pydantic_model(messages, List[components.Message]), + model=model, + models=models, + frequency_penalty=frequency_penalty, + logit_bias=logit_bias, + logprobs=logprobs, + top_logprobs=top_logprobs, + max_completion_tokens=max_completion_tokens, + max_tokens=max_tokens, + metadata=metadata, + presence_penalty=presence_penalty, + reasoning=utils.get_pydantic_model( + reasoning, Optional[components.Reasoning] + ), + response_format=utils.get_pydantic_model( + response_format, Optional[components.ResponseFormat] + ), + seed=seed, + stop=stop, + stream=stream, + stream_options=utils.get_pydantic_model( + stream_options, OptionalNullable[components.ChatStreamOptions] + ), + temperature=temperature, + tool_choice=tool_choice, + tools=utils.get_pydantic_model( + tools, Optional[List[components.ToolDefinitionJSON]] + ), + top_p=top_p, + debug=utils.get_pydantic_model(debug, Optional[components.Debug]), + image_config=image_config, + modalities=modalities, ), - plugins=utils.get_pydantic_model( - plugins, Optional[List[components.ChatGenerationParamsPluginUnion]] - ), - route=route, - user=user, - session_id=session_id, - messages=utils.get_pydantic_model(messages, List[components.Message]), - model=model, - models=models, - frequency_penalty=frequency_penalty, - logit_bias=logit_bias, - logprobs=logprobs, - top_logprobs=top_logprobs, - max_completion_tokens=max_completion_tokens, - max_tokens=max_tokens, - metadata=metadata, - presence_penalty=presence_penalty, - reasoning=utils.get_pydantic_model( - reasoning, Optional[components.Reasoning] - ), - response_format=utils.get_pydantic_model( - response_format, - Optional[components.ChatGenerationParamsResponseFormatUnion], - ), - seed=seed, - stop=stop, - stream=stream, - stream_options=utils.get_pydantic_model( - stream_options, OptionalNullable[components.ChatStreamOptions] - ), - temperature=temperature, - tool_choice=tool_choice, - tools=utils.get_pydantic_model( - tools, Optional[List[components.ToolDefinitionJSON]] - ), - top_p=top_p, - debug=utils.get_pydantic_model(debug, Optional[components.Debug]), - image_config=image_config, - modalities=modalities, ) req = self._build_request_async( @@ -893,9 +877,17 @@ class Chat(BaseSDK): user_agent_header="user-agent", accept_header_value="text/event-stream" if stream else "application/json", http_headers=http_headers, + _globals=operations.SendChatCompletionRequestGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", components.ChatGenerationParams + request.chat_generation_params, + False, + False, + "json", + components.ChatGenerationParams, ), allow_empty_value=None, timeout_ms=timeout_ms, diff --git a/src/openrouter/completions.py b/src/openrouter/completions.py deleted file mode 100644 index 26bbf6a..0000000 --- a/src/openrouter/completions.py +++ /dev/null @@ -1,361 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from .basesdk import BaseSDK -from openrouter import components, errors, utils -from openrouter._hooks import HookContext -from openrouter.types import OptionalNullable, UNSET -from openrouter.utils import get_security_from_env -from openrouter.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Dict, List, Mapping, Optional, Union - - -class Completions(BaseSDK): - def generate( - self, - *, - prompt: Union[components.Prompt, components.PromptTypedDict], - model: Optional[str] = None, - models: Optional[List[str]] = None, - best_of: OptionalNullable[int] = UNSET, - echo: OptionalNullable[bool] = UNSET, - frequency_penalty: OptionalNullable[float] = UNSET, - logit_bias: OptionalNullable[Dict[str, float]] = UNSET, - logprobs: OptionalNullable[int] = UNSET, - max_tokens: OptionalNullable[int] = UNSET, - n: OptionalNullable[int] = UNSET, - presence_penalty: OptionalNullable[float] = UNSET, - seed: OptionalNullable[int] = UNSET, - stop: OptionalNullable[ - Union[ - components.CompletionCreateParamsStop, - components.CompletionCreateParamsStopTypedDict, - ] - ] = UNSET, - stream: Optional[bool] = False, - stream_options: OptionalNullable[ - Union[components.StreamOptions, components.StreamOptionsTypedDict] - ] = UNSET, - suffix: OptionalNullable[str] = UNSET, - temperature: OptionalNullable[float] = UNSET, - top_p: OptionalNullable[float] = UNSET, - user: Optional[str] = None, - metadata: OptionalNullable[Dict[str, str]] = UNSET, - response_format: OptionalNullable[ - Union[ - components.CompletionCreateParamsResponseFormatUnion, - components.CompletionCreateParamsResponseFormatUnionTypedDict, - ] - ] = UNSET, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> components.CompletionResponse: - r"""Create a completion - - Creates a completion for the provided prompt and parameters. Supports both streaming and non-streaming modes. - - :param prompt: - :param model: - :param models: - :param best_of: - :param echo: - :param frequency_penalty: - :param logit_bias: - :param logprobs: - :param max_tokens: - :param n: - :param presence_penalty: - :param seed: - :param stop: - :param stream: - :param stream_options: - :param suffix: - :param temperature: - :param top_p: - :param user: - :param metadata: - :param response_format: - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = components.CompletionCreateParams( - model=model, - models=models, - prompt=prompt, - best_of=best_of, - echo=echo, - frequency_penalty=frequency_penalty, - logit_bias=logit_bias, - logprobs=logprobs, - max_tokens=max_tokens, - n=n, - presence_penalty=presence_penalty, - seed=seed, - stop=stop, - stream=stream, - stream_options=utils.get_pydantic_model( - stream_options, OptionalNullable[components.StreamOptions] - ), - suffix=suffix, - temperature=temperature, - top_p=top_p, - user=user, - metadata=metadata, - response_format=utils.get_pydantic_model( - response_format, - OptionalNullable[components.CompletionCreateParamsResponseFormatUnion], - ), - ) - - req = self._build_request( - method="POST", - path="/completions", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", components.CompletionCreateParams - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = self.do_request( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="createCompletions", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, components.Security - ), - ), - request=req, - error_status_codes=["400", "401", "429", "4XX", "500", "5XX"], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(components.CompletionResponse, http_res) - if utils.match_response(http_res, ["400", "401", "429"], "application/json"): - response_data = unmarshal_json_response(errors.ChatErrorData, http_res) - raise errors.ChatError(response_data, http_res) - if utils.match_response(http_res, "500", "application/json"): - response_data = unmarshal_json_response(errors.ChatErrorData, http_res) - raise errors.ChatError(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.OpenRouterDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.OpenRouterDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.OpenRouterDefaultError("Unexpected response received", http_res) - - async def generate_async( - self, - *, - prompt: Union[components.Prompt, components.PromptTypedDict], - model: Optional[str] = None, - models: Optional[List[str]] = None, - best_of: OptionalNullable[int] = UNSET, - echo: OptionalNullable[bool] = UNSET, - frequency_penalty: OptionalNullable[float] = UNSET, - logit_bias: OptionalNullable[Dict[str, float]] = UNSET, - logprobs: OptionalNullable[int] = UNSET, - max_tokens: OptionalNullable[int] = UNSET, - n: OptionalNullable[int] = UNSET, - presence_penalty: OptionalNullable[float] = UNSET, - seed: OptionalNullable[int] = UNSET, - stop: OptionalNullable[ - Union[ - components.CompletionCreateParamsStop, - components.CompletionCreateParamsStopTypedDict, - ] - ] = UNSET, - stream: Optional[bool] = False, - stream_options: OptionalNullable[ - Union[components.StreamOptions, components.StreamOptionsTypedDict] - ] = UNSET, - suffix: OptionalNullable[str] = UNSET, - temperature: OptionalNullable[float] = UNSET, - top_p: OptionalNullable[float] = UNSET, - user: Optional[str] = None, - metadata: OptionalNullable[Dict[str, str]] = UNSET, - response_format: OptionalNullable[ - Union[ - components.CompletionCreateParamsResponseFormatUnion, - components.CompletionCreateParamsResponseFormatUnionTypedDict, - ] - ] = UNSET, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> components.CompletionResponse: - r"""Create a completion - - Creates a completion for the provided prompt and parameters. Supports both streaming and non-streaming modes. - - :param prompt: - :param model: - :param models: - :param best_of: - :param echo: - :param frequency_penalty: - :param logit_bias: - :param logprobs: - :param max_tokens: - :param n: - :param presence_penalty: - :param seed: - :param stop: - :param stream: - :param stream_options: - :param suffix: - :param temperature: - :param top_p: - :param user: - :param metadata: - :param response_format: - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = components.CompletionCreateParams( - model=model, - models=models, - prompt=prompt, - best_of=best_of, - echo=echo, - frequency_penalty=frequency_penalty, - logit_bias=logit_bias, - logprobs=logprobs, - max_tokens=max_tokens, - n=n, - presence_penalty=presence_penalty, - seed=seed, - stop=stop, - stream=stream, - stream_options=utils.get_pydantic_model( - stream_options, OptionalNullable[components.StreamOptions] - ), - suffix=suffix, - temperature=temperature, - top_p=top_p, - user=user, - metadata=metadata, - response_format=utils.get_pydantic_model( - response_format, - OptionalNullable[components.CompletionCreateParamsResponseFormatUnion], - ), - ) - - req = self._build_request_async( - method="POST", - path="/completions", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", components.CompletionCreateParams - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = await self.do_request_async( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="createCompletions", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, components.Security - ), - ), - request=req, - error_status_codes=["400", "401", "429", "4XX", "500", "5XX"], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(components.CompletionResponse, http_res) - if utils.match_response(http_res, ["400", "401", "429"], "application/json"): - response_data = unmarshal_json_response(errors.ChatErrorData, http_res) - raise errors.ChatError(response_data, http_res) - if utils.match_response(http_res, "500", "application/json"): - response_data = unmarshal_json_response(errors.ChatErrorData, http_res) - raise errors.ChatError(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.OpenRouterDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.OpenRouterDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.OpenRouterDefaultError("Unexpected response received", http_res) diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 94e838c..4dba5f4 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -6,18 +6,45 @@ import builtins import sys if TYPE_CHECKING: - from ._schema0 import Schema0, Schema0Enum, Schema0TypedDict - from ._schema2 import ( - Schema2, - Schema2ReasoningEncrypted, - Schema2ReasoningEncryptedTypedDict, - Schema2ReasoningSummary, - Schema2ReasoningSummaryTypedDict, - Schema2ReasoningText, - Schema2ReasoningTextTypedDict, - Schema2TypedDict, - Schema4, + from ._schema10 import ( + Completion, + CompletionTypedDict, + Prompt, + PromptTypedDict, + Schema10, + Schema10TypedDict, ) + from ._schema14 import Schema14, Schema14TypedDict + from ._schema17 import ( + Engine, + Pdf, + PdfEngine, + PdfTypedDict, + Schema17, + Schema17AutoRouter, + Schema17AutoRouterTypedDict, + Schema17FileParser, + Schema17FileParserTypedDict, + Schema17Moderation, + Schema17ModerationTypedDict, + Schema17ResponseHealing, + Schema17ResponseHealingTypedDict, + Schema17TypedDict, + Schema17Web, + Schema17WebTypedDict, + ) + from ._schema19 import ( + Schema19, + Schema19ReasoningEncrypted, + Schema19ReasoningEncryptedTypedDict, + Schema19ReasoningSummary, + Schema19ReasoningSummaryTypedDict, + Schema19ReasoningText, + Schema19ReasoningTextTypedDict, + Schema19TypedDict, + Schema21, + ) + from ._schema5 import Schema5, Schema5Enum, Schema5TypedDict from .activityitem import ActivityItem, ActivityItemTypedDict from .assistantmessage import ( AssistantMessage, @@ -41,56 +68,34 @@ if TYPE_CHECKING: from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict from .chatgenerationparams import ( ChatGenerationParams, - ChatGenerationParamsDataCollection, ChatGenerationParamsImageConfig, ChatGenerationParamsImageConfigTypedDict, - ChatGenerationParamsMaxPrice, - ChatGenerationParamsMaxPriceTypedDict, - ChatGenerationParamsPluginAutoRouter, - ChatGenerationParamsPluginAutoRouterTypedDict, - ChatGenerationParamsPluginFileParser, - ChatGenerationParamsPluginFileParserTypedDict, - ChatGenerationParamsPluginModeration, - ChatGenerationParamsPluginModerationTypedDict, - ChatGenerationParamsPluginResponseHealing, - ChatGenerationParamsPluginResponseHealingTypedDict, - ChatGenerationParamsPluginUnion, - ChatGenerationParamsPluginUnionTypedDict, - ChatGenerationParamsPluginWeb, - ChatGenerationParamsPluginWebTypedDict, - ChatGenerationParamsPreferredMaxLatency, - ChatGenerationParamsPreferredMaxLatencyTypedDict, - ChatGenerationParamsPreferredMaxLatencyUnion, - ChatGenerationParamsPreferredMaxLatencyUnionTypedDict, - ChatGenerationParamsPreferredMinThroughput, - ChatGenerationParamsPreferredMinThroughputTypedDict, - ChatGenerationParamsPreferredMinThroughputUnion, - ChatGenerationParamsPreferredMinThroughputUnionTypedDict, - ChatGenerationParamsProvider, - ChatGenerationParamsProviderTypedDict, - ChatGenerationParamsResponseFormatJSONObject, - ChatGenerationParamsResponseFormatJSONObjectTypedDict, - ChatGenerationParamsResponseFormatPython, - ChatGenerationParamsResponseFormatPythonTypedDict, - ChatGenerationParamsResponseFormatText, - ChatGenerationParamsResponseFormatTextTypedDict, - ChatGenerationParamsResponseFormatUnion, - ChatGenerationParamsResponseFormatUnionTypedDict, - ChatGenerationParamsStop, - ChatGenerationParamsStopTypedDict, ChatGenerationParamsTypedDict, Debug, DebugTypedDict, Effort, - Engine, Modality, - Pdf, - PdfEngine, - PdfTypedDict, - Quantizations, Reasoning, ReasoningTypedDict, + ResponseFormat, + ResponseFormatJSONObject, + ResponseFormatJSONObjectTypedDict, + ResponseFormatPython, + ResponseFormatPythonTypedDict, + ResponseFormatText, + ResponseFormatTextTypedDict, + ResponseFormatTypedDict, Route, + Schema0, + Schema0TypedDict, + Schema15, + Schema15TypedDict, + Schema15Union, + Schema15UnionTypedDict, + Schema3, + Schema8, + Stop, + StopTypedDict, ) from .chatgenerationtokenusage import ( ChatGenerationTokenUsage, @@ -177,32 +182,6 @@ if TYPE_CHECKING: ChatStreamingResponseChunkTypedDict, ) from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict - from .completionchoice import ( - CompletionChoice, - CompletionChoiceTypedDict, - CompletionFinishReason, - ) - from .completioncreateparams import ( - CompletionCreateParams, - CompletionCreateParamsResponseFormatJSONObject, - CompletionCreateParamsResponseFormatJSONObjectTypedDict, - CompletionCreateParamsResponseFormatPython, - CompletionCreateParamsResponseFormatPythonTypedDict, - CompletionCreateParamsResponseFormatText, - CompletionCreateParamsResponseFormatTextTypedDict, - CompletionCreateParamsResponseFormatUnion, - CompletionCreateParamsResponseFormatUnionTypedDict, - CompletionCreateParamsStop, - CompletionCreateParamsStopTypedDict, - CompletionCreateParamsTypedDict, - Prompt, - PromptTypedDict, - StreamOptions, - StreamOptionsTypedDict, - ) - from .completionlogprobs import CompletionLogprobs, CompletionLogprobsTypedDict - from .completionresponse import CompletionResponse, CompletionResponseTypedDict - from .completionusage import CompletionUsage, CompletionUsageTypedDict from .createchargerequest import ( ChainID, CreateChargeRequest, @@ -210,6 +189,12 @@ if TYPE_CHECKING: ) from .datacollection import DataCollection from .defaultparameters import DefaultParameters, DefaultParametersTypedDict + from .developermessage import ( + DeveloperMessage, + DeveloperMessageContent, + DeveloperMessageContentTypedDict, + DeveloperMessageTypedDict, + ) from .edgenetworktimeoutresponseerrordata import ( EdgeNetworkTimeoutResponseErrorData, EdgeNetworkTimeoutResponseErrorDataTypedDict, @@ -236,14 +221,7 @@ if TYPE_CHECKING: ListEndpointsResponseTypedDict, Tokenizer, ) - from .message import ( - Message, - MessageContent, - MessageContentTypedDict, - MessageDeveloper, - MessageDeveloperTypedDict, - MessageTypedDict, - ) + from .message import Message, MessageTypedDict from .model import Model, ModelTypedDict from .modelarchitecture import ( ModelArchitecture, @@ -495,20 +473,6 @@ if TYPE_CHECKING: OpenResponsesRequestOnlyTypedDict, OpenResponsesRequestOrder, OpenResponsesRequestOrderTypedDict, - OpenResponsesRequestPluginAutoRouter, - OpenResponsesRequestPluginAutoRouterTypedDict, - OpenResponsesRequestPluginFileParser, - OpenResponsesRequestPluginFileParserTypedDict, - OpenResponsesRequestPluginModeration, - OpenResponsesRequestPluginModerationTypedDict, - OpenResponsesRequestPluginResponseHealing, - OpenResponsesRequestPluginResponseHealingTypedDict, - OpenResponsesRequestPluginUnion, - OpenResponsesRequestPluginUnionTypedDict, - OpenResponsesRequestPluginWeb, - OpenResponsesRequestPluginWebTypedDict, - OpenResponsesRequestProvider, - OpenResponsesRequestProviderTypedDict, OpenResponsesRequestSort, OpenResponsesRequestSortTypedDict, OpenResponsesRequestToolFunction, @@ -517,6 +481,20 @@ if TYPE_CHECKING: OpenResponsesRequestToolUnionTypedDict, OpenResponsesRequestType, OpenResponsesRequestTypedDict, + Plugin, + PluginAutoRouter, + PluginAutoRouterTypedDict, + PluginFileParser, + PluginFileParserTypedDict, + PluginModeration, + PluginModerationTypedDict, + PluginResponseHealing, + PluginResponseHealingTypedDict, + PluginTypedDict, + PluginWeb, + PluginWebTypedDict, + Provider, + ProviderTypedDict, ServiceTier, Truncation, ) @@ -929,43 +907,8 @@ __all__ = [ "ChatErrorError", "ChatErrorErrorTypedDict", "ChatGenerationParams", - "ChatGenerationParamsDataCollection", "ChatGenerationParamsImageConfig", "ChatGenerationParamsImageConfigTypedDict", - "ChatGenerationParamsMaxPrice", - "ChatGenerationParamsMaxPriceTypedDict", - "ChatGenerationParamsPluginAutoRouter", - "ChatGenerationParamsPluginAutoRouterTypedDict", - "ChatGenerationParamsPluginFileParser", - "ChatGenerationParamsPluginFileParserTypedDict", - "ChatGenerationParamsPluginModeration", - "ChatGenerationParamsPluginModerationTypedDict", - "ChatGenerationParamsPluginResponseHealing", - "ChatGenerationParamsPluginResponseHealingTypedDict", - "ChatGenerationParamsPluginUnion", - "ChatGenerationParamsPluginUnionTypedDict", - "ChatGenerationParamsPluginWeb", - "ChatGenerationParamsPluginWebTypedDict", - "ChatGenerationParamsPreferredMaxLatency", - "ChatGenerationParamsPreferredMaxLatencyTypedDict", - "ChatGenerationParamsPreferredMaxLatencyUnion", - "ChatGenerationParamsPreferredMaxLatencyUnionTypedDict", - "ChatGenerationParamsPreferredMinThroughput", - "ChatGenerationParamsPreferredMinThroughputTypedDict", - "ChatGenerationParamsPreferredMinThroughputUnion", - "ChatGenerationParamsPreferredMinThroughputUnionTypedDict", - "ChatGenerationParamsProvider", - "ChatGenerationParamsProviderTypedDict", - "ChatGenerationParamsResponseFormatJSONObject", - "ChatGenerationParamsResponseFormatJSONObjectTypedDict", - "ChatGenerationParamsResponseFormatPython", - "ChatGenerationParamsResponseFormatPythonTypedDict", - "ChatGenerationParamsResponseFormatText", - "ChatGenerationParamsResponseFormatTextTypedDict", - "ChatGenerationParamsResponseFormatUnion", - "ChatGenerationParamsResponseFormatUnionTypedDict", - "ChatGenerationParamsStop", - "ChatGenerationParamsStopTypedDict", "ChatGenerationParamsTypedDict", "ChatGenerationTokenUsage", "ChatGenerationTokenUsageTypedDict", @@ -1024,29 +967,10 @@ __all__ = [ "Code", "CodeEnum", "CodeTypedDict", - "CompletionChoice", - "CompletionChoiceTypedDict", - "CompletionCreateParams", - "CompletionCreateParamsResponseFormatJSONObject", - "CompletionCreateParamsResponseFormatJSONObjectTypedDict", - "CompletionCreateParamsResponseFormatPython", - "CompletionCreateParamsResponseFormatPythonTypedDict", - "CompletionCreateParamsResponseFormatText", - "CompletionCreateParamsResponseFormatTextTypedDict", - "CompletionCreateParamsResponseFormatUnion", - "CompletionCreateParamsResponseFormatUnionTypedDict", - "CompletionCreateParamsStop", - "CompletionCreateParamsStopTypedDict", - "CompletionCreateParamsTypedDict", - "CompletionFinishReason", - "CompletionLogprobs", - "CompletionLogprobsTypedDict", - "CompletionResponse", - "CompletionResponseTypedDict", + "Completion", "CompletionTokensDetails", "CompletionTokensDetailsTypedDict", - "CompletionUsage", - "CompletionUsageTypedDict", + "CompletionTypedDict", "CostDetails", "CostDetailsTypedDict", "CreateChargeRequest", @@ -1056,6 +980,10 @@ __all__ = [ "DebugTypedDict", "DefaultParameters", "DefaultParametersTypedDict", + "DeveloperMessage", + "DeveloperMessageContent", + "DeveloperMessageContentTypedDict", + "DeveloperMessageTypedDict", "EdgeNetworkTimeoutResponseErrorData", "EdgeNetworkTimeoutResponseErrorDataTypedDict", "Effort", @@ -1090,10 +1018,6 @@ __all__ = [ "Logprob", "LogprobTypedDict", "Message", - "MessageContent", - "MessageContentTypedDict", - "MessageDeveloper", - "MessageDeveloperTypedDict", "MessageTypedDict", "Modality", "Model", @@ -1278,20 +1202,6 @@ __all__ = [ "OpenResponsesRequestOnlyTypedDict", "OpenResponsesRequestOrder", "OpenResponsesRequestOrderTypedDict", - "OpenResponsesRequestPluginAutoRouter", - "OpenResponsesRequestPluginAutoRouterTypedDict", - "OpenResponsesRequestPluginFileParser", - "OpenResponsesRequestPluginFileParserTypedDict", - "OpenResponsesRequestPluginModeration", - "OpenResponsesRequestPluginModerationTypedDict", - "OpenResponsesRequestPluginResponseHealing", - "OpenResponsesRequestPluginResponseHealingTypedDict", - "OpenResponsesRequestPluginUnion", - "OpenResponsesRequestPluginUnionTypedDict", - "OpenResponsesRequestPluginWeb", - "OpenResponsesRequestPluginWebTypedDict", - "OpenResponsesRequestProvider", - "OpenResponsesRequestProviderTypedDict", "OpenResponsesRequestSort", "OpenResponsesRequestSortTypedDict", "OpenResponsesRequestToolFunction", @@ -1400,6 +1310,18 @@ __all__ = [ "PercentileStatsTypedDict", "PercentileThroughputCutoffs", "PercentileThroughputCutoffsTypedDict", + "Plugin", + "PluginAutoRouter", + "PluginAutoRouterTypedDict", + "PluginFileParser", + "PluginFileParserTypedDict", + "PluginModeration", + "PluginModerationTypedDict", + "PluginResponseHealing", + "PluginResponseHealingTypedDict", + "PluginTypedDict", + "PluginWeb", + "PluginWebTypedDict", "PreferredMaxLatency", "PreferredMaxLatencyTypedDict", "PreferredMinThroughput", @@ -1410,6 +1332,7 @@ __all__ = [ "PromptTokensDetails", "PromptTokensDetailsTypedDict", "PromptTypedDict", + "Provider", "ProviderName", "ProviderOverloadedResponseErrorData", "ProviderOverloadedResponseErrorDataTypedDict", @@ -1437,13 +1360,13 @@ __all__ = [ "ProviderSortConfigUnionTypedDict", "ProviderSortUnion", "ProviderSortUnionTypedDict", + "ProviderTypedDict", "PublicEndpoint", "PublicEndpointQuantization", "PublicEndpointTypedDict", "PublicPricing", "PublicPricingTypedDict", "Quantization", - "Quantizations", "Reason", "Reasoning", "ReasoningSummaryText", @@ -1456,12 +1379,20 @@ __all__ = [ "ReasoningTypedDict", "RequestTimeoutResponseErrorData", "RequestTimeoutResponseErrorDataTypedDict", + "ResponseFormat", + "ResponseFormatJSONObject", + "ResponseFormatJSONObjectTypedDict", "ResponseFormatJSONSchema", "ResponseFormatJSONSchemaTypedDict", + "ResponseFormatPython", + "ResponseFormatPythonTypedDict", + "ResponseFormatText", "ResponseFormatTextConfig", "ResponseFormatTextConfigTypedDict", "ResponseFormatTextGrammar", "ResponseFormatTextGrammarTypedDict", + "ResponseFormatTextTypedDict", + "ResponseFormatTypedDict", "ResponseInputAudio", "ResponseInputAudioFormat", "ResponseInputAudioInputAudio", @@ -1546,25 +1477,49 @@ __all__ = [ "ResponsesWebSearchUserLocationTypedDict", "Route", "Schema0", - "Schema0Enum", "Schema0TypedDict", - "Schema2", - "Schema2ReasoningEncrypted", - "Schema2ReasoningEncryptedTypedDict", - "Schema2ReasoningSummary", - "Schema2ReasoningSummaryTypedDict", - "Schema2ReasoningText", - "Schema2ReasoningTextTypedDict", - "Schema2TypedDict", - "Schema4", + "Schema10", + "Schema10TypedDict", + "Schema14", + "Schema14TypedDict", + "Schema15", + "Schema15TypedDict", + "Schema15Union", + "Schema15UnionTypedDict", + "Schema17", + "Schema17AutoRouter", + "Schema17AutoRouterTypedDict", + "Schema17FileParser", + "Schema17FileParserTypedDict", + "Schema17Moderation", + "Schema17ModerationTypedDict", + "Schema17ResponseHealing", + "Schema17ResponseHealingTypedDict", + "Schema17TypedDict", + "Schema17Web", + "Schema17WebTypedDict", + "Schema19", + "Schema19ReasoningEncrypted", + "Schema19ReasoningEncryptedTypedDict", + "Schema19ReasoningSummary", + "Schema19ReasoningSummaryTypedDict", + "Schema19ReasoningText", + "Schema19ReasoningTextTypedDict", + "Schema19TypedDict", + "Schema21", + "Schema3", + "Schema5", + "Schema5Enum", + "Schema5TypedDict", + "Schema8", "Security", "SecurityTypedDict", "ServiceTier", "ServiceUnavailableResponseErrorData", "ServiceUnavailableResponseErrorDataTypedDict", "SortEnum", - "StreamOptions", - "StreamOptionsTypedDict", + "Stop", + "StopTypedDict", "SystemMessage", "SystemMessageContent", "SystemMessageContentTypedDict", @@ -1629,18 +1584,42 @@ __all__ = [ ] _dynamic_imports: dict[str, str] = { - "Schema0": "._schema0", - "Schema0Enum": "._schema0", - "Schema0TypedDict": "._schema0", - "Schema2": "._schema2", - "Schema2ReasoningEncrypted": "._schema2", - "Schema2ReasoningEncryptedTypedDict": "._schema2", - "Schema2ReasoningSummary": "._schema2", - "Schema2ReasoningSummaryTypedDict": "._schema2", - "Schema2ReasoningText": "._schema2", - "Schema2ReasoningTextTypedDict": "._schema2", - "Schema2TypedDict": "._schema2", - "Schema4": "._schema2", + "Completion": "._schema10", + "CompletionTypedDict": "._schema10", + "Prompt": "._schema10", + "PromptTypedDict": "._schema10", + "Schema10": "._schema10", + "Schema10TypedDict": "._schema10", + "Schema14": "._schema14", + "Schema14TypedDict": "._schema14", + "Engine": "._schema17", + "Pdf": "._schema17", + "PdfEngine": "._schema17", + "PdfTypedDict": "._schema17", + "Schema17": "._schema17", + "Schema17AutoRouter": "._schema17", + "Schema17AutoRouterTypedDict": "._schema17", + "Schema17FileParser": "._schema17", + "Schema17FileParserTypedDict": "._schema17", + "Schema17Moderation": "._schema17", + "Schema17ModerationTypedDict": "._schema17", + "Schema17ResponseHealing": "._schema17", + "Schema17ResponseHealingTypedDict": "._schema17", + "Schema17TypedDict": "._schema17", + "Schema17Web": "._schema17", + "Schema17WebTypedDict": "._schema17", + "Schema19": "._schema19", + "Schema19ReasoningEncrypted": "._schema19", + "Schema19ReasoningEncryptedTypedDict": "._schema19", + "Schema19ReasoningSummary": "._schema19", + "Schema19ReasoningSummaryTypedDict": "._schema19", + "Schema19ReasoningText": "._schema19", + "Schema19ReasoningTextTypedDict": "._schema19", + "Schema19TypedDict": "._schema19", + "Schema21": "._schema19", + "Schema5": "._schema5", + "Schema5Enum": "._schema5", + "Schema5TypedDict": "._schema5", "ActivityItem": ".activityitem", "ActivityItemTypedDict": ".activityitem", "AssistantMessage": ".assistantmessage", @@ -1661,56 +1640,34 @@ _dynamic_imports: dict[str, str] = { "Code": ".chaterror", "CodeTypedDict": ".chaterror", "ChatGenerationParams": ".chatgenerationparams", - "ChatGenerationParamsDataCollection": ".chatgenerationparams", "ChatGenerationParamsImageConfig": ".chatgenerationparams", "ChatGenerationParamsImageConfigTypedDict": ".chatgenerationparams", - "ChatGenerationParamsMaxPrice": ".chatgenerationparams", - "ChatGenerationParamsMaxPriceTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPluginAutoRouter": ".chatgenerationparams", - "ChatGenerationParamsPluginAutoRouterTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPluginFileParser": ".chatgenerationparams", - "ChatGenerationParamsPluginFileParserTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPluginModeration": ".chatgenerationparams", - "ChatGenerationParamsPluginModerationTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPluginResponseHealing": ".chatgenerationparams", - "ChatGenerationParamsPluginResponseHealingTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPluginUnion": ".chatgenerationparams", - "ChatGenerationParamsPluginUnionTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPluginWeb": ".chatgenerationparams", - "ChatGenerationParamsPluginWebTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPreferredMaxLatency": ".chatgenerationparams", - "ChatGenerationParamsPreferredMaxLatencyTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPreferredMaxLatencyUnion": ".chatgenerationparams", - "ChatGenerationParamsPreferredMaxLatencyUnionTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPreferredMinThroughput": ".chatgenerationparams", - "ChatGenerationParamsPreferredMinThroughputTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPreferredMinThroughputUnion": ".chatgenerationparams", - "ChatGenerationParamsPreferredMinThroughputUnionTypedDict": ".chatgenerationparams", - "ChatGenerationParamsProvider": ".chatgenerationparams", - "ChatGenerationParamsProviderTypedDict": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatJSONObject": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatJSONObjectTypedDict": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatPython": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatPythonTypedDict": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatText": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatTextTypedDict": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatUnion": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatUnionTypedDict": ".chatgenerationparams", - "ChatGenerationParamsStop": ".chatgenerationparams", - "ChatGenerationParamsStopTypedDict": ".chatgenerationparams", "ChatGenerationParamsTypedDict": ".chatgenerationparams", "Debug": ".chatgenerationparams", "DebugTypedDict": ".chatgenerationparams", "Effort": ".chatgenerationparams", - "Engine": ".chatgenerationparams", "Modality": ".chatgenerationparams", - "Pdf": ".chatgenerationparams", - "PdfEngine": ".chatgenerationparams", - "PdfTypedDict": ".chatgenerationparams", - "Quantizations": ".chatgenerationparams", "Reasoning": ".chatgenerationparams", "ReasoningTypedDict": ".chatgenerationparams", + "ResponseFormat": ".chatgenerationparams", + "ResponseFormatJSONObject": ".chatgenerationparams", + "ResponseFormatJSONObjectTypedDict": ".chatgenerationparams", + "ResponseFormatPython": ".chatgenerationparams", + "ResponseFormatPythonTypedDict": ".chatgenerationparams", + "ResponseFormatText": ".chatgenerationparams", + "ResponseFormatTextTypedDict": ".chatgenerationparams", + "ResponseFormatTypedDict": ".chatgenerationparams", "Route": ".chatgenerationparams", + "Schema0": ".chatgenerationparams", + "Schema0TypedDict": ".chatgenerationparams", + "Schema15": ".chatgenerationparams", + "Schema15TypedDict": ".chatgenerationparams", + "Schema15Union": ".chatgenerationparams", + "Schema15UnionTypedDict": ".chatgenerationparams", + "Schema3": ".chatgenerationparams", + "Schema8": ".chatgenerationparams", + "Stop": ".chatgenerationparams", + "StopTypedDict": ".chatgenerationparams", "ChatGenerationTokenUsage": ".chatgenerationtokenusage", "ChatGenerationTokenUsageTypedDict": ".chatgenerationtokenusage", "CompletionTokensDetails": ".chatgenerationtokenusage", @@ -1774,37 +1731,16 @@ _dynamic_imports: dict[str, str] = { "ChatStreamingResponseChunkTypedDict": ".chatstreamingresponsechunk", "ChatStreamOptions": ".chatstreamoptions", "ChatStreamOptionsTypedDict": ".chatstreamoptions", - "CompletionChoice": ".completionchoice", - "CompletionChoiceTypedDict": ".completionchoice", - "CompletionFinishReason": ".completionchoice", - "CompletionCreateParams": ".completioncreateparams", - "CompletionCreateParamsResponseFormatJSONObject": ".completioncreateparams", - "CompletionCreateParamsResponseFormatJSONObjectTypedDict": ".completioncreateparams", - "CompletionCreateParamsResponseFormatPython": ".completioncreateparams", - "CompletionCreateParamsResponseFormatPythonTypedDict": ".completioncreateparams", - "CompletionCreateParamsResponseFormatText": ".completioncreateparams", - "CompletionCreateParamsResponseFormatTextTypedDict": ".completioncreateparams", - "CompletionCreateParamsResponseFormatUnion": ".completioncreateparams", - "CompletionCreateParamsResponseFormatUnionTypedDict": ".completioncreateparams", - "CompletionCreateParamsStop": ".completioncreateparams", - "CompletionCreateParamsStopTypedDict": ".completioncreateparams", - "CompletionCreateParamsTypedDict": ".completioncreateparams", - "Prompt": ".completioncreateparams", - "PromptTypedDict": ".completioncreateparams", - "StreamOptions": ".completioncreateparams", - "StreamOptionsTypedDict": ".completioncreateparams", - "CompletionLogprobs": ".completionlogprobs", - "CompletionLogprobsTypedDict": ".completionlogprobs", - "CompletionResponse": ".completionresponse", - "CompletionResponseTypedDict": ".completionresponse", - "CompletionUsage": ".completionusage", - "CompletionUsageTypedDict": ".completionusage", "ChainID": ".createchargerequest", "CreateChargeRequest": ".createchargerequest", "CreateChargeRequestTypedDict": ".createchargerequest", "DataCollection": ".datacollection", "DefaultParameters": ".defaultparameters", "DefaultParametersTypedDict": ".defaultparameters", + "DeveloperMessage": ".developermessage", + "DeveloperMessageContent": ".developermessage", + "DeveloperMessageContentTypedDict": ".developermessage", + "DeveloperMessageTypedDict": ".developermessage", "EdgeNetworkTimeoutResponseErrorData": ".edgenetworktimeoutresponseerrordata", "EdgeNetworkTimeoutResponseErrorDataTypedDict": ".edgenetworktimeoutresponseerrordata", "EndpointStatus": ".endpointstatus", @@ -1829,10 +1765,6 @@ _dynamic_imports: dict[str, str] = { "ListEndpointsResponseTypedDict": ".listendpointsresponse", "Tokenizer": ".listendpointsresponse", "Message": ".message", - "MessageContent": ".message", - "MessageContentTypedDict": ".message", - "MessageDeveloper": ".message", - "MessageDeveloperTypedDict": ".message", "MessageTypedDict": ".message", "Model": ".model", "ModelTypedDict": ".model", @@ -2026,20 +1958,6 @@ _dynamic_imports: dict[str, str] = { "OpenResponsesRequestOnlyTypedDict": ".openresponsesrequest", "OpenResponsesRequestOrder": ".openresponsesrequest", "OpenResponsesRequestOrderTypedDict": ".openresponsesrequest", - "OpenResponsesRequestPluginAutoRouter": ".openresponsesrequest", - "OpenResponsesRequestPluginAutoRouterTypedDict": ".openresponsesrequest", - "OpenResponsesRequestPluginFileParser": ".openresponsesrequest", - "OpenResponsesRequestPluginFileParserTypedDict": ".openresponsesrequest", - "OpenResponsesRequestPluginModeration": ".openresponsesrequest", - "OpenResponsesRequestPluginModerationTypedDict": ".openresponsesrequest", - "OpenResponsesRequestPluginResponseHealing": ".openresponsesrequest", - "OpenResponsesRequestPluginResponseHealingTypedDict": ".openresponsesrequest", - "OpenResponsesRequestPluginUnion": ".openresponsesrequest", - "OpenResponsesRequestPluginUnionTypedDict": ".openresponsesrequest", - "OpenResponsesRequestPluginWeb": ".openresponsesrequest", - "OpenResponsesRequestPluginWebTypedDict": ".openresponsesrequest", - "OpenResponsesRequestProvider": ".openresponsesrequest", - "OpenResponsesRequestProviderTypedDict": ".openresponsesrequest", "OpenResponsesRequestSort": ".openresponsesrequest", "OpenResponsesRequestSortTypedDict": ".openresponsesrequest", "OpenResponsesRequestToolFunction": ".openresponsesrequest", @@ -2048,6 +1966,20 @@ _dynamic_imports: dict[str, str] = { "OpenResponsesRequestToolUnionTypedDict": ".openresponsesrequest", "OpenResponsesRequestType": ".openresponsesrequest", "OpenResponsesRequestTypedDict": ".openresponsesrequest", + "Plugin": ".openresponsesrequest", + "PluginAutoRouter": ".openresponsesrequest", + "PluginAutoRouterTypedDict": ".openresponsesrequest", + "PluginFileParser": ".openresponsesrequest", + "PluginFileParserTypedDict": ".openresponsesrequest", + "PluginModeration": ".openresponsesrequest", + "PluginModerationTypedDict": ".openresponsesrequest", + "PluginResponseHealing": ".openresponsesrequest", + "PluginResponseHealingTypedDict": ".openresponsesrequest", + "PluginTypedDict": ".openresponsesrequest", + "PluginWeb": ".openresponsesrequest", + "PluginWebTypedDict": ".openresponsesrequest", + "Provider": ".openresponsesrequest", + "ProviderTypedDict": ".openresponsesrequest", "ServiceTier": ".openresponsesrequest", "Truncation": ".openresponsesrequest", "OpenResponsesResponseText": ".openresponsesresponsetext", diff --git a/src/openrouter/components/_schema10.py b/src/openrouter/components/_schema10.py new file mode 100644 index 0000000..ec61549 --- /dev/null +++ b/src/openrouter/components/_schema10.py @@ -0,0 +1,39 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from ._schema14 import Schema14, Schema14TypedDict +from openrouter.types import BaseModel +from typing import Any, Optional, Union +from typing_extensions import NotRequired, TypeAliasType, TypedDict + + +PromptTypedDict = TypeAliasType("PromptTypedDict", Union[float, str, Any]) + + +Prompt = TypeAliasType("Prompt", Union[float, str, Any]) + + +CompletionTypedDict = TypeAliasType("CompletionTypedDict", Union[float, str, Any]) + + +Completion = TypeAliasType("Completion", Union[float, str, Any]) + + +class Schema10TypedDict(TypedDict): + prompt: NotRequired[PromptTypedDict] + completion: NotRequired[CompletionTypedDict] + image: NotRequired[Schema14TypedDict] + audio: NotRequired[Schema14TypedDict] + request: NotRequired[Schema14TypedDict] + + +class Schema10(BaseModel): + prompt: Optional[Prompt] = None + + completion: Optional[Completion] = None + + image: Optional[Schema14] = None + + audio: Optional[Schema14] = None + + request: Optional[Schema14] = None diff --git a/src/openrouter/components/_schema14.py b/src/openrouter/components/_schema14.py new file mode 100644 index 0000000..2f9446a --- /dev/null +++ b/src/openrouter/components/_schema14.py @@ -0,0 +1,11 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from typing import Any, Union +from typing_extensions import TypeAliasType + + +Schema14TypedDict = TypeAliasType("Schema14TypedDict", Union[float, str, Any]) + + +Schema14 = TypeAliasType("Schema14", Union[float, str, Any]) diff --git a/src/openrouter/components/_schema17.py b/src/openrouter/components/_schema17.py new file mode 100644 index 0000000..4122820 --- /dev/null +++ b/src/openrouter/components/_schema17.py @@ -0,0 +1,154 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UnrecognizedStr +from openrouter.utils import get_discriminator, validate_const, validate_open_enum +import pydantic +from pydantic import Discriminator, Tag +from pydantic.functional_validators import AfterValidator, PlainValidator +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class Schema17ResponseHealingTypedDict(TypedDict): + id: Literal["response-healing"] + enabled: NotRequired[bool] + + +class Schema17ResponseHealing(BaseModel): + ID: Annotated[ + Annotated[ + Literal["response-healing"], + AfterValidator(validate_const("response-healing")), + ], + pydantic.Field(alias="id"), + ] = "response-healing" + + enabled: Optional[bool] = None + + +PdfEngine = Union[ + Literal[ + "mistral-ocr", + "pdf-text", + "native", + ], + UnrecognizedStr, +] + + +class PdfTypedDict(TypedDict): + engine: NotRequired[PdfEngine] + + +class Pdf(BaseModel): + engine: Annotated[ + Optional[PdfEngine], PlainValidator(validate_open_enum(False)) + ] = None + + +class Schema17FileParserTypedDict(TypedDict): + id: Literal["file-parser"] + enabled: NotRequired[bool] + pdf: NotRequired[PdfTypedDict] + + +class Schema17FileParser(BaseModel): + ID: Annotated[ + Annotated[ + Literal["file-parser"], AfterValidator(validate_const("file-parser")) + ], + pydantic.Field(alias="id"), + ] = "file-parser" + + enabled: Optional[bool] = None + + pdf: Optional[Pdf] = None + + +Engine = Union[ + Literal[ + "native", + "exa", + ], + UnrecognizedStr, +] + + +class Schema17WebTypedDict(TypedDict): + id: Literal["web"] + enabled: NotRequired[bool] + max_results: NotRequired[float] + search_prompt: NotRequired[str] + engine: NotRequired[Engine] + + +class Schema17Web(BaseModel): + ID: Annotated[ + Annotated[Literal["web"], AfterValidator(validate_const("web"))], + pydantic.Field(alias="id"), + ] = "web" + + enabled: Optional[bool] = None + + max_results: Optional[float] = None + + search_prompt: Optional[str] = None + + engine: Annotated[Optional[Engine], PlainValidator(validate_open_enum(False))] = ( + None + ) + + +class Schema17ModerationTypedDict(TypedDict): + id: Literal["moderation"] + + +class Schema17Moderation(BaseModel): + ID: Annotated[ + Annotated[Literal["moderation"], AfterValidator(validate_const("moderation"))], + pydantic.Field(alias="id"), + ] = "moderation" + + +class Schema17AutoRouterTypedDict(TypedDict): + id: Literal["auto-router"] + enabled: NotRequired[bool] + allowed_models: NotRequired[List[str]] + + +class Schema17AutoRouter(BaseModel): + ID: Annotated[ + Annotated[ + Literal["auto-router"], AfterValidator(validate_const("auto-router")) + ], + pydantic.Field(alias="id"), + ] = "auto-router" + + enabled: Optional[bool] = None + + allowed_models: Optional[List[str]] = None + + +Schema17TypedDict = TypeAliasType( + "Schema17TypedDict", + Union[ + Schema17ModerationTypedDict, + Schema17ResponseHealingTypedDict, + Schema17AutoRouterTypedDict, + Schema17FileParserTypedDict, + Schema17WebTypedDict, + ], +) + + +Schema17 = Annotated[ + Union[ + Annotated[Schema17AutoRouter, Tag("auto-router")], + Annotated[Schema17Moderation, Tag("moderation")], + Annotated[Schema17Web, Tag("web")], + Annotated[Schema17FileParser, Tag("file-parser")], + Annotated[Schema17ResponseHealing, Tag("response-healing")], + ], + Discriminator(lambda m: get_discriminator(m, "id", "id")), +] diff --git a/src/openrouter/components/_schema2.py b/src/openrouter/components/_schema19.py similarity index 81% rename from src/openrouter/components/_schema2.py rename to src/openrouter/components/_schema19.py index faec5d8..3c05ebd 100644 --- a/src/openrouter/components/_schema2.py +++ b/src/openrouter/components/_schema19.py @@ -17,7 +17,7 @@ from typing import Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -Schema4 = Union[ +Schema21 = Union[ Literal[ "unknown", "openai-responses-v1", @@ -30,16 +30,16 @@ Schema4 = Union[ ] -class Schema2ReasoningTextTypedDict(TypedDict): +class Schema19ReasoningTextTypedDict(TypedDict): type: Literal["reasoning.text"] text: NotRequired[Nullable[str]] signature: NotRequired[Nullable[str]] id: NotRequired[Nullable[str]] - format_: NotRequired[Nullable[Schema4]] + format_: NotRequired[Nullable[Schema21]] index: NotRequired[float] -class Schema2ReasoningText(BaseModel): +class Schema19ReasoningText(BaseModel): TYPE: Annotated[ Annotated[ Literal["reasoning.text"], AfterValidator(validate_const("reasoning.text")) @@ -54,7 +54,9 @@ class Schema2ReasoningText(BaseModel): id: OptionalNullable[str] = UNSET format_: Annotated[ - Annotated[OptionalNullable[Schema4], PlainValidator(validate_open_enum(False))], + Annotated[ + OptionalNullable[Schema21], PlainValidator(validate_open_enum(False)) + ], pydantic.Field(alias="format"), ] = UNSET @@ -91,15 +93,15 @@ class Schema2ReasoningText(BaseModel): return m -class Schema2ReasoningEncryptedTypedDict(TypedDict): +class Schema19ReasoningEncryptedTypedDict(TypedDict): data: str type: Literal["reasoning.encrypted"] id: NotRequired[Nullable[str]] - format_: NotRequired[Nullable[Schema4]] + format_: NotRequired[Nullable[Schema21]] index: NotRequired[float] -class Schema2ReasoningEncrypted(BaseModel): +class Schema19ReasoningEncrypted(BaseModel): data: str TYPE: Annotated[ @@ -113,7 +115,9 @@ class Schema2ReasoningEncrypted(BaseModel): id: OptionalNullable[str] = UNSET format_: Annotated[ - Annotated[OptionalNullable[Schema4], PlainValidator(validate_open_enum(False))], + Annotated[ + OptionalNullable[Schema21], PlainValidator(validate_open_enum(False)) + ], pydantic.Field(alias="format"), ] = UNSET @@ -150,15 +154,15 @@ class Schema2ReasoningEncrypted(BaseModel): return m -class Schema2ReasoningSummaryTypedDict(TypedDict): +class Schema19ReasoningSummaryTypedDict(TypedDict): summary: str type: Literal["reasoning.summary"] id: NotRequired[Nullable[str]] - format_: NotRequired[Nullable[Schema4]] + format_: NotRequired[Nullable[Schema21]] index: NotRequired[float] -class Schema2ReasoningSummary(BaseModel): +class Schema19ReasoningSummary(BaseModel): summary: str TYPE: Annotated[ @@ -172,7 +176,9 @@ class Schema2ReasoningSummary(BaseModel): id: OptionalNullable[str] = UNSET format_: Annotated[ - Annotated[OptionalNullable[Schema4], PlainValidator(validate_open_enum(False))], + Annotated[ + OptionalNullable[Schema21], PlainValidator(validate_open_enum(False)) + ], pydantic.Field(alias="format"), ] = UNSET @@ -209,21 +215,21 @@ class Schema2ReasoningSummary(BaseModel): return m -Schema2TypedDict = TypeAliasType( - "Schema2TypedDict", +Schema19TypedDict = TypeAliasType( + "Schema19TypedDict", Union[ - Schema2ReasoningSummaryTypedDict, - Schema2ReasoningEncryptedTypedDict, - Schema2ReasoningTextTypedDict, + Schema19ReasoningSummaryTypedDict, + Schema19ReasoningEncryptedTypedDict, + Schema19ReasoningTextTypedDict, ], ) -Schema2 = Annotated[ +Schema19 = Annotated[ Union[ - Annotated[Schema2ReasoningSummary, Tag("reasoning.summary")], - Annotated[Schema2ReasoningEncrypted, Tag("reasoning.encrypted")], - Annotated[Schema2ReasoningText, Tag("reasoning.text")], + Annotated[Schema19ReasoningSummary, Tag("reasoning.summary")], + Annotated[Schema19ReasoningEncrypted, Tag("reasoning.encrypted")], + Annotated[Schema19ReasoningText, Tag("reasoning.text")], ], Discriminator(lambda m: get_discriminator(m, "type", "type")), ] diff --git a/src/openrouter/components/_schema0.py b/src/openrouter/components/_schema5.py similarity index 88% rename from src/openrouter/components/_schema0.py rename to src/openrouter/components/_schema5.py index 4da27c8..c7458de 100644 --- a/src/openrouter/components/_schema0.py +++ b/src/openrouter/components/_schema5.py @@ -8,11 +8,12 @@ from typing import Literal, Union from typing_extensions import Annotated, TypeAliasType -Schema0Enum = Union[ +Schema5Enum = Union[ Literal[ "AI21", "AionLabs", "Alibaba", + "Ambient", "Amazon Bedrock", "Amazon Nova", "Anthropic", @@ -69,6 +70,7 @@ Schema0Enum = Union[ "Seed", "SiliconFlow", "Sourceful", + "StepFun", "Stealth", "StreamLake", "Switchpoint", @@ -85,10 +87,10 @@ Schema0Enum = Union[ ] -Schema0TypedDict = TypeAliasType("Schema0TypedDict", Union[Schema0Enum, str]) +Schema5TypedDict = TypeAliasType("Schema5TypedDict", Union[Schema5Enum, str]) -Schema0 = TypeAliasType( - "Schema0", - Union[Annotated[Schema0Enum, PlainValidator(validate_open_enum(False))], str], +Schema5 = TypeAliasType( + "Schema5", + Union[Annotated[Schema5Enum, PlainValidator(validate_open_enum(False))], str], ) diff --git a/src/openrouter/components/assistantmessage.py b/src/openrouter/components/assistantmessage.py index f9f4fa6..a3ec986 100644 --- a/src/openrouter/components/assistantmessage.py +++ b/src/openrouter/components/assistantmessage.py @@ -1,7 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from ._schema2 import Schema2, Schema2TypedDict +from ._schema19 import Schema19, Schema19TypedDict from .chatmessagecontentitem import ( ChatMessageContentItem, ChatMessageContentItemTypedDict, @@ -56,7 +56,7 @@ class AssistantMessageTypedDict(TypedDict): tool_calls: NotRequired[List[ChatMessageToolCallTypedDict]] refusal: NotRequired[Nullable[str]] reasoning: NotRequired[Nullable[str]] - reasoning_details: NotRequired[List[Schema2TypedDict]] + reasoning_details: NotRequired[List[Schema19TypedDict]] images: NotRequired[List[ImageTypedDict]] @@ -76,7 +76,7 @@ class AssistantMessage(BaseModel): reasoning: OptionalNullable[str] = UNSET - reasoning_details: Optional[List[Schema2]] = None + reasoning_details: Optional[List[Schema19]] = None images: Optional[List[Image]] = None diff --git a/src/openrouter/components/chatgenerationparams.py b/src/openrouter/components/chatgenerationparams.py index 226d298..c052d8c 100644 --- a/src/openrouter/components/chatgenerationparams.py +++ b/src/openrouter/components/chatgenerationparams.py @@ -1,7 +1,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from ._schema0 import Schema0, Schema0TypedDict +from ._schema10 import Schema10, Schema10TypedDict +from ._schema17 import Schema17, Schema17TypedDict +from ._schema5 import Schema5, Schema5TypedDict from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict from .message import Message, MessageTypedDict from .providersortunion import ProviderSortUnion, ProviderSortUnionTypedDict @@ -31,7 +33,7 @@ from typing import Any, Dict, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -ChatGenerationParamsDataCollection = Union[ +Schema3 = Union[ Literal[ "deny", "allow", @@ -40,7 +42,7 @@ ChatGenerationParamsDataCollection = Union[ ] -Quantizations = Union[ +Schema8 = Union[ Literal[ "int4", "int8", @@ -56,38 +58,14 @@ Quantizations = Union[ ] -class ChatGenerationParamsMaxPriceTypedDict(TypedDict): - r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" - - prompt: NotRequired[Any] - completion: NotRequired[Any] - image: NotRequired[Any] - audio: NotRequired[Any] - request: NotRequired[Any] - - -class ChatGenerationParamsMaxPrice(BaseModel): - r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" - - prompt: Optional[Any] = None - - completion: Optional[Any] = None - - image: Optional[Any] = None - - audio: Optional[Any] = None - - request: Optional[Any] = None - - -class ChatGenerationParamsPreferredMinThroughputTypedDict(TypedDict): +class Schema15TypedDict(TypedDict): p50: NotRequired[Nullable[float]] p75: NotRequired[Nullable[float]] p90: NotRequired[Nullable[float]] p99: NotRequired[Nullable[float]] -class ChatGenerationParamsPreferredMinThroughput(BaseModel): +class Schema15(BaseModel): p50: OptionalNullable[float] = UNSET p75: OptionalNullable[float] = UNSET @@ -127,170 +105,60 @@ class ChatGenerationParamsPreferredMinThroughput(BaseModel): return m -ChatGenerationParamsPreferredMinThroughputUnionTypedDict = TypeAliasType( - "ChatGenerationParamsPreferredMinThroughputUnionTypedDict", - Union[ChatGenerationParamsPreferredMinThroughputTypedDict, float], +Schema15UnionTypedDict = TypeAliasType( + "Schema15UnionTypedDict", Union[Schema15TypedDict, float] ) -ChatGenerationParamsPreferredMinThroughputUnion = TypeAliasType( - "ChatGenerationParamsPreferredMinThroughputUnion", - Union[ChatGenerationParamsPreferredMinThroughput, float], -) +Schema15Union = TypeAliasType("Schema15Union", Union[Schema15, float]) -class ChatGenerationParamsPreferredMaxLatencyTypedDict(TypedDict): - p50: NotRequired[Nullable[float]] - p75: NotRequired[Nullable[float]] - p90: NotRequired[Nullable[float]] - p99: NotRequired[Nullable[float]] - - -class ChatGenerationParamsPreferredMaxLatency(BaseModel): - p50: OptionalNullable[float] = UNSET - - p75: OptionalNullable[float] = UNSET - - p90: OptionalNullable[float] = UNSET - - p99: OptionalNullable[float] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = ["p50", "p75", "p90", "p99"] - nullable_fields = ["p50", "p75", "p90", "p99"] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - return m - - -ChatGenerationParamsPreferredMaxLatencyUnionTypedDict = TypeAliasType( - "ChatGenerationParamsPreferredMaxLatencyUnionTypedDict", - Union[ChatGenerationParamsPreferredMaxLatencyTypedDict, float], -) - - -ChatGenerationParamsPreferredMaxLatencyUnion = TypeAliasType( - "ChatGenerationParamsPreferredMaxLatencyUnion", - Union[ChatGenerationParamsPreferredMaxLatency, float], -) - - -class ChatGenerationParamsProviderTypedDict(TypedDict): +class Schema0TypedDict(TypedDict): allow_fallbacks: NotRequired[Nullable[bool]] - r"""Whether to allow backup providers to serve requests - - true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider. - - false: use only the primary/custom provider, and return the upstream error if it's unavailable. - - """ require_parameters: NotRequired[Nullable[bool]] - r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.""" - data_collection: NotRequired[Nullable[ChatGenerationParamsDataCollection]] - r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. - - allow: (default) allow providers which store user data non-transiently and may train on it - - - deny: use only providers which do not collect user data. - """ + data_collection: NotRequired[Nullable[Schema3]] zdr: NotRequired[Nullable[bool]] enforce_distillable_text: NotRequired[Nullable[bool]] - order: NotRequired[Nullable[List[Schema0TypedDict]]] - r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" - only: NotRequired[Nullable[List[Schema0TypedDict]]] - r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" - ignore: NotRequired[Nullable[List[Schema0TypedDict]]] - r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" - quantizations: NotRequired[Nullable[List[Quantizations]]] - r"""A list of quantization levels to filter the provider by.""" + order: NotRequired[Nullable[List[Schema5TypedDict]]] + only: NotRequired[Nullable[List[Schema5TypedDict]]] + ignore: NotRequired[Nullable[List[Schema5TypedDict]]] + quantizations: NotRequired[Nullable[List[Schema8]]] sort: NotRequired[Nullable[ProviderSortUnionTypedDict]] - r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" - max_price: NotRequired[ChatGenerationParamsMaxPriceTypedDict] - r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" - preferred_min_throughput: NotRequired[ - Nullable[ChatGenerationParamsPreferredMinThroughputUnionTypedDict] - ] - r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" - preferred_max_latency: NotRequired[ - Nullable[ChatGenerationParamsPreferredMaxLatencyUnionTypedDict] - ] - r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" + max_price: NotRequired[Schema10TypedDict] + preferred_min_throughput: NotRequired[Nullable[Schema15UnionTypedDict]] + preferred_max_latency: NotRequired[Nullable[Schema15UnionTypedDict]] -class ChatGenerationParamsProvider(BaseModel): +class Schema0(BaseModel): allow_fallbacks: OptionalNullable[bool] = UNSET - r"""Whether to allow backup providers to serve requests - - true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider. - - false: use only the primary/custom provider, and return the upstream error if it's unavailable. - - """ require_parameters: OptionalNullable[bool] = UNSET - r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.""" data_collection: Annotated[ - OptionalNullable[ChatGenerationParamsDataCollection], - PlainValidator(validate_open_enum(False)), + OptionalNullable[Schema3], PlainValidator(validate_open_enum(False)) ] = UNSET - r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. - - allow: (default) allow providers which store user data non-transiently and may train on it - - - deny: use only providers which do not collect user data. - """ zdr: OptionalNullable[bool] = UNSET enforce_distillable_text: OptionalNullable[bool] = UNSET - order: OptionalNullable[List[Schema0]] = UNSET - r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" + order: OptionalNullable[List[Schema5]] = UNSET - only: OptionalNullable[List[Schema0]] = UNSET - r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" + only: OptionalNullable[List[Schema5]] = UNSET - ignore: OptionalNullable[List[Schema0]] = UNSET - r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" + ignore: OptionalNullable[List[Schema5]] = UNSET quantizations: OptionalNullable[ - List[Annotated[Quantizations, PlainValidator(validate_open_enum(False))]] + List[Annotated[Schema8, PlainValidator(validate_open_enum(False))]] ] = UNSET - r"""A list of quantization levels to filter the provider by.""" sort: OptionalNullable[ProviderSortUnion] = UNSET - r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" - max_price: Optional[ChatGenerationParamsMaxPrice] = None - r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" + max_price: Optional[Schema10] = None - preferred_min_throughput: OptionalNullable[ - ChatGenerationParamsPreferredMinThroughputUnion - ] = UNSET - r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" + preferred_min_throughput: OptionalNullable[Schema15Union] = UNSET - preferred_max_latency: OptionalNullable[ - ChatGenerationParamsPreferredMaxLatencyUnion - ] = UNSET - r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" + preferred_max_latency: OptionalNullable[Schema15Union] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -350,150 +218,6 @@ class ChatGenerationParamsProvider(BaseModel): return m -class ChatGenerationParamsPluginResponseHealingTypedDict(TypedDict): - id: Literal["response-healing"] - enabled: NotRequired[bool] - - -class ChatGenerationParamsPluginResponseHealing(BaseModel): - ID: Annotated[ - Annotated[ - Literal["response-healing"], - AfterValidator(validate_const("response-healing")), - ], - pydantic.Field(alias="id"), - ] = "response-healing" - - enabled: Optional[bool] = None - - -PdfEngine = Union[ - Literal[ - "mistral-ocr", - "pdf-text", - "native", - ], - UnrecognizedStr, -] - - -class PdfTypedDict(TypedDict): - engine: NotRequired[PdfEngine] - - -class Pdf(BaseModel): - engine: Annotated[ - Optional[PdfEngine], PlainValidator(validate_open_enum(False)) - ] = None - - -class ChatGenerationParamsPluginFileParserTypedDict(TypedDict): - id: Literal["file-parser"] - enabled: NotRequired[bool] - pdf: NotRequired[PdfTypedDict] - - -class ChatGenerationParamsPluginFileParser(BaseModel): - ID: Annotated[ - Annotated[ - Literal["file-parser"], AfterValidator(validate_const("file-parser")) - ], - pydantic.Field(alias="id"), - ] = "file-parser" - - enabled: Optional[bool] = None - - pdf: Optional[Pdf] = None - - -Engine = Union[ - Literal[ - "native", - "exa", - ], - UnrecognizedStr, -] - - -class ChatGenerationParamsPluginWebTypedDict(TypedDict): - id: Literal["web"] - enabled: NotRequired[bool] - max_results: NotRequired[float] - search_prompt: NotRequired[str] - engine: NotRequired[Engine] - - -class ChatGenerationParamsPluginWeb(BaseModel): - ID: Annotated[ - Annotated[Literal["web"], AfterValidator(validate_const("web"))], - pydantic.Field(alias="id"), - ] = "web" - - enabled: Optional[bool] = None - - max_results: Optional[float] = None - - search_prompt: Optional[str] = None - - engine: Annotated[Optional[Engine], PlainValidator(validate_open_enum(False))] = ( - None - ) - - -class ChatGenerationParamsPluginModerationTypedDict(TypedDict): - id: Literal["moderation"] - - -class ChatGenerationParamsPluginModeration(BaseModel): - ID: Annotated[ - Annotated[Literal["moderation"], AfterValidator(validate_const("moderation"))], - pydantic.Field(alias="id"), - ] = "moderation" - - -class ChatGenerationParamsPluginAutoRouterTypedDict(TypedDict): - id: Literal["auto-router"] - enabled: NotRequired[bool] - allowed_models: NotRequired[List[str]] - - -class ChatGenerationParamsPluginAutoRouter(BaseModel): - ID: Annotated[ - Annotated[ - Literal["auto-router"], AfterValidator(validate_const("auto-router")) - ], - pydantic.Field(alias="id"), - ] = "auto-router" - - enabled: Optional[bool] = None - - allowed_models: Optional[List[str]] = None - - -ChatGenerationParamsPluginUnionTypedDict = TypeAliasType( - "ChatGenerationParamsPluginUnionTypedDict", - Union[ - ChatGenerationParamsPluginModerationTypedDict, - ChatGenerationParamsPluginResponseHealingTypedDict, - ChatGenerationParamsPluginAutoRouterTypedDict, - ChatGenerationParamsPluginFileParserTypedDict, - ChatGenerationParamsPluginWebTypedDict, - ], -) - - -ChatGenerationParamsPluginUnion = Annotated[ - Union[ - Annotated[ChatGenerationParamsPluginAutoRouter, Tag("auto-router")], - Annotated[ChatGenerationParamsPluginModeration, Tag("moderation")], - Annotated[ChatGenerationParamsPluginWeb, Tag("web")], - Annotated[ChatGenerationParamsPluginFileParser, Tag("file-parser")], - Annotated[ChatGenerationParamsPluginResponseHealing, Tag("response-healing")], - ], - Discriminator(lambda m: get_discriminator(m, "id", "id")), -] - - Route = Union[ Literal[ "fallback", @@ -562,22 +286,22 @@ class Reasoning(BaseModel): return m -class ChatGenerationParamsResponseFormatPythonTypedDict(TypedDict): +class ResponseFormatPythonTypedDict(TypedDict): type: Literal["python"] -class ChatGenerationParamsResponseFormatPython(BaseModel): +class ResponseFormatPython(BaseModel): TYPE: Annotated[ Annotated[Literal["python"], AfterValidator(validate_const("python"))], pydantic.Field(alias="type"), ] = "python" -class ChatGenerationParamsResponseFormatJSONObjectTypedDict(TypedDict): +class ResponseFormatJSONObjectTypedDict(TypedDict): type: Literal["json_object"] -class ChatGenerationParamsResponseFormatJSONObject(BaseModel): +class ResponseFormatJSONObject(BaseModel): TYPE: Annotated[ Annotated[ Literal["json_object"], AfterValidator(validate_const("json_object")) @@ -586,49 +310,45 @@ class ChatGenerationParamsResponseFormatJSONObject(BaseModel): ] = "json_object" -class ChatGenerationParamsResponseFormatTextTypedDict(TypedDict): +class ResponseFormatTextTypedDict(TypedDict): type: Literal["text"] -class ChatGenerationParamsResponseFormatText(BaseModel): +class ResponseFormatText(BaseModel): TYPE: Annotated[ Annotated[Literal["text"], AfterValidator(validate_const("text"))], pydantic.Field(alias="type"), ] = "text" -ChatGenerationParamsResponseFormatUnionTypedDict = TypeAliasType( - "ChatGenerationParamsResponseFormatUnionTypedDict", +ResponseFormatTypedDict = TypeAliasType( + "ResponseFormatTypedDict", Union[ - ChatGenerationParamsResponseFormatTextTypedDict, - ChatGenerationParamsResponseFormatJSONObjectTypedDict, - ChatGenerationParamsResponseFormatPythonTypedDict, + ResponseFormatTextTypedDict, + ResponseFormatJSONObjectTypedDict, + ResponseFormatPythonTypedDict, ResponseFormatJSONSchemaTypedDict, ResponseFormatTextGrammarTypedDict, ], ) -ChatGenerationParamsResponseFormatUnion = Annotated[ +ResponseFormat = Annotated[ Union[ - Annotated[ChatGenerationParamsResponseFormatText, Tag("text")], - Annotated[ChatGenerationParamsResponseFormatJSONObject, Tag("json_object")], + Annotated[ResponseFormatText, Tag("text")], + Annotated[ResponseFormatJSONObject, Tag("json_object")], Annotated[ResponseFormatJSONSchema, Tag("json_schema")], Annotated[ResponseFormatTextGrammar, Tag("grammar")], - Annotated[ChatGenerationParamsResponseFormatPython, Tag("python")], + Annotated[ResponseFormatPython, Tag("python")], ], Discriminator(lambda m: get_discriminator(m, "type", "type")), ] -ChatGenerationParamsStopTypedDict = TypeAliasType( - "ChatGenerationParamsStopTypedDict", Union[str, List[str]] -) +StopTypedDict = TypeAliasType("StopTypedDict", Union[str, List[str]]) -ChatGenerationParamsStop = TypeAliasType( - "ChatGenerationParamsStop", Union[str, List[str]] -) +Stop = TypeAliasType("Stop", Union[str, List[str]]) class DebugTypedDict(TypedDict): @@ -640,12 +360,12 @@ class Debug(BaseModel): ChatGenerationParamsImageConfigTypedDict = TypeAliasType( - "ChatGenerationParamsImageConfigTypedDict", Union[str, float] + "ChatGenerationParamsImageConfigTypedDict", Union[str, float, List[Any]] ) ChatGenerationParamsImageConfig = TypeAliasType( - "ChatGenerationParamsImageConfig", Union[str, float] + "ChatGenerationParamsImageConfig", Union[str, float, List[Any]] ) @@ -660,14 +380,11 @@ Modality = Union[ class ChatGenerationParamsTypedDict(TypedDict): messages: List[MessageTypedDict] - provider: NotRequired[Nullable[ChatGenerationParamsProviderTypedDict]] - r"""When multiple model providers are available, optionally indicate your routing preference.""" - plugins: NotRequired[List[ChatGenerationParamsPluginUnionTypedDict]] - r"""Plugins you want to enable for this request, including their settings.""" + provider: NotRequired[Nullable[Schema0TypedDict]] + plugins: NotRequired[List[Schema17TypedDict]] route: NotRequired[Nullable[Route]] user: NotRequired[str] session_id: NotRequired[str] - r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.""" model: NotRequired[str] models: NotRequired[List[str]] frequency_penalty: NotRequired[Nullable[float]] @@ -679,9 +396,9 @@ class ChatGenerationParamsTypedDict(TypedDict): metadata: NotRequired[Dict[str, str]] presence_penalty: NotRequired[Nullable[float]] reasoning: NotRequired[ReasoningTypedDict] - response_format: NotRequired[ChatGenerationParamsResponseFormatUnionTypedDict] + response_format: NotRequired[ResponseFormatTypedDict] seed: NotRequired[Nullable[int]] - stop: NotRequired[Nullable[ChatGenerationParamsStopTypedDict]] + stop: NotRequired[Nullable[StopTypedDict]] stream: NotRequired[bool] stream_options: NotRequired[Nullable[ChatStreamOptionsTypedDict]] temperature: NotRequired[Nullable[float]] @@ -696,11 +413,9 @@ class ChatGenerationParamsTypedDict(TypedDict): class ChatGenerationParams(BaseModel): messages: List[Message] - provider: OptionalNullable[ChatGenerationParamsProvider] = UNSET - r"""When multiple model providers are available, optionally indicate your routing preference.""" + provider: OptionalNullable[Schema0] = UNSET - plugins: Optional[List[ChatGenerationParamsPluginUnion]] = None - r"""Plugins you want to enable for this request, including their settings.""" + plugins: Optional[List[Schema17]] = None route: Annotated[ OptionalNullable[Route], PlainValidator(validate_open_enum(False)) @@ -709,7 +424,6 @@ class ChatGenerationParams(BaseModel): user: Optional[str] = None session_id: Optional[str] = None - r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.""" model: Optional[str] = None @@ -733,11 +447,11 @@ class ChatGenerationParams(BaseModel): reasoning: Optional[Reasoning] = None - response_format: Optional[ChatGenerationParamsResponseFormatUnion] = None + response_format: Optional[ResponseFormat] = None seed: OptionalNullable[int] = UNSET - stop: OptionalNullable[ChatGenerationParamsStop] = UNSET + stop: OptionalNullable[Stop] = UNSET stream: Optional[bool] = False diff --git a/src/openrouter/components/chatstreamingmessagechunk.py b/src/openrouter/components/chatstreamingmessagechunk.py index 05aeb51..3dad989 100644 --- a/src/openrouter/components/chatstreamingmessagechunk.py +++ b/src/openrouter/components/chatstreamingmessagechunk.py @@ -1,7 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from ._schema2 import Schema2, Schema2TypedDict +from ._schema19 import Schema19, Schema19TypedDict from .chatstreamingmessagetoolcall import ( ChatStreamingMessageToolCall, ChatStreamingMessageToolCallTypedDict, @@ -27,7 +27,7 @@ class ChatStreamingMessageChunkTypedDict(TypedDict): reasoning: NotRequired[Nullable[str]] refusal: NotRequired[Nullable[str]] tool_calls: NotRequired[List[ChatStreamingMessageToolCallTypedDict]] - reasoning_details: NotRequired[List[Schema2TypedDict]] + reasoning_details: NotRequired[List[Schema19TypedDict]] class ChatStreamingMessageChunk(BaseModel): @@ -41,7 +41,7 @@ class ChatStreamingMessageChunk(BaseModel): tool_calls: Optional[List[ChatStreamingMessageToolCall]] = None - reasoning_details: Optional[List[Schema2]] = None + reasoning_details: Optional[List[Schema19]] = None @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/completionchoice.py b/src/openrouter/components/completionchoice.py deleted file mode 100644 index 21ce2b9..0000000 --- a/src/openrouter/components/completionchoice.py +++ /dev/null @@ -1,82 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .completionlogprobs import CompletionLogprobs, CompletionLogprobsTypedDict -from openrouter.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, - UnrecognizedStr, -) -from openrouter.utils import validate_open_enum -from pydantic import model_serializer -from pydantic.functional_validators import PlainValidator -from typing import Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypedDict - - -CompletionFinishReason = Union[ - Literal[ - "stop", - "length", - "content_filter", - ], - UnrecognizedStr, -] - - -class CompletionChoiceTypedDict(TypedDict): - text: str - index: float - logprobs: Nullable[CompletionLogprobsTypedDict] - finish_reason: Nullable[CompletionFinishReason] - native_finish_reason: NotRequired[str] - reasoning: NotRequired[Nullable[str]] - - -class CompletionChoice(BaseModel): - text: str - - index: float - - logprobs: Nullable[CompletionLogprobs] - - finish_reason: Annotated[ - Nullable[CompletionFinishReason], PlainValidator(validate_open_enum(False)) - ] - - native_finish_reason: Optional[str] = None - - reasoning: OptionalNullable[str] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = ["native_finish_reason", "reasoning"] - nullable_fields = ["logprobs", "finish_reason", "reasoning"] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - return m diff --git a/src/openrouter/components/completioncreateparams.py b/src/openrouter/components/completioncreateparams.py deleted file mode 100644 index 712feaa..0000000 --- a/src/openrouter/components/completioncreateparams.py +++ /dev/null @@ -1,277 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .responseformatjsonschema import ( - ResponseFormatJSONSchema, - ResponseFormatJSONSchemaTypedDict, -) -from .responseformattextgrammar import ( - ResponseFormatTextGrammar, - ResponseFormatTextGrammarTypedDict, -) -from openrouter.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from openrouter.utils import get_discriminator, validate_const -import pydantic -from pydantic import Discriminator, Tag, model_serializer -from pydantic.functional_validators import AfterValidator -from typing import Dict, List, Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict - - -PromptTypedDict = TypeAliasType( - "PromptTypedDict", Union[str, List[str], List[float], List[List[float]]] -) - - -Prompt = TypeAliasType("Prompt", Union[str, List[str], List[float], List[List[float]]]) - - -CompletionCreateParamsStopTypedDict = TypeAliasType( - "CompletionCreateParamsStopTypedDict", Union[str, List[str]] -) - - -CompletionCreateParamsStop = TypeAliasType( - "CompletionCreateParamsStop", Union[str, List[str]] -) - - -class StreamOptionsTypedDict(TypedDict): - include_usage: NotRequired[Nullable[bool]] - - -class StreamOptions(BaseModel): - include_usage: OptionalNullable[bool] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = ["include_usage"] - nullable_fields = ["include_usage"] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - return m - - -class CompletionCreateParamsResponseFormatPythonTypedDict(TypedDict): - type: Literal["python"] - - -class CompletionCreateParamsResponseFormatPython(BaseModel): - TYPE: Annotated[ - Annotated[Literal["python"], AfterValidator(validate_const("python"))], - pydantic.Field(alias="type"), - ] = "python" - - -class CompletionCreateParamsResponseFormatJSONObjectTypedDict(TypedDict): - type: Literal["json_object"] - - -class CompletionCreateParamsResponseFormatJSONObject(BaseModel): - TYPE: Annotated[ - Annotated[ - Literal["json_object"], AfterValidator(validate_const("json_object")) - ], - pydantic.Field(alias="type"), - ] = "json_object" - - -class CompletionCreateParamsResponseFormatTextTypedDict(TypedDict): - type: Literal["text"] - - -class CompletionCreateParamsResponseFormatText(BaseModel): - TYPE: Annotated[ - Annotated[Literal["text"], AfterValidator(validate_const("text"))], - pydantic.Field(alias="type"), - ] = "text" - - -CompletionCreateParamsResponseFormatUnionTypedDict = TypeAliasType( - "CompletionCreateParamsResponseFormatUnionTypedDict", - Union[ - CompletionCreateParamsResponseFormatTextTypedDict, - CompletionCreateParamsResponseFormatJSONObjectTypedDict, - CompletionCreateParamsResponseFormatPythonTypedDict, - ResponseFormatJSONSchemaTypedDict, - ResponseFormatTextGrammarTypedDict, - ], -) - - -CompletionCreateParamsResponseFormatUnion = Annotated[ - Union[ - Annotated[CompletionCreateParamsResponseFormatText, Tag("text")], - Annotated[CompletionCreateParamsResponseFormatJSONObject, Tag("json_object")], - Annotated[ResponseFormatJSONSchema, Tag("json_schema")], - Annotated[ResponseFormatTextGrammar, Tag("grammar")], - Annotated[CompletionCreateParamsResponseFormatPython, Tag("python")], - ], - Discriminator(lambda m: get_discriminator(m, "type", "type")), -] - - -class CompletionCreateParamsTypedDict(TypedDict): - prompt: PromptTypedDict - model: NotRequired[str] - models: NotRequired[List[str]] - best_of: NotRequired[Nullable[int]] - echo: NotRequired[Nullable[bool]] - frequency_penalty: NotRequired[Nullable[float]] - logit_bias: NotRequired[Nullable[Dict[str, float]]] - logprobs: NotRequired[Nullable[int]] - max_tokens: NotRequired[Nullable[int]] - n: NotRequired[Nullable[int]] - presence_penalty: NotRequired[Nullable[float]] - seed: NotRequired[Nullable[int]] - stop: NotRequired[Nullable[CompletionCreateParamsStopTypedDict]] - stream: NotRequired[bool] - stream_options: NotRequired[Nullable[StreamOptionsTypedDict]] - suffix: NotRequired[Nullable[str]] - temperature: NotRequired[Nullable[float]] - top_p: NotRequired[Nullable[float]] - user: NotRequired[str] - metadata: NotRequired[Nullable[Dict[str, str]]] - response_format: NotRequired[ - Nullable[CompletionCreateParamsResponseFormatUnionTypedDict] - ] - - -class CompletionCreateParams(BaseModel): - prompt: Prompt - - model: Optional[str] = None - - models: Optional[List[str]] = None - - best_of: OptionalNullable[int] = UNSET - - echo: OptionalNullable[bool] = UNSET - - frequency_penalty: OptionalNullable[float] = UNSET - - logit_bias: OptionalNullable[Dict[str, float]] = UNSET - - logprobs: OptionalNullable[int] = UNSET - - max_tokens: OptionalNullable[int] = UNSET - - n: OptionalNullable[int] = UNSET - - presence_penalty: OptionalNullable[float] = UNSET - - seed: OptionalNullable[int] = UNSET - - stop: OptionalNullable[CompletionCreateParamsStop] = UNSET - - stream: Optional[bool] = False - - stream_options: OptionalNullable[StreamOptions] = UNSET - - suffix: OptionalNullable[str] = UNSET - - temperature: OptionalNullable[float] = UNSET - - top_p: OptionalNullable[float] = UNSET - - user: Optional[str] = None - - metadata: OptionalNullable[Dict[str, str]] = UNSET - - response_format: OptionalNullable[CompletionCreateParamsResponseFormatUnion] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = [ - "model", - "models", - "best_of", - "echo", - "frequency_penalty", - "logit_bias", - "logprobs", - "max_tokens", - "n", - "presence_penalty", - "seed", - "stop", - "stream", - "stream_options", - "suffix", - "temperature", - "top_p", - "user", - "metadata", - "response_format", - ] - nullable_fields = [ - "best_of", - "echo", - "frequency_penalty", - "logit_bias", - "logprobs", - "max_tokens", - "n", - "presence_penalty", - "seed", - "stop", - "stream_options", - "suffix", - "temperature", - "top_p", - "metadata", - "response_format", - ] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - return m diff --git a/src/openrouter/components/completionlogprobs.py b/src/openrouter/components/completionlogprobs.py deleted file mode 100644 index 758ccd1..0000000 --- a/src/openrouter/components/completionlogprobs.py +++ /dev/null @@ -1,54 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Dict, List -from typing_extensions import TypedDict - - -class CompletionLogprobsTypedDict(TypedDict): - tokens: List[str] - token_logprobs: List[float] - top_logprobs: Nullable[List[Dict[str, float]]] - text_offset: List[float] - - -class CompletionLogprobs(BaseModel): - tokens: List[str] - - token_logprobs: List[float] - - top_logprobs: Nullable[List[Dict[str, float]]] - - text_offset: List[float] - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = [] - nullable_fields = ["top_logprobs"] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - return m diff --git a/src/openrouter/components/completionresponse.py b/src/openrouter/components/completionresponse.py deleted file mode 100644 index dcdd529..0000000 --- a/src/openrouter/components/completionresponse.py +++ /dev/null @@ -1,46 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .completionchoice import CompletionChoice, CompletionChoiceTypedDict -from .completionusage import CompletionUsage, CompletionUsageTypedDict -from openrouter.types import BaseModel -from openrouter.utils import validate_const -import pydantic -from pydantic.functional_validators import AfterValidator -from typing import List, Literal, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class CompletionResponseTypedDict(TypedDict): - id: str - created: float - model: str - choices: List[CompletionChoiceTypedDict] - object: Literal["text_completion"] - provider: NotRequired[str] - system_fingerprint: NotRequired[str] - usage: NotRequired[CompletionUsageTypedDict] - - -class CompletionResponse(BaseModel): - id: str - - created: float - - model: str - - choices: List[CompletionChoice] - - OBJECT: Annotated[ - Annotated[ - Literal["text_completion"], - AfterValidator(validate_const("text_completion")), - ], - pydantic.Field(alias="object"), - ] = "text_completion" - - provider: Optional[str] = None - - system_fingerprint: Optional[str] = None - - usage: Optional[CompletionUsage] = None diff --git a/src/openrouter/components/completionusage.py b/src/openrouter/components/completionusage.py deleted file mode 100644 index 80bba78..0000000 --- a/src/openrouter/components/completionusage.py +++ /dev/null @@ -1,19 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from openrouter.types import BaseModel -from typing_extensions import TypedDict - - -class CompletionUsageTypedDict(TypedDict): - prompt_tokens: float - completion_tokens: float - total_tokens: float - - -class CompletionUsage(BaseModel): - prompt_tokens: float - - completion_tokens: float - - total_tokens: float diff --git a/src/openrouter/components/developermessage.py b/src/openrouter/components/developermessage.py new file mode 100644 index 0000000..b3042b0 --- /dev/null +++ b/src/openrouter/components/developermessage.py @@ -0,0 +1,41 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .chatmessagecontentitemtext import ( + ChatMessageContentItemText, + ChatMessageContentItemTextTypedDict, +) +from openrouter.types import BaseModel +from openrouter.utils import validate_const +import pydantic +from pydantic.functional_validators import AfterValidator +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +DeveloperMessageContentTypedDict = TypeAliasType( + "DeveloperMessageContentTypedDict", + Union[str, List[ChatMessageContentItemTextTypedDict]], +) + + +DeveloperMessageContent = TypeAliasType( + "DeveloperMessageContent", Union[str, List[ChatMessageContentItemText]] +) + + +class DeveloperMessageTypedDict(TypedDict): + content: DeveloperMessageContentTypedDict + role: Literal["developer"] + name: NotRequired[str] + + +class DeveloperMessage(BaseModel): + content: DeveloperMessageContent + + ROLE: Annotated[ + Annotated[Literal["developer"], AfterValidator(validate_const("developer"))], + pydantic.Field(alias="role"), + ] = "developer" + + name: Optional[str] = None diff --git a/src/openrouter/components/message.py b/src/openrouter/components/message.py index 8d92cba..569d0e0 100644 --- a/src/openrouter/components/message.py +++ b/src/openrouter/components/message.py @@ -2,47 +2,14 @@ from __future__ import annotations from .assistantmessage import AssistantMessage, AssistantMessageTypedDict -from .chatmessagecontentitemtext import ( - ChatMessageContentItemText, - ChatMessageContentItemTextTypedDict, -) +from .developermessage import DeveloperMessage, DeveloperMessageTypedDict from .systemmessage import SystemMessage, SystemMessageTypedDict from .toolresponsemessage import ToolResponseMessage, ToolResponseMessageTypedDict from .usermessage import UserMessage, UserMessageTypedDict -from openrouter.types import BaseModel -from openrouter.utils import get_discriminator, validate_const -import pydantic +from openrouter.utils import get_discriminator from pydantic import Discriminator, Tag -from pydantic.functional_validators import AfterValidator -from typing import List, Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict - - -MessageContentTypedDict = TypeAliasType( - "MessageContentTypedDict", Union[str, List[ChatMessageContentItemTextTypedDict]] -) - - -MessageContent = TypeAliasType( - "MessageContent", Union[str, List[ChatMessageContentItemText]] -) - - -class MessageDeveloperTypedDict(TypedDict): - content: MessageContentTypedDict - role: Literal["developer"] - name: NotRequired[str] - - -class MessageDeveloper(BaseModel): - content: MessageContent - - ROLE: Annotated[ - Annotated[Literal["developer"], AfterValidator(validate_const("developer"))], - pydantic.Field(alias="role"), - ] = "developer" - - name: Optional[str] = None +from typing import Union +from typing_extensions import Annotated, TypeAliasType MessageTypedDict = TypeAliasType( @@ -50,7 +17,7 @@ MessageTypedDict = TypeAliasType( Union[ SystemMessageTypedDict, UserMessageTypedDict, - MessageDeveloperTypedDict, + DeveloperMessageTypedDict, ToolResponseMessageTypedDict, AssistantMessageTypedDict, ], @@ -61,7 +28,7 @@ Message = Annotated[ Union[ Annotated[SystemMessage, Tag("system")], Annotated[UserMessage, Tag("user")], - Annotated[MessageDeveloper, Tag("developer")], + Annotated[DeveloperMessage, Tag("developer")], Annotated[AssistantMessage, Tag("assistant")], Annotated[ToolResponseMessage, Tag("tool")], ], diff --git a/src/openrouter/components/openresponsesrequest.py b/src/openrouter/components/openresponsesrequest.py index 9c55233..8d0071c 100644 --- a/src/openrouter/components/openresponsesrequest.py +++ b/src/openrouter/components/openresponsesrequest.py @@ -222,37 +222,29 @@ class OpenResponsesRequestMaxPriceTypedDict(TypedDict): r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" prompt: NotRequired[str] - r"""A value in string format that is a large number""" + r"""Price per million prompt tokens""" completion: NotRequired[str] - r"""A value in string format that is a large number""" image: NotRequired[str] - r"""A value in string format that is a large number""" audio: NotRequired[str] - r"""A value in string format that is a large number""" request: NotRequired[str] - r"""A value in string format that is a large number""" class OpenResponsesRequestMaxPrice(BaseModel): r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" prompt: Optional[str] = None - r"""A value in string format that is a large number""" + r"""Price per million prompt tokens""" completion: Optional[str] = None - r"""A value in string format that is a large number""" image: Optional[str] = None - r"""A value in string format that is a large number""" audio: Optional[str] = None - r"""A value in string format that is a large number""" request: Optional[str] = None - r"""A value in string format that is a large number""" -class OpenResponsesRequestProviderTypedDict(TypedDict): +class ProviderTypedDict(TypedDict): r"""When multiple model providers are available, optionally indicate your routing preference.""" allow_fallbacks: NotRequired[Nullable[bool]] @@ -291,7 +283,7 @@ class OpenResponsesRequestProviderTypedDict(TypedDict): r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" -class OpenResponsesRequestProvider(BaseModel): +class Provider(BaseModel): r"""When multiple model providers are available, optionally indicate your routing preference.""" allow_fallbacks: OptionalNullable[bool] = UNSET @@ -406,13 +398,13 @@ class OpenResponsesRequestProvider(BaseModel): IDResponseHealing = Literal["response-healing",] -class OpenResponsesRequestPluginResponseHealingTypedDict(TypedDict): +class PluginResponseHealingTypedDict(TypedDict): id: IDResponseHealing enabled: NotRequired[bool] r"""Set to false to disable the response-healing plugin for this request. Defaults to true.""" -class OpenResponsesRequestPluginResponseHealing(BaseModel): +class PluginResponseHealing(BaseModel): id: IDResponseHealing enabled: Optional[bool] = None @@ -422,7 +414,7 @@ class OpenResponsesRequestPluginResponseHealing(BaseModel): IDFileParser = Literal["file-parser",] -class OpenResponsesRequestPluginFileParserTypedDict(TypedDict): +class PluginFileParserTypedDict(TypedDict): id: IDFileParser enabled: NotRequired[bool] r"""Set to false to disable the file-parser plugin for this request. Defaults to true.""" @@ -430,7 +422,7 @@ class OpenResponsesRequestPluginFileParserTypedDict(TypedDict): r"""Options for PDF parsing.""" -class OpenResponsesRequestPluginFileParser(BaseModel): +class PluginFileParser(BaseModel): id: IDFileParser enabled: Optional[bool] = None @@ -443,7 +435,7 @@ class OpenResponsesRequestPluginFileParser(BaseModel): IDWeb = Literal["web",] -class OpenResponsesRequestPluginWebTypedDict(TypedDict): +class PluginWebTypedDict(TypedDict): id: IDWeb enabled: NotRequired[bool] r"""Set to false to disable the web-search plugin for this request. Defaults to true.""" @@ -453,7 +445,7 @@ class OpenResponsesRequestPluginWebTypedDict(TypedDict): r"""The search engine to use for web search.""" -class OpenResponsesRequestPluginWeb(BaseModel): +class PluginWeb(BaseModel): id: IDWeb enabled: Optional[bool] = None @@ -472,18 +464,18 @@ class OpenResponsesRequestPluginWeb(BaseModel): IDModeration = Literal["moderation",] -class OpenResponsesRequestPluginModerationTypedDict(TypedDict): +class PluginModerationTypedDict(TypedDict): id: IDModeration -class OpenResponsesRequestPluginModeration(BaseModel): +class PluginModeration(BaseModel): id: IDModeration IDAutoRouter = Literal["auto-router",] -class OpenResponsesRequestPluginAutoRouterTypedDict(TypedDict): +class PluginAutoRouterTypedDict(TypedDict): id: IDAutoRouter enabled: NotRequired[bool] r"""Set to false to disable the auto-router plugin for this request. Defaults to true.""" @@ -491,7 +483,7 @@ class OpenResponsesRequestPluginAutoRouterTypedDict(TypedDict): r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list.""" -class OpenResponsesRequestPluginAutoRouter(BaseModel): +class PluginAutoRouter(BaseModel): id: IDAutoRouter enabled: Optional[bool] = None @@ -501,25 +493,25 @@ class OpenResponsesRequestPluginAutoRouter(BaseModel): r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list.""" -OpenResponsesRequestPluginUnionTypedDict = TypeAliasType( - "OpenResponsesRequestPluginUnionTypedDict", +PluginTypedDict = TypeAliasType( + "PluginTypedDict", Union[ - OpenResponsesRequestPluginModerationTypedDict, - OpenResponsesRequestPluginResponseHealingTypedDict, - OpenResponsesRequestPluginAutoRouterTypedDict, - OpenResponsesRequestPluginFileParserTypedDict, - OpenResponsesRequestPluginWebTypedDict, + PluginModerationTypedDict, + PluginResponseHealingTypedDict, + PluginAutoRouterTypedDict, + PluginFileParserTypedDict, + PluginWebTypedDict, ], ) -OpenResponsesRequestPluginUnion = Annotated[ +Plugin = Annotated[ Union[ - Annotated[OpenResponsesRequestPluginAutoRouter, Tag("auto-router")], - Annotated[OpenResponsesRequestPluginModeration, Tag("moderation")], - Annotated[OpenResponsesRequestPluginWeb, Tag("web")], - Annotated[OpenResponsesRequestPluginFileParser, Tag("file-parser")], - Annotated[OpenResponsesRequestPluginResponseHealing, Tag("response-healing")], + Annotated[PluginAutoRouter, Tag("auto-router")], + Annotated[PluginModeration, Tag("moderation")], + Annotated[PluginWeb, Tag("web")], + Annotated[PluginFileParser, Tag("file-parser")], + Annotated[PluginResponseHealing, Tag("response-healing")], ], Discriminator(lambda m: get_discriminator(m, "id", "id")), ] @@ -564,9 +556,9 @@ class OpenResponsesRequestTypedDict(TypedDict): service_tier: NotRequired[ServiceTier] truncation: NotRequired[Nullable[Truncation]] stream: NotRequired[bool] - provider: NotRequired[Nullable[OpenResponsesRequestProviderTypedDict]] + provider: NotRequired[Nullable[ProviderTypedDict]] r"""When multiple model providers are available, optionally indicate your routing preference.""" - plugins: NotRequired[List[OpenResponsesRequestPluginUnionTypedDict]] + plugins: NotRequired[List[PluginTypedDict]] r"""Plugins you want to enable for this request, including their settings.""" user: NotRequired[str] r"""A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.""" @@ -660,10 +652,10 @@ class OpenResponsesRequest(BaseModel): stream: Optional[bool] = False - provider: OptionalNullable[OpenResponsesRequestProvider] = UNSET + provider: OptionalNullable[Provider] = UNSET r"""When multiple model providers are available, optionally indicate your routing preference.""" - plugins: Optional[List[OpenResponsesRequestPluginUnion]] = None + plugins: Optional[List[Plugin]] = None r"""Plugins you want to enable for this request, including their settings.""" user: Optional[str] = None diff --git a/src/openrouter/components/providername.py b/src/openrouter/components/providername.py index e9c1402..29c27a6 100644 --- a/src/openrouter/components/providername.py +++ b/src/openrouter/components/providername.py @@ -10,6 +10,7 @@ ProviderName = Union[ "AI21", "AionLabs", "Alibaba", + "Ambient", "Amazon Bedrock", "Amazon Nova", "Anthropic", @@ -66,6 +67,7 @@ ProviderName = Union[ "Seed", "SiliconFlow", "Sourceful", + "StepFun", "Stealth", "StreamLake", "Switchpoint", diff --git a/src/openrouter/components/providerpreferences.py b/src/openrouter/components/providerpreferences.py index b0d41b0..d3ad2c7 100644 --- a/src/openrouter/components/providerpreferences.py +++ b/src/openrouter/components/providerpreferences.py @@ -176,34 +176,26 @@ class ProviderPreferencesMaxPriceTypedDict(TypedDict): r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" prompt: NotRequired[str] - r"""A value in string format that is a large number""" + r"""Price per million prompt tokens""" completion: NotRequired[str] - r"""A value in string format that is a large number""" image: NotRequired[str] - r"""A value in string format that is a large number""" audio: NotRequired[str] - r"""A value in string format that is a large number""" request: NotRequired[str] - r"""A value in string format that is a large number""" class ProviderPreferencesMaxPrice(BaseModel): r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" prompt: Optional[str] = None - r"""A value in string format that is a large number""" + r"""Price per million prompt tokens""" completion: Optional[str] = None - r"""A value in string format that is a large number""" image: Optional[str] = None - r"""A value in string format that is a large number""" audio: Optional[str] = None - r"""A value in string format that is a large number""" request: Optional[str] = None - r"""A value in string format that is a large number""" class ProviderPreferencesTypedDict(TypedDict): diff --git a/src/openrouter/components/publicendpoint.py b/src/openrouter/components/publicendpoint.py index dcb5e7c..522f96b 100644 --- a/src/openrouter/components/publicendpoint.py +++ b/src/openrouter/components/publicendpoint.py @@ -15,73 +15,47 @@ from typing_extensions import Annotated, NotRequired, TypedDict class PricingTypedDict(TypedDict): prompt: str - r"""A value in string format that is a large number""" completion: str - r"""A value in string format that is a large number""" request: NotRequired[str] - r"""A value in string format that is a large number""" image: NotRequired[str] - r"""A value in string format that is a large number""" image_token: NotRequired[str] - r"""A value in string format that is a large number""" image_output: NotRequired[str] - r"""A value in string format that is a large number""" audio: NotRequired[str] - r"""A value in string format that is a large number""" audio_output: NotRequired[str] - r"""A value in string format that is a large number""" input_audio_cache: NotRequired[str] - r"""A value in string format that is a large number""" web_search: NotRequired[str] - r"""A value in string format that is a large number""" internal_reasoning: NotRequired[str] - r"""A value in string format that is a large number""" input_cache_read: NotRequired[str] - r"""A value in string format that is a large number""" input_cache_write: NotRequired[str] - r"""A value in string format that is a large number""" discount: NotRequired[float] class Pricing(BaseModel): prompt: str - r"""A value in string format that is a large number""" completion: str - r"""A value in string format that is a large number""" request: Optional[str] = None - r"""A value in string format that is a large number""" image: Optional[str] = None - r"""A value in string format that is a large number""" image_token: Optional[str] = None - r"""A value in string format that is a large number""" image_output: Optional[str] = None - r"""A value in string format that is a large number""" audio: Optional[str] = None - r"""A value in string format that is a large number""" audio_output: Optional[str] = None - r"""A value in string format that is a large number""" input_audio_cache: Optional[str] = None - r"""A value in string format that is a large number""" web_search: Optional[str] = None - r"""A value in string format that is a large number""" internal_reasoning: Optional[str] = None - r"""A value in string format that is a large number""" input_cache_read: Optional[str] = None - r"""A value in string format that is a large number""" input_cache_write: Optional[str] = None - r"""A value in string format that is a large number""" discount: Optional[float] = None diff --git a/src/openrouter/components/publicpricing.py b/src/openrouter/components/publicpricing.py index 5bd726d..0aef8d6 100644 --- a/src/openrouter/components/publicpricing.py +++ b/src/openrouter/components/publicpricing.py @@ -10,31 +10,18 @@ class PublicPricingTypedDict(TypedDict): r"""Pricing information for the model""" prompt: str - r"""A value in string format that is a large number""" completion: str - r"""A value in string format that is a large number""" request: NotRequired[str] - r"""A value in string format that is a large number""" image: NotRequired[str] - r"""A value in string format that is a large number""" image_token: NotRequired[str] - r"""A value in string format that is a large number""" image_output: NotRequired[str] - r"""A value in string format that is a large number""" audio: NotRequired[str] - r"""A value in string format that is a large number""" audio_output: NotRequired[str] - r"""A value in string format that is a large number""" input_audio_cache: NotRequired[str] - r"""A value in string format that is a large number""" web_search: NotRequired[str] - r"""A value in string format that is a large number""" internal_reasoning: NotRequired[str] - r"""A value in string format that is a large number""" input_cache_read: NotRequired[str] - r"""A value in string format that is a large number""" input_cache_write: NotRequired[str] - r"""A value in string format that is a large number""" discount: NotRequired[float] @@ -42,42 +29,29 @@ class PublicPricing(BaseModel): r"""Pricing information for the model""" prompt: str - r"""A value in string format that is a large number""" completion: str - r"""A value in string format that is a large number""" request: Optional[str] = None - r"""A value in string format that is a large number""" image: Optional[str] = None - r"""A value in string format that is a large number""" image_token: Optional[str] = None - r"""A value in string format that is a large number""" image_output: Optional[str] = None - r"""A value in string format that is a large number""" audio: Optional[str] = None - r"""A value in string format that is a large number""" audio_output: Optional[str] = None - r"""A value in string format that is a large number""" input_audio_cache: Optional[str] = None - r"""A value in string format that is a large number""" web_search: Optional[str] = None - r"""A value in string format that is a large number""" internal_reasoning: Optional[str] = None - r"""A value in string format that is a large number""" input_cache_read: Optional[str] = None - r"""A value in string format that is a large number""" input_cache_write: Optional[str] = None - r"""A value in string format that is a large number""" discount: Optional[float] = None diff --git a/src/openrouter/credits.py b/src/openrouter/credits.py index fc70b00..9ad87fd 100644 --- a/src/openrouter/credits.py +++ b/src/openrouter/credits.py @@ -15,6 +15,8 @@ class Credits(BaseSDK): def get_credits( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -22,7 +24,12 @@ class Credits(BaseSDK): ) -> operations.GetCreditsResponse: r"""Get remaining credits - Get total credits purchased and used for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Get total credits purchased and used for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -38,18 +45,28 @@ class Credits(BaseSDK): base_url = server_url else: base_url = self._get_url(base_url, url_variables) + + request = operations.GetCreditsRequest( + http_referer=http_referer, + x_title=x_title, + ) + req = self._build_request( method="GET", path="/credits", base_url=base_url, url_variables=url_variables, - request=None, + request=request, request_body_required=False, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.GetCreditsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -112,6 +129,8 @@ class Credits(BaseSDK): async def get_credits_async( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -119,7 +138,12 @@ class Credits(BaseSDK): ) -> operations.GetCreditsResponse: r"""Get remaining credits - Get total credits purchased and used for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Get total credits purchased and used for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -135,18 +159,28 @@ class Credits(BaseSDK): base_url = server_url else: base_url = self._get_url(base_url, url_variables) + + request = operations.GetCreditsRequest( + http_referer=http_referer, + x_title=x_title, + ) + req = self._build_request_async( method="GET", path="/credits", base_url=base_url, url_variables=url_variables, - request=None, + request=request, request_body_required=False, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.GetCreditsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -216,6 +250,8 @@ class Credits(BaseSDK): amount: float, sender: str, chain_id: components.ChainID, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -229,6 +265,11 @@ class Credits(BaseSDK): :param amount: :param sender: :param chain_id: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -244,10 +285,14 @@ class Credits(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = components.CreateChargeRequest( - amount=amount, - sender=sender, - chain_id=chain_id, + request = operations.CreateCoinbaseChargeRequest( + http_referer=http_referer, + x_title=x_title, + create_charge_request=components.CreateChargeRequest( + amount=amount, + sender=sender, + chain_id=chain_id, + ), ) req = self._build_request( @@ -262,11 +307,19 @@ class Credits(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.CreateCoinbaseChargeGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=utils.get_pydantic_model( security, operations.CreateCoinbaseChargeSecurity ), get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", components.CreateChargeRequest + request.create_charge_request, + False, + False, + "json", + components.CreateChargeRequest, ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -341,6 +394,8 @@ class Credits(BaseSDK): amount: float, sender: str, chain_id: components.ChainID, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -354,6 +409,11 @@ class Credits(BaseSDK): :param amount: :param sender: :param chain_id: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -369,10 +429,14 @@ class Credits(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = components.CreateChargeRequest( - amount=amount, - sender=sender, - chain_id=chain_id, + request = operations.CreateCoinbaseChargeRequest( + http_referer=http_referer, + x_title=x_title, + create_charge_request=components.CreateChargeRequest( + amount=amount, + sender=sender, + chain_id=chain_id, + ), ) req = self._build_request_async( @@ -387,11 +451,19 @@ class Credits(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.CreateCoinbaseChargeGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=utils.get_pydantic_model( security, operations.CreateCoinbaseChargeSecurity ), get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", components.CreateChargeRequest + request.create_charge_request, + False, + False, + "json", + components.CreateChargeRequest, ), allow_empty_value=None, timeout_ms=timeout_ms, diff --git a/src/openrouter/embeddings.py b/src/openrouter/embeddings.py index 20e9512..9a32c49 100644 --- a/src/openrouter/embeddings.py +++ b/src/openrouter/embeddings.py @@ -23,6 +23,8 @@ class Embeddings(BaseSDK): *, input: Union[operations.InputUnion, operations.InputUnionTypedDict], model: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, encoding_format: Optional[operations.EncodingFormat] = None, dimensions: Optional[int] = None, user: Optional[str] = None, @@ -44,6 +46,11 @@ class Embeddings(BaseSDK): :param input: :param model: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param encoding_format: :param dimensions: :param user: @@ -66,15 +73,19 @@ class Embeddings(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.CreateEmbeddingsRequest( - input=utils.get_pydantic_model(input, operations.InputUnion), - model=model, - encoding_format=encoding_format, - dimensions=dimensions, - user=user, - provider=utils.get_pydantic_model( - provider, Optional[components.ProviderPreferences] + http_referer=http_referer, + x_title=x_title, + request_body=operations.CreateEmbeddingsRequestBody( + input=utils.get_pydantic_model(input, operations.InputUnion), + model=model, + encoding_format=encoding_format, + dimensions=dimensions, + user=user, + provider=utils.get_pydantic_model( + provider, Optional[components.ProviderPreferences] + ), + input_type=input_type, ), - input_type=input_type, ) req = self._build_request( @@ -91,9 +102,17 @@ class Embeddings(BaseSDK): if accept_header_override is not None else "application/json;q=1, text/event-stream;q=0", http_headers=http_headers, + _globals=operations.CreateEmbeddingsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", operations.CreateEmbeddingsRequest + request.request_body, + False, + False, + "json", + operations.CreateEmbeddingsRequestBody, ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -210,6 +229,8 @@ class Embeddings(BaseSDK): *, input: Union[operations.InputUnion, operations.InputUnionTypedDict], model: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, encoding_format: Optional[operations.EncodingFormat] = None, dimensions: Optional[int] = None, user: Optional[str] = None, @@ -231,6 +252,11 @@ class Embeddings(BaseSDK): :param input: :param model: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param encoding_format: :param dimensions: :param user: @@ -253,15 +279,19 @@ class Embeddings(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.CreateEmbeddingsRequest( - input=utils.get_pydantic_model(input, operations.InputUnion), - model=model, - encoding_format=encoding_format, - dimensions=dimensions, - user=user, - provider=utils.get_pydantic_model( - provider, Optional[components.ProviderPreferences] + http_referer=http_referer, + x_title=x_title, + request_body=operations.CreateEmbeddingsRequestBody( + input=utils.get_pydantic_model(input, operations.InputUnion), + model=model, + encoding_format=encoding_format, + dimensions=dimensions, + user=user, + provider=utils.get_pydantic_model( + provider, Optional[components.ProviderPreferences] + ), + input_type=input_type, ), - input_type=input_type, ) req = self._build_request_async( @@ -278,9 +308,17 @@ class Embeddings(BaseSDK): if accept_header_override is not None else "application/json;q=1, text/event-stream;q=0", http_headers=http_headers, + _globals=operations.CreateEmbeddingsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", operations.CreateEmbeddingsRequest + request.request_body, + False, + False, + "json", + operations.CreateEmbeddingsRequestBody, ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -395,6 +433,8 @@ class Embeddings(BaseSDK): def list_models( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -404,6 +444,11 @@ class Embeddings(BaseSDK): Returns a list of all available embeddings models and their properties + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -418,18 +463,28 @@ class Embeddings(BaseSDK): base_url = server_url else: base_url = self._get_url(base_url, url_variables) + + request = operations.ListEmbeddingsModelsRequest( + http_referer=http_referer, + x_title=x_title, + ) + req = self._build_request( method="GET", path="/embeddings/models", base_url=base_url, url_variables=url_variables, - request=None, + request=request, request_body_required=False, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListEmbeddingsModelsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -487,6 +542,8 @@ class Embeddings(BaseSDK): async def list_models_async( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -496,6 +553,11 @@ class Embeddings(BaseSDK): Returns a list of all available embeddings models and their properties + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -510,18 +572,28 @@ class Embeddings(BaseSDK): base_url = server_url else: base_url = self._get_url(base_url, url_variables) + + request = operations.ListEmbeddingsModelsRequest( + http_referer=http_referer, + x_title=x_title, + ) + req = self._build_request_async( method="GET", path="/embeddings/models", base_url=base_url, url_variables=url_variables, - request=None, + request=request, request_body_required=False, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListEmbeddingsModelsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, diff --git a/src/openrouter/endpoints.py b/src/openrouter/endpoints.py index 23f6842..0d37b12 100644 --- a/src/openrouter/endpoints.py +++ b/src/openrouter/endpoints.py @@ -17,6 +17,8 @@ class Endpoints(BaseSDK): *, author: str, slug: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -26,6 +28,11 @@ class Endpoints(BaseSDK): :param author: :param slug: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -42,6 +49,8 @@ class Endpoints(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ListEndpointsRequest( + http_referer=http_referer, + x_title=x_title, author=author, slug=slug, ) @@ -58,6 +67,10 @@ class Endpoints(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListEndpointsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -117,6 +130,8 @@ class Endpoints(BaseSDK): *, author: str, slug: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -126,6 +141,11 @@ class Endpoints(BaseSDK): :param author: :param slug: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -142,6 +162,8 @@ class Endpoints(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ListEndpointsRequest( + http_referer=http_referer, + x_title=x_title, author=author, slug=slug, ) @@ -158,6 +180,10 @@ class Endpoints(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListEndpointsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -215,6 +241,8 @@ class Endpoints(BaseSDK): def list_zdr_endpoints( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -222,6 +250,11 @@ class Endpoints(BaseSDK): ) -> operations.ListEndpointsZdrResponse: r"""Preview the impact of ZDR on the available endpoints + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -236,18 +269,28 @@ class Endpoints(BaseSDK): base_url = server_url else: base_url = self._get_url(base_url, url_variables) + + request = operations.ListEndpointsZdrRequest( + http_referer=http_referer, + x_title=x_title, + ) + req = self._build_request( method="GET", path="/endpoints/zdr", base_url=base_url, url_variables=url_variables, - request=None, + request=request, request_body_required=False, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListEndpointsZdrGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -302,6 +345,8 @@ class Endpoints(BaseSDK): async def list_zdr_endpoints_async( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -309,6 +354,11 @@ class Endpoints(BaseSDK): ) -> operations.ListEndpointsZdrResponse: r"""Preview the impact of ZDR on the available endpoints + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -323,18 +373,28 @@ class Endpoints(BaseSDK): base_url = server_url else: base_url = self._get_url(base_url, url_variables) + + request = operations.ListEndpointsZdrRequest( + http_referer=http_referer, + x_title=x_title, + ) + req = self._build_request_async( method="GET", path="/endpoints/zdr", base_url=base_url, url_variables=url_variables, - request=None, + request=request, request_body_required=False, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListEndpointsZdrGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, diff --git a/src/openrouter/generations.py b/src/openrouter/generations.py index fd085ef..7a3a199 100644 --- a/src/openrouter/generations.py +++ b/src/openrouter/generations.py @@ -16,6 +16,8 @@ class Generations(BaseSDK): self, *, id: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -24,6 +26,11 @@ class Generations(BaseSDK): r"""Get request & usage metadata for a generation :param id: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -40,6 +47,8 @@ class Generations(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.GetGenerationRequest( + http_referer=http_referer, + x_title=x_title, id=id, ) @@ -55,6 +64,10 @@ class Generations(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.GetGenerationGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -154,6 +167,8 @@ class Generations(BaseSDK): self, *, id: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -162,6 +177,11 @@ class Generations(BaseSDK): r"""Get request & usage metadata for a generation :param id: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -178,6 +198,8 @@ class Generations(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.GetGenerationRequest( + http_referer=http_referer, + x_title=x_title, id=id, ) @@ -193,6 +215,10 @@ class Generations(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.GetGenerationGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, diff --git a/src/openrouter/guardrails.py b/src/openrouter/guardrails.py index 73c7370..a8454a6 100644 --- a/src/openrouter/guardrails.py +++ b/src/openrouter/guardrails.py @@ -15,6 +15,8 @@ class Guardrails(BaseSDK): def list( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, offset: Optional[str] = None, limit: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -24,7 +26,12 @@ class Guardrails(BaseSDK): ) -> operations.ListGuardrailsResponse: r"""List guardrails - List all guardrails for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. :param offset: Number of records to skip for pagination :param limit: Maximum number of records to return (max 100) @@ -44,6 +51,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ListGuardrailsRequest( + http_referer=http_referer, + x_title=x_title, offset=offset, limit=limit, ) @@ -60,6 +69,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListGuardrailsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -117,6 +130,8 @@ class Guardrails(BaseSDK): async def list_async( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, offset: Optional[str] = None, limit: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -126,7 +141,12 @@ class Guardrails(BaseSDK): ) -> operations.ListGuardrailsResponse: r"""List guardrails - List all guardrails for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. :param offset: Number of records to skip for pagination :param limit: Maximum number of records to return (max 100) @@ -146,6 +166,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ListGuardrailsRequest( + http_referer=http_referer, + x_title=x_title, offset=offset, limit=limit, ) @@ -162,6 +184,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListGuardrailsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -220,6 +246,8 @@ class Guardrails(BaseSDK): self, *, name: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, description: OptionalNullable[str] = UNSET, limit_usd: OptionalNullable[float] = UNSET, reset_interval: OptionalNullable[ @@ -235,9 +263,14 @@ class Guardrails(BaseSDK): ) -> operations.CreateGuardrailResponse: r"""Create a guardrail - Create a new guardrail for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Create a new guardrail for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param name: Name for the new guardrail + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param description: Description of the guardrail :param limit_usd: Spending limit in USD :param reset_interval: Interval at which the limit resets (daily, weekly, monthly) @@ -260,13 +293,17 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.CreateGuardrailRequest( - name=name, - description=description, - limit_usd=limit_usd, - reset_interval=reset_interval, - allowed_providers=allowed_providers, - allowed_models=allowed_models, - enforce_zdr=enforce_zdr, + http_referer=http_referer, + x_title=x_title, + request_body=operations.CreateGuardrailRequestBody( + name=name, + description=description, + limit_usd=limit_usd, + reset_interval=reset_interval, + allowed_providers=allowed_providers, + allowed_models=allowed_models, + enforce_zdr=enforce_zdr, + ), ) req = self._build_request( @@ -281,9 +318,17 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.CreateGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", operations.CreateGuardrailRequest + request.request_body, + False, + False, + "json", + operations.CreateGuardrailRequestBody, ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -347,6 +392,8 @@ class Guardrails(BaseSDK): self, *, name: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, description: OptionalNullable[str] = UNSET, limit_usd: OptionalNullable[float] = UNSET, reset_interval: OptionalNullable[ @@ -362,9 +409,14 @@ class Guardrails(BaseSDK): ) -> operations.CreateGuardrailResponse: r"""Create a guardrail - Create a new guardrail for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Create a new guardrail for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param name: Name for the new guardrail + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param description: Description of the guardrail :param limit_usd: Spending limit in USD :param reset_interval: Interval at which the limit resets (daily, weekly, monthly) @@ -387,13 +439,17 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.CreateGuardrailRequest( - name=name, - description=description, - limit_usd=limit_usd, - reset_interval=reset_interval, - allowed_providers=allowed_providers, - allowed_models=allowed_models, - enforce_zdr=enforce_zdr, + http_referer=http_referer, + x_title=x_title, + request_body=operations.CreateGuardrailRequestBody( + name=name, + description=description, + limit_usd=limit_usd, + reset_interval=reset_interval, + allowed_providers=allowed_providers, + allowed_models=allowed_models, + enforce_zdr=enforce_zdr, + ), ) req = self._build_request_async( @@ -408,9 +464,17 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.CreateGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", operations.CreateGuardrailRequest + request.request_body, + False, + False, + "json", + operations.CreateGuardrailRequestBody, ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -474,6 +538,8 @@ class Guardrails(BaseSDK): self, *, id: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -481,9 +547,14 @@ class Guardrails(BaseSDK): ) -> operations.GetGuardrailResponse: r"""Get a guardrail - Get a single guardrail by ID. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Get a single guardrail by ID. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail to retrieve + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -500,6 +571,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.GetGuardrailRequest( + http_referer=http_referer, + x_title=x_title, id=id, ) @@ -515,6 +588,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.GetGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -578,6 +655,8 @@ class Guardrails(BaseSDK): self, *, id: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -585,9 +664,14 @@ class Guardrails(BaseSDK): ) -> operations.GetGuardrailResponse: r"""Get a guardrail - Get a single guardrail by ID. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Get a single guardrail by ID. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail to retrieve + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -604,6 +688,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.GetGuardrailRequest( + http_referer=http_referer, + x_title=x_title, id=id, ) @@ -619,6 +705,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.GetGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -682,6 +772,8 @@ class Guardrails(BaseSDK): self, *, id: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, name: Optional[str] = None, description: OptionalNullable[str] = UNSET, limit_usd: OptionalNullable[float] = UNSET, @@ -698,9 +790,14 @@ class Guardrails(BaseSDK): ) -> operations.UpdateGuardrailResponse: r"""Update a guardrail - Update an existing guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Update an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail to update + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param name: New name for the guardrail :param description: New description for the guardrail :param limit_usd: New spending limit in USD @@ -724,6 +821,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.UpdateGuardrailRequest( + http_referer=http_referer, + x_title=x_title, id=id, request_body=operations.UpdateGuardrailRequestBody( name=name, @@ -748,6 +847,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.UpdateGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request.request_body, @@ -823,6 +926,8 @@ class Guardrails(BaseSDK): self, *, id: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, name: Optional[str] = None, description: OptionalNullable[str] = UNSET, limit_usd: OptionalNullable[float] = UNSET, @@ -839,9 +944,14 @@ class Guardrails(BaseSDK): ) -> operations.UpdateGuardrailResponse: r"""Update a guardrail - Update an existing guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Update an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail to update + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param name: New name for the guardrail :param description: New description for the guardrail :param limit_usd: New spending limit in USD @@ -865,6 +975,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.UpdateGuardrailRequest( + http_referer=http_referer, + x_title=x_title, id=id, request_body=operations.UpdateGuardrailRequestBody( name=name, @@ -889,6 +1001,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.UpdateGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request.request_body, @@ -964,6 +1080,8 @@ class Guardrails(BaseSDK): self, *, id: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -971,9 +1089,14 @@ class Guardrails(BaseSDK): ) -> operations.DeleteGuardrailResponse: r"""Delete a guardrail - Delete an existing guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Delete an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail to delete + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -990,6 +1113,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.DeleteGuardrailRequest( + http_referer=http_referer, + x_title=x_title, id=id, ) @@ -1005,6 +1130,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.DeleteGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -1068,6 +1197,8 @@ class Guardrails(BaseSDK): self, *, id: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -1075,9 +1206,14 @@ class Guardrails(BaseSDK): ) -> operations.DeleteGuardrailResponse: r"""Delete a guardrail - Delete an existing guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Delete an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail to delete + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -1094,6 +1230,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.DeleteGuardrailRequest( + http_referer=http_referer, + x_title=x_title, id=id, ) @@ -1109,6 +1247,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.DeleteGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -1171,6 +1313,8 @@ class Guardrails(BaseSDK): def list_key_assignments( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, offset: Optional[str] = None, limit: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -1180,7 +1324,12 @@ class Guardrails(BaseSDK): ) -> operations.ListKeyAssignmentsResponse: r"""List all key assignments - List all API key guardrail assignments for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all API key guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. :param offset: Number of records to skip for pagination :param limit: Maximum number of records to return (max 100) @@ -1200,6 +1349,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ListKeyAssignmentsRequest( + http_referer=http_referer, + x_title=x_title, offset=offset, limit=limit, ) @@ -1216,6 +1367,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListKeyAssignmentsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -1275,6 +1430,8 @@ class Guardrails(BaseSDK): async def list_key_assignments_async( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, offset: Optional[str] = None, limit: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -1284,7 +1441,12 @@ class Guardrails(BaseSDK): ) -> operations.ListKeyAssignmentsResponse: r"""List all key assignments - List all API key guardrail assignments for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all API key guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. :param offset: Number of records to skip for pagination :param limit: Maximum number of records to return (max 100) @@ -1304,6 +1466,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ListKeyAssignmentsRequest( + http_referer=http_referer, + x_title=x_title, offset=offset, limit=limit, ) @@ -1320,6 +1484,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListKeyAssignmentsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -1379,6 +1547,8 @@ class Guardrails(BaseSDK): def list_member_assignments( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, offset: Optional[str] = None, limit: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -1388,7 +1558,12 @@ class Guardrails(BaseSDK): ) -> operations.ListMemberAssignmentsResponse: r"""List all member assignments - List all organization member guardrail assignments for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all organization member guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. :param offset: Number of records to skip for pagination :param limit: Maximum number of records to return (max 100) @@ -1408,6 +1583,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ListMemberAssignmentsRequest( + http_referer=http_referer, + x_title=x_title, offset=offset, limit=limit, ) @@ -1424,6 +1601,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListMemberAssignmentsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -1483,6 +1664,8 @@ class Guardrails(BaseSDK): async def list_member_assignments_async( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, offset: Optional[str] = None, limit: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -1492,7 +1675,12 @@ class Guardrails(BaseSDK): ) -> operations.ListMemberAssignmentsResponse: r"""List all member assignments - List all organization member guardrail assignments for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all organization member guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. :param offset: Number of records to skip for pagination :param limit: Maximum number of records to return (max 100) @@ -1512,6 +1700,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ListMemberAssignmentsRequest( + http_referer=http_referer, + x_title=x_title, offset=offset, limit=limit, ) @@ -1528,6 +1718,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListMemberAssignmentsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -1588,6 +1782,8 @@ class Guardrails(BaseSDK): self, *, id: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, offset: Optional[str] = None, limit: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -1597,9 +1793,14 @@ class Guardrails(BaseSDK): ) -> operations.ListGuardrailKeyAssignmentsResponse: r"""List key assignments for a guardrail - List all API key assignments for a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all API key assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param offset: Number of records to skip for pagination :param limit: Maximum number of records to return (max 100) :param retries: Override the default retry configuration for this method @@ -1618,6 +1819,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ListGuardrailKeyAssignmentsRequest( + http_referer=http_referer, + x_title=x_title, id=id, offset=offset, limit=limit, @@ -1635,6 +1838,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListGuardrailKeyAssignmentsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -1700,6 +1907,8 @@ class Guardrails(BaseSDK): self, *, id: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, offset: Optional[str] = None, limit: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -1709,9 +1918,14 @@ class Guardrails(BaseSDK): ) -> operations.ListGuardrailKeyAssignmentsResponse: r"""List key assignments for a guardrail - List all API key assignments for a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all API key assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param offset: Number of records to skip for pagination :param limit: Maximum number of records to return (max 100) :param retries: Override the default retry configuration for this method @@ -1730,6 +1944,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ListGuardrailKeyAssignmentsRequest( + http_referer=http_referer, + x_title=x_title, id=id, offset=offset, limit=limit, @@ -1747,6 +1963,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListGuardrailKeyAssignmentsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -1813,6 +2033,8 @@ class Guardrails(BaseSDK): *, id: str, key_hashes: List[str], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -1820,10 +2042,15 @@ class Guardrails(BaseSDK): ) -> operations.BulkAssignKeysToGuardrailResponse: r"""Bulk assign keys to a guardrail - Assign multiple API keys to a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Assign multiple API keys to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param key_hashes: Array of API key hashes to assign to the guardrail + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -1840,6 +2067,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.BulkAssignKeysToGuardrailRequest( + http_referer=http_referer, + x_title=x_title, id=id, request_body=operations.BulkAssignKeysToGuardrailRequestBody( key_hashes=key_hashes, @@ -1858,6 +2087,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.BulkAssignKeysToGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request.request_body, @@ -1936,6 +2169,8 @@ class Guardrails(BaseSDK): *, id: str, key_hashes: List[str], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -1943,10 +2178,15 @@ class Guardrails(BaseSDK): ) -> operations.BulkAssignKeysToGuardrailResponse: r"""Bulk assign keys to a guardrail - Assign multiple API keys to a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Assign multiple API keys to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param key_hashes: Array of API key hashes to assign to the guardrail + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -1963,6 +2203,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.BulkAssignKeysToGuardrailRequest( + http_referer=http_referer, + x_title=x_title, id=id, request_body=operations.BulkAssignKeysToGuardrailRequestBody( key_hashes=key_hashes, @@ -1981,6 +2223,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.BulkAssignKeysToGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request.request_body, @@ -2058,6 +2304,8 @@ class Guardrails(BaseSDK): self, *, id: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, offset: Optional[str] = None, limit: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -2067,9 +2315,14 @@ class Guardrails(BaseSDK): ) -> operations.ListGuardrailMemberAssignmentsResponse: r"""List member assignments for a guardrail - List all organization member assignments for a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all organization member assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param offset: Number of records to skip for pagination :param limit: Maximum number of records to return (max 100) :param retries: Override the default retry configuration for this method @@ -2088,6 +2341,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ListGuardrailMemberAssignmentsRequest( + http_referer=http_referer, + x_title=x_title, id=id, offset=offset, limit=limit, @@ -2105,6 +2360,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListGuardrailMemberAssignmentsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -2170,6 +2429,8 @@ class Guardrails(BaseSDK): self, *, id: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, offset: Optional[str] = None, limit: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -2179,9 +2440,14 @@ class Guardrails(BaseSDK): ) -> operations.ListGuardrailMemberAssignmentsResponse: r"""List member assignments for a guardrail - List all organization member assignments for a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + List all organization member assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param offset: Number of records to skip for pagination :param limit: Maximum number of records to return (max 100) :param retries: Override the default retry configuration for this method @@ -2200,6 +2466,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ListGuardrailMemberAssignmentsRequest( + http_referer=http_referer, + x_title=x_title, id=id, offset=offset, limit=limit, @@ -2217,6 +2485,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListGuardrailMemberAssignmentsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -2283,6 +2555,8 @@ class Guardrails(BaseSDK): *, id: str, member_user_ids: List[str], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -2290,10 +2564,15 @@ class Guardrails(BaseSDK): ) -> operations.BulkAssignMembersToGuardrailResponse: r"""Bulk assign members to a guardrail - Assign multiple organization members to a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Assign multiple organization members to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param member_user_ids: Array of member user IDs to assign to the guardrail + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -2310,6 +2589,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.BulkAssignMembersToGuardrailRequest( + http_referer=http_referer, + x_title=x_title, id=id, request_body=operations.BulkAssignMembersToGuardrailRequestBody( member_user_ids=member_user_ids, @@ -2328,6 +2609,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.BulkAssignMembersToGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request.request_body, @@ -2406,6 +2691,8 @@ class Guardrails(BaseSDK): *, id: str, member_user_ids: List[str], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -2413,10 +2700,15 @@ class Guardrails(BaseSDK): ) -> operations.BulkAssignMembersToGuardrailResponse: r"""Bulk assign members to a guardrail - Assign multiple organization members to a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Assign multiple organization members to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param member_user_ids: Array of member user IDs to assign to the guardrail + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -2433,6 +2725,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.BulkAssignMembersToGuardrailRequest( + http_referer=http_referer, + x_title=x_title, id=id, request_body=operations.BulkAssignMembersToGuardrailRequestBody( member_user_ids=member_user_ids, @@ -2451,6 +2745,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.BulkAssignMembersToGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request.request_body, @@ -2529,6 +2827,8 @@ class Guardrails(BaseSDK): *, id: str, key_hashes: List[str], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -2536,10 +2836,15 @@ class Guardrails(BaseSDK): ) -> operations.BulkUnassignKeysFromGuardrailResponse: r"""Bulk unassign keys from a guardrail - Unassign multiple API keys from a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Unassign multiple API keys from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param key_hashes: Array of API key hashes to unassign from the guardrail + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -2556,6 +2861,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.BulkUnassignKeysFromGuardrailRequest( + http_referer=http_referer, + x_title=x_title, id=id, request_body=operations.BulkUnassignKeysFromGuardrailRequestBody( key_hashes=key_hashes, @@ -2574,6 +2881,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.BulkUnassignKeysFromGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request.request_body, @@ -2652,6 +2963,8 @@ class Guardrails(BaseSDK): *, id: str, key_hashes: List[str], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -2659,10 +2972,15 @@ class Guardrails(BaseSDK): ) -> operations.BulkUnassignKeysFromGuardrailResponse: r"""Bulk unassign keys from a guardrail - Unassign multiple API keys from a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Unassign multiple API keys from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param key_hashes: Array of API key hashes to unassign from the guardrail + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -2679,6 +2997,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.BulkUnassignKeysFromGuardrailRequest( + http_referer=http_referer, + x_title=x_title, id=id, request_body=operations.BulkUnassignKeysFromGuardrailRequestBody( key_hashes=key_hashes, @@ -2697,6 +3017,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.BulkUnassignKeysFromGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request.request_body, @@ -2775,6 +3099,8 @@ class Guardrails(BaseSDK): *, id: str, member_user_ids: List[str], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -2782,10 +3108,15 @@ class Guardrails(BaseSDK): ) -> operations.BulkUnassignMembersFromGuardrailResponse: r"""Bulk unassign members from a guardrail - Unassign multiple organization members from a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Unassign multiple organization members from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param member_user_ids: Array of member user IDs to unassign from the guardrail + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -2802,6 +3133,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.BulkUnassignMembersFromGuardrailRequest( + http_referer=http_referer, + x_title=x_title, id=id, request_body=operations.BulkUnassignMembersFromGuardrailRequestBody( member_user_ids=member_user_ids, @@ -2820,6 +3153,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.BulkUnassignMembersFromGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request.request_body, @@ -2898,6 +3235,8 @@ class Guardrails(BaseSDK): *, id: str, member_user_ids: List[str], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -2905,10 +3244,15 @@ class Guardrails(BaseSDK): ) -> operations.BulkUnassignMembersFromGuardrailResponse: r"""Bulk unassign members from a guardrail - Unassign multiple organization members from a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required. + Unassign multiple organization members from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The unique identifier of the guardrail :param member_user_ids: Array of member user IDs to unassign from the guardrail + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -2925,6 +3269,8 @@ class Guardrails(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.BulkUnassignMembersFromGuardrailRequest( + http_referer=http_referer, + x_title=x_title, id=id, request_body=operations.BulkUnassignMembersFromGuardrailRequestBody( member_user_ids=member_user_ids, @@ -2943,6 +3289,10 @@ class Guardrails(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.BulkUnassignMembersFromGuardrailGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request.request_body, diff --git a/src/openrouter/models_.py b/src/openrouter/models_.py index a3d8d13..ae103c1 100644 --- a/src/openrouter/models_.py +++ b/src/openrouter/models_.py @@ -15,6 +15,8 @@ class Models(BaseSDK): def count( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -22,6 +24,11 @@ class Models(BaseSDK): ) -> components.ModelsCountResponse: r"""Get total count of available models + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -36,18 +43,28 @@ class Models(BaseSDK): base_url = server_url else: base_url = self._get_url(base_url, url_variables) + + request = operations.ListModelsCountRequest( + http_referer=http_referer, + x_title=x_title, + ) + req = self._build_request( method="GET", path="/models/count", base_url=base_url, url_variables=url_variables, - request=None, + request=request, request_body_required=False, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListModelsCountGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -100,6 +117,8 @@ class Models(BaseSDK): async def count_async( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -107,6 +126,11 @@ class Models(BaseSDK): ) -> components.ModelsCountResponse: r"""Get total count of available models + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -121,18 +145,28 @@ class Models(BaseSDK): base_url = server_url else: base_url = self._get_url(base_url, url_variables) + + request = operations.ListModelsCountRequest( + http_referer=http_referer, + x_title=x_title, + ) + req = self._build_request_async( method="GET", path="/models/count", base_url=base_url, url_variables=url_variables, - request=None, + request=request, request_body_required=False, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListModelsCountGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -185,6 +219,8 @@ class Models(BaseSDK): def list( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, category: Optional[operations.Category] = None, supported_parameters: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -194,6 +230,11 @@ class Models(BaseSDK): ) -> components.ModelsListResponse: r"""List all models and their properties + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param category: Filter models by use case category :param supported_parameters: :param retries: Override the default retry configuration for this method @@ -212,6 +253,8 @@ class Models(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.GetModelsRequest( + http_referer=http_referer, + x_title=x_title, category=category, supported_parameters=supported_parameters, ) @@ -228,6 +271,10 @@ class Models(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.GetModelsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -285,6 +332,8 @@ class Models(BaseSDK): async def list_async( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, category: Optional[operations.Category] = None, supported_parameters: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -294,6 +343,11 @@ class Models(BaseSDK): ) -> components.ModelsListResponse: r"""List all models and their properties + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param category: Filter models by use case category :param supported_parameters: :param retries: Override the default retry configuration for this method @@ -312,6 +366,8 @@ class Models(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.GetModelsRequest( + http_referer=http_referer, + x_title=x_title, category=category, supported_parameters=supported_parameters, ) @@ -328,6 +384,10 @@ class Models(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.GetModelsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -389,14 +449,23 @@ class Models(BaseSDK): operations.ListModelsUserSecurity, operations.ListModelsUserSecurityTypedDict, ], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, ) -> components.ModelsListResponse: - r"""List models filtered by user provider preferences + r"""List models filtered by user provider preferences, privacy settings, and guardrails + + List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing). :param security: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -411,18 +480,28 @@ class Models(BaseSDK): base_url = server_url else: base_url = self._get_url(base_url, url_variables) + + request = operations.ListModelsUserRequest( + http_referer=http_referer, + x_title=x_title, + ) + req = self._build_request( method="GET", path="/models/user", base_url=base_url, url_variables=url_variables, - request=None, + request=request, request_body_required=False, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListModelsUserGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=utils.get_pydantic_model( security, operations.ListModelsUserSecurity ), @@ -447,7 +526,7 @@ class Models(BaseSDK): security_source=get_security_from_env(security, components.Security), ), request=req, - error_status_codes=["401", "4XX", "500", "5XX"], + error_status_codes=["401", "404", "4XX", "500", "5XX"], retry_config=retry_config, ) @@ -459,6 +538,11 @@ class Models(BaseSDK): errors.UnauthorizedResponseErrorData, http_res ) raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) if utils.match_response(http_res, "500", "application/json"): response_data = unmarshal_json_response( errors.InternalServerResponseErrorData, http_res @@ -484,14 +568,23 @@ class Models(BaseSDK): operations.ListModelsUserSecurity, operations.ListModelsUserSecurityTypedDict, ], + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, ) -> components.ModelsListResponse: - r"""List models filtered by user provider preferences + r"""List models filtered by user provider preferences, privacy settings, and guardrails + + List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing). :param security: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -506,18 +599,28 @@ class Models(BaseSDK): base_url = server_url else: base_url = self._get_url(base_url, url_variables) + + request = operations.ListModelsUserRequest( + http_referer=http_referer, + x_title=x_title, + ) + req = self._build_request_async( method="GET", path="/models/user", base_url=base_url, url_variables=url_variables, - request=None, + request=request, request_body_required=False, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListModelsUserGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=utils.get_pydantic_model( security, operations.ListModelsUserSecurity ), @@ -542,7 +645,7 @@ class Models(BaseSDK): security_source=get_security_from_env(security, components.Security), ), request=req, - error_status_codes=["401", "4XX", "500", "5XX"], + error_status_codes=["401", "404", "4XX", "500", "5XX"], retry_config=retry_config, ) @@ -554,6 +657,11 @@ class Models(BaseSDK): errors.UnauthorizedResponseErrorData, http_res ) raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) if utils.match_response(http_res, "500", "application/json"): response_data = unmarshal_json_response( errors.InternalServerResponseErrorData, http_res diff --git a/src/openrouter/oauth.py b/src/openrouter/oauth.py index 3fc3316..024af82 100644 --- a/src/openrouter/oauth.py +++ b/src/openrouter/oauth.py @@ -17,6 +17,8 @@ class OAuth(BaseSDK): self, *, code: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, code_verifier: Optional[str] = None, code_challenge_method: OptionalNullable[ operations.ExchangeAuthCodeForAPIKeyCodeChallengeMethod @@ -31,6 +33,11 @@ class OAuth(BaseSDK): Exchange an authorization code from the PKCE flow for a user-controlled API key :param code: The authorization code received from the OAuth redirect + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param code_verifier: The code verifier if code_challenge was used in the authorization request :param code_challenge_method: The method used to generate the code challenge :param retries: Override the default retry configuration for this method @@ -49,9 +56,13 @@ class OAuth(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ExchangeAuthCodeForAPIKeyRequest( - code=code, - code_verifier=code_verifier, - code_challenge_method=code_challenge_method, + http_referer=http_referer, + x_title=x_title, + request_body=operations.ExchangeAuthCodeForAPIKeyRequestBody( + code=code, + code_verifier=code_verifier, + code_challenge_method=code_challenge_method, + ), ) req = self._build_request( @@ -66,13 +77,17 @@ class OAuth(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ExchangeAuthCodeForAPIKeyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, + request.request_body, False, False, "json", - operations.ExchangeAuthCodeForAPIKeyRequest, + operations.ExchangeAuthCodeForAPIKeyRequestBody, ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -138,6 +153,8 @@ class OAuth(BaseSDK): self, *, code: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, code_verifier: Optional[str] = None, code_challenge_method: OptionalNullable[ operations.ExchangeAuthCodeForAPIKeyCodeChallengeMethod @@ -152,6 +169,11 @@ class OAuth(BaseSDK): Exchange an authorization code from the PKCE flow for a user-controlled API key :param code: The authorization code received from the OAuth redirect + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param code_verifier: The code verifier if code_challenge was used in the authorization request :param code_challenge_method: The method used to generate the code challenge :param retries: Override the default retry configuration for this method @@ -170,9 +192,13 @@ class OAuth(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.ExchangeAuthCodeForAPIKeyRequest( - code=code, - code_verifier=code_verifier, - code_challenge_method=code_challenge_method, + http_referer=http_referer, + x_title=x_title, + request_body=operations.ExchangeAuthCodeForAPIKeyRequestBody( + code=code, + code_verifier=code_verifier, + code_challenge_method=code_challenge_method, + ), ) req = self._build_request_async( @@ -187,13 +213,17 @@ class OAuth(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ExchangeAuthCodeForAPIKeyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, + request.request_body, False, False, "json", - operations.ExchangeAuthCodeForAPIKeyRequest, + operations.ExchangeAuthCodeForAPIKeyRequestBody, ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -259,6 +289,8 @@ class OAuth(BaseSDK): self, *, callback_url: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, code_challenge: Optional[str] = None, code_challenge_method: Optional[ operations.CreateAuthKeysCodeCodeChallengeMethod @@ -275,6 +307,11 @@ class OAuth(BaseSDK): Create an authorization code for the PKCE flow to generate a user-controlled API key :param callback_url: The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param code_challenge: PKCE code challenge for enhanced security :param code_challenge_method: The method used to generate the code challenge :param limit: Credit limit for the API key to be created @@ -295,11 +332,15 @@ class OAuth(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.CreateAuthKeysCodeRequest( - callback_url=callback_url, - code_challenge=code_challenge, - code_challenge_method=code_challenge_method, - limit=limit, - expires_at=expires_at, + http_referer=http_referer, + x_title=x_title, + request_body=operations.CreateAuthKeysCodeRequestBody( + callback_url=callback_url, + code_challenge=code_challenge, + code_challenge_method=code_challenge_method, + limit=limit, + expires_at=expires_at, + ), ) req = self._build_request( @@ -314,9 +355,17 @@ class OAuth(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.CreateAuthKeysCodeGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", operations.CreateAuthKeysCodeRequest + request.request_body, + False, + False, + "json", + operations.CreateAuthKeysCodeRequestBody, ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -382,6 +431,8 @@ class OAuth(BaseSDK): self, *, callback_url: str, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, code_challenge: Optional[str] = None, code_challenge_method: Optional[ operations.CreateAuthKeysCodeCodeChallengeMethod @@ -398,6 +449,11 @@ class OAuth(BaseSDK): Create an authorization code for the PKCE flow to generate a user-controlled API key :param callback_url: The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param code_challenge: PKCE code challenge for enhanced security :param code_challenge_method: The method used to generate the code challenge :param limit: Credit limit for the API key to be created @@ -418,11 +474,15 @@ class OAuth(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.CreateAuthKeysCodeRequest( - callback_url=callback_url, - code_challenge=code_challenge, - code_challenge_method=code_challenge_method, - limit=limit, - expires_at=expires_at, + http_referer=http_referer, + x_title=x_title, + request_body=operations.CreateAuthKeysCodeRequestBody( + callback_url=callback_url, + code_challenge=code_challenge, + code_challenge_method=code_challenge_method, + limit=limit, + expires_at=expires_at, + ), ) req = self._build_request_async( @@ -437,9 +497,17 @@ class OAuth(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.CreateAuthKeysCodeGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", operations.CreateAuthKeysCodeRequest + request.request_body, + False, + False, + "json", + operations.CreateAuthKeysCodeRequestBody, ), allow_empty_value=None, timeout_ms=timeout_ms, diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 6620d39..a8f6455 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -7,6 +7,8 @@ import sys if TYPE_CHECKING: from .bulkassignkeystoguardrail import ( + BulkAssignKeysToGuardrailGlobals, + BulkAssignKeysToGuardrailGlobalsTypedDict, BulkAssignKeysToGuardrailRequest, BulkAssignKeysToGuardrailRequestBody, BulkAssignKeysToGuardrailRequestBodyTypedDict, @@ -15,6 +17,8 @@ if TYPE_CHECKING: BulkAssignKeysToGuardrailResponseTypedDict, ) from .bulkassignmemberstoguardrail import ( + BulkAssignMembersToGuardrailGlobals, + BulkAssignMembersToGuardrailGlobalsTypedDict, BulkAssignMembersToGuardrailRequest, BulkAssignMembersToGuardrailRequestBody, BulkAssignMembersToGuardrailRequestBodyTypedDict, @@ -23,6 +27,8 @@ if TYPE_CHECKING: BulkAssignMembersToGuardrailResponseTypedDict, ) from .bulkunassignkeysfromguardrail import ( + BulkUnassignKeysFromGuardrailGlobals, + BulkUnassignKeysFromGuardrailGlobalsTypedDict, BulkUnassignKeysFromGuardrailRequest, BulkUnassignKeysFromGuardrailRequestBody, BulkUnassignKeysFromGuardrailRequestBodyTypedDict, @@ -31,6 +37,8 @@ if TYPE_CHECKING: BulkUnassignKeysFromGuardrailResponseTypedDict, ) from .bulkunassignmembersfromguardrail import ( + BulkUnassignMembersFromGuardrailGlobals, + BulkUnassignMembersFromGuardrailGlobalsTypedDict, BulkUnassignMembersFromGuardrailRequest, BulkUnassignMembersFromGuardrailRequestBody, BulkUnassignMembersFromGuardrailRequestBodyTypedDict, @@ -42,7 +50,11 @@ if TYPE_CHECKING: CreateAuthKeysCodeCodeChallengeMethod, CreateAuthKeysCodeData, CreateAuthKeysCodeDataTypedDict, + CreateAuthKeysCodeGlobals, + CreateAuthKeysCodeGlobalsTypedDict, CreateAuthKeysCodeRequest, + CreateAuthKeysCodeRequestBody, + CreateAuthKeysCodeRequestBodyTypedDict, CreateAuthKeysCodeRequestTypedDict, CreateAuthKeysCodeResponse, CreateAuthKeysCodeResponseTypedDict, @@ -52,6 +64,10 @@ if TYPE_CHECKING: CallDataTypedDict, CreateCoinbaseChargeData, CreateCoinbaseChargeDataTypedDict, + CreateCoinbaseChargeGlobals, + CreateCoinbaseChargeGlobalsTypedDict, + CreateCoinbaseChargeRequest, + CreateCoinbaseChargeRequestTypedDict, CreateCoinbaseChargeResponse, CreateCoinbaseChargeResponseTypedDict, CreateCoinbaseChargeSecurity, @@ -72,7 +88,11 @@ if TYPE_CHECKING: ContentTypedDict, CreateEmbeddingsData, CreateEmbeddingsDataTypedDict, + CreateEmbeddingsGlobals, + CreateEmbeddingsGlobalsTypedDict, CreateEmbeddingsRequest, + CreateEmbeddingsRequestBody, + CreateEmbeddingsRequestBodyTypedDict, CreateEmbeddingsRequestTypedDict, CreateEmbeddingsResponse, CreateEmbeddingsResponseBody, @@ -97,7 +117,11 @@ if TYPE_CHECKING: from .createguardrail import ( CreateGuardrailData, CreateGuardrailDataTypedDict, + CreateGuardrailGlobals, + CreateGuardrailGlobalsTypedDict, CreateGuardrailRequest, + CreateGuardrailRequestBody, + CreateGuardrailRequestBodyTypedDict, CreateGuardrailRequestTypedDict, CreateGuardrailResetIntervalRequest, CreateGuardrailResetIntervalResponse, @@ -107,25 +131,37 @@ if TYPE_CHECKING: from .createkeys import ( CreateKeysData, CreateKeysDataTypedDict, + CreateKeysGlobals, + CreateKeysGlobalsTypedDict, CreateKeysLimitReset, CreateKeysRequest, + CreateKeysRequestBody, + CreateKeysRequestBodyTypedDict, CreateKeysRequestTypedDict, CreateKeysResponse, CreateKeysResponseTypedDict, ) from .createresponses import ( + CreateResponsesGlobals, + CreateResponsesGlobalsTypedDict, + CreateResponsesRequest, + CreateResponsesRequestTypedDict, CreateResponsesResponse, CreateResponsesResponseBody, CreateResponsesResponseBodyTypedDict, CreateResponsesResponseTypedDict, ) from .deleteguardrail import ( + DeleteGuardrailGlobals, + DeleteGuardrailGlobalsTypedDict, DeleteGuardrailRequest, DeleteGuardrailRequestTypedDict, DeleteGuardrailResponse, DeleteGuardrailResponseTypedDict, ) from .deletekeys import ( + DeleteKeysGlobals, + DeleteKeysGlobalsTypedDict, DeleteKeysRequest, DeleteKeysRequestTypedDict, DeleteKeysResponse, @@ -133,7 +169,11 @@ if TYPE_CHECKING: ) from .exchangeauthcodeforapikey import ( ExchangeAuthCodeForAPIKeyCodeChallengeMethod, + ExchangeAuthCodeForAPIKeyGlobals, + ExchangeAuthCodeForAPIKeyGlobalsTypedDict, ExchangeAuthCodeForAPIKeyRequest, + ExchangeAuthCodeForAPIKeyRequestBody, + ExchangeAuthCodeForAPIKeyRequestBodyTypedDict, ExchangeAuthCodeForAPIKeyRequestTypedDict, ExchangeAuthCodeForAPIKeyResponse, ExchangeAuthCodeForAPIKeyResponseTypedDict, @@ -141,12 +181,20 @@ if TYPE_CHECKING: from .getcredits import ( GetCreditsData, GetCreditsDataTypedDict, + GetCreditsGlobals, + GetCreditsGlobalsTypedDict, + GetCreditsRequest, + GetCreditsRequestTypedDict, GetCreditsResponse, GetCreditsResponseTypedDict, ) from .getcurrentkey import ( GetCurrentKeyData, GetCurrentKeyDataTypedDict, + GetCurrentKeyGlobals, + GetCurrentKeyGlobalsTypedDict, + GetCurrentKeyRequest, + GetCurrentKeyRequestTypedDict, GetCurrentKeyResponse, GetCurrentKeyResponseTypedDict, RateLimit, @@ -156,14 +204,21 @@ if TYPE_CHECKING: APIType, GetGenerationData, GetGenerationDataTypedDict, + GetGenerationGlobals, + GetGenerationGlobalsTypedDict, GetGenerationRequest, GetGenerationRequestTypedDict, GetGenerationResponse, GetGenerationResponseTypedDict, + ProviderName, + ProviderResponse, + ProviderResponseTypedDict, ) from .getguardrail import ( GetGuardrailData, GetGuardrailDataTypedDict, + GetGuardrailGlobals, + GetGuardrailGlobalsTypedDict, GetGuardrailRequest, GetGuardrailRequestTypedDict, GetGuardrailResetInterval, @@ -173,13 +228,23 @@ if TYPE_CHECKING: from .getkey import ( GetKeyData, GetKeyDataTypedDict, + GetKeyGlobals, + GetKeyGlobalsTypedDict, GetKeyRequest, GetKeyRequestTypedDict, GetKeyResponse, GetKeyResponseTypedDict, ) - from .getmodels import Category, GetModelsRequest, GetModelsRequestTypedDict + from .getmodels import ( + Category, + GetModelsGlobals, + GetModelsGlobalsTypedDict, + GetModelsRequest, + GetModelsRequestTypedDict, + ) from .getuseractivity import ( + GetUserActivityGlobals, + GetUserActivityGlobalsTypedDict, GetUserActivityRequest, GetUserActivityRequestTypedDict, GetUserActivityResponse, @@ -188,24 +253,40 @@ if TYPE_CHECKING: from .list import ( ListData, ListDataTypedDict, + ListGlobals, + ListGlobalsTypedDict, ListRequest, ListRequestTypedDict, ListResponse, ListResponseTypedDict, ) + from .listembeddingsmodels import ( + ListEmbeddingsModelsGlobals, + ListEmbeddingsModelsGlobalsTypedDict, + ListEmbeddingsModelsRequest, + ListEmbeddingsModelsRequestTypedDict, + ) from .listendpoints import ( + ListEndpointsGlobals, + ListEndpointsGlobalsTypedDict, ListEndpointsRequest, ListEndpointsRequestTypedDict, ListEndpointsResponse, ListEndpointsResponseTypedDict, ) from .listendpointszdr import ( + ListEndpointsZdrGlobals, + ListEndpointsZdrGlobalsTypedDict, + ListEndpointsZdrRequest, + ListEndpointsZdrRequestTypedDict, ListEndpointsZdrResponse, ListEndpointsZdrResponseTypedDict, ) from .listguardrailkeyassignments import ( ListGuardrailKeyAssignmentsData, ListGuardrailKeyAssignmentsDataTypedDict, + ListGuardrailKeyAssignmentsGlobals, + ListGuardrailKeyAssignmentsGlobalsTypedDict, ListGuardrailKeyAssignmentsRequest, ListGuardrailKeyAssignmentsRequestTypedDict, ListGuardrailKeyAssignmentsResponse, @@ -214,6 +295,8 @@ if TYPE_CHECKING: from .listguardrailmemberassignments import ( ListGuardrailMemberAssignmentsData, ListGuardrailMemberAssignmentsDataTypedDict, + ListGuardrailMemberAssignmentsGlobals, + ListGuardrailMemberAssignmentsGlobalsTypedDict, ListGuardrailMemberAssignmentsRequest, ListGuardrailMemberAssignmentsRequestTypedDict, ListGuardrailMemberAssignmentsResponse, @@ -222,6 +305,8 @@ if TYPE_CHECKING: from .listguardrails import ( ListGuardrailsData, ListGuardrailsDataTypedDict, + ListGuardrailsGlobals, + ListGuardrailsGlobalsTypedDict, ListGuardrailsRequest, ListGuardrailsRequestTypedDict, ListGuardrailsResetInterval, @@ -231,6 +316,8 @@ if TYPE_CHECKING: from .listkeyassignments import ( ListKeyAssignmentsData, ListKeyAssignmentsDataTypedDict, + ListKeyAssignmentsGlobals, + ListKeyAssignmentsGlobalsTypedDict, ListKeyAssignmentsRequest, ListKeyAssignmentsRequestTypedDict, ListKeyAssignmentsResponse, @@ -239,25 +326,50 @@ if TYPE_CHECKING: from .listmemberassignments import ( ListMemberAssignmentsData, ListMemberAssignmentsDataTypedDict, + ListMemberAssignmentsGlobals, + ListMemberAssignmentsGlobalsTypedDict, ListMemberAssignmentsRequest, ListMemberAssignmentsRequestTypedDict, ListMemberAssignmentsResponse, ListMemberAssignmentsResponseTypedDict, ) - from .listmodelsuser import ListModelsUserSecurity, ListModelsUserSecurityTypedDict + from .listmodelscount import ( + ListModelsCountGlobals, + ListModelsCountGlobalsTypedDict, + ListModelsCountRequest, + ListModelsCountRequestTypedDict, + ) + from .listmodelsuser import ( + ListModelsUserGlobals, + ListModelsUserGlobalsTypedDict, + ListModelsUserRequest, + ListModelsUserRequestTypedDict, + ListModelsUserSecurity, + ListModelsUserSecurityTypedDict, + ) from .listproviders import ( ListProvidersData, ListProvidersDataTypedDict, + ListProvidersGlobals, + ListProvidersGlobalsTypedDict, + ListProvidersRequest, + ListProvidersRequestTypedDict, ListProvidersResponse, ListProvidersResponseTypedDict, ) from .sendchatcompletionrequest import ( + SendChatCompletionRequestGlobals, + SendChatCompletionRequestGlobalsTypedDict, + SendChatCompletionRequestRequest, + SendChatCompletionRequestRequestTypedDict, SendChatCompletionRequestResponse, SendChatCompletionRequestResponseTypedDict, ) from .updateguardrail import ( UpdateGuardrailData, UpdateGuardrailDataTypedDict, + UpdateGuardrailGlobals, + UpdateGuardrailGlobalsTypedDict, UpdateGuardrailRequest, UpdateGuardrailRequestBody, UpdateGuardrailRequestBodyTypedDict, @@ -270,6 +382,8 @@ if TYPE_CHECKING: from .updatekeys import ( UpdateKeysData, UpdateKeysDataTypedDict, + UpdateKeysGlobals, + UpdateKeysGlobalsTypedDict, UpdateKeysLimitReset, UpdateKeysRequest, UpdateKeysRequestBody, @@ -281,24 +395,32 @@ if TYPE_CHECKING: __all__ = [ "APIType", + "BulkAssignKeysToGuardrailGlobals", + "BulkAssignKeysToGuardrailGlobalsTypedDict", "BulkAssignKeysToGuardrailRequest", "BulkAssignKeysToGuardrailRequestBody", "BulkAssignKeysToGuardrailRequestBodyTypedDict", "BulkAssignKeysToGuardrailRequestTypedDict", "BulkAssignKeysToGuardrailResponse", "BulkAssignKeysToGuardrailResponseTypedDict", + "BulkAssignMembersToGuardrailGlobals", + "BulkAssignMembersToGuardrailGlobalsTypedDict", "BulkAssignMembersToGuardrailRequest", "BulkAssignMembersToGuardrailRequestBody", "BulkAssignMembersToGuardrailRequestBodyTypedDict", "BulkAssignMembersToGuardrailRequestTypedDict", "BulkAssignMembersToGuardrailResponse", "BulkAssignMembersToGuardrailResponseTypedDict", + "BulkUnassignKeysFromGuardrailGlobals", + "BulkUnassignKeysFromGuardrailGlobalsTypedDict", "BulkUnassignKeysFromGuardrailRequest", "BulkUnassignKeysFromGuardrailRequestBody", "BulkUnassignKeysFromGuardrailRequestBodyTypedDict", "BulkUnassignKeysFromGuardrailRequestTypedDict", "BulkUnassignKeysFromGuardrailResponse", "BulkUnassignKeysFromGuardrailResponseTypedDict", + "BulkUnassignMembersFromGuardrailGlobals", + "BulkUnassignMembersFromGuardrailGlobalsTypedDict", "BulkUnassignMembersFromGuardrailRequest", "BulkUnassignMembersFromGuardrailRequestBody", "BulkUnassignMembersFromGuardrailRequestBodyTypedDict", @@ -317,19 +439,31 @@ __all__ = [ "CreateAuthKeysCodeCodeChallengeMethod", "CreateAuthKeysCodeData", "CreateAuthKeysCodeDataTypedDict", + "CreateAuthKeysCodeGlobals", + "CreateAuthKeysCodeGlobalsTypedDict", "CreateAuthKeysCodeRequest", + "CreateAuthKeysCodeRequestBody", + "CreateAuthKeysCodeRequestBodyTypedDict", "CreateAuthKeysCodeRequestTypedDict", "CreateAuthKeysCodeResponse", "CreateAuthKeysCodeResponseTypedDict", "CreateCoinbaseChargeData", "CreateCoinbaseChargeDataTypedDict", + "CreateCoinbaseChargeGlobals", + "CreateCoinbaseChargeGlobalsTypedDict", + "CreateCoinbaseChargeRequest", + "CreateCoinbaseChargeRequestTypedDict", "CreateCoinbaseChargeResponse", "CreateCoinbaseChargeResponseTypedDict", "CreateCoinbaseChargeSecurity", "CreateCoinbaseChargeSecurityTypedDict", "CreateEmbeddingsData", "CreateEmbeddingsDataTypedDict", + "CreateEmbeddingsGlobals", + "CreateEmbeddingsGlobalsTypedDict", "CreateEmbeddingsRequest", + "CreateEmbeddingsRequestBody", + "CreateEmbeddingsRequestBodyTypedDict", "CreateEmbeddingsRequestTypedDict", "CreateEmbeddingsResponse", "CreateEmbeddingsResponseBody", @@ -337,7 +471,11 @@ __all__ = [ "CreateEmbeddingsResponseTypedDict", "CreateGuardrailData", "CreateGuardrailDataTypedDict", + "CreateGuardrailGlobals", + "CreateGuardrailGlobalsTypedDict", "CreateGuardrailRequest", + "CreateGuardrailRequestBody", + "CreateGuardrailRequestBodyTypedDict", "CreateGuardrailRequestTypedDict", "CreateGuardrailResetIntervalRequest", "CreateGuardrailResetIntervalResponse", @@ -345,19 +483,31 @@ __all__ = [ "CreateGuardrailResponseTypedDict", "CreateKeysData", "CreateKeysDataTypedDict", + "CreateKeysGlobals", + "CreateKeysGlobalsTypedDict", "CreateKeysLimitReset", "CreateKeysRequest", + "CreateKeysRequestBody", + "CreateKeysRequestBodyTypedDict", "CreateKeysRequestTypedDict", "CreateKeysResponse", "CreateKeysResponseTypedDict", + "CreateResponsesGlobals", + "CreateResponsesGlobalsTypedDict", + "CreateResponsesRequest", + "CreateResponsesRequestTypedDict", "CreateResponsesResponse", "CreateResponsesResponseBody", "CreateResponsesResponseBodyTypedDict", "CreateResponsesResponseTypedDict", + "DeleteGuardrailGlobals", + "DeleteGuardrailGlobalsTypedDict", "DeleteGuardrailRequest", "DeleteGuardrailRequestTypedDict", "DeleteGuardrailResponse", "DeleteGuardrailResponseTypedDict", + "DeleteKeysGlobals", + "DeleteKeysGlobalsTypedDict", "DeleteKeysRequest", "DeleteKeysRequestTypedDict", "DeleteKeysResponse", @@ -366,26 +516,42 @@ __all__ = [ "EmbeddingTypedDict", "EncodingFormat", "ExchangeAuthCodeForAPIKeyCodeChallengeMethod", + "ExchangeAuthCodeForAPIKeyGlobals", + "ExchangeAuthCodeForAPIKeyGlobalsTypedDict", "ExchangeAuthCodeForAPIKeyRequest", + "ExchangeAuthCodeForAPIKeyRequestBody", + "ExchangeAuthCodeForAPIKeyRequestBodyTypedDict", "ExchangeAuthCodeForAPIKeyRequestTypedDict", "ExchangeAuthCodeForAPIKeyResponse", "ExchangeAuthCodeForAPIKeyResponseTypedDict", "GetCreditsData", "GetCreditsDataTypedDict", + "GetCreditsGlobals", + "GetCreditsGlobalsTypedDict", + "GetCreditsRequest", + "GetCreditsRequestTypedDict", "GetCreditsResponse", "GetCreditsResponseTypedDict", "GetCurrentKeyData", "GetCurrentKeyDataTypedDict", + "GetCurrentKeyGlobals", + "GetCurrentKeyGlobalsTypedDict", + "GetCurrentKeyRequest", + "GetCurrentKeyRequestTypedDict", "GetCurrentKeyResponse", "GetCurrentKeyResponseTypedDict", "GetGenerationData", "GetGenerationDataTypedDict", + "GetGenerationGlobals", + "GetGenerationGlobalsTypedDict", "GetGenerationRequest", "GetGenerationRequestTypedDict", "GetGenerationResponse", "GetGenerationResponseTypedDict", "GetGuardrailData", "GetGuardrailDataTypedDict", + "GetGuardrailGlobals", + "GetGuardrailGlobalsTypedDict", "GetGuardrailRequest", "GetGuardrailRequestTypedDict", "GetGuardrailResetInterval", @@ -393,12 +559,18 @@ __all__ = [ "GetGuardrailResponseTypedDict", "GetKeyData", "GetKeyDataTypedDict", + "GetKeyGlobals", + "GetKeyGlobalsTypedDict", "GetKeyRequest", "GetKeyRequestTypedDict", "GetKeyResponse", "GetKeyResponseTypedDict", + "GetModelsGlobals", + "GetModelsGlobalsTypedDict", "GetModelsRequest", "GetModelsRequestTypedDict", + "GetUserActivityGlobals", + "GetUserActivityGlobalsTypedDict", "GetUserActivityRequest", "GetUserActivityRequestTypedDict", "GetUserActivityResponse", @@ -411,26 +583,44 @@ __all__ = [ "InputUnionTypedDict", "ListData", "ListDataTypedDict", + "ListEmbeddingsModelsGlobals", + "ListEmbeddingsModelsGlobalsTypedDict", + "ListEmbeddingsModelsRequest", + "ListEmbeddingsModelsRequestTypedDict", + "ListEndpointsGlobals", + "ListEndpointsGlobalsTypedDict", "ListEndpointsRequest", "ListEndpointsRequestTypedDict", "ListEndpointsResponse", "ListEndpointsResponseTypedDict", + "ListEndpointsZdrGlobals", + "ListEndpointsZdrGlobalsTypedDict", + "ListEndpointsZdrRequest", + "ListEndpointsZdrRequestTypedDict", "ListEndpointsZdrResponse", "ListEndpointsZdrResponseTypedDict", + "ListGlobals", + "ListGlobalsTypedDict", "ListGuardrailKeyAssignmentsData", "ListGuardrailKeyAssignmentsDataTypedDict", + "ListGuardrailKeyAssignmentsGlobals", + "ListGuardrailKeyAssignmentsGlobalsTypedDict", "ListGuardrailKeyAssignmentsRequest", "ListGuardrailKeyAssignmentsRequestTypedDict", "ListGuardrailKeyAssignmentsResponse", "ListGuardrailKeyAssignmentsResponseTypedDict", "ListGuardrailMemberAssignmentsData", "ListGuardrailMemberAssignmentsDataTypedDict", + "ListGuardrailMemberAssignmentsGlobals", + "ListGuardrailMemberAssignmentsGlobalsTypedDict", "ListGuardrailMemberAssignmentsRequest", "ListGuardrailMemberAssignmentsRequestTypedDict", "ListGuardrailMemberAssignmentsResponse", "ListGuardrailMemberAssignmentsResponseTypedDict", "ListGuardrailsData", "ListGuardrailsDataTypedDict", + "ListGuardrailsGlobals", + "ListGuardrailsGlobalsTypedDict", "ListGuardrailsRequest", "ListGuardrailsRequestTypedDict", "ListGuardrailsResetInterval", @@ -438,20 +628,36 @@ __all__ = [ "ListGuardrailsResponseTypedDict", "ListKeyAssignmentsData", "ListKeyAssignmentsDataTypedDict", + "ListKeyAssignmentsGlobals", + "ListKeyAssignmentsGlobalsTypedDict", "ListKeyAssignmentsRequest", "ListKeyAssignmentsRequestTypedDict", "ListKeyAssignmentsResponse", "ListKeyAssignmentsResponseTypedDict", "ListMemberAssignmentsData", "ListMemberAssignmentsDataTypedDict", + "ListMemberAssignmentsGlobals", + "ListMemberAssignmentsGlobalsTypedDict", "ListMemberAssignmentsRequest", "ListMemberAssignmentsRequestTypedDict", "ListMemberAssignmentsResponse", "ListMemberAssignmentsResponseTypedDict", + "ListModelsCountGlobals", + "ListModelsCountGlobalsTypedDict", + "ListModelsCountRequest", + "ListModelsCountRequestTypedDict", + "ListModelsUserGlobals", + "ListModelsUserGlobalsTypedDict", + "ListModelsUserRequest", + "ListModelsUserRequestTypedDict", "ListModelsUserSecurity", "ListModelsUserSecurityTypedDict", "ListProvidersData", "ListProvidersDataTypedDict", + "ListProvidersGlobals", + "ListProvidersGlobalsTypedDict", + "ListProvidersRequest", + "ListProvidersRequestTypedDict", "ListProvidersResponse", "ListProvidersResponseTypedDict", "ListRequest", @@ -462,8 +668,15 @@ __all__ = [ "MetadataTypedDict", "Object", "ObjectEmbedding", + "ProviderName", + "ProviderResponse", + "ProviderResponseTypedDict", "RateLimit", "RateLimitTypedDict", + "SendChatCompletionRequestGlobals", + "SendChatCompletionRequestGlobalsTypedDict", + "SendChatCompletionRequestRequest", + "SendChatCompletionRequestRequestTypedDict", "SendChatCompletionRequestResponse", "SendChatCompletionRequestResponseTypedDict", "TransferIntent", @@ -472,6 +685,8 @@ __all__ = [ "TypeText", "UpdateGuardrailData", "UpdateGuardrailDataTypedDict", + "UpdateGuardrailGlobals", + "UpdateGuardrailGlobalsTypedDict", "UpdateGuardrailRequest", "UpdateGuardrailRequestBody", "UpdateGuardrailRequestBodyTypedDict", @@ -482,6 +697,8 @@ __all__ = [ "UpdateGuardrailResponseTypedDict", "UpdateKeysData", "UpdateKeysDataTypedDict", + "UpdateKeysGlobals", + "UpdateKeysGlobalsTypedDict", "UpdateKeysLimitReset", "UpdateKeysRequest", "UpdateKeysRequestBody", @@ -496,24 +713,32 @@ __all__ = [ ] _dynamic_imports: dict[str, str] = { + "BulkAssignKeysToGuardrailGlobals": ".bulkassignkeystoguardrail", + "BulkAssignKeysToGuardrailGlobalsTypedDict": ".bulkassignkeystoguardrail", "BulkAssignKeysToGuardrailRequest": ".bulkassignkeystoguardrail", "BulkAssignKeysToGuardrailRequestBody": ".bulkassignkeystoguardrail", "BulkAssignKeysToGuardrailRequestBodyTypedDict": ".bulkassignkeystoguardrail", "BulkAssignKeysToGuardrailRequestTypedDict": ".bulkassignkeystoguardrail", "BulkAssignKeysToGuardrailResponse": ".bulkassignkeystoguardrail", "BulkAssignKeysToGuardrailResponseTypedDict": ".bulkassignkeystoguardrail", + "BulkAssignMembersToGuardrailGlobals": ".bulkassignmemberstoguardrail", + "BulkAssignMembersToGuardrailGlobalsTypedDict": ".bulkassignmemberstoguardrail", "BulkAssignMembersToGuardrailRequest": ".bulkassignmemberstoguardrail", "BulkAssignMembersToGuardrailRequestBody": ".bulkassignmemberstoguardrail", "BulkAssignMembersToGuardrailRequestBodyTypedDict": ".bulkassignmemberstoguardrail", "BulkAssignMembersToGuardrailRequestTypedDict": ".bulkassignmemberstoguardrail", "BulkAssignMembersToGuardrailResponse": ".bulkassignmemberstoguardrail", "BulkAssignMembersToGuardrailResponseTypedDict": ".bulkassignmemberstoguardrail", + "BulkUnassignKeysFromGuardrailGlobals": ".bulkunassignkeysfromguardrail", + "BulkUnassignKeysFromGuardrailGlobalsTypedDict": ".bulkunassignkeysfromguardrail", "BulkUnassignKeysFromGuardrailRequest": ".bulkunassignkeysfromguardrail", "BulkUnassignKeysFromGuardrailRequestBody": ".bulkunassignkeysfromguardrail", "BulkUnassignKeysFromGuardrailRequestBodyTypedDict": ".bulkunassignkeysfromguardrail", "BulkUnassignKeysFromGuardrailRequestTypedDict": ".bulkunassignkeysfromguardrail", "BulkUnassignKeysFromGuardrailResponse": ".bulkunassignkeysfromguardrail", "BulkUnassignKeysFromGuardrailResponseTypedDict": ".bulkunassignkeysfromguardrail", + "BulkUnassignMembersFromGuardrailGlobals": ".bulkunassignmembersfromguardrail", + "BulkUnassignMembersFromGuardrailGlobalsTypedDict": ".bulkunassignmembersfromguardrail", "BulkUnassignMembersFromGuardrailRequest": ".bulkunassignmembersfromguardrail", "BulkUnassignMembersFromGuardrailRequestBody": ".bulkunassignmembersfromguardrail", "BulkUnassignMembersFromGuardrailRequestBodyTypedDict": ".bulkunassignmembersfromguardrail", @@ -523,7 +748,11 @@ _dynamic_imports: dict[str, str] = { "CreateAuthKeysCodeCodeChallengeMethod": ".createauthkeyscode", "CreateAuthKeysCodeData": ".createauthkeyscode", "CreateAuthKeysCodeDataTypedDict": ".createauthkeyscode", + "CreateAuthKeysCodeGlobals": ".createauthkeyscode", + "CreateAuthKeysCodeGlobalsTypedDict": ".createauthkeyscode", "CreateAuthKeysCodeRequest": ".createauthkeyscode", + "CreateAuthKeysCodeRequestBody": ".createauthkeyscode", + "CreateAuthKeysCodeRequestBodyTypedDict": ".createauthkeyscode", "CreateAuthKeysCodeRequestTypedDict": ".createauthkeyscode", "CreateAuthKeysCodeResponse": ".createauthkeyscode", "CreateAuthKeysCodeResponseTypedDict": ".createauthkeyscode", @@ -531,6 +760,10 @@ _dynamic_imports: dict[str, str] = { "CallDataTypedDict": ".createcoinbasecharge", "CreateCoinbaseChargeData": ".createcoinbasecharge", "CreateCoinbaseChargeDataTypedDict": ".createcoinbasecharge", + "CreateCoinbaseChargeGlobals": ".createcoinbasecharge", + "CreateCoinbaseChargeGlobalsTypedDict": ".createcoinbasecharge", + "CreateCoinbaseChargeRequest": ".createcoinbasecharge", + "CreateCoinbaseChargeRequestTypedDict": ".createcoinbasecharge", "CreateCoinbaseChargeResponse": ".createcoinbasecharge", "CreateCoinbaseChargeResponseTypedDict": ".createcoinbasecharge", "CreateCoinbaseChargeSecurity": ".createcoinbasecharge", @@ -549,7 +782,11 @@ _dynamic_imports: dict[str, str] = { "ContentTypedDict": ".createembeddings", "CreateEmbeddingsData": ".createembeddings", "CreateEmbeddingsDataTypedDict": ".createembeddings", + "CreateEmbeddingsGlobals": ".createembeddings", + "CreateEmbeddingsGlobalsTypedDict": ".createembeddings", "CreateEmbeddingsRequest": ".createembeddings", + "CreateEmbeddingsRequestBody": ".createembeddings", + "CreateEmbeddingsRequestBodyTypedDict": ".createembeddings", "CreateEmbeddingsRequestTypedDict": ".createembeddings", "CreateEmbeddingsResponse": ".createembeddings", "CreateEmbeddingsResponseBody": ".createembeddings", @@ -572,7 +809,11 @@ _dynamic_imports: dict[str, str] = { "UsageTypedDict": ".createembeddings", "CreateGuardrailData": ".createguardrail", "CreateGuardrailDataTypedDict": ".createguardrail", + "CreateGuardrailGlobals": ".createguardrail", + "CreateGuardrailGlobalsTypedDict": ".createguardrail", "CreateGuardrailRequest": ".createguardrail", + "CreateGuardrailRequestBody": ".createguardrail", + "CreateGuardrailRequestBodyTypedDict": ".createguardrail", "CreateGuardrailRequestTypedDict": ".createguardrail", "CreateGuardrailResetIntervalRequest": ".createguardrail", "CreateGuardrailResetIntervalResponse": ".createguardrail", @@ -580,34 +821,58 @@ _dynamic_imports: dict[str, str] = { "CreateGuardrailResponseTypedDict": ".createguardrail", "CreateKeysData": ".createkeys", "CreateKeysDataTypedDict": ".createkeys", + "CreateKeysGlobals": ".createkeys", + "CreateKeysGlobalsTypedDict": ".createkeys", "CreateKeysLimitReset": ".createkeys", "CreateKeysRequest": ".createkeys", + "CreateKeysRequestBody": ".createkeys", + "CreateKeysRequestBodyTypedDict": ".createkeys", "CreateKeysRequestTypedDict": ".createkeys", "CreateKeysResponse": ".createkeys", "CreateKeysResponseTypedDict": ".createkeys", + "CreateResponsesGlobals": ".createresponses", + "CreateResponsesGlobalsTypedDict": ".createresponses", + "CreateResponsesRequest": ".createresponses", + "CreateResponsesRequestTypedDict": ".createresponses", "CreateResponsesResponse": ".createresponses", "CreateResponsesResponseBody": ".createresponses", "CreateResponsesResponseBodyTypedDict": ".createresponses", "CreateResponsesResponseTypedDict": ".createresponses", + "DeleteGuardrailGlobals": ".deleteguardrail", + "DeleteGuardrailGlobalsTypedDict": ".deleteguardrail", "DeleteGuardrailRequest": ".deleteguardrail", "DeleteGuardrailRequestTypedDict": ".deleteguardrail", "DeleteGuardrailResponse": ".deleteguardrail", "DeleteGuardrailResponseTypedDict": ".deleteguardrail", + "DeleteKeysGlobals": ".deletekeys", + "DeleteKeysGlobalsTypedDict": ".deletekeys", "DeleteKeysRequest": ".deletekeys", "DeleteKeysRequestTypedDict": ".deletekeys", "DeleteKeysResponse": ".deletekeys", "DeleteKeysResponseTypedDict": ".deletekeys", "ExchangeAuthCodeForAPIKeyCodeChallengeMethod": ".exchangeauthcodeforapikey", + "ExchangeAuthCodeForAPIKeyGlobals": ".exchangeauthcodeforapikey", + "ExchangeAuthCodeForAPIKeyGlobalsTypedDict": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyRequest": ".exchangeauthcodeforapikey", + "ExchangeAuthCodeForAPIKeyRequestBody": ".exchangeauthcodeforapikey", + "ExchangeAuthCodeForAPIKeyRequestBodyTypedDict": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyRequestTypedDict": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyResponse": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyResponseTypedDict": ".exchangeauthcodeforapikey", "GetCreditsData": ".getcredits", "GetCreditsDataTypedDict": ".getcredits", + "GetCreditsGlobals": ".getcredits", + "GetCreditsGlobalsTypedDict": ".getcredits", + "GetCreditsRequest": ".getcredits", + "GetCreditsRequestTypedDict": ".getcredits", "GetCreditsResponse": ".getcredits", "GetCreditsResponseTypedDict": ".getcredits", "GetCurrentKeyData": ".getcurrentkey", "GetCurrentKeyDataTypedDict": ".getcurrentkey", + "GetCurrentKeyGlobals": ".getcurrentkey", + "GetCurrentKeyGlobalsTypedDict": ".getcurrentkey", + "GetCurrentKeyRequest": ".getcurrentkey", + "GetCurrentKeyRequestTypedDict": ".getcurrentkey", "GetCurrentKeyResponse": ".getcurrentkey", "GetCurrentKeyResponseTypedDict": ".getcurrentkey", "RateLimit": ".getcurrentkey", @@ -615,12 +880,19 @@ _dynamic_imports: dict[str, str] = { "APIType": ".getgeneration", "GetGenerationData": ".getgeneration", "GetGenerationDataTypedDict": ".getgeneration", + "GetGenerationGlobals": ".getgeneration", + "GetGenerationGlobalsTypedDict": ".getgeneration", "GetGenerationRequest": ".getgeneration", "GetGenerationRequestTypedDict": ".getgeneration", "GetGenerationResponse": ".getgeneration", "GetGenerationResponseTypedDict": ".getgeneration", + "ProviderName": ".getgeneration", + "ProviderResponse": ".getgeneration", + "ProviderResponseTypedDict": ".getgeneration", "GetGuardrailData": ".getguardrail", "GetGuardrailDataTypedDict": ".getguardrail", + "GetGuardrailGlobals": ".getguardrail", + "GetGuardrailGlobalsTypedDict": ".getguardrail", "GetGuardrailRequest": ".getguardrail", "GetGuardrailRequestTypedDict": ".getguardrail", "GetGuardrailResetInterval": ".getguardrail", @@ -628,43 +900,67 @@ _dynamic_imports: dict[str, str] = { "GetGuardrailResponseTypedDict": ".getguardrail", "GetKeyData": ".getkey", "GetKeyDataTypedDict": ".getkey", + "GetKeyGlobals": ".getkey", + "GetKeyGlobalsTypedDict": ".getkey", "GetKeyRequest": ".getkey", "GetKeyRequestTypedDict": ".getkey", "GetKeyResponse": ".getkey", "GetKeyResponseTypedDict": ".getkey", "Category": ".getmodels", + "GetModelsGlobals": ".getmodels", + "GetModelsGlobalsTypedDict": ".getmodels", "GetModelsRequest": ".getmodels", "GetModelsRequestTypedDict": ".getmodels", + "GetUserActivityGlobals": ".getuseractivity", + "GetUserActivityGlobalsTypedDict": ".getuseractivity", "GetUserActivityRequest": ".getuseractivity", "GetUserActivityRequestTypedDict": ".getuseractivity", "GetUserActivityResponse": ".getuseractivity", "GetUserActivityResponseTypedDict": ".getuseractivity", "ListData": ".list", "ListDataTypedDict": ".list", + "ListGlobals": ".list", + "ListGlobalsTypedDict": ".list", "ListRequest": ".list", "ListRequestTypedDict": ".list", "ListResponse": ".list", "ListResponseTypedDict": ".list", + "ListEmbeddingsModelsGlobals": ".listembeddingsmodels", + "ListEmbeddingsModelsGlobalsTypedDict": ".listembeddingsmodels", + "ListEmbeddingsModelsRequest": ".listembeddingsmodels", + "ListEmbeddingsModelsRequestTypedDict": ".listembeddingsmodels", + "ListEndpointsGlobals": ".listendpoints", + "ListEndpointsGlobalsTypedDict": ".listendpoints", "ListEndpointsRequest": ".listendpoints", "ListEndpointsRequestTypedDict": ".listendpoints", "ListEndpointsResponse": ".listendpoints", "ListEndpointsResponseTypedDict": ".listendpoints", + "ListEndpointsZdrGlobals": ".listendpointszdr", + "ListEndpointsZdrGlobalsTypedDict": ".listendpointszdr", + "ListEndpointsZdrRequest": ".listendpointszdr", + "ListEndpointsZdrRequestTypedDict": ".listendpointszdr", "ListEndpointsZdrResponse": ".listendpointszdr", "ListEndpointsZdrResponseTypedDict": ".listendpointszdr", "ListGuardrailKeyAssignmentsData": ".listguardrailkeyassignments", "ListGuardrailKeyAssignmentsDataTypedDict": ".listguardrailkeyassignments", + "ListGuardrailKeyAssignmentsGlobals": ".listguardrailkeyassignments", + "ListGuardrailKeyAssignmentsGlobalsTypedDict": ".listguardrailkeyassignments", "ListGuardrailKeyAssignmentsRequest": ".listguardrailkeyassignments", "ListGuardrailKeyAssignmentsRequestTypedDict": ".listguardrailkeyassignments", "ListGuardrailKeyAssignmentsResponse": ".listguardrailkeyassignments", "ListGuardrailKeyAssignmentsResponseTypedDict": ".listguardrailkeyassignments", "ListGuardrailMemberAssignmentsData": ".listguardrailmemberassignments", "ListGuardrailMemberAssignmentsDataTypedDict": ".listguardrailmemberassignments", + "ListGuardrailMemberAssignmentsGlobals": ".listguardrailmemberassignments", + "ListGuardrailMemberAssignmentsGlobalsTypedDict": ".listguardrailmemberassignments", "ListGuardrailMemberAssignmentsRequest": ".listguardrailmemberassignments", "ListGuardrailMemberAssignmentsRequestTypedDict": ".listguardrailmemberassignments", "ListGuardrailMemberAssignmentsResponse": ".listguardrailmemberassignments", "ListGuardrailMemberAssignmentsResponseTypedDict": ".listguardrailmemberassignments", "ListGuardrailsData": ".listguardrails", "ListGuardrailsDataTypedDict": ".listguardrails", + "ListGuardrailsGlobals": ".listguardrails", + "ListGuardrailsGlobalsTypedDict": ".listguardrails", "ListGuardrailsRequest": ".listguardrails", "ListGuardrailsRequestTypedDict": ".listguardrails", "ListGuardrailsResetInterval": ".listguardrails", @@ -672,26 +968,48 @@ _dynamic_imports: dict[str, str] = { "ListGuardrailsResponseTypedDict": ".listguardrails", "ListKeyAssignmentsData": ".listkeyassignments", "ListKeyAssignmentsDataTypedDict": ".listkeyassignments", + "ListKeyAssignmentsGlobals": ".listkeyassignments", + "ListKeyAssignmentsGlobalsTypedDict": ".listkeyassignments", "ListKeyAssignmentsRequest": ".listkeyassignments", "ListKeyAssignmentsRequestTypedDict": ".listkeyassignments", "ListKeyAssignmentsResponse": ".listkeyassignments", "ListKeyAssignmentsResponseTypedDict": ".listkeyassignments", "ListMemberAssignmentsData": ".listmemberassignments", "ListMemberAssignmentsDataTypedDict": ".listmemberassignments", + "ListMemberAssignmentsGlobals": ".listmemberassignments", + "ListMemberAssignmentsGlobalsTypedDict": ".listmemberassignments", "ListMemberAssignmentsRequest": ".listmemberassignments", "ListMemberAssignmentsRequestTypedDict": ".listmemberassignments", "ListMemberAssignmentsResponse": ".listmemberassignments", "ListMemberAssignmentsResponseTypedDict": ".listmemberassignments", + "ListModelsCountGlobals": ".listmodelscount", + "ListModelsCountGlobalsTypedDict": ".listmodelscount", + "ListModelsCountRequest": ".listmodelscount", + "ListModelsCountRequestTypedDict": ".listmodelscount", + "ListModelsUserGlobals": ".listmodelsuser", + "ListModelsUserGlobalsTypedDict": ".listmodelsuser", + "ListModelsUserRequest": ".listmodelsuser", + "ListModelsUserRequestTypedDict": ".listmodelsuser", "ListModelsUserSecurity": ".listmodelsuser", "ListModelsUserSecurityTypedDict": ".listmodelsuser", "ListProvidersData": ".listproviders", "ListProvidersDataTypedDict": ".listproviders", + "ListProvidersGlobals": ".listproviders", + "ListProvidersGlobalsTypedDict": ".listproviders", + "ListProvidersRequest": ".listproviders", + "ListProvidersRequestTypedDict": ".listproviders", "ListProvidersResponse": ".listproviders", "ListProvidersResponseTypedDict": ".listproviders", + "SendChatCompletionRequestGlobals": ".sendchatcompletionrequest", + "SendChatCompletionRequestGlobalsTypedDict": ".sendchatcompletionrequest", + "SendChatCompletionRequestRequest": ".sendchatcompletionrequest", + "SendChatCompletionRequestRequestTypedDict": ".sendchatcompletionrequest", "SendChatCompletionRequestResponse": ".sendchatcompletionrequest", "SendChatCompletionRequestResponseTypedDict": ".sendchatcompletionrequest", "UpdateGuardrailData": ".updateguardrail", "UpdateGuardrailDataTypedDict": ".updateguardrail", + "UpdateGuardrailGlobals": ".updateguardrail", + "UpdateGuardrailGlobalsTypedDict": ".updateguardrail", "UpdateGuardrailRequest": ".updateguardrail", "UpdateGuardrailRequestBody": ".updateguardrail", "UpdateGuardrailRequestBodyTypedDict": ".updateguardrail", @@ -702,6 +1020,8 @@ _dynamic_imports: dict[str, str] = { "UpdateGuardrailResponseTypedDict": ".updateguardrail", "UpdateKeysData": ".updatekeys", "UpdateKeysDataTypedDict": ".updatekeys", + "UpdateKeysGlobals": ".updatekeys", + "UpdateKeysGlobalsTypedDict": ".updatekeys", "UpdateKeysLimitReset": ".updatekeys", "UpdateKeysRequest": ".updatekeys", "UpdateKeysRequestBody": ".updatekeys", diff --git a/src/openrouter/operations/bulkassignkeystoguardrail.py b/src/openrouter/operations/bulkassignkeystoguardrail.py index b899bfa..f4e1a67 100644 --- a/src/openrouter/operations/bulkassignkeystoguardrail.py +++ b/src/openrouter/operations/bulkassignkeystoguardrail.py @@ -2,9 +2,48 @@ from __future__ import annotations from openrouter.types import BaseModel -from openrouter.utils import FieldMetadata, PathParamMetadata, RequestMetadata -from typing import List -from typing_extensions import Annotated, TypedDict +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class BulkAssignKeysToGuardrailGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class BulkAssignKeysToGuardrailGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class BulkAssignKeysToGuardrailRequestBodyTypedDict(TypedDict): @@ -21,6 +60,15 @@ class BulkAssignKeysToGuardrailRequestTypedDict(TypedDict): id: str r"""The unique identifier of the guardrail""" request_body: BulkAssignKeysToGuardrailRequestBodyTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class BulkAssignKeysToGuardrailRequest(BaseModel): @@ -34,6 +82,25 @@ class BulkAssignKeysToGuardrailRequest(BaseModel): FieldMetadata(request=RequestMetadata(media_type="application/json")), ] + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + class BulkAssignKeysToGuardrailResponseTypedDict(TypedDict): r"""Assignment result""" diff --git a/src/openrouter/operations/bulkassignmemberstoguardrail.py b/src/openrouter/operations/bulkassignmemberstoguardrail.py index 1342726..fc5c674 100644 --- a/src/openrouter/operations/bulkassignmemberstoguardrail.py +++ b/src/openrouter/operations/bulkassignmemberstoguardrail.py @@ -2,9 +2,48 @@ from __future__ import annotations from openrouter.types import BaseModel -from openrouter.utils import FieldMetadata, PathParamMetadata, RequestMetadata -from typing import List -from typing_extensions import Annotated, TypedDict +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class BulkAssignMembersToGuardrailGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class BulkAssignMembersToGuardrailGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class BulkAssignMembersToGuardrailRequestBodyTypedDict(TypedDict): @@ -21,6 +60,15 @@ class BulkAssignMembersToGuardrailRequestTypedDict(TypedDict): id: str r"""The unique identifier of the guardrail""" request_body: BulkAssignMembersToGuardrailRequestBodyTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class BulkAssignMembersToGuardrailRequest(BaseModel): @@ -34,6 +82,25 @@ class BulkAssignMembersToGuardrailRequest(BaseModel): FieldMetadata(request=RequestMetadata(media_type="application/json")), ] + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + class BulkAssignMembersToGuardrailResponseTypedDict(TypedDict): r"""Assignment result""" diff --git a/src/openrouter/operations/bulkunassignkeysfromguardrail.py b/src/openrouter/operations/bulkunassignkeysfromguardrail.py index 5d873be..6b88cbc 100644 --- a/src/openrouter/operations/bulkunassignkeysfromguardrail.py +++ b/src/openrouter/operations/bulkunassignkeysfromguardrail.py @@ -2,9 +2,48 @@ from __future__ import annotations from openrouter.types import BaseModel -from openrouter.utils import FieldMetadata, PathParamMetadata, RequestMetadata -from typing import List -from typing_extensions import Annotated, TypedDict +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class BulkUnassignKeysFromGuardrailGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class BulkUnassignKeysFromGuardrailGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class BulkUnassignKeysFromGuardrailRequestBodyTypedDict(TypedDict): @@ -21,6 +60,15 @@ class BulkUnassignKeysFromGuardrailRequestTypedDict(TypedDict): id: str r"""The unique identifier of the guardrail""" request_body: BulkUnassignKeysFromGuardrailRequestBodyTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class BulkUnassignKeysFromGuardrailRequest(BaseModel): @@ -34,6 +82,25 @@ class BulkUnassignKeysFromGuardrailRequest(BaseModel): FieldMetadata(request=RequestMetadata(media_type="application/json")), ] + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + class BulkUnassignKeysFromGuardrailResponseTypedDict(TypedDict): r"""Unassignment result""" diff --git a/src/openrouter/operations/bulkunassignmembersfromguardrail.py b/src/openrouter/operations/bulkunassignmembersfromguardrail.py index fde8fad..8cdde8d 100644 --- a/src/openrouter/operations/bulkunassignmembersfromguardrail.py +++ b/src/openrouter/operations/bulkunassignmembersfromguardrail.py @@ -2,9 +2,48 @@ from __future__ import annotations from openrouter.types import BaseModel -from openrouter.utils import FieldMetadata, PathParamMetadata, RequestMetadata -from typing import List -from typing_extensions import Annotated, TypedDict +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class BulkUnassignMembersFromGuardrailGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class BulkUnassignMembersFromGuardrailGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class BulkUnassignMembersFromGuardrailRequestBodyTypedDict(TypedDict): @@ -21,6 +60,15 @@ class BulkUnassignMembersFromGuardrailRequestTypedDict(TypedDict): id: str r"""The unique identifier of the guardrail""" request_body: BulkUnassignMembersFromGuardrailRequestBodyTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class BulkUnassignMembersFromGuardrailRequest(BaseModel): @@ -34,6 +82,25 @@ class BulkUnassignMembersFromGuardrailRequest(BaseModel): FieldMetadata(request=RequestMetadata(media_type="application/json")), ] + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + class BulkUnassignMembersFromGuardrailResponseTypedDict(TypedDict): r"""Unassignment result""" diff --git a/src/openrouter/operations/createauthkeyscode.py b/src/openrouter/operations/createauthkeyscode.py index 5d07bb8..9ca929d 100644 --- a/src/openrouter/operations/createauthkeyscode.py +++ b/src/openrouter/operations/createauthkeyscode.py @@ -10,13 +10,52 @@ from openrouter.types import ( UNSET_SENTINEL, UnrecognizedStr, ) -from openrouter.utils import validate_open_enum +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + RequestMetadata, + validate_open_enum, +) +import pydantic from pydantic import model_serializer from pydantic.functional_validators import PlainValidator from typing import Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict +class CreateAuthKeysCodeGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class CreateAuthKeysCodeGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + CreateAuthKeysCodeCodeChallengeMethod = Union[ Literal[ "S256", @@ -27,7 +66,7 @@ CreateAuthKeysCodeCodeChallengeMethod = Union[ r"""The method used to generate the code challenge""" -class CreateAuthKeysCodeRequestTypedDict(TypedDict): +class CreateAuthKeysCodeRequestBodyTypedDict(TypedDict): callback_url: str r"""The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed.""" code_challenge: NotRequired[str] @@ -40,7 +79,7 @@ class CreateAuthKeysCodeRequestTypedDict(TypedDict): r"""Optional expiration time for the API key to be created""" -class CreateAuthKeysCodeRequest(BaseModel): +class CreateAuthKeysCodeRequestBody(BaseModel): callback_url: str r"""The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed.""" @@ -95,6 +134,45 @@ class CreateAuthKeysCodeRequest(BaseModel): return m +class CreateAuthKeysCodeRequestTypedDict(TypedDict): + request_body: CreateAuthKeysCodeRequestBodyTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class CreateAuthKeysCodeRequest(BaseModel): + request_body: Annotated[ + CreateAuthKeysCodeRequestBody, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + class CreateAuthKeysCodeDataTypedDict(TypedDict): r"""Auth code data""" diff --git a/src/openrouter/operations/createcoinbasecharge.py b/src/openrouter/operations/createcoinbasecharge.py index dfb2f59..2fe8172 100644 --- a/src/openrouter/operations/createcoinbasecharge.py +++ b/src/openrouter/operations/createcoinbasecharge.py @@ -1,9 +1,50 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from openrouter.components import createchargerequest as components_createchargerequest from openrouter.types import BaseModel -from openrouter.utils import FieldMetadata, SecurityMetadata -from typing_extensions import Annotated, TypedDict +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + RequestMetadata, + SecurityMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateCoinbaseChargeGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class CreateCoinbaseChargeGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class CreateCoinbaseChargeSecurityTypedDict(TypedDict): @@ -24,6 +65,45 @@ class CreateCoinbaseChargeSecurity(BaseModel): ] +class CreateCoinbaseChargeRequestTypedDict(TypedDict): + create_charge_request: components_createchargerequest.CreateChargeRequestTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class CreateCoinbaseChargeRequest(BaseModel): + create_charge_request: Annotated[ + components_createchargerequest.CreateChargeRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + class CallDataTypedDict(TypedDict): deadline: str fee_amount: str diff --git a/src/openrouter/operations/createembeddings.py b/src/openrouter/operations/createembeddings.py index 6b0f07d..637389e 100644 --- a/src/openrouter/operations/createembeddings.py +++ b/src/openrouter/operations/createembeddings.py @@ -3,13 +3,53 @@ from __future__ import annotations from openrouter.components import providerpreferences as components_providerpreferences from openrouter.types import BaseModel, UnrecognizedStr -from openrouter.utils import get_discriminator, validate_open_enum +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + RequestMetadata, + get_discriminator, + validate_open_enum, +) +import pydantic from pydantic import Discriminator, Tag from pydantic.functional_validators import PlainValidator from typing import List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict +class CreateEmbeddingsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class CreateEmbeddingsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + TypeImageURL = Literal["image_url",] @@ -88,7 +128,7 @@ EncodingFormat = Union[ ] -class CreateEmbeddingsRequestTypedDict(TypedDict): +class CreateEmbeddingsRequestBodyTypedDict(TypedDict): input: InputUnionTypedDict model: str encoding_format: NotRequired[EncodingFormat] @@ -99,7 +139,7 @@ class CreateEmbeddingsRequestTypedDict(TypedDict): input_type: NotRequired[str] -class CreateEmbeddingsRequest(BaseModel): +class CreateEmbeddingsRequestBody(BaseModel): input: InputUnion model: str @@ -118,6 +158,45 @@ class CreateEmbeddingsRequest(BaseModel): input_type: Optional[str] = None +class CreateEmbeddingsRequestTypedDict(TypedDict): + request_body: CreateEmbeddingsRequestBodyTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class CreateEmbeddingsRequest(BaseModel): + request_body: Annotated[ + CreateEmbeddingsRequestBody, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + Object = Literal["list",] diff --git a/src/openrouter/operations/createguardrail.py b/src/openrouter/operations/createguardrail.py index d9e8739..629fa8a 100644 --- a/src/openrouter/operations/createguardrail.py +++ b/src/openrouter/operations/createguardrail.py @@ -9,13 +9,52 @@ from openrouter.types import ( UNSET_SENTINEL, UnrecognizedStr, ) -from openrouter.utils import validate_open_enum +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + RequestMetadata, + validate_open_enum, +) +import pydantic from pydantic import model_serializer from pydantic.functional_validators import PlainValidator -from typing import List, Literal, Union +from typing import List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict +class CreateGuardrailGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class CreateGuardrailGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + CreateGuardrailResetIntervalRequest = Union[ Literal[ "daily", @@ -27,7 +66,7 @@ CreateGuardrailResetIntervalRequest = Union[ r"""Interval at which the limit resets (daily, weekly, monthly)""" -class CreateGuardrailRequestTypedDict(TypedDict): +class CreateGuardrailRequestBodyTypedDict(TypedDict): name: str r"""Name for the new guardrail""" description: NotRequired[Nullable[str]] @@ -44,7 +83,7 @@ class CreateGuardrailRequestTypedDict(TypedDict): r"""Whether to enforce zero data retention""" -class CreateGuardrailRequest(BaseModel): +class CreateGuardrailRequestBody(BaseModel): name: str r"""Name for the new guardrail""" @@ -114,6 +153,45 @@ class CreateGuardrailRequest(BaseModel): return m +class CreateGuardrailRequestTypedDict(TypedDict): + request_body: CreateGuardrailRequestBodyTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class CreateGuardrailRequest(BaseModel): + request_body: Annotated[ + CreateGuardrailRequestBody, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + CreateGuardrailResetIntervalResponse = Union[ Literal[ "daily", diff --git a/src/openrouter/operations/createkeys.py b/src/openrouter/operations/createkeys.py index 6a4dca6..f53ff9e 100644 --- a/src/openrouter/operations/createkeys.py +++ b/src/openrouter/operations/createkeys.py @@ -10,13 +10,52 @@ from openrouter.types import ( UNSET_SENTINEL, UnrecognizedStr, ) -from openrouter.utils import validate_open_enum +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + RequestMetadata, + validate_open_enum, +) +import pydantic from pydantic import model_serializer from pydantic.functional_validators import PlainValidator from typing import Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict +class CreateKeysGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class CreateKeysGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + CreateKeysLimitReset = Union[ Literal[ "daily", @@ -28,7 +67,7 @@ CreateKeysLimitReset = Union[ r"""Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday.""" -class CreateKeysRequestTypedDict(TypedDict): +class CreateKeysRequestBodyTypedDict(TypedDict): name: str r"""Name for the new API key""" limit: NotRequired[Nullable[float]] @@ -41,7 +80,7 @@ class CreateKeysRequestTypedDict(TypedDict): r"""Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected""" -class CreateKeysRequest(BaseModel): +class CreateKeysRequestBody(BaseModel): name: str r"""Name for the new API key""" @@ -96,6 +135,45 @@ class CreateKeysRequest(BaseModel): return m +class CreateKeysRequestTypedDict(TypedDict): + request_body: CreateKeysRequestBodyTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class CreateKeysRequest(BaseModel): + request_body: Annotated[ + CreateKeysRequestBody, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + class CreateKeysDataTypedDict(TypedDict): r"""The created API key information""" diff --git a/src/openrouter/operations/createresponses.py b/src/openrouter/operations/createresponses.py index e8ef408..2865ddc 100644 --- a/src/openrouter/operations/createresponses.py +++ b/src/openrouter/operations/createresponses.py @@ -3,12 +3,93 @@ from __future__ import annotations from openrouter.components import ( openresponsesnonstreamingresponse as components_openresponsesnonstreamingresponse, + openresponsesrequest as components_openresponsesrequest, openresponsesstreamevent as components_openresponsesstreamevent, ) from openrouter.types import BaseModel -from openrouter.utils import eventstreaming -from typing import Union -from typing_extensions import TypeAliasType, TypedDict +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + RequestMetadata, + eventstreaming, +) +import pydantic +from typing import Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class CreateResponsesGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class CreateResponsesGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class CreateResponsesRequestTypedDict(TypedDict): + open_responses_request: ( + components_openresponsesrequest.OpenResponsesRequestTypedDict + ) + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class CreateResponsesRequest(BaseModel): + open_responses_request: Annotated[ + components_openresponsesrequest.OpenResponsesRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class CreateResponsesResponseBodyTypedDict(TypedDict): diff --git a/src/openrouter/operations/deleteguardrail.py b/src/openrouter/operations/deleteguardrail.py index 7210638..23367ff 100644 --- a/src/openrouter/operations/deleteguardrail.py +++ b/src/openrouter/operations/deleteguardrail.py @@ -2,16 +2,63 @@ from __future__ import annotations from openrouter.types import BaseModel -from openrouter.utils import FieldMetadata, PathParamMetadata, validate_const +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + validate_const, +) import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal -from typing_extensions import Annotated, TypedDict +from typing import Literal, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DeleteGuardrailGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class DeleteGuardrailGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class DeleteGuardrailRequestTypedDict(TypedDict): id: str r"""The unique identifier of the guardrail to delete""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class DeleteGuardrailRequest(BaseModel): @@ -20,6 +67,25 @@ class DeleteGuardrailRequest(BaseModel): ] r"""The unique identifier of the guardrail to delete""" + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + class DeleteGuardrailResponseTypedDict(TypedDict): r"""Guardrail deleted successfully""" diff --git a/src/openrouter/operations/deletekeys.py b/src/openrouter/operations/deletekeys.py index 97ec94d..986ea96 100644 --- a/src/openrouter/operations/deletekeys.py +++ b/src/openrouter/operations/deletekeys.py @@ -2,16 +2,63 @@ from __future__ import annotations from openrouter.types import BaseModel -from openrouter.utils import FieldMetadata, PathParamMetadata, validate_const +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + validate_const, +) import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal -from typing_extensions import Annotated, TypedDict +from typing import Literal, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DeleteKeysGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class DeleteKeysGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class DeleteKeysRequestTypedDict(TypedDict): hash: str r"""The hash identifier of the API key to delete""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class DeleteKeysRequest(BaseModel): @@ -20,6 +67,25 @@ class DeleteKeysRequest(BaseModel): ] r"""The hash identifier of the API key to delete""" + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + class DeleteKeysResponseTypedDict(TypedDict): r"""API key deleted successfully""" diff --git a/src/openrouter/operations/exchangeauthcodeforapikey.py b/src/openrouter/operations/exchangeauthcodeforapikey.py index 1f475e5..4e14679 100644 --- a/src/openrouter/operations/exchangeauthcodeforapikey.py +++ b/src/openrouter/operations/exchangeauthcodeforapikey.py @@ -9,13 +9,52 @@ from openrouter.types import ( UNSET_SENTINEL, UnrecognizedStr, ) -from openrouter.utils import validate_open_enum +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + RequestMetadata, + validate_open_enum, +) +import pydantic from pydantic import model_serializer from pydantic.functional_validators import PlainValidator from typing import Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict +class ExchangeAuthCodeForAPIKeyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ExchangeAuthCodeForAPIKeyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + ExchangeAuthCodeForAPIKeyCodeChallengeMethod = Union[ Literal[ "S256", @@ -26,7 +65,7 @@ ExchangeAuthCodeForAPIKeyCodeChallengeMethod = Union[ r"""The method used to generate the code challenge""" -class ExchangeAuthCodeForAPIKeyRequestTypedDict(TypedDict): +class ExchangeAuthCodeForAPIKeyRequestBodyTypedDict(TypedDict): code: str r"""The authorization code received from the OAuth redirect""" code_verifier: NotRequired[str] @@ -37,7 +76,7 @@ class ExchangeAuthCodeForAPIKeyRequestTypedDict(TypedDict): r"""The method used to generate the code challenge""" -class ExchangeAuthCodeForAPIKeyRequest(BaseModel): +class ExchangeAuthCodeForAPIKeyRequestBody(BaseModel): code: str r"""The authorization code received from the OAuth redirect""" @@ -81,6 +120,45 @@ class ExchangeAuthCodeForAPIKeyRequest(BaseModel): return m +class ExchangeAuthCodeForAPIKeyRequestTypedDict(TypedDict): + request_body: ExchangeAuthCodeForAPIKeyRequestBodyTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ExchangeAuthCodeForAPIKeyRequest(BaseModel): + request_body: Annotated[ + ExchangeAuthCodeForAPIKeyRequestBody, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + class ExchangeAuthCodeForAPIKeyResponseTypedDict(TypedDict): r"""Successfully exchanged code for an API key""" diff --git a/src/openrouter/operations/getcredits.py b/src/openrouter/operations/getcredits.py index 8cab52d..4c79e6d 100644 --- a/src/openrouter/operations/getcredits.py +++ b/src/openrouter/operations/getcredits.py @@ -2,7 +2,76 @@ from __future__ import annotations from openrouter.types import BaseModel -from typing_extensions import TypedDict +from openrouter.utils import FieldMetadata, HeaderMetadata +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetCreditsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class GetCreditsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class GetCreditsRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class GetCreditsRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class GetCreditsDataTypedDict(TypedDict): diff --git a/src/openrouter/operations/getcurrentkey.py b/src/openrouter/operations/getcurrentkey.py index 9bd9931..8836057 100644 --- a/src/openrouter/operations/getcurrentkey.py +++ b/src/openrouter/operations/getcurrentkey.py @@ -9,11 +9,79 @@ from openrouter.types import ( UNSET, UNSET_SENTINEL, ) +from openrouter.utils import FieldMetadata, HeaderMetadata import pydantic from pydantic import model_serializer +from typing import Optional from typing_extensions import Annotated, NotRequired, TypedDict, deprecated +class GetCurrentKeyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class GetCurrentKeyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class GetCurrentKeyRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class GetCurrentKeyRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + @deprecated( "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." ) @@ -69,8 +137,10 @@ class GetCurrentKeyDataTypedDict(TypedDict): r"""External BYOK usage (in USD) for current UTC month""" is_free_tier: bool r"""Whether this is a free tier API key""" + is_management_key: bool + r"""Whether this is a management key""" is_provisioning_key: bool - r"""Whether this is a provisioning key""" + r"""Whether this is a management key""" limit_remaining: Nullable[float] r"""Remaining spending limit in USD""" limit_reset: Nullable[str] @@ -119,8 +189,16 @@ class GetCurrentKeyData(BaseModel): is_free_tier: bool r"""Whether this is a free tier API key""" - is_provisioning_key: bool - r"""Whether this is a provisioning key""" + is_management_key: bool + r"""Whether this is a management key""" + + is_provisioning_key: Annotated[ + bool, + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ), + ] + r"""Whether this is a management key""" limit_remaining: Nullable[float] r"""Remaining spending limit in USD""" diff --git a/src/openrouter/operations/getgeneration.py b/src/openrouter/operations/getgeneration.py index 7a4e89a..cad7425 100644 --- a/src/openrouter/operations/getgeneration.py +++ b/src/openrouter/operations/getgeneration.py @@ -2,15 +2,63 @@ from __future__ import annotations from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr -from openrouter.utils import FieldMetadata, QueryParamMetadata, validate_open_enum +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + QueryParamMetadata, + validate_open_enum, +) +import pydantic from pydantic import model_serializer from pydantic.functional_validators import PlainValidator -from typing import Literal, Union -from typing_extensions import Annotated, TypedDict +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetGenerationGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class GetGenerationGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class GetGenerationRequestTypedDict(TypedDict): id: str + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class GetGenerationRequest(BaseModel): @@ -18,6 +66,25 @@ class GetGenerationRequest(BaseModel): str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True)) ] + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + APIType = Union[ Literal[ @@ -29,6 +96,178 @@ APIType = Union[ r"""Type of API used for the generation""" +ProviderName = Union[ + Literal[ + "AnyScale", + "Atoma", + "Cent-ML", + "CrofAI", + "Enfer", + "GoPomelo", + "HuggingFace", + "Hyperbolic 2", + "InoCloud", + "Kluster", + "Lambda", + "Lepton", + "Lynn 2", + "Lynn", + "Mancer", + "Meta", + "Modal", + "Nineteen", + "OctoAI", + "Recursal", + "Reflection", + "Replicate", + "SambaNova 2", + "SF Compute", + "Targon", + "Together 2", + "Ubicloud", + "01.AI", + "AI21", + "AionLabs", + "Alibaba", + "Ambient", + "Amazon Bedrock", + "Amazon Nova", + "Anthropic", + "Arcee AI", + "AtlasCloud", + "Avian", + "Azure", + "BaseTen", + "BytePlus", + "Black Forest Labs", + "Cerebras", + "Chutes", + "Cirrascale", + "Clarifai", + "Cloudflare", + "Cohere", + "Crusoe", + "DeepInfra", + "DeepSeek", + "Featherless", + "Fireworks", + "Friendli", + "GMICloud", + "Google", + "Google AI Studio", + "Groq", + "Hyperbolic", + "Inception", + "Inceptron", + "InferenceNet", + "Infermatic", + "Inflection", + "Liquid", + "Mara", + "Mancer 2", + "Minimax", + "ModelRun", + "Mistral", + "Modular", + "Moonshot AI", + "Morph", + "NCompass", + "Nebius", + "NextBit", + "Novita", + "Nvidia", + "OpenAI", + "OpenInference", + "Parasail", + "Perplexity", + "Phala", + "Relace", + "SambaNova", + "Seed", + "SiliconFlow", + "Sourceful", + "StepFun", + "Stealth", + "StreamLake", + "Switchpoint", + "Together", + "Upstage", + "Venice", + "WandB", + "Xiaomi", + "xAI", + "Z.AI", + "FakeProvider", + ], + UnrecognizedStr, +] + + +class ProviderResponseTypedDict(TypedDict): + status: Nullable[float] + id: NotRequired[str] + endpoint_id: NotRequired[str] + model_permaslug: NotRequired[str] + provider_name: NotRequired[ProviderName] + latency: NotRequired[float] + is_byok: NotRequired[bool] + + +class ProviderResponse(BaseModel): + status: Nullable[float] + + id: Optional[str] = None + + endpoint_id: Optional[str] = None + + model_permaslug: Optional[str] = None + + provider_name: Annotated[ + Optional[ProviderName], PlainValidator(validate_open_enum(False)) + ] = None + + latency: Optional[float] = None + + is_byok: Optional[bool] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "id", + "endpoint_id", + "model_permaslug", + "provider_name", + "latency", + "is_byok", + ] + nullable_fields = ["status"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m + + class GetGenerationDataTypedDict(TypedDict): r"""Generation data""" @@ -98,6 +337,8 @@ class GetGenerationDataTypedDict(TypedDict): r"""Type of API used for the generation""" router: Nullable[str] r"""Router used for the request (e.g., openrouter/auto)""" + provider_responses: Nullable[List[ProviderResponseTypedDict]] + r"""List of provider responses for this generation, including fallback attempts""" class GetGenerationData(BaseModel): @@ -202,6 +443,9 @@ class GetGenerationData(BaseModel): router: Nullable[str] r"""Router used for the request (e.g., openrouter/auto)""" + provider_responses: Nullable[List[ProviderResponse]] + r"""List of provider responses for this generation, including fallback attempts""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [] @@ -232,6 +476,7 @@ class GetGenerationData(BaseModel): "external_user", "api_type", "router", + "provider_responses", ] null_default_fields = [] diff --git a/src/openrouter/operations/getguardrail.py b/src/openrouter/operations/getguardrail.py index 603657e..8d185cc 100644 --- a/src/openrouter/operations/getguardrail.py +++ b/src/openrouter/operations/getguardrail.py @@ -9,16 +9,64 @@ from openrouter.types import ( UNSET_SENTINEL, UnrecognizedStr, ) -from openrouter.utils import FieldMetadata, PathParamMetadata, validate_open_enum +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + validate_open_enum, +) +import pydantic from pydantic import model_serializer from pydantic.functional_validators import PlainValidator -from typing import List, Literal, Union +from typing import List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict +class GetGuardrailGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class GetGuardrailGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + class GetGuardrailRequestTypedDict(TypedDict): id: str r"""The unique identifier of the guardrail to retrieve""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class GetGuardrailRequest(BaseModel): @@ -27,6 +75,25 @@ class GetGuardrailRequest(BaseModel): ] r"""The unique identifier of the guardrail to retrieve""" + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + GetGuardrailResetInterval = Union[ Literal[ diff --git a/src/openrouter/operations/getkey.py b/src/openrouter/operations/getkey.py index fe774e3..af7317e 100644 --- a/src/openrouter/operations/getkey.py +++ b/src/openrouter/operations/getkey.py @@ -9,14 +9,58 @@ from openrouter.types import ( UNSET, UNSET_SENTINEL, ) -from openrouter.utils import FieldMetadata, PathParamMetadata +from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic from pydantic import model_serializer +from typing import Optional from typing_extensions import Annotated, NotRequired, TypedDict +class GetKeyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class GetKeyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + class GetKeyRequestTypedDict(TypedDict): hash: str r"""The hash identifier of the API key to retrieve""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class GetKeyRequest(BaseModel): @@ -25,6 +69,25 @@ class GetKeyRequest(BaseModel): ] r"""The hash identifier of the API key to retrieve""" + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + class GetKeyDataTypedDict(TypedDict): r"""The API key information""" diff --git a/src/openrouter/operations/getmodels.py b/src/openrouter/operations/getmodels.py index dfc79ca..6a9cc9e 100644 --- a/src/openrouter/operations/getmodels.py +++ b/src/openrouter/operations/getmodels.py @@ -2,12 +2,51 @@ from __future__ import annotations from openrouter.types import BaseModel, UnrecognizedStr -from openrouter.utils import FieldMetadata, QueryParamMetadata, validate_open_enum +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + QueryParamMetadata, + validate_open_enum, +) +import pydantic from pydantic.functional_validators import PlainValidator from typing import Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict +class GetModelsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class GetModelsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + Category = Union[ Literal[ "programming", @@ -29,12 +68,40 @@ r"""Filter models by use case category""" class GetModelsRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ category: NotRequired[Category] r"""Filter models by use case category""" supported_parameters: NotRequired[str] class GetModelsRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + category: Annotated[ Annotated[Optional[Category], PlainValidator(validate_open_enum(False))], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), diff --git a/src/openrouter/operations/getuseractivity.py b/src/openrouter/operations/getuseractivity.py index f485082..fef1ba4 100644 --- a/src/openrouter/operations/getuseractivity.py +++ b/src/openrouter/operations/getuseractivity.py @@ -3,18 +3,79 @@ from __future__ import annotations from openrouter.components import activityitem as components_activityitem from openrouter.types import BaseModel -from openrouter.utils import FieldMetadata, QueryParamMetadata +from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata import pydantic from typing import List, Optional from typing_extensions import Annotated, NotRequired, TypedDict +class GetUserActivityGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class GetUserActivityGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + class GetUserActivityRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ date_: NotRequired[str] r"""Filter by a single UTC date in the last 30 days (YYYY-MM-DD format).""" class GetUserActivityRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + date_: Annotated[ Optional[str], pydantic.Field(alias="date"), diff --git a/src/openrouter/operations/list.py b/src/openrouter/operations/list.py index d4f87f7..63ecc47 100644 --- a/src/openrouter/operations/list.py +++ b/src/openrouter/operations/list.py @@ -9,13 +9,56 @@ from openrouter.types import ( UNSET, UNSET_SENTINEL, ) -from openrouter.utils import FieldMetadata, QueryParamMetadata +from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata +import pydantic from pydantic import model_serializer from typing import List, Optional from typing_extensions import Annotated, NotRequired, TypedDict +class ListGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + class ListRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ include_disabled: NotRequired[str] r"""Whether to include disabled API keys in the response""" offset: NotRequired[str] @@ -23,6 +66,25 @@ class ListRequestTypedDict(TypedDict): class ListRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + include_disabled: Annotated[ Optional[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), diff --git a/src/openrouter/operations/listembeddingsmodels.py b/src/openrouter/operations/listembeddingsmodels.py new file mode 100644 index 0000000..fc32d4d --- /dev/null +++ b/src/openrouter/operations/listembeddingsmodels.py @@ -0,0 +1,74 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from openrouter.utils import FieldMetadata, HeaderMetadata +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListEmbeddingsModelsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListEmbeddingsModelsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListEmbeddingsModelsRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListEmbeddingsModelsRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ diff --git a/src/openrouter/operations/listendpoints.py b/src/openrouter/operations/listendpoints.py index 20286ca..3e20e63 100644 --- a/src/openrouter/operations/listendpoints.py +++ b/src/openrouter/operations/listendpoints.py @@ -5,13 +5,57 @@ from openrouter.components import ( listendpointsresponse as components_listendpointsresponse, ) from openrouter.types import BaseModel -from openrouter.utils import FieldMetadata, PathParamMetadata -from typing_extensions import Annotated, TypedDict +from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListEndpointsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListEndpointsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class ListEndpointsRequestTypedDict(TypedDict): author: str slug: str + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class ListEndpointsRequest(BaseModel): @@ -23,6 +67,25 @@ class ListEndpointsRequest(BaseModel): str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) ] + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + class ListEndpointsResponseTypedDict(TypedDict): r"""Returns a list of endpoints""" diff --git a/src/openrouter/operations/listendpointszdr.py b/src/openrouter/operations/listendpointszdr.py index dcf7b20..6814c5e 100644 --- a/src/openrouter/operations/listendpointszdr.py +++ b/src/openrouter/operations/listendpointszdr.py @@ -3,8 +3,76 @@ from __future__ import annotations from openrouter.components import publicendpoint as components_publicendpoint from openrouter.types import BaseModel -from typing import List -from typing_extensions import TypedDict +from openrouter.utils import FieldMetadata, HeaderMetadata +import pydantic +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListEndpointsZdrGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListEndpointsZdrGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListEndpointsZdrRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListEndpointsZdrRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class ListEndpointsZdrResponseTypedDict(TypedDict): diff --git a/src/openrouter/operations/listguardrailkeyassignments.py b/src/openrouter/operations/listguardrailkeyassignments.py index 68a20aa..d90770f 100644 --- a/src/openrouter/operations/listguardrailkeyassignments.py +++ b/src/openrouter/operations/listguardrailkeyassignments.py @@ -2,15 +2,63 @@ from __future__ import annotations from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL -from openrouter.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic from pydantic import model_serializer from typing import List, Optional from typing_extensions import Annotated, NotRequired, TypedDict +class ListGuardrailKeyAssignmentsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListGuardrailKeyAssignmentsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + class ListGuardrailKeyAssignmentsRequestTypedDict(TypedDict): id: str r"""The unique identifier of the guardrail""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ offset: NotRequired[str] r"""Number of records to skip for pagination""" limit: NotRequired[str] @@ -23,6 +71,25 @@ class ListGuardrailKeyAssignmentsRequest(BaseModel): ] r"""The unique identifier of the guardrail""" + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + offset: Annotated[ Optional[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), diff --git a/src/openrouter/operations/listguardrailmemberassignments.py b/src/openrouter/operations/listguardrailmemberassignments.py index cb81a7b..45b6c42 100644 --- a/src/openrouter/operations/listguardrailmemberassignments.py +++ b/src/openrouter/operations/listguardrailmemberassignments.py @@ -2,15 +2,63 @@ from __future__ import annotations from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL -from openrouter.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic from pydantic import model_serializer from typing import List, Optional from typing_extensions import Annotated, NotRequired, TypedDict +class ListGuardrailMemberAssignmentsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListGuardrailMemberAssignmentsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + class ListGuardrailMemberAssignmentsRequestTypedDict(TypedDict): id: str r"""The unique identifier of the guardrail""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ offset: NotRequired[str] r"""Number of records to skip for pagination""" limit: NotRequired[str] @@ -23,6 +71,25 @@ class ListGuardrailMemberAssignmentsRequest(BaseModel): ] r"""The unique identifier of the guardrail""" + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + offset: Annotated[ Optional[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), diff --git a/src/openrouter/operations/listguardrails.py b/src/openrouter/operations/listguardrails.py index 4452312..89f34ae 100644 --- a/src/openrouter/operations/listguardrails.py +++ b/src/openrouter/operations/listguardrails.py @@ -9,14 +9,62 @@ from openrouter.types import ( UNSET_SENTINEL, UnrecognizedStr, ) -from openrouter.utils import FieldMetadata, QueryParamMetadata, validate_open_enum +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + QueryParamMetadata, + validate_open_enum, +) +import pydantic from pydantic import model_serializer from pydantic.functional_validators import PlainValidator from typing import List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict +class ListGuardrailsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListGuardrailsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + class ListGuardrailsRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ offset: NotRequired[str] r"""Number of records to skip for pagination""" limit: NotRequired[str] @@ -24,6 +72,25 @@ class ListGuardrailsRequestTypedDict(TypedDict): class ListGuardrailsRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + offset: Annotated[ Optional[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), diff --git a/src/openrouter/operations/listkeyassignments.py b/src/openrouter/operations/listkeyassignments.py index c54ebb6..870d9de 100644 --- a/src/openrouter/operations/listkeyassignments.py +++ b/src/openrouter/operations/listkeyassignments.py @@ -2,13 +2,56 @@ from __future__ import annotations from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL -from openrouter.utils import FieldMetadata, QueryParamMetadata +from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata +import pydantic from pydantic import model_serializer from typing import List, Optional from typing_extensions import Annotated, NotRequired, TypedDict +class ListKeyAssignmentsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListKeyAssignmentsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + class ListKeyAssignmentsRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ offset: NotRequired[str] r"""Number of records to skip for pagination""" limit: NotRequired[str] @@ -16,6 +59,25 @@ class ListKeyAssignmentsRequestTypedDict(TypedDict): class ListKeyAssignmentsRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + offset: Annotated[ Optional[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), diff --git a/src/openrouter/operations/listmemberassignments.py b/src/openrouter/operations/listmemberassignments.py index 5adb2b5..c6ae44e 100644 --- a/src/openrouter/operations/listmemberassignments.py +++ b/src/openrouter/operations/listmemberassignments.py @@ -2,13 +2,56 @@ from __future__ import annotations from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL -from openrouter.utils import FieldMetadata, QueryParamMetadata +from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata +import pydantic from pydantic import model_serializer from typing import List, Optional from typing_extensions import Annotated, NotRequired, TypedDict +class ListMemberAssignmentsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListMemberAssignmentsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + class ListMemberAssignmentsRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ offset: NotRequired[str] r"""Number of records to skip for pagination""" limit: NotRequired[str] @@ -16,6 +59,25 @@ class ListMemberAssignmentsRequestTypedDict(TypedDict): class ListMemberAssignmentsRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + offset: Annotated[ Optional[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), diff --git a/src/openrouter/operations/listmodelscount.py b/src/openrouter/operations/listmodelscount.py new file mode 100644 index 0000000..77b8ead --- /dev/null +++ b/src/openrouter/operations/listmodelscount.py @@ -0,0 +1,74 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from openrouter.utils import FieldMetadata, HeaderMetadata +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListModelsCountGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListModelsCountGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListModelsCountRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListModelsCountRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ diff --git a/src/openrouter/operations/listmodelsuser.py b/src/openrouter/operations/listmodelsuser.py index bf66ce3..8f3668f 100644 --- a/src/openrouter/operations/listmodelsuser.py +++ b/src/openrouter/operations/listmodelsuser.py @@ -2,8 +2,43 @@ from __future__ import annotations from openrouter.types import BaseModel -from openrouter.utils import FieldMetadata, SecurityMetadata -from typing_extensions import Annotated, TypedDict +from openrouter.utils import FieldMetadata, HeaderMetadata, SecurityMetadata +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListModelsUserGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListModelsUserGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class ListModelsUserSecurityTypedDict(TypedDict): @@ -22,3 +57,36 @@ class ListModelsUserSecurity(BaseModel): ) ), ] + + +class ListModelsUserRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListModelsUserRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ diff --git a/src/openrouter/operations/listproviders.py b/src/openrouter/operations/listproviders.py index 4ff3f60..2f905fd 100644 --- a/src/openrouter/operations/listproviders.py +++ b/src/openrouter/operations/listproviders.py @@ -8,9 +8,77 @@ from openrouter.types import ( UNSET, UNSET_SENTINEL, ) +from openrouter.utils import FieldMetadata, HeaderMetadata +import pydantic from pydantic import model_serializer -from typing import List -from typing_extensions import NotRequired, TypedDict +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListProvidersGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListProvidersGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListProvidersRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class ListProvidersRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class ListProvidersDataTypedDict(TypedDict): diff --git a/src/openrouter/operations/sendchatcompletionrequest.py b/src/openrouter/operations/sendchatcompletionrequest.py index 7a576b9..4db4072 100644 --- a/src/openrouter/operations/sendchatcompletionrequest.py +++ b/src/openrouter/operations/sendchatcompletionrequest.py @@ -2,12 +2,96 @@ from __future__ import annotations from openrouter.components import ( + chatgenerationparams as components_chatgenerationparams, chatresponse as components_chatresponse, chatstreamingresponsechunk as components_chatstreamingresponsechunk, ) -from openrouter.utils import eventstreaming -from typing import Union -from typing_extensions import TypeAliasType +from openrouter.types import BaseModel +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + RequestMetadata, + eventstreaming, +) +import pydantic +from typing import Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class SendChatCompletionRequestGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class SendChatCompletionRequestGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class SendChatCompletionRequestRequestTypedDict(TypedDict): + chat_generation_params: ( + components_chatgenerationparams.ChatGenerationParamsTypedDict + ) + r"""Chat completion request parameters""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class SendChatCompletionRequestRequest(BaseModel): + chat_generation_params: Annotated[ + components_chatgenerationparams.ChatGenerationParams, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + r"""Chat completion request parameters""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ SendChatCompletionRequestResponseTypedDict = TypeAliasType( diff --git a/src/openrouter/operations/updateguardrail.py b/src/openrouter/operations/updateguardrail.py index 7667861..061dc40 100644 --- a/src/openrouter/operations/updateguardrail.py +++ b/src/openrouter/operations/updateguardrail.py @@ -11,16 +11,51 @@ from openrouter.types import ( ) from openrouter.utils import ( FieldMetadata, + HeaderMetadata, PathParamMetadata, RequestMetadata, validate_open_enum, ) +import pydantic from pydantic import model_serializer from pydantic.functional_validators import PlainValidator from typing import List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict +class UpdateGuardrailGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class UpdateGuardrailGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + UpdateGuardrailResetIntervalRequest = Union[ Literal[ "daily", @@ -124,6 +159,15 @@ class UpdateGuardrailRequestTypedDict(TypedDict): id: str r"""The unique identifier of the guardrail to update""" request_body: UpdateGuardrailRequestBodyTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class UpdateGuardrailRequest(BaseModel): @@ -137,6 +181,25 @@ class UpdateGuardrailRequest(BaseModel): FieldMetadata(request=RequestMetadata(media_type="application/json")), ] + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + UpdateGuardrailResetIntervalResponse = Union[ Literal[ diff --git a/src/openrouter/operations/updatekeys.py b/src/openrouter/operations/updatekeys.py index 7f81066..740bf48 100644 --- a/src/openrouter/operations/updatekeys.py +++ b/src/openrouter/operations/updatekeys.py @@ -12,16 +12,51 @@ from openrouter.types import ( ) from openrouter.utils import ( FieldMetadata, + HeaderMetadata, PathParamMetadata, RequestMetadata, validate_open_enum, ) +import pydantic from pydantic import model_serializer from pydantic.functional_validators import PlainValidator from typing import Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict +class UpdateKeysGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + +class UpdateKeysGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + UpdateKeysLimitReset = Union[ Literal[ "daily", @@ -106,6 +141,15 @@ class UpdateKeysRequestTypedDict(TypedDict): hash: str r"""The hash identifier of the API key to update""" request_body: UpdateKeysRequestBodyTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ class UpdateKeysRequest(BaseModel): @@ -119,6 +163,25 @@ class UpdateKeysRequest(BaseModel): FieldMetadata(request=RequestMetadata(media_type="application/json")), ] + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + class UpdateKeysDataTypedDict(TypedDict): r"""The updated API key information""" diff --git a/src/openrouter/providers.py b/src/openrouter/providers.py index 04c0598..228f618 100644 --- a/src/openrouter/providers.py +++ b/src/openrouter/providers.py @@ -15,6 +15,8 @@ class Providers(BaseSDK): def list( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -22,6 +24,11 @@ class Providers(BaseSDK): ) -> operations.ListProvidersResponse: r"""List all providers + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -36,18 +43,28 @@ class Providers(BaseSDK): base_url = server_url else: base_url = self._get_url(base_url, url_variables) + + request = operations.ListProvidersRequest( + http_referer=http_referer, + x_title=x_title, + ) + req = self._build_request( method="GET", path="/providers", base_url=base_url, url_variables=url_variables, - request=None, + request=request, request_body_required=False, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListProvidersGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, @@ -100,6 +117,8 @@ class Providers(BaseSDK): async def list_async( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -107,6 +126,11 @@ class Providers(BaseSDK): ) -> operations.ListProvidersResponse: r"""List all providers + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -121,18 +145,28 @@ class Providers(BaseSDK): base_url = server_url else: base_url = self._get_url(base_url, url_variables) + + request = operations.ListProvidersRequest( + http_referer=http_referer, + x_title=x_title, + ) + req = self._build_request_async( method="GET", path="/providers", base_url=base_url, url_variables=url_variables, - request=None, + request=request, request_body_required=False, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + _globals=operations.ListProvidersGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, allow_empty_value=None, timeout_ms=timeout_ms, diff --git a/src/openrouter/responses.py b/src/openrouter/responses.py index 480cab0..8c4281e 100644 --- a/src/openrouter/responses.py +++ b/src/openrouter/responses.py @@ -22,6 +22,8 @@ class Responses(BaseSDK): def send( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, input: Optional[ Union[components.OpenResponsesInput, components.OpenResponsesInputTypedDict] ] = None, @@ -84,16 +86,10 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Union[Literal[False], None] = None, provider: OptionalNullable[ - Union[ - components.OpenResponsesRequestProvider, - components.OpenResponsesRequestProviderTypedDict, - ] + Union[components.Provider, components.ProviderTypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.OpenResponsesRequestPluginUnion], - List[components.OpenResponsesRequestPluginUnionTypedDict], - ] + Union[List[components.Plugin], List[components.PluginTypedDict]] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, @@ -106,6 +102,11 @@ class Responses(BaseSDK): Creates a streaming or non-streaming response using OpenResponses API format + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param input: Input for a response request - can be a string or array of items :param instructions: :param metadata: Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed. @@ -150,6 +151,8 @@ class Responses(BaseSDK): def send( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, input: Optional[ Union[components.OpenResponsesInput, components.OpenResponsesInputTypedDict] ] = None, @@ -212,16 +215,10 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Literal[True], provider: OptionalNullable[ - Union[ - components.OpenResponsesRequestProvider, - components.OpenResponsesRequestProviderTypedDict, - ] + Union[components.Provider, components.ProviderTypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.OpenResponsesRequestPluginUnion], - List[components.OpenResponsesRequestPluginUnionTypedDict], - ] + Union[List[components.Plugin], List[components.PluginTypedDict]] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, @@ -234,6 +231,11 @@ class Responses(BaseSDK): Creates a streaming or non-streaming response using OpenResponses API format + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param input: Input for a response request - can be a string or array of items :param instructions: :param metadata: Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed. @@ -277,6 +279,8 @@ class Responses(BaseSDK): def send( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, input: Optional[ Union[components.OpenResponsesInput, components.OpenResponsesInputTypedDict] ] = None, @@ -339,16 +343,10 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Optional[bool] = False, provider: OptionalNullable[ - Union[ - components.OpenResponsesRequestProvider, - components.OpenResponsesRequestProviderTypedDict, - ] + Union[components.Provider, components.ProviderTypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.OpenResponsesRequestPluginUnion], - List[components.OpenResponsesRequestPluginUnionTypedDict], - ] + Union[List[components.Plugin], List[components.PluginTypedDict]] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, @@ -361,6 +359,11 @@ class Responses(BaseSDK): Creates a streaming or non-streaming response using OpenResponses API format + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param input: Input for a response request - can be a string or array of items :param instructions: :param metadata: Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed. @@ -410,56 +413,60 @@ class Responses(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = components.OpenResponsesRequest( - input=utils.get_pydantic_model( - input, Optional[components.OpenResponsesInput] + request = operations.CreateResponsesRequest( + http_referer=http_referer, + x_title=x_title, + open_responses_request=components.OpenResponsesRequest( + input=utils.get_pydantic_model( + input, Optional[components.OpenResponsesInput] + ), + instructions=instructions, + metadata=metadata, + tools=utils.get_pydantic_model( + tools, Optional[List[components.OpenResponsesRequestToolUnion]] + ), + tool_choice=utils.get_pydantic_model( + tool_choice, Optional[components.OpenAIResponsesToolChoiceUnion] + ), + parallel_tool_calls=parallel_tool_calls, + model=model, + models=models, + text=utils.get_pydantic_model( + text, Optional[components.OpenResponsesResponseText] + ), + reasoning=utils.get_pydantic_model( + reasoning, OptionalNullable[components.OpenResponsesReasoningConfig] + ), + max_output_tokens=max_output_tokens, + temperature=temperature, + top_p=top_p, + top_logprobs=top_logprobs, + max_tool_calls=max_tool_calls, + presence_penalty=presence_penalty, + frequency_penalty=frequency_penalty, + top_k=top_k, + image_config=image_config, + modalities=modalities, + prompt_cache_key=prompt_cache_key, + previous_response_id=previous_response_id, + prompt=utils.get_pydantic_model( + prompt, OptionalNullable[components.OpenAIResponsesPrompt] + ), + include=include, + background=background, + safety_identifier=safety_identifier, + service_tier=service_tier, + truncation=truncation, + stream=stream, + provider=utils.get_pydantic_model( + provider, OptionalNullable[components.Provider] + ), + plugins=utils.get_pydantic_model( + plugins, Optional[List[components.Plugin]] + ), + user=user, + session_id=session_id, ), - instructions=instructions, - metadata=metadata, - tools=utils.get_pydantic_model( - tools, Optional[List[components.OpenResponsesRequestToolUnion]] - ), - tool_choice=utils.get_pydantic_model( - tool_choice, Optional[components.OpenAIResponsesToolChoiceUnion] - ), - parallel_tool_calls=parallel_tool_calls, - model=model, - models=models, - text=utils.get_pydantic_model( - text, Optional[components.OpenResponsesResponseText] - ), - reasoning=utils.get_pydantic_model( - reasoning, OptionalNullable[components.OpenResponsesReasoningConfig] - ), - max_output_tokens=max_output_tokens, - temperature=temperature, - top_p=top_p, - top_logprobs=top_logprobs, - max_tool_calls=max_tool_calls, - presence_penalty=presence_penalty, - frequency_penalty=frequency_penalty, - top_k=top_k, - image_config=image_config, - modalities=modalities, - prompt_cache_key=prompt_cache_key, - previous_response_id=previous_response_id, - prompt=utils.get_pydantic_model( - prompt, OptionalNullable[components.OpenAIResponsesPrompt] - ), - include=include, - background=background, - safety_identifier=safety_identifier, - service_tier=service_tier, - truncation=truncation, - stream=stream, - provider=utils.get_pydantic_model( - provider, OptionalNullable[components.OpenResponsesRequestProvider] - ), - plugins=utils.get_pydantic_model( - plugins, Optional[List[components.OpenResponsesRequestPluginUnion]] - ), - user=user, - session_id=session_id, ) req = self._build_request( @@ -474,9 +481,17 @@ class Responses(BaseSDK): user_agent_header="user-agent", accept_header_value="text/event-stream" if stream else "application/json", http_headers=http_headers, + _globals=operations.CreateResponsesGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", components.OpenResponsesRequest + request.open_responses_request, + False, + False, + "json", + components.OpenResponsesRequest, ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -655,6 +670,8 @@ class Responses(BaseSDK): async def send_async( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, input: Optional[ Union[components.OpenResponsesInput, components.OpenResponsesInputTypedDict] ] = None, @@ -717,16 +734,10 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Union[Literal[False], None] = None, provider: OptionalNullable[ - Union[ - components.OpenResponsesRequestProvider, - components.OpenResponsesRequestProviderTypedDict, - ] + Union[components.Provider, components.ProviderTypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.OpenResponsesRequestPluginUnion], - List[components.OpenResponsesRequestPluginUnionTypedDict], - ] + Union[List[components.Plugin], List[components.PluginTypedDict]] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, @@ -739,6 +750,11 @@ class Responses(BaseSDK): Creates a streaming or non-streaming response using OpenResponses API format + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param input: Input for a response request - can be a string or array of items :param instructions: :param metadata: Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed. @@ -783,6 +799,8 @@ class Responses(BaseSDK): async def send_async( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, input: Optional[ Union[components.OpenResponsesInput, components.OpenResponsesInputTypedDict] ] = None, @@ -845,16 +863,10 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Literal[True], provider: OptionalNullable[ - Union[ - components.OpenResponsesRequestProvider, - components.OpenResponsesRequestProviderTypedDict, - ] + Union[components.Provider, components.ProviderTypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.OpenResponsesRequestPluginUnion], - List[components.OpenResponsesRequestPluginUnionTypedDict], - ] + Union[List[components.Plugin], List[components.PluginTypedDict]] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, @@ -867,6 +879,11 @@ class Responses(BaseSDK): Creates a streaming or non-streaming response using OpenResponses API format + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param input: Input for a response request - can be a string or array of items :param instructions: :param metadata: Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed. @@ -910,6 +927,8 @@ class Responses(BaseSDK): async def send_async( self, *, + http_referer: Optional[str] = None, + x_title: Optional[str] = None, input: Optional[ Union[components.OpenResponsesInput, components.OpenResponsesInputTypedDict] ] = None, @@ -972,16 +991,10 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Optional[bool] = False, provider: OptionalNullable[ - Union[ - components.OpenResponsesRequestProvider, - components.OpenResponsesRequestProviderTypedDict, - ] + Union[components.Provider, components.ProviderTypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.OpenResponsesRequestPluginUnion], - List[components.OpenResponsesRequestPluginUnionTypedDict], - ] + Union[List[components.Plugin], List[components.PluginTypedDict]] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, @@ -994,6 +1007,11 @@ class Responses(BaseSDK): Creates a streaming or non-streaming response using OpenResponses API format + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + :param input: Input for a response request - can be a string or array of items :param instructions: :param metadata: Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed. @@ -1043,56 +1061,60 @@ class Responses(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = components.OpenResponsesRequest( - input=utils.get_pydantic_model( - input, Optional[components.OpenResponsesInput] + request = operations.CreateResponsesRequest( + http_referer=http_referer, + x_title=x_title, + open_responses_request=components.OpenResponsesRequest( + input=utils.get_pydantic_model( + input, Optional[components.OpenResponsesInput] + ), + instructions=instructions, + metadata=metadata, + tools=utils.get_pydantic_model( + tools, Optional[List[components.OpenResponsesRequestToolUnion]] + ), + tool_choice=utils.get_pydantic_model( + tool_choice, Optional[components.OpenAIResponsesToolChoiceUnion] + ), + parallel_tool_calls=parallel_tool_calls, + model=model, + models=models, + text=utils.get_pydantic_model( + text, Optional[components.OpenResponsesResponseText] + ), + reasoning=utils.get_pydantic_model( + reasoning, OptionalNullable[components.OpenResponsesReasoningConfig] + ), + max_output_tokens=max_output_tokens, + temperature=temperature, + top_p=top_p, + top_logprobs=top_logprobs, + max_tool_calls=max_tool_calls, + presence_penalty=presence_penalty, + frequency_penalty=frequency_penalty, + top_k=top_k, + image_config=image_config, + modalities=modalities, + prompt_cache_key=prompt_cache_key, + previous_response_id=previous_response_id, + prompt=utils.get_pydantic_model( + prompt, OptionalNullable[components.OpenAIResponsesPrompt] + ), + include=include, + background=background, + safety_identifier=safety_identifier, + service_tier=service_tier, + truncation=truncation, + stream=stream, + provider=utils.get_pydantic_model( + provider, OptionalNullable[components.Provider] + ), + plugins=utils.get_pydantic_model( + plugins, Optional[List[components.Plugin]] + ), + user=user, + session_id=session_id, ), - instructions=instructions, - metadata=metadata, - tools=utils.get_pydantic_model( - tools, Optional[List[components.OpenResponsesRequestToolUnion]] - ), - tool_choice=utils.get_pydantic_model( - tool_choice, Optional[components.OpenAIResponsesToolChoiceUnion] - ), - parallel_tool_calls=parallel_tool_calls, - model=model, - models=models, - text=utils.get_pydantic_model( - text, Optional[components.OpenResponsesResponseText] - ), - reasoning=utils.get_pydantic_model( - reasoning, OptionalNullable[components.OpenResponsesReasoningConfig] - ), - max_output_tokens=max_output_tokens, - temperature=temperature, - top_p=top_p, - top_logprobs=top_logprobs, - max_tool_calls=max_tool_calls, - presence_penalty=presence_penalty, - frequency_penalty=frequency_penalty, - top_k=top_k, - image_config=image_config, - modalities=modalities, - prompt_cache_key=prompt_cache_key, - previous_response_id=previous_response_id, - prompt=utils.get_pydantic_model( - prompt, OptionalNullable[components.OpenAIResponsesPrompt] - ), - include=include, - background=background, - safety_identifier=safety_identifier, - service_tier=service_tier, - truncation=truncation, - stream=stream, - provider=utils.get_pydantic_model( - provider, OptionalNullable[components.OpenResponsesRequestProvider] - ), - plugins=utils.get_pydantic_model( - plugins, Optional[List[components.OpenResponsesRequestPluginUnion]] - ), - user=user, - session_id=session_id, ) req = self._build_request_async( @@ -1107,9 +1129,17 @@ class Responses(BaseSDK): user_agent_header="user-agent", accept_header_value="text/event-stream" if stream else "application/json", http_headers=http_headers, + _globals=operations.CreateResponsesGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_title=self.sdk_configuration.globals.x_title, + ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", components.OpenResponsesRequest + request.open_responses_request, + False, + False, + "json", + components.OpenResponsesRequest, ), allow_empty_value=None, timeout_ms=timeout_ms, diff --git a/src/openrouter/sdk.py b/src/openrouter/sdk.py index 03b39eb..062548f 100644 --- a/src/openrouter/sdk.py +++ b/src/openrouter/sdk.py @@ -20,7 +20,6 @@ if TYPE_CHECKING: from openrouter.api_keys import APIKeys from openrouter.beta import Beta from openrouter.chat import Chat - from openrouter.completions import Completions from openrouter.credits import Credits from openrouter.embeddings import Embeddings from openrouter.endpoints import Endpoints @@ -32,7 +31,7 @@ if TYPE_CHECKING: class OpenRouter(BaseSDK): - r"""OpenRouter API: OpenAI-compatible Chat Completions and Completions API with additional OpenRouter features + r"""OpenRouter API: OpenAI-compatible API with additional OpenRouter features https://openrouter.ai/docs - OpenRouter Documentation """ @@ -58,7 +57,6 @@ class OpenRouter(BaseSDK): o_auth: "OAuth" r"""OAuth authentication endpoints""" chat: "Chat" - completions: "Completions" _sub_sdk_map = { "beta": ("openrouter.beta", "Beta"), "analytics": ("openrouter.analytics", "Analytics"), @@ -72,7 +70,6 @@ class OpenRouter(BaseSDK): "guardrails": ("openrouter.guardrails", "Guardrails"), "o_auth": ("openrouter.oauth", "OAuth"), "chat": ("openrouter.chat", "Chat"), - "completions": ("openrouter.completions", "Completions"), } def __init__( diff --git a/uv.lock b/uv.lock index 25699b8..6b1deff 100644 --- a/uv.lock +++ b/uv.lock @@ -211,7 +211,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.1.3" +version = "0.2.0" source = { editable = "." } dependencies = [ { name = "httpcore" },