Compare commits

...
5 Commits
Author SHA1 Message Date
Matt AppersonandGitHub d433ce35e8 chore: regenerate Python SDK with updated OpenAPI spec (#26) 2025-12-12 15:17:08 -05:00
Matt Apperson 61e5216764 chore: regenerate Python SDK with updated OpenAPI spec
Updates include:
- Updated OpenAPI spec with new component schemas
- Restructured component documentation with nested parameter types
- Added new components for plugin and provider configurations
- Updated chat generation params and response request structures
- Version bump and dependency updates
2025-12-12 15:13:12 -05:00
Matt AppersonandGitHub 67ef52b03e chore: Python SDK updates and regeneration (#24) 2025-12-04 13:09:00 -05:00
Matt Apperson d4474da1b8 more updates 2025-12-04 13:07:08 -05:00
Matt Apperson aed8199b2b updates 2025-12-04 13:07:01 -05:00
77 changed files with 2425 additions and 737 deletions
+3 -1
View File
@@ -1,7 +1,9 @@
{ {
"permissions": { "permissions": {
"allow": [ "allow": [
"Bash(python3:*)" "Bash(python3:*)",
"Bash(git push:*)",
"Bash(gh pr create:*)"
], ],
"deny": [], "deny": [],
"ask": [] "ask": []
+50 -31
View File
@@ -1,12 +1,12 @@
lockVersion: 2.0.0 lockVersion: 2.0.0
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
management: management:
docChecksum: 7c3a22e3f6b8d7c91ff063e2951aed2f docChecksum: e929ecf569d79ab96a315332a4855566
docVersion: 1.0.0 docVersion: 1.0.0
speakeasyVersion: 1.666.0 speakeasyVersion: 1.666.0
generationVersion: 2.768.0 generationVersion: 2.768.0
releaseVersion: 0.1.1 releaseVersion: 0.0.22
configChecksum: 1206f35a1f0802441ea1b8674cd04f00 configChecksum: 0afda3910a58a8d797ac6674fa858711
repoURL: https://github.com/OpenRouterTeam/python-sdk.git repoURL: https://github.com/OpenRouterTeam/python-sdk.git
installationURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git
published: true published: true
@@ -58,10 +58,22 @@ generatedFiles:
- docs/components/chatcompletionfinishreason.md - docs/components/chatcompletionfinishreason.md
- docs/components/chaterrorerror.md - docs/components/chaterrorerror.md
- docs/components/chatgenerationparams.md - docs/components/chatgenerationparams.md
- docs/components/chatgenerationparamsdatacollection.md
- docs/components/chatgenerationparamsengine.md
- docs/components/chatgenerationparamsmaxprice.md
- docs/components/chatgenerationparamspdf.md
- docs/components/chatgenerationparamspdfengine.md
- docs/components/chatgenerationparamspluginfileparser.md
- docs/components/chatgenerationparamspluginmoderation.md
- docs/components/chatgenerationparamspluginresponsehealing.md
- docs/components/chatgenerationparamspluginunion.md
- docs/components/chatgenerationparamspluginweb.md
- docs/components/chatgenerationparamsprovider.md
- docs/components/chatgenerationparamsresponseformatjsonobject.md - docs/components/chatgenerationparamsresponseformatjsonobject.md
- docs/components/chatgenerationparamsresponseformatpython.md - docs/components/chatgenerationparamsresponseformatpython.md
- docs/components/chatgenerationparamsresponseformattext.md - docs/components/chatgenerationparamsresponseformattext.md
- docs/components/chatgenerationparamsresponseformatunion.md - docs/components/chatgenerationparamsresponseformatunion.md
- docs/components/chatgenerationparamsroute.md
- docs/components/chatgenerationparamsstop.md - docs/components/chatgenerationparamsstop.md
- docs/components/chatgenerationtokenusage.md - docs/components/chatgenerationtokenusage.md
- docs/components/chatmessagecontentitem.md - docs/components/chatmessagecontentitem.md
@@ -111,7 +123,6 @@ generatedFiles:
- docs/components/edgenetworktimeoutresponseerrordata.md - docs/components/edgenetworktimeoutresponseerrordata.md
- docs/components/effort.md - docs/components/effort.md
- docs/components/endpointstatus.md - docs/components/endpointstatus.md
- docs/components/engine.md
- docs/components/filecitation.md - docs/components/filecitation.md
- docs/components/filecitationtype.md - docs/components/filecitationtype.md
- docs/components/filepath.md - docs/components/filepath.md
@@ -130,7 +141,6 @@ generatedFiles:
- docs/components/internalserverresponseerrordata.md - docs/components/internalserverresponseerrordata.md
- docs/components/jsonschemaconfig.md - docs/components/jsonschemaconfig.md
- docs/components/listendpointsresponse.md - docs/components/listendpointsresponse.md
- docs/components/maxprice.md
- docs/components/message.md - docs/components/message.md
- docs/components/messagecontent.md - docs/components/messagecontent.md
- docs/components/messagedeveloper.md - docs/components/messagedeveloper.md
@@ -244,6 +254,17 @@ generatedFiles:
- docs/components/openresponsesreasoningsummarytextdoneeventtype.md - docs/components/openresponsesreasoningsummarytextdoneeventtype.md
- docs/components/openresponsesreasoningtype.md - docs/components/openresponsesreasoningtype.md
- docs/components/openresponsesrequest.md - docs/components/openresponsesrequest.md
- docs/components/openresponsesrequestengine.md
- docs/components/openresponsesrequestmaxprice.md
- docs/components/openresponsesrequestpdf.md
- docs/components/openresponsesrequestpdfengine.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/openresponsesrequestroute.md
- docs/components/openresponsesrequesttoolfunction.md - docs/components/openresponsesrequesttoolfunction.md
- docs/components/openresponsesrequesttoolunion.md - docs/components/openresponsesrequesttoolunion.md
- docs/components/openresponsesrequesttype.md - docs/components/openresponsesrequesttype.md
@@ -297,18 +318,10 @@ generatedFiles:
- docs/components/part2.md - docs/components/part2.md
- docs/components/payloadtoolargeresponseerrordata.md - docs/components/payloadtoolargeresponseerrordata.md
- docs/components/paymentrequiredresponseerrordata.md - docs/components/paymentrequiredresponseerrordata.md
- docs/components/pdf.md
- docs/components/pdfengine.md
- docs/components/perrequestlimits.md - docs/components/perrequestlimits.md
- docs/components/plugin.md
- docs/components/pluginfileparser.md
- docs/components/pluginmoderation.md
- docs/components/pluginresponsehealing.md
- docs/components/pluginweb.md
- docs/components/pricing.md - docs/components/pricing.md
- docs/components/prompt.md - docs/components/prompt.md
- docs/components/prompttokensdetails.md - docs/components/prompttokensdetails.md
- docs/components/provider.md
- docs/components/providername.md - docs/components/providername.md
- docs/components/provideroverloadedresponseerrordata.md - docs/components/provideroverloadedresponseerrordata.md
- docs/components/providersort.md - docs/components/providersort.md
@@ -316,6 +329,7 @@ generatedFiles:
- docs/components/publicendpointquantization.md - docs/components/publicendpointquantization.md
- docs/components/publicpricing.md - docs/components/publicpricing.md
- docs/components/quantization.md - docs/components/quantization.md
- docs/components/quantizations.md
- docs/components/reason.md - docs/components/reason.md
- docs/components/reasoning.md - docs/components/reasoning.md
- docs/components/reasoningsummarytext.md - docs/components/reasoningsummarytext.md
@@ -379,9 +393,12 @@ generatedFiles:
- docs/components/responseswebsearchuserlocationtype.md - docs/components/responseswebsearchuserlocationtype.md
- docs/components/responsetextconfig.md - docs/components/responsetextconfig.md
- docs/components/responsetextconfigverbosity.md - docs/components/responsetextconfigverbosity.md
- docs/components/schema0.md
- docs/components/schema0enum.md
- docs/components/security.md - docs/components/security.md
- docs/components/servicetier.md - docs/components/servicetier.md
- docs/components/serviceunavailableresponseerrordata.md - docs/components/serviceunavailableresponseerrordata.md
- docs/components/sort.md
- docs/components/streamoptions.md - docs/components/streamoptions.md
- docs/components/systemmessage.md - docs/components/systemmessage.md
- docs/components/systemmessagecontent.md - docs/components/systemmessagecontent.md
@@ -459,6 +476,7 @@ generatedFiles:
- docs/operations/createembeddingsprovider.md - docs/operations/createembeddingsprovider.md
- docs/operations/createembeddingsrequest.md - docs/operations/createembeddingsrequest.md
- docs/operations/createembeddingsresponse.md - docs/operations/createembeddingsresponse.md
- docs/operations/createembeddingsresponsebody.md
- docs/operations/createkeysdata.md - docs/operations/createkeysdata.md
- docs/operations/createkeyslimitreset.md - docs/operations/createkeyslimitreset.md
- docs/operations/createkeysrequest.md - docs/operations/createkeysrequest.md
@@ -551,6 +569,7 @@ generatedFiles:
- src/openrouter/chat.py - src/openrouter/chat.py
- src/openrouter/completions.py - src/openrouter/completions.py
- src/openrouter/components/__init__.py - src/openrouter/components/__init__.py
- src/openrouter/components/_schema0.py
- src/openrouter/components/activityitem.py - src/openrouter/components/activityitem.py
- src/openrouter/components/assistantmessage.py - src/openrouter/components/assistantmessage.py
- src/openrouter/components/badgatewayresponseerrordata.py - src/openrouter/components/badgatewayresponseerrordata.py
@@ -776,10 +795,10 @@ examples:
createResponses: createResponses:
speakeasy-default-create-responses: speakeasy-default-create-responses:
requestBody: requestBody:
application/json: {"input": [{"type": "message", "role": "user", "content": "Hello, how are you?"}], "tools": [{"type": "function", "name": "get_current_weather", "description": "Get the current weather in a given location", "parameters": {"type": "object", "properties": {"location": {"type": "string"}}}}], "model": "anthropic/claude-4.5-sonnet-20250929", "temperature": 0.7, "top_p": 0.9, "store": false, "service_tier": "auto", "stream": false} application/json: {"store": false, "service_tier": "auto", "stream": false}
responses: responses:
"200": "200":
application/json: {"id": "resp-abc123", "object": "response", "created_at": 1704067200, "model": "gpt-4", "status": "completed", "output": [{"id": "msg-abc123", "role": "assistant", "type": "message", "status": "completed", "content": [{"type": "output_text", "text": "Hello! How can I help you today?", "annotations": []}]}], "error": null, "incomplete_details": null, "usage": {"input_tokens": 10, "input_tokens_details": {"cached_tokens": 0}, "output_tokens": 25, "output_tokens_details": {"reasoning_tokens": 0}, "total_tokens": 35}, "max_output_tokens": null, "temperature": null, "top_p": null, "instructions": null, "metadata": null, "tools": [], "tool_choice": "auto", "parallel_tool_calls": true} application/json: {"id": "resp-abc123", "object": "response", "created_at": 1704067200, "model": "gpt-4", "output": [{"id": "msg-abc123", "role": "assistant", "type": "message", "content": [{"type": "output_text", "text": "Hello! How can I help you today?"}]}], "error": null, "incomplete_details": null, "temperature": null, "top_p": null, "instructions": null, "metadata": null, "tools": [], "tool_choice": "auto", "parallel_tool_calls": true}
"400": "400":
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
"401": "401":
@@ -851,7 +870,7 @@ examples:
createEmbeddings: createEmbeddings:
speakeasy-default-create-embeddings: speakeasy-default-create-embeddings:
requestBody: requestBody:
application/json: {"input": "<value>", "model": "Taurus", "provider": {"data_collection": "allow", "zdr": true, "enforce_distillable_text": true, "order": ["OpenAI"], "only": ["OpenAI"], "ignore": ["OpenAI"], "quantizations": ["fp16"], "sort": "price"}} application/json: {"input": "<value>", "model": "Taurus"}
responses: responses:
"200": "200":
application/json: {"object": "list", "data": [], "model": "Land Cruiser"} application/json: {"object": "list", "data": [], "model": "Land Cruiser"}
@@ -880,7 +899,7 @@ examples:
speakeasy-default-list-embeddings-models: speakeasy-default-list-embeddings-models:
responses: responses:
"200": "200":
application/json: {"data": [{"id": "openai/gpt-4", "canonical_slug": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "pricing": {"prompt": "0.00003", "completion": "0.00006", "request": "0", "image": "0"}, "context_length": 8192, "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"context_length": 8192, "max_completion_tokens": 4096, "is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]} application/json: {"data": [{"id": "openai/gpt-4", "canonical_slug": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "context_length": 8192, "architecture": {"modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]}
"400": "400":
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
"500": "500":
@@ -920,7 +939,7 @@ examples:
speakeasy-default-get-models: speakeasy-default-get-models:
responses: responses:
"200": "200":
application/json: {"data": [{"id": "openai/gpt-4", "canonical_slug": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "pricing": {"prompt": "0.00003", "completion": "0.00006", "request": "0", "image": "0"}, "context_length": 8192, "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"context_length": 8192, "max_completion_tokens": 4096, "is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]} application/json: {"data": [{"id": "openai/gpt-4", "canonical_slug": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "context_length": 8192, "architecture": {"modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]}
"400": "400":
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
"500": "500":
@@ -929,7 +948,7 @@ examples:
speakeasy-default-list-models-user: speakeasy-default-list-models-user:
responses: responses:
"200": "200":
application/json: {"data": [{"id": "openai/gpt-4", "canonical_slug": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "pricing": {"prompt": "0.00003", "completion": "0.00006", "request": "0", "image": "0"}, "context_length": 8192, "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"context_length": 8192, "max_completion_tokens": 4096, "is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]} application/json: {"data": [{"id": "openai/gpt-4", "canonical_slug": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "context_length": 8192, "architecture": {"modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]}
"401": "401":
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
"500": "500":
@@ -942,7 +961,7 @@ examples:
slug: "<value>" slug: "<value>"
responses: responses:
"200": "200":
application/json: {"data": {"id": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "endpoints": [{"name": "OpenAI: GPT-4", "model_name": "GPT-4", "context_length": 8192, "pricing": {"prompt": "0.00003", "completion": "0.00006", "request": "0", "image": "0"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "status": -3, "uptime_last_30m": 99.5, "supports_implicit_caching": true}]}} application/json: {"data": {"id": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "endpoints": [{"name": "OpenAI: GPT-4", "model_name": "GPT-4", "context_length": 8192, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "uptime_last_30m": 99.5, "supports_implicit_caching": true}]}}
"404": "404":
application/json: {"error": {"code": 404, "message": "Resource not found"}} application/json: {"error": {"code": 404, "message": "Resource not found"}}
"500": "500":
@@ -951,7 +970,7 @@ examples:
speakeasy-default-list-endpoints-zdr: speakeasy-default-list-endpoints-zdr:
responses: responses:
"200": "200":
application/json: {"data": [{"name": "OpenAI: GPT-4", "model_name": "GPT-4", "context_length": 8192, "pricing": {"prompt": "0.00003", "completion": "0.00006", "request": "0", "image": "0"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens"], "status": 0, "uptime_last_30m": 99.5, "supports_implicit_caching": true}]} application/json: {"data": [{"name": "OpenAI: GPT-4", "model_name": "GPT-4", "context_length": 8192, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens"], "uptime_last_30m": 99.5, "supports_implicit_caching": true}]}
"500": "500":
application/json: {"error": {"code": 500, "message": "Internal Server Error"}} application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
getParameters: getParameters:
@@ -973,7 +992,7 @@ examples:
speakeasy-default-list-providers: speakeasy-default-list-providers:
responses: responses:
"200": "200":
application/json: {"data": [{"name": "OpenAI", "slug": "openai", "privacy_policy_url": "https://openai.com/privacy", "terms_of_service_url": "https://openai.com/terms", "status_page_url": "https://status.openai.com"}]} application/json: {"data": [{"name": "OpenAI", "slug": "openai", "privacy_policy_url": "https://openai.com/privacy"}]}
"500": "500":
application/json: {"error": {"code": 500, "message": "Internal Server Error"}} application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
list: list:
@@ -984,7 +1003,7 @@ examples:
offset: "0" offset: "0"
responses: responses:
"200": "200":
application/json: {"data": [{"hash": "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", "name": "My Production Key", "label": "Production API Key", "disabled": false, "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "include_byok_in_limit": false, "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, "created_at": "2025-08-24T10:30:00Z", "updated_at": "2025-08-24T15:45:00Z", "expires_at": "2027-12-31T23:59:59Z"}]} application/json: {"data": [{"hash": "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", "name": "My Production Key", "label": "Production API Key", "disabled": false, "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "include_byok_in_limit": false, "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, "created_at": "2025-08-24T10:30:00Z", "updated_at": "2025-08-24T15:45:00Z"}]}
"401": "401":
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
"429": "429":
@@ -994,10 +1013,10 @@ examples:
createKeys: createKeys:
speakeasy-default-create-keys: speakeasy-default-create-keys:
requestBody: requestBody:
application/json: {"name": "My New API Key", "limit": 50, "limit_reset": "monthly", "include_byok_in_limit": true, "expires_at": "2027-12-31T23:59:59Z"} application/json: {"name": "My New API Key"}
responses: responses:
"201": "201":
application/json: {"data": {"hash": "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", "name": "My New API Key", "label": "My New API Key", "disabled": false, "limit": 50, "limit_remaining": 50, "limit_reset": "monthly", "include_byok_in_limit": true, "usage": 0, "usage_daily": 0, "usage_weekly": 0, "usage_monthly": 0, "byok_usage": 0, "byok_usage_daily": 0, "byok_usage_weekly": 0, "byok_usage_monthly": 0, "created_at": "2025-08-24T10:30:00Z", "updated_at": null, "expires_at": "2027-12-31T23:59:59Z"}, "key": "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"} application/json: {"data": {"hash": "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", "name": "My New API Key", "label": "My New API Key", "disabled": false, "limit": 50, "limit_remaining": 50, "limit_reset": "monthly", "include_byok_in_limit": true, "usage": 0, "usage_daily": 0, "usage_weekly": 0, "usage_monthly": 0, "byok_usage": 0, "byok_usage_daily": 0, "byok_usage_weekly": 0, "byok_usage_monthly": 0, "created_at": "2025-08-24T10:30:00Z", "updated_at": null}, "key": "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"}
"400": "400":
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
"401": "401":
@@ -1012,10 +1031,10 @@ examples:
path: path:
hash: "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" hash: "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"
requestBody: requestBody:
application/json: {"name": "Updated API Key Name", "disabled": false, "limit": 75, "limit_reset": "daily", "include_byok_in_limit": true} application/json: {}
responses: responses:
"200": "200":
application/json: {"data": {"hash": "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", "name": "Updated API Key Name", "label": "Updated API Key Name", "disabled": false, "limit": 75, "limit_remaining": 49.5, "limit_reset": "daily", "include_byok_in_limit": true, "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, "created_at": "2025-08-24T10:30:00Z", "updated_at": "2025-08-24T16:00:00Z", "expires_at": null}} application/json: {"data": {"hash": "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", "name": "Updated API Key Name", "label": "Updated API Key Name", "disabled": false, "limit": 75, "limit_remaining": 49.5, "limit_reset": "daily", "include_byok_in_limit": true, "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, "created_at": "2025-08-24T10:30:00Z", "updated_at": "2025-08-24T16:00:00Z"}}
"400": "400":
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
"401": "401":
@@ -1049,7 +1068,7 @@ examples:
hash: "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" hash: "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"
responses: responses:
"200": "200":
application/json: {"data": {"hash": "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", "name": "My Production Key", "label": "Production API Key", "disabled": false, "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "include_byok_in_limit": false, "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, "created_at": "2025-08-24T10:30:00Z", "updated_at": "2025-08-24T15:45:00Z", "expires_at": "2027-12-31T23:59:59Z"}} application/json: {"data": {"hash": "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", "name": "My Production Key", "label": "Production API Key", "disabled": false, "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "include_byok_in_limit": false, "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, "created_at": "2025-08-24T10:30:00Z", "updated_at": "2025-08-24T15:45:00Z"}}
"401": "401":
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
"404": "404":
@@ -1062,7 +1081,7 @@ examples:
speakeasy-default-get-current-key: speakeasy-default-get-current-key:
responses: responses:
"200": "200":
application/json: {"data": {"label": "sk-or-v1-au78b3456789012345678901234567890", "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."}}} application/json: {"data": {"label": "sk-or-v1-au78b3456789012345678901234567890", "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."}}}
"401": "401":
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
"500": "500":
@@ -1070,7 +1089,7 @@ examples:
exchangeAuthCodeForAPIKey: exchangeAuthCodeForAPIKey:
speakeasy-default-exchange-auth-code-for-API-key: speakeasy-default-exchange-auth-code-for-API-key:
requestBody: requestBody:
application/json: {"code": "auth_code_abc123def456", "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "code_challenge_method": "S256"} application/json: {"code": "auth_code_abc123def456"}
responses: responses:
"200": "200":
application/json: {"key": "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", "user_id": "user_2yOPcMpKoQhcd4bVgSMlELRaIah"} application/json: {"key": "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", "user_id": "user_2yOPcMpKoQhcd4bVgSMlELRaIah"}
@@ -1083,7 +1102,7 @@ examples:
createAuthKeysCode: createAuthKeysCode:
speakeasy-default-create-auth-keys-code: speakeasy-default-create-auth-keys-code:
requestBody: requestBody:
application/json: {"callback_url": "https://myapp.com/auth/callback", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "code_challenge_method": "S256", "limit": 100} application/json: {"callback_url": "https://myapp.com/auth/callback"}
responses: responses:
"200": "200":
application/json: {"data": {"id": "auth_code_xyz789", "app_id": 12345, "created_at": "2025-08-24T10:30:00Z"}} application/json: {"data": {"id": "auth_code_xyz789", "app_id": 12345, "created_at": "2025-08-24T10:30:00Z"}}
+7 -5
View File
@@ -6,7 +6,7 @@ generation:
sdkClassName: OpenRouter sdkClassName: OpenRouter
maintainOpenAPIOrder: true maintainOpenAPIOrder: true
usageSnippets: usageSnippets:
optionalPropertyRendering: withExample optionalPropertyRendering: never
sdkInitStyle: constructor sdkInitStyle: constructor
useClassNamesForArrayFields: true useClassNamesForArrayFields: true
fixes: fixes:
@@ -24,13 +24,14 @@ generation:
sdkHooksConfigAccess: true sdkHooksConfigAccess: true
schemas: schemas:
allOfMergeStrategy: shallowMerge allOfMergeStrategy: shallowMerge
requestBodyFieldName: body requestBodyFieldName: ""
tests: tests:
generateTests: false generateTests: false
generateNewTests: true generateNewTests: true
skipResponseBodyAssertions: false skipResponseBodyAssertions: false
preApplyUnionDiscriminators: true
python: python:
version: 0.1.1 version: 0.0.22
additionalDependencies: additionalDependencies:
dev: {} dev: {}
main: {} main: {}
@@ -57,11 +58,12 @@ python:
imports: imports:
option: openapi option: openapi
paths: paths:
callbacks: "" callbacks: callbacks
errors: errors errors: errors
operations: operations operations: operations
shared: components shared: components
webhooks: "" webhooks: webhooks
inferSSEOverload: true
inferUnionDiscriminators: true inferUnionDiscriminators: true
inputModelSuffix: input inputModelSuffix: input
legacyPyright: false legacyPyright: false
+345 -12
View File
@@ -1054,6 +1054,7 @@ components:
type: string type: string
nullable: true nullable: true
enum: enum:
- xhigh
- high - high
- medium - medium
- low - low
@@ -3479,6 +3480,7 @@ components:
- Infermatic - Infermatic
- Inflection - Inflection
- Liquid - Liquid
- Mara
- Mancer 2 - Mancer 2
- Minimax - Minimax
- ModelRun - ModelRun
@@ -3507,6 +3509,7 @@ components:
- Together - Together
- Venice - Venice
- WandB - WandB
- Xiaomi
- xAI - xAI
- Z.AI - Z.AI
- FakeProvider - FakeProvider
@@ -3536,12 +3539,8 @@ components:
performed. performed.
example: price example: price
BigNumberUnion: BigNumberUnion:
anyOf: type: string
- type: number description: A value in string format that is a large number
- type: string
- type: number
example: 1000
description: A value in string or number format that is a large number
example: 1000 example: 1000
OpenResponsesRequest: OpenResponsesRequest:
type: object type: object
@@ -3736,10 +3735,23 @@ components:
$ref: '#/components/schemas/BigNumberUnion' $ref: '#/components/schemas/BigNumberUnion'
request: request:
$ref: '#/components/schemas/BigNumberUnion' $ref: '#/components/schemas/BigNumberUnion'
additionalProperties: false
description: >- description: >-
The object specifying the maximum price you want to pay for this request. USD price per million tokens, The object specifying the maximum price you want to pay for this request. USD price per million tokens,
for prompt and completion. for prompt and completion.
min_throughput:
type: number
nullable: true
example: 100
description: >-
The minimum throughput (in tokens per second) required for this request. Only providers serving the
model with at least this throughput will be used.
max_latency:
type: number
nullable: true
example: 5
description: >-
The maximum latency (in seconds) allowed for this request. Only providers serving the model with better
than this latency will be used.
additionalProperties: false additionalProperties: false
description: When multiple model providers are available, optionally indicate your routing preference. description: When multiple model providers are available, optionally indicate your routing preference.
plugins: plugins:
@@ -3760,6 +3772,9 @@ components:
type: string type: string
enum: enum:
- web - web
enabled:
type: boolean
description: Set to false to disable the web-search plugin for this request. Defaults to true.
max_results: max_results:
type: number type: number
search_prompt: search_prompt:
@@ -3777,6 +3792,9 @@ components:
type: string type: string
enum: enum:
- file-parser - file-parser
enabled:
type: boolean
description: Set to false to disable the file-parser plugin for this request. Defaults to true.
max_files: max_files:
type: number type: number
pdf: pdf:
@@ -3796,9 +3814,21 @@ components:
type: string type: string
enum: enum:
- response-healing - response-healing
enabled:
type: boolean
description: Set to false to disable the response-healing plugin for this request. Defaults to true.
required: required:
- id - id
description: Plugins you want to enable for this request, including their settings. description: Plugins you want to enable for this request, including their settings.
route:
type: string
nullable: true
enum:
- fallback
- sort
description: >-
Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts
all endpoints together by routing criteria.
user: user:
type: string type: string
maxLength: 128 maxLength: 128
@@ -4594,6 +4624,87 @@ components:
uptime_last_30m: 99.5 uptime_last_30m: 99.5
supports_implicit_caching: true supports_implicit_caching: true
__schema0: __schema0:
type: array
items:
anyOf:
- type: string
enum:
- AI21
- AionLabs
- Alibaba
- 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
- GoPomelo
- Google
- Google AI Studio
- Groq
- Hyperbolic
- Inception
- 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
- SiliconFlow
- Sourceful
- Stealth
- StreamLake
- Switchpoint
- Targon
- Together
- Venice
- WandB
- Xiaomi
- xAI
- Z.AI
- FakeProvider
- type: string
__schema1:
anyOf:
- type: number
- type: string
- type: number
__schema2:
anyOf: anyOf:
- $ref: '#/components/schemas/ChatCompletionFinishReason' - $ref: '#/components/schemas/ChatCompletionFinishReason'
- type: 'null' - type: 'null'
@@ -5051,6 +5162,214 @@ components:
ChatGenerationParams: ChatGenerationParams:
type: object type: object
properties: 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:
- type: string
enum:
- price
- throughput
- latency
- 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'
min_throughput:
description: >-
The minimum throughput (in tokens per second) required for this request. Only providers serving the
model with at least this throughput will be used.
anyOf:
- type: number
- type: 'null'
max_latency:
description: >-
The maximum latency (in seconds) allowed for this request. Only providers serving the model with
better than this latency will be used.
anyOf:
- type: number
- type: 'null'
additionalProperties: false
- type: 'null'
plugins:
description: Plugins you want to enable for this request, including their settings.
type: array
items:
oneOf:
- 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
max_files:
type: number
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
route:
description: >-
Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts
all endpoints together by routing criteria.
anyOf:
- type: string
enum:
- fallback
- sort
- type: 'null'
user:
type: string
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
messages: messages:
minItems: 1 minItems: 1
type: array type: array
@@ -5120,6 +5439,7 @@ components:
- low - low
- medium - medium
- high - high
- xhigh
- type: 'null' - type: 'null'
summary: summary:
anyOf: anyOf:
@@ -5193,8 +5513,6 @@ components:
minimum: 0 minimum: 0
maximum: 1 maximum: 1
- type: 'null' - type: 'null'
user:
type: string
debug: debug:
type: object type: object
properties: properties:
@@ -5206,7 +5524,7 @@ components:
type: object type: object
properties: properties:
finish_reason: finish_reason:
$ref: '#/components/schemas/__schema0' $ref: '#/components/schemas/__schema2'
index: index:
type: number type: number
message: message:
@@ -5267,7 +5585,7 @@ components:
delta: delta:
$ref: '#/components/schemas/ChatStreamingMessageChunk' $ref: '#/components/schemas/ChatStreamingMessageChunk'
finish_reason: finish_reason:
$ref: '#/components/schemas/__schema0' $ref: '#/components/schemas/__schema2'
index: index:
type: number type: number
logprobs: logprobs:
@@ -6173,10 +6491,23 @@ paths:
$ref: '#/components/schemas/BigNumberUnion' $ref: '#/components/schemas/BigNumberUnion'
request: request:
$ref: '#/components/schemas/BigNumberUnion' $ref: '#/components/schemas/BigNumberUnion'
additionalProperties: false
description: >- description: >-
The object specifying the maximum price you want to pay for this request. USD price per million The object specifying the maximum price you want to pay for this request. USD price per million
tokens, for prompt and completion. tokens, for prompt and completion.
min_throughput:
type: number
nullable: true
example: 100
description: >-
The minimum throughput (in tokens per second) required for this request. Only providers serving
the model with at least this throughput will be used.
max_latency:
type: number
nullable: true
example: 5
description: >-
The maximum latency (in seconds) allowed for this request. Only providers serving the model with
better than this latency will be used.
input_type: input_type:
type: string type: string
required: required:
@@ -6816,6 +7147,7 @@ paths:
- Infermatic - Infermatic
- Inflection - Inflection
- Liquid - Liquid
- Mara
- Mancer 2 - Mancer 2
- Minimax - Minimax
- ModelRun - ModelRun
@@ -6844,6 +7176,7 @@ paths:
- Together - Together
- Venice - Venice
- WandB - WandB
- Xiaomi
- xAI - xAI
- Z.AI - Z.AI
- FakeProvider - FakeProvider
+346 -14
View File
@@ -1063,6 +1063,7 @@ components:
type: string type: string
nullable: true nullable: true
enum: enum:
- xhigh
- high - high
- medium - medium
- low - low
@@ -3496,6 +3497,7 @@ components:
- Infermatic - Infermatic
- Inflection - Inflection
- Liquid - Liquid
- Mara
- Mancer 2 - Mancer 2
- Minimax - Minimax
- ModelRun - ModelRun
@@ -3516,6 +3518,7 @@ components:
- Relace - Relace
- SambaNova - SambaNova
- SiliconFlow - SiliconFlow
- Sourceful
- Stealth - Stealth
- StreamLake - StreamLake
- Switchpoint - Switchpoint
@@ -3523,6 +3526,7 @@ components:
- Together - Together
- Venice - Venice
- WandB - WandB
- Xiaomi
- xAI - xAI
- Z.AI - Z.AI
- FakeProvider - FakeProvider
@@ -3554,12 +3558,8 @@ components:
example: price example: price
x-speakeasy-unknown-values: allow x-speakeasy-unknown-values: allow
BigNumberUnion: BigNumberUnion:
anyOf: type: string
- type: number description: A value in string format that is a large number
- type: string
- type: number
example: 1000
description: A value in string or number format that is a large number
example: 1000 example: 1000
OpenResponsesRequest: OpenResponsesRequest:
type: object type: object
@@ -3747,9 +3747,20 @@ components:
$ref: '#/components/schemas/BigNumberUnion' $ref: '#/components/schemas/BigNumberUnion'
request: request:
$ref: '#/components/schemas/BigNumberUnion' $ref: '#/components/schemas/BigNumberUnion'
additionalProperties: false
description: >- description: >-
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
min_throughput:
type: number
nullable: true
example: 100
description: >-
The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used.
max_latency:
type: number
nullable: true
example: 5
description: >-
The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used.
additionalProperties: false additionalProperties: false
description: When multiple model providers are available, optionally indicate your routing preference. description: When multiple model providers are available, optionally indicate your routing preference.
plugins: plugins:
@@ -3770,6 +3781,9 @@ components:
type: string type: string
enum: enum:
- web - web
enabled:
type: boolean
description: Set to false to disable the web-search plugin for this request. Defaults to true.
max_results: max_results:
type: number type: number
search_prompt: search_prompt:
@@ -3788,6 +3802,9 @@ components:
type: string type: string
enum: enum:
- file-parser - file-parser
enabled:
type: boolean
description: Set to false to disable the file-parser plugin for this request. Defaults to true.
max_files: max_files:
type: number type: number
pdf: pdf:
@@ -3808,14 +3825,31 @@ components:
type: string type: string
enum: enum:
- response-healing - response-healing
enabled:
type: boolean
description: Set to false to disable the response-healing plugin for this request. Defaults to true.
required: required:
- id - id
description: Plugins you want to enable for this request, including their settings. description: Plugins you want to enable for this request, including their settings.
route:
type: string
nullable: true
enum:
- fallback
- sort
description: >-
Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria.
x-speakeasy-unknown-values: allow
user: user:
type: string type: string
maxLength: 128 maxLength: 128
description: >- description: >-
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. 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:
type: string
maxLength: 128
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.
description: Request schema for Responses endpoint description: Request schema for Responses endpoint
example: example:
model: anthropic/claude-4.5-sonnet-20250929 model: anthropic/claude-4.5-sonnet-20250929
@@ -4605,6 +4639,88 @@ components:
uptime_last_30m: 99.5 uptime_last_30m: 99.5
supports_implicit_caching: true supports_implicit_caching: true
__schema0: __schema0:
type: array
items:
anyOf:
- type: string
enum:
- AI21
- AionLabs
- Alibaba
- 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
- GoPomelo
- Google
- Google AI Studio
- Groq
- Hyperbolic
- Inception
- 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
- SiliconFlow
- Sourceful
- Stealth
- StreamLake
- Switchpoint
- Targon
- Together
- Venice
- WandB
- Xiaomi
- xAI
- Z.AI
- FakeProvider
x-speakeasy-unknown-values: allow
- type: string
__schema1:
anyOf:
- type: number
- type: string
- type: number
__schema2:
anyOf: anyOf:
- $ref: '#/components/schemas/ChatCompletionFinishReason' - $ref: '#/components/schemas/ChatCompletionFinishReason'
- type: 'null' - type: 'null'
@@ -5065,6 +5181,206 @@ components:
ChatGenerationParams: ChatGenerationParams:
type: object type: object
properties: 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:
- type: string
enum:
- price
- throughput
- latency
x-speakeasy-unknown-values: allow
- 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'
min_throughput:
description: >-
The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used.
anyOf:
- type: number
- type: 'null'
max_latency:
description: >-
The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used.
anyOf:
- type: number
- type: 'null'
additionalProperties: false
- type: 'null'
plugins:
description: Plugins you want to enable for this request, including their settings.
type: array
items:
oneOf:
- 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
max_files:
type: number
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
route:
description: >-
Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria.
anyOf:
- type: string
enum:
- fallback
- sort
x-speakeasy-unknown-values: allow
- type: 'null'
user:
type: string
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
messages: messages:
minItems: 1 minItems: 1
type: array type: array
@@ -5134,6 +5450,7 @@ components:
- low - low
- medium - medium
- high - high
- xhigh
x-speakeasy-unknown-values: allow x-speakeasy-unknown-values: allow
- type: 'null' - type: 'null'
summary: summary:
@@ -5208,8 +5525,6 @@ components:
minimum: 0 minimum: 0
maximum: 1 maximum: 1
- type: 'null' - type: 'null'
user:
type: string
debug: debug:
type: object type: object
properties: properties:
@@ -5221,7 +5536,7 @@ components:
type: object type: object
properties: properties:
finish_reason: finish_reason:
$ref: '#/components/schemas/__schema0' $ref: '#/components/schemas/__schema2'
index: index:
type: number type: number
message: message:
@@ -5282,7 +5597,7 @@ components:
delta: delta:
$ref: '#/components/schemas/ChatStreamingMessageChunk' $ref: '#/components/schemas/ChatStreamingMessageChunk'
finish_reason: finish_reason:
$ref: '#/components/schemas/__schema0' $ref: '#/components/schemas/__schema2'
index: index:
type: number type: number
logprobs: logprobs:
@@ -6181,9 +6496,20 @@ paths:
$ref: '#/components/schemas/BigNumberUnion' $ref: '#/components/schemas/BigNumberUnion'
request: request:
$ref: '#/components/schemas/BigNumberUnion' $ref: '#/components/schemas/BigNumberUnion'
additionalProperties: false
description: >- description: >-
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
min_throughput:
type: number
nullable: true
example: 100
description: >-
The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used.
max_latency:
type: number
nullable: true
example: 5
description: >-
The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used.
input_type: input_type:
type: string type: string
required: required:
@@ -6242,6 +6568,11 @@ paths:
- object - object
- data - data
- model - model
text/event-stream:
schema:
type: string
description: Not used for embeddings - embeddings do not support streaming
x-speakeasy-sse-sentinel: '[DONE]'
'400': '400':
description: Bad Request - Invalid request parameters or malformed input description: Bad Request - Invalid request parameters or malformed input
content: content:
@@ -6806,6 +7137,7 @@ paths:
- Infermatic - Infermatic
- Inflection - Inflection
- Liquid - Liquid
- Mara
- Mancer 2 - Mancer 2
- Minimax - Minimax
- ModelRun - ModelRun
@@ -6826,6 +7158,7 @@ paths:
- Relace - Relace
- SambaNova - SambaNova
- SiliconFlow - SiliconFlow
- Sourceful
- Stealth - Stealth
- StreamLake - StreamLake
- Switchpoint - Switchpoint
@@ -6833,6 +7166,7 @@ paths:
- Together - Together
- Venice - Venice
- WandB - WandB
- Xiaomi
- xAI - xAI
- Z.AI - Z.AI
- FakeProvider - FakeProvider
@@ -8437,5 +8771,3 @@ x-speakeasy-globals:
parameters: parameters:
- $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppIdentifier"
- $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppDisplayName"
- $ref: "#/components/parameters/AppIdentifier"
- $ref: "#/components/parameters/AppDisplayName"
+17 -8
View File
@@ -6,36 +6,45 @@ sources:
sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553 sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553
tags: tags:
- latest - latest
OpenRouter API:
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:b128cdb6be96021e55feea5e2dcb6e7438de706138fcde4f871b14877885445b
sourceBlobDigest: sha256:8b15f72eaabbd77f4642be28a2861fd1cfd5d8cfe96e72fb8a76832387c64fab
tags:
- latest
- 1.0.0
targets: targets:
open-router: open-router:
source: -OAS source: OpenRouter API
sourceNamespace: open-router-chat-completions-api sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:f1b59b9b643de5e20d6e3299a8274783d8c0854615876f5d7f6f081814842695 sourceRevisionDigest: sha256:b128cdb6be96021e55feea5e2dcb6e7438de706138fcde4f871b14877885445b
sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553 sourceBlobDigest: sha256:8b15f72eaabbd77f4642be28a2861fd1cfd5d8cfe96e72fb8a76832387c64fab
codeSamplesNamespace: open-router-python-code-samples
codeSamplesRevisionDigest: sha256:92747cd4c744e6671784b73c124d89adc662799d11caf5e6573880f6bfb52405
workflow: workflow:
workflowVersion: 1.0.0 workflowVersion: 1.0.0
speakeasyVersion: 1.666.0 speakeasyVersion: 1.666.0
sources: sources:
-OAS: OpenRouter API:
inputs: inputs:
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main - location: .speakeasy/in.openapi.yaml
overlays: overlays:
- location: .speakeasy/overlays/open-enums.overlay.yaml - location: .speakeasy/overlays/open-enums.overlay.yaml
- location: .speakeasy/overlays/remove-rss-responses.overlay.yaml - location: .speakeasy/overlays/remove-rss-responses.overlay.yaml
- location: .speakeasy/overlays/add-headers.overlay.yaml - location: .speakeasy/overlays/add-headers.overlay.yaml
output: .speakeasy/out.openapi.yaml output: .speakeasy/out.openapi.yaml
registry: registry:
location: registry.speakeasyapi.dev/openrouter/sdk/-oas location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
targets: targets:
open-router: open-router:
target: python target: python
source: -OAS source: OpenRouter API
publish: publish:
pypi: pypi:
token: $pypi_token token: $pypi_token
codeSamples: codeSamples:
registry: registry:
location: registry.speakeasyapi.dev/openrouter/sdk/-oas-python-code-samples location: registry.speakeasyapi.dev/openrouter/sdk/open-router-python-code-samples
labelOverride: labelOverride:
fixedValue: Python (SDK) fixedValue: Python (SDK)
blocking: false blocking: false
+5 -5
View File
@@ -1,26 +1,26 @@
workflowVersion: 1.0.0 workflowVersion: 1.0.0
speakeasyVersion: 1.666.0 speakeasyVersion: 1.666.0
sources: sources:
-OAS: OpenRouter API:
inputs: inputs:
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main - location: .speakeasy/in.openapi.yaml
overlays: overlays:
- location: .speakeasy/overlays/open-enums.overlay.yaml - location: .speakeasy/overlays/open-enums.overlay.yaml
- location: .speakeasy/overlays/remove-rss-responses.overlay.yaml - location: .speakeasy/overlays/remove-rss-responses.overlay.yaml
- location: .speakeasy/overlays/add-headers.overlay.yaml - location: .speakeasy/overlays/add-headers.overlay.yaml
output: .speakeasy/out.openapi.yaml output: .speakeasy/out.openapi.yaml
registry: registry:
location: registry.speakeasyapi.dev/openrouter/sdk/-oas location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
targets: targets:
open-router: open-router:
target: python target: python
source: -OAS source: OpenRouter API
publish: publish:
pypi: pypi:
token: $pypi_token token: $pypi_token
codeSamples: codeSamples:
registry: registry:
location: registry.speakeasyapi.dev/openrouter/sdk/-oas-python-code-samples location: registry.speakeasyapi.dev/openrouter/sdk/open-router-python-code-samples
labelOverride: labelOverride:
fixedValue: Python (SDK) fixedValue: Python (SDK)
blocking: false blocking: false
+2 -110
View File
@@ -9,61 +9,7 @@ with OpenRouter(
api_key=os.getenv("OPENROUTER_API_KEY", ""), api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router: ) as open_router:
res = open_router.beta.responses.send(input=[ res = open_router.beta.responses.send(service_tier="auto", stream=False)
{
"type": "message",
"role": "user",
"content": "Hello, how are you?",
},
], metadata={
"user_id": "123",
"session_id": "abc-def-ghi",
}, tools=[
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
},
},
},
},
], model="anthropic/claude-4.5-sonnet-20250929", text={
"format_": {
"type": "text",
},
"verbosity": "medium",
}, reasoning={
"summary": "auto",
"enabled": True,
}, temperature=0.7, top_p=0.9, prompt={
"id": "<id>",
"variables": {
"key": {
"type": "input_text",
"text": "Hello, how can I help you?",
},
},
}, service_tier="auto", truncation="auto", stream=False, provider={
"data_collection": "allow",
"zdr": True,
"enforce_distillable_text": True,
"order": [
"OpenAI",
],
"only": [
"OpenAI",
],
"ignore": [
"OpenAI",
],
"quantizations": None,
"sort": "price",
})
with res as event_stream: with res as event_stream:
for event in event_stream: for event in event_stream:
@@ -87,61 +33,7 @@ async def main():
api_key=os.getenv("OPENROUTER_API_KEY", ""), api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router: ) as open_router:
res = await open_router.beta.responses.send_async(input=[ res = await open_router.beta.responses.send_async(service_tier="auto", stream=False)
{
"type": "message",
"role": "user",
"content": "Hello, how are you?",
},
], metadata={
"user_id": "123",
"session_id": "abc-def-ghi",
}, tools=[
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
},
},
},
},
], model="anthropic/claude-4.5-sonnet-20250929", text={
"format_": {
"type": "text",
},
"verbosity": "medium",
}, reasoning={
"summary": "auto",
"enabled": True,
}, temperature=0.7, top_p=0.9, prompt={
"id": "<id>",
"variables": {
"key": {
"type": "input_text",
"text": "Hello, how can I help you?",
},
},
}, service_tier="auto", truncation="auto", stream=False, provider={
"data_collection": "allow",
"zdr": True,
"enforce_distillable_text": True,
"order": [
"OpenAI",
],
"only": [
"OpenAI",
],
"ignore": [
"OpenAI",
],
"quantizations": None,
"sort": "price",
})
async with res as event_stream: async with res as event_stream:
async for event in event_stream: async for event in event_stream:
+29 -25
View File
@@ -3,28 +3,32 @@
## Fields ## Fields
| Field | Type | Required | Description | | Field | 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. |
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | | `plugins` | List[[components.ChatGenerationParamsPluginUnion](../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. |
| `models` | List[*str*] | :heavy_minus_sign: | N/A | | `route` | [OptionalNullable[components.ChatGenerationParamsRoute]](../components/chatgenerationparamsroute.md) | :heavy_minus_sign: | Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria. |
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `logit_bias` | Dict[str, *float*] | :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. |
| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | N/A |
| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `models` | List[*str*] | :heavy_minus_sign: | N/A |
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | | `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
| `reasoning` | [Optional[components.Reasoning]](../components/reasoning.md) | :heavy_minus_sign: | N/A | | `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `response_format` | [Optional[components.ChatGenerationParamsResponseFormatUnion]](../components/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A | | `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `stop` | [OptionalNullable[components.ChatGenerationParamsStop]](../components/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A | | `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A | | `reasoning` | [Optional[components.Reasoning]](../components/reasoning.md) | :heavy_minus_sign: | N/A |
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `response_format` | [Optional[components.ChatGenerationParamsResponseFormatUnion]](../components/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A |
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A | | `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A | | `stop` | [OptionalNullable[components.ChatGenerationParamsStop]](../components/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A |
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | | `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A |
| `debug` | [Optional[components.Debug]](../components/debug.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 |
@@ -0,0 +1,9 @@
# ChatGenerationParamsDataCollection
## Values
| Name | Value |
| ------- | ------- |
| `DENY` | deny |
| `ALLOW` | allow |
@@ -1,4 +1,4 @@
# Engine # ChatGenerationParamsEngine
## Values ## Values
@@ -0,0 +1,14 @@
# 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 |
@@ -0,0 +1,8 @@
# ChatGenerationParamsPdf
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `engine` | [Optional[components.ChatGenerationParamsPdfEngine]](../components/chatgenerationparamspdfengine.md) | :heavy_minus_sign: | N/A |
@@ -1,4 +1,4 @@
# PdfEngine # ChatGenerationParamsPdfEngine
## Values ## Values
@@ -0,0 +1,11 @@
# ChatGenerationParamsPluginFileParser
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `id` | *Literal["file-parser"]* | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
| `max_files` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `pdf` | [Optional[components.ChatGenerationParamsPdf]](../components/chatgenerationparamspdf.md) | :heavy_minus_sign: | N/A |
@@ -0,0 +1,8 @@
# ChatGenerationParamsPluginModeration
## Fields
| Field | Type | Required | Description |
| ----------------------- | ----------------------- | ----------------------- | ----------------------- |
| `id` | *Literal["moderation"]* | :heavy_check_mark: | N/A |
@@ -0,0 +1,9 @@
# ChatGenerationParamsPluginResponseHealing
## Fields
| Field | Type | Required | Description |
| ----------------------------- | ----------------------------- | ----------------------------- | ----------------------------- |
| `id` | *Literal["response-healing"]* | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
@@ -0,0 +1,29 @@
# ChatGenerationParamsPluginUnion
## Supported Types
### `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 */
```
@@ -0,0 +1,12 @@
# ChatGenerationParamsPluginWeb
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `id` | *Literal["web"]* | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `engine` | [Optional[components.ChatGenerationParamsEngine]](../components/chatgenerationparamsengine.md) | :heavy_minus_sign: | N/A |
@@ -0,0 +1,20 @@
# ChatGenerationParamsProvider
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests<br/>- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.<br/>- false: use only the primary/custom provider, and return the upstream error if it's unavailable.<br/> |
| `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.<br/>- allow: (default) allow providers which store user data non-transiently and may train on it<br/><br/>- 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.Sort]](../components/sort.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. |
| `min_throughput` | *OptionalNullable[float]* | :heavy_minus_sign: | The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used. |
| `max_latency` | *OptionalNullable[float]* | :heavy_minus_sign: | The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used. |
@@ -0,0 +1,9 @@
# ChatGenerationParamsRoute
## Values
| Name | Value |
| ---------- | ---------- |
| `FALLBACK` | fallback |
| `SORT` | sort |
+2 -1
View File
@@ -9,4 +9,5 @@
| `MINIMAL` | minimal | | `MINIMAL` | minimal |
| `LOW` | low | | `LOW` | low |
| `MEDIUM` | medium | | `MEDIUM` | medium |
| `HIGH` | high | | `HIGH` | high |
| `XHIGH` | xhigh |
-14
View File
@@ -1,14 +0,0 @@
# MaxPrice
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: | A value in string or number format that is a large number |
| `completion` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
| `image` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
| `audio` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
| `request` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
@@ -5,6 +5,7 @@
| Name | Value | | Name | Value |
| --------- | --------- | | --------- | --------- |
| `XHIGH` | xhigh |
| `HIGH` | high | | `HIGH` | high |
| `MEDIUM` | medium | | `MEDIUM` | medium |
| `LOW` | low | | `LOW` | low |
+5 -3
View File
@@ -31,6 +31,8 @@ Request schema for Responses endpoint
| `service_tier` | [Optional[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | | | `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 | | `truncation` | [OptionalNullable[components.Truncation]](../components/truncation.md) | :heavy_minus_sign: | N/A | auto |
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
| `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | | `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../components/openresponsesrequestprovider.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. | | | `plugins` | List[[components.OpenResponsesRequestPluginUnion](../components/openresponsesrequestpluginunion.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. | | | `route` | [OptionalNullable[components.OpenResponsesRequestRoute]](../components/openresponsesrequestroute.md) | :heavy_minus_sign: | Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria. | |
| `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. | |
@@ -0,0 +1,9 @@
# OpenResponsesRequestEngine
## Values
| Name | Value |
| -------- | -------- |
| `NATIVE` | native |
| `EXA` | exa |
@@ -0,0 +1,14 @@
# OpenResponsesRequestMaxPrice
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 | 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 |
@@ -0,0 +1,8 @@
# OpenResponsesRequestPdf
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `engine` | [Optional[components.OpenResponsesRequestPdfEngine]](../components/openresponsesrequestpdfengine.md) | :heavy_minus_sign: | N/A |
@@ -0,0 +1,10 @@
# OpenResponsesRequestPdfEngine
## Values
| Name | Value |
| ------------- | ------------- |
| `MISTRAL_OCR` | mistral-ocr |
| `PDF_TEXT` | pdf-text |
| `NATIVE` | native |
@@ -0,0 +1,11 @@
# OpenResponsesRequestPluginFileParser
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `id` | [components.IDFileParser](../components/idfileparser.md) | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the file-parser plugin for this request. Defaults to true. |
| `max_files` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `pdf` | [Optional[components.OpenResponsesRequestPdf]](../components/openresponsesrequestpdf.md) | :heavy_minus_sign: | N/A |
@@ -1,4 +1,4 @@
# PluginModeration # OpenResponsesRequestPluginModeration
## Fields ## Fields
@@ -0,0 +1,9 @@
# OpenResponsesRequestPluginResponseHealing
## Fields
| Field | Type | Required | Description |
| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `id` | [components.IDResponseHealing](../components/idresponsehealing.md) | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the response-healing plugin for this request. Defaults to true. |
@@ -0,0 +1,29 @@
# OpenResponsesRequestPluginUnion
## Supported Types
### `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 */
```
@@ -0,0 +1,12 @@
# OpenResponsesRequestPluginWeb
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `id` | [components.IDWeb](../components/idweb.md) | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the web-search plugin for this request. Defaults to true. |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `engine` | [Optional[components.OpenResponsesRequestEngine]](../components/openresponsesrequestengine.md) | :heavy_minus_sign: | N/A |
@@ -1,4 +1,4 @@
# Provider # OpenResponsesRequestProvider
When multiple model providers are available, optionally indicate your routing preference. When multiple model providers are available, optionally indicate your routing preference.
@@ -17,4 +17,6 @@ When multiple model providers are available, optionally indicate your routing pr
| `ignore` | List[[components.Ignore](../components/ignore.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. | | | `ignore` | List[[components.Ignore](../components/ignore.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.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | | | `quantizations` | List[[components.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | |
| `sort` | [OptionalNullable[components.ProviderSort]](../components/providersort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price | | `sort` | [OptionalNullable[components.ProviderSort]](../components/providersort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price |
| `max_price` | [Optional[components.MaxPrice]](../components/maxprice.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. | | | `max_price` | [Optional[components.OpenResponsesRequestMaxPrice]](../components/openresponsesrequestmaxprice.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. | |
| `min_throughput` | *OptionalNullable[float]* | :heavy_minus_sign: | The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used. | 100 |
| `max_latency` | *OptionalNullable[float]* | :heavy_minus_sign: | The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used. | 5 |
@@ -0,0 +1,11 @@
# OpenResponsesRequestRoute
Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria.
## Values
| Name | Value |
| ---------- | ---------- |
| `FALLBACK` | fallback |
| `SORT` | sort |
-8
View File
@@ -1,8 +0,0 @@
# Pdf
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| `engine` | [Optional[components.PdfEngine]](../components/pdfengine.md) | :heavy_minus_sign: | N/A |
-29
View File
@@ -1,29 +0,0 @@
# Plugin
## Supported Types
### `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 */
```
-10
View File
@@ -1,10 +0,0 @@
# PluginFileParser
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
| `id` | [components.IDFileParser](../components/idfileparser.md) | :heavy_check_mark: | N/A |
| `max_files` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `pdf` | [Optional[components.Pdf]](../components/pdf.md) | :heavy_minus_sign: | N/A |
-8
View File
@@ -1,8 +0,0 @@
# PluginResponseHealing
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
| `id` | [components.IDResponseHealing](../components/idresponsehealing.md) | :heavy_check_mark: | N/A |
-11
View File
@@ -1,11 +0,0 @@
# PluginWeb
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ |
| `id` | [components.IDWeb](../components/idweb.md) | :heavy_check_mark: | N/A |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `engine` | [Optional[components.Engine]](../components/engine.md) | :heavy_minus_sign: | N/A |
+15 -15
View File
@@ -3,18 +3,18 @@
## Fields ## Fields
| Field | Type | Required | Description | | Field | Type | Required | Description | Example |
| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
| `prompt` | *Any* | :heavy_check_mark: | A value in string or number format that is a large number | | `prompt` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 |
| `completion` | *Any* | :heavy_check_mark: | A value in string or number format that is a large number | | `completion` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 |
| `request` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `image` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `image_token` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `image_token` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `image_output` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `image_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `audio` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `input_audio_cache` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `web_search` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `web_search` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `internal_reasoning` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `input_cache_read` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `input_cache_write` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `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 | | `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | |
+3
View File
@@ -41,6 +41,7 @@
| `INFERMATIC` | Infermatic | | `INFERMATIC` | Infermatic |
| `INFLECTION` | Inflection | | `INFLECTION` | Inflection |
| `LIQUID` | Liquid | | `LIQUID` | Liquid |
| `MARA` | Mara |
| `MANCER_2` | Mancer 2 | | `MANCER_2` | Mancer 2 |
| `MINIMAX` | Minimax | | `MINIMAX` | Minimax |
| `MODEL_RUN` | ModelRun | | `MODEL_RUN` | ModelRun |
@@ -61,6 +62,7 @@
| `RELACE` | Relace | | `RELACE` | Relace |
| `SAMBA_NOVA` | SambaNova | | `SAMBA_NOVA` | SambaNova |
| `SILICON_FLOW` | SiliconFlow | | `SILICON_FLOW` | SiliconFlow |
| `SOURCEFUL` | Sourceful |
| `STEALTH` | Stealth | | `STEALTH` | Stealth |
| `STREAM_LAKE` | StreamLake | | `STREAM_LAKE` | StreamLake |
| `SWITCHPOINT` | Switchpoint | | `SWITCHPOINT` | Switchpoint |
@@ -68,6 +70,7 @@
| `TOGETHER` | Together | | `TOGETHER` | Together |
| `VENICE` | Venice | | `VENICE` | Venice |
| `WAND_B` | WandB | | `WAND_B` | WandB |
| `XIAOMI` | Xiaomi |
| `X_AI` | xAI | | `X_AI` | xAI |
| `Z_AI` | Z.AI | | `Z_AI` | Z.AI |
| `FAKE_PROVIDER` | FakeProvider | | `FAKE_PROVIDER` | FakeProvider |
+15 -15
View File
@@ -5,18 +5,18 @@ Pricing information for the model
## Fields ## Fields
| Field | Type | Required | Description | | Field | Type | Required | Description | Example |
| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
| `prompt` | *Any* | :heavy_check_mark: | A value in string or number format that is a large number | | `prompt` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 |
| `completion` | *Any* | :heavy_check_mark: | A value in string or number format that is a large number | | `completion` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 |
| `request` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `image` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `image_token` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `image_token` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `image_output` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `image_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `audio` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `input_audio_cache` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `web_search` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `web_search` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `internal_reasoning` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `input_cache_read` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `input_cache_write` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `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 | | `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | |
+16
View File
@@ -0,0 +1,16 @@
# Quantizations
## Values
| Name | Value |
| --------- | --------- |
| `INT4` | int4 |
| `INT8` | int8 |
| `FP4` | fp4 |
| `FP6` | fp6 |
| `FP8` | fp8 |
| `FP16` | fp16 |
| `BF16` | bf16 |
| `FP32` | fp32 |
| `UNKNOWN` | unknown |
+17
View File
@@ -0,0 +1,17 @@
# Schema0
## Supported Types
### `components.Schema0Enum`
```python
value: components.Schema0Enum = /* values here */
```
### `str`
```python
value: str = /* values here */
```
+76
View File
@@ -0,0 +1,76 @@
# Schema0Enum
## Values
| Name | Value |
| ------------------- | ------------------- |
| `AI21` | AI21 |
| `AION_LABS` | AionLabs |
| `ALIBABA` | Alibaba |
| `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 |
| `GO_POMELO` | GoPomelo |
| `GOOGLE` | Google |
| `GOOGLE_AI_STUDIO` | Google AI Studio |
| `GROQ` | Groq |
| `HYPERBOLIC` | Hyperbolic |
| `INCEPTION` | Inception |
| `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 |
| `SILICON_FLOW` | SiliconFlow |
| `SOURCEFUL` | Sourceful |
| `STEALTH` | Stealth |
| `STREAM_LAKE` | StreamLake |
| `SWITCHPOINT` | Switchpoint |
| `TARGON` | Targon |
| `TOGETHER` | Together |
| `VENICE` | Venice |
| `WAND_B` | WandB |
| `XIAOMI` | Xiaomi |
| `X_AI` | xAI |
| `Z_AI` | Z.AI |
| `FAKE_PROVIDER` | FakeProvider |
+10
View File
@@ -0,0 +1,10 @@
# Sort
## Values
| Name | Value |
| ------------ | ------------ |
| `PRICE` | price |
| `THROUGHPUT` | throughput |
| `LATENCY` | latency |
+3 -1
View File
@@ -15,4 +15,6 @@
| `ignore` | List[[operations.Ignore](../operations/ignore.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. | | | `ignore` | List[[operations.Ignore](../operations/ignore.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.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | | | `quantizations` | List[[components.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | |
| `sort` | [OptionalNullable[components.ProviderSort]](../components/providersort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price | | `sort` | [OptionalNullable[components.ProviderSort]](../components/providersort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price |
| `max_price` | [Optional[operations.MaxPrice]](../operations/maxprice.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. | | | `max_price` | [Optional[operations.MaxPrice]](../operations/maxprice.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. | |
| `min_throughput` | *OptionalNullable[float]* | :heavy_minus_sign: | The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used. | 100 |
| `max_latency` | *OptionalNullable[float]* | :heavy_minus_sign: | The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used. | 5 |
+12 -9
View File
@@ -1,14 +1,17 @@
# CreateEmbeddingsResponse # CreateEmbeddingsResponse
Embedding response
## Supported Types
## Fields ### `operations.CreateEmbeddingsResponseBody`
```python
value: operations.CreateEmbeddingsResponseBody = /* values here */
```
### `str`
```python
value: str = /* values here */
```
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
| `id` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `object` | [operations.Object](../operations/object.md) | :heavy_check_mark: | N/A |
| `data` | List[[operations.CreateEmbeddingsData](../operations/createembeddingsdata.md)] | :heavy_check_mark: | N/A |
| `model` | *str* | :heavy_check_mark: | N/A |
| `usage` | [Optional[operations.Usage]](../operations/usage.md) | :heavy_minus_sign: | N/A |
@@ -0,0 +1,14 @@
# CreateEmbeddingsResponseBody
Embedding response
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
| `id` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `object` | [operations.Object](../operations/object.md) | :heavy_check_mark: | N/A |
| `data` | List[[operations.CreateEmbeddingsData](../operations/createembeddingsdata.md)] | :heavy_check_mark: | N/A |
| `model` | *str* | :heavy_check_mark: | N/A |
| `usage` | [Optional[operations.Usage]](../operations/usage.md) | :heavy_minus_sign: | N/A |
+3
View File
@@ -41,6 +41,7 @@
| `INFERMATIC` | Infermatic | | `INFERMATIC` | Infermatic |
| `INFLECTION` | Inflection | | `INFLECTION` | Inflection |
| `LIQUID` | Liquid | | `LIQUID` | Liquid |
| `MARA` | Mara |
| `MANCER_2` | Mancer 2 | | `MANCER_2` | Mancer 2 |
| `MINIMAX` | Minimax | | `MINIMAX` | Minimax |
| `MODEL_RUN` | ModelRun | | `MODEL_RUN` | ModelRun |
@@ -61,6 +62,7 @@
| `RELACE` | Relace | | `RELACE` | Relace |
| `SAMBA_NOVA` | SambaNova | | `SAMBA_NOVA` | SambaNova |
| `SILICON_FLOW` | SiliconFlow | | `SILICON_FLOW` | SiliconFlow |
| `SOURCEFUL` | Sourceful |
| `STEALTH` | Stealth | | `STEALTH` | Stealth |
| `STREAM_LAKE` | StreamLake | | `STREAM_LAKE` | StreamLake |
| `SWITCHPOINT` | Switchpoint | | `SWITCHPOINT` | Switchpoint |
@@ -68,6 +70,7 @@
| `TOGETHER` | Together | | `TOGETHER` | Together |
| `VENICE` | Venice | | `VENICE` | Venice |
| `WAND_B` | WandB | | `WAND_B` | WandB |
| `XIAOMI` | Xiaomi |
| `X_AI` | xAI | | `X_AI` | xAI |
| `Z_AI` | Z.AI | | `Z_AI` | Z.AI |
| `FAKE_PROVIDER` | FakeProvider | | `FAKE_PROVIDER` | FakeProvider |
+7 -7
View File
@@ -5,10 +5,10 @@ The object specifying the maximum price you want to pay for this request. USD pr
## Fields ## Fields
| Field | Type | Required | Description | | Field | Type | Required | Description | Example |
| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
| `prompt` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `prompt` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `completion` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `completion` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `image` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `audio` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `request` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
+1 -1
View File
@@ -6,4 +6,4 @@
| Field | Type | Required | Description | Example | | Field | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to update | 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 | | `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to update | 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 |
| `body` | [operations.UpdateKeysRequestBody](../operations/updatekeysrequestbody.md) | :heavy_check_mark: | N/A | {<br/>"name": "Updated API Key Name",<br/>"disabled": false,<br/>"limit": 75,<br/>"limit_reset": "daily",<br/>"include_byok_in_limit": true<br/>} | | `request_body` | [operations.UpdateKeysRequestBody](../operations/updatekeysrequestbody.md) | :heavy_check_mark: | N/A | {<br/>"name": "Updated API Key Name",<br/>"disabled": false,<br/>"limit": 75,<br/>"limit_reset": "daily",<br/>"include_byok_in_limit": true<br/>} |
+2 -3
View File
@@ -67,7 +67,6 @@ Create a new API key
<!-- UsageSnippet language="python" operationID="createKeys" method="post" path="/keys" --> <!-- UsageSnippet language="python" operationID="createKeys" method="post" path="/keys" -->
```python ```python
from openrouter import OpenRouter from openrouter import OpenRouter
from openrouter.utils import parse_datetime
import os import os
@@ -75,7 +74,7 @@ with OpenRouter(
api_key=os.getenv("OPENROUTER_API_KEY", ""), api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router: ) as open_router:
res = open_router.api_keys.create(name="My New API Key", limit=50, limit_reset="monthly", include_byok_in_limit=True, expires_at=parse_datetime("2027-12-31T23:59:59Z")) res = open_router.api_keys.create(name="My New API Key")
# Handle response # Handle response
print(res) print(res)
@@ -123,7 +122,7 @@ with OpenRouter(
api_key=os.getenv("OPENROUTER_API_KEY", ""), api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router: ) as open_router:
res = open_router.api_keys.update(hash="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", name="Updated API Key Name", disabled=False, limit=75, limit_reset="daily", include_byok_in_limit=True) res = open_router.api_keys.update(hash="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")
# Handle response # Handle response
print(res) print(res)
+30 -26
View File
@@ -34,32 +34,36 @@ with OpenRouter(
### Parameters ### Parameters
| Parameter | Type | Required | Description | | Parameter | Type | Required | Description |
| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `messages` | List[[components.Message](../../components/message.md)] | :heavy_check_mark: | N/A | | `messages` | List[[components.Message](../../components/message.md)] | :heavy_check_mark: | N/A |
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | | `provider` | [OptionalNullable[components.ChatGenerationParamsProvider]](../../components/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. |
| `models` | List[*str*] | :heavy_minus_sign: | N/A | | `plugins` | List[[components.ChatGenerationParamsPluginUnion](../../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. |
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `route` | [OptionalNullable[components.ChatGenerationParamsRoute]](../../components/chatgenerationparamsroute.md) | :heavy_minus_sign: | Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria. |
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A | | `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `logprobs` | *OptionalNullable[bool]* | :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. |
| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `models` | List[*str*] | :heavy_minus_sign: | N/A |
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | | `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
| `reasoning` | [Optional[components.Reasoning]](../../components/reasoning.md) | :heavy_minus_sign: | N/A | | `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `response_format` | [Optional[components.ChatGenerationParamsResponseFormatUnion]](../../components/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A | | `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `stop` | [OptionalNullable[components.ChatGenerationParamsStop]](../../components/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A | | `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A | | `reasoning` | [Optional[components.Reasoning]](../../components/reasoning.md) | :heavy_minus_sign: | N/A |
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `response_format` | [Optional[components.ChatGenerationParamsResponseFormatUnion]](../../components/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A |
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A | | `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
| `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A | | `stop` | [OptionalNullable[components.ChatGenerationParamsStop]](../../components/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A |
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | | `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A |
| `debug` | [Optional[components.Debug]](../../components/debug.md) | :heavy_minus_sign: | N/A | | `temperature` | *OptionalNullable[float]* | :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. | | `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 |
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
### Response ### Response
+1 -18
View File
@@ -26,24 +26,7 @@ with OpenRouter(
api_key=os.getenv("OPENROUTER_API_KEY", ""), api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router: ) as open_router:
res = open_router.embeddings.generate(input="<value>", model="Taurus", provider={ res = open_router.embeddings.generate(input="<value>", model="Taurus")
"data_collection": "allow",
"zdr": True,
"enforce_distillable_text": True,
"order": [
"OpenAI",
],
"only": [
"OpenAI",
],
"ignore": [
"OpenAI",
],
"quantizations": [
"fp16",
],
"sort": "price",
})
# Handle response # Handle response
print(res) print(res)
+2 -2
View File
@@ -26,7 +26,7 @@ with OpenRouter(
api_key=os.getenv("OPENROUTER_API_KEY", ""), api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router: ) as open_router:
res = open_router.o_auth.exchange_auth_code_for_api_key(code="auth_code_abc123def456", code_verifier="dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", code_challenge_method="S256") res = open_router.o_auth.exchange_auth_code_for_api_key(code="auth_code_abc123def456")
# Handle response # Handle response
print(res) print(res)
@@ -71,7 +71,7 @@ with OpenRouter(
api_key=os.getenv("OPENROUTER_API_KEY", ""), api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router: ) as open_router:
res = open_router.o_auth.create_auth_code(callback_url="https://myapp.com/auth/callback", code_challenge="E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", code_challenge_method="S256", limit=100) res = open_router.o_auth.create_auth_code(callback_url="https://myapp.com/auth/callback")
# Handle response # Handle response
print(res) print(res)
+5 -57
View File
@@ -25,61 +25,7 @@ with OpenRouter(
api_key=os.getenv("OPENROUTER_API_KEY", ""), api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router: ) as open_router:
res = open_router.beta.responses.send(input=[ res = open_router.beta.responses.send(service_tier="auto", stream=False)
{
"type": "message",
"role": "user",
"content": "Hello, how are you?",
},
], metadata={
"user_id": "123",
"session_id": "abc-def-ghi",
}, tools=[
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
},
},
},
},
], model="anthropic/claude-4.5-sonnet-20250929", text={
"format_": {
"type": "text",
},
"verbosity": "medium",
}, reasoning={
"summary": "auto",
"enabled": True,
}, temperature=0.7, top_p=0.9, prompt={
"id": "<id>",
"variables": {
"key": {
"type": "input_text",
"text": "Hello, how can I help you?",
},
},
}, service_tier="auto", truncation="auto", stream=False, provider={
"data_collection": "allow",
"zdr": True,
"enforce_distillable_text": True,
"order": [
"OpenAI",
],
"only": [
"OpenAI",
],
"ignore": [
"OpenAI",
],
"quantizations": None,
"sort": "price",
})
with res as event_stream: with res as event_stream:
for event in event_stream: for event in event_stream:
@@ -115,9 +61,11 @@ with OpenRouter(
| `service_tier` | [Optional[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | | | `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 | | `truncation` | [OptionalNullable[components.Truncation]](../../components/truncation.md) | :heavy_minus_sign: | N/A | auto |
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
| `provider` | [OptionalNullable[components.Provider]](../../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | | `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../../components/openresponsesrequestprovider.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. | | | `plugins` | List[[components.OpenResponsesRequestPluginUnion](../../components/openresponsesrequestpluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
| `route` | [OptionalNullable[components.OpenResponsesRequestRoute]](../../components/openresponsesrequestroute.md) | :heavy_minus_sign: | Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria. | |
| `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. | | | `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. | | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
### Response ### Response
+1 -1
View File
@@ -1,6 +1,6 @@
[project] [project]
name = "openrouter" name = "openrouter"
version = "0.1.1" version = "0.0.22"
description = "Official Python Client SDK for OpenRouter." description = "Official Python Client SDK for OpenRouter."
authors = [{ name = "OpenRouter" },] authors = [{ name = "OpenRouter" },]
readme = "README-PYPI.md" readme = "README-PYPI.md"
+2 -2
View File
@@ -3,10 +3,10 @@
import importlib.metadata import importlib.metadata
__title__: str = "openrouter" __title__: str = "openrouter"
__version__: str = "0.1.1" __version__: str = "0.0.22"
__openapi_doc_version__: str = "1.0.0" __openapi_doc_version__: str = "1.0.0"
__gen_version__: str = "2.768.0" __gen_version__: str = "2.768.0"
__user_agent__: str = "speakeasy-sdk/python 0.1.1 2.768.0 1.0.0 openrouter" __user_agent__: str = "speakeasy-sdk/python 0.0.22 2.768.0 1.0.0 openrouter"
try: try:
if __package__ is not None: if __package__ is not None:
+12 -4
View File
@@ -506,7 +506,7 @@ class APIKeys(BaseSDK):
request = operations.UpdateKeysRequest( request = operations.UpdateKeysRequest(
hash=hash, hash=hash,
body=operations.UpdateKeysRequestBody( request_body=operations.UpdateKeysRequestBody(
name=name, name=name,
disabled=disabled, disabled=disabled,
limit=limit, limit=limit,
@@ -529,7 +529,11 @@ class APIKeys(BaseSDK):
http_headers=http_headers, http_headers=http_headers,
security=self.sdk_configuration.security, security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body( get_serialized_body=lambda: utils.serialize_request_body(
request.body, False, False, "json", operations.UpdateKeysRequestBody request.request_body,
False,
False,
"json",
operations.UpdateKeysRequestBody,
), ),
allow_empty_value=None, allow_empty_value=None,
timeout_ms=timeout_ms, timeout_ms=timeout_ms,
@@ -638,7 +642,7 @@ class APIKeys(BaseSDK):
request = operations.UpdateKeysRequest( request = operations.UpdateKeysRequest(
hash=hash, hash=hash,
body=operations.UpdateKeysRequestBody( request_body=operations.UpdateKeysRequestBody(
name=name, name=name,
disabled=disabled, disabled=disabled,
limit=limit, limit=limit,
@@ -661,7 +665,11 @@ class APIKeys(BaseSDK):
http_headers=http_headers, http_headers=http_headers,
security=self.sdk_configuration.security, security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body( get_serialized_body=lambda: utils.serialize_request_body(
request.body, False, False, "json", operations.UpdateKeysRequestBody request.request_body,
False,
False,
"json",
operations.UpdateKeysRequestBody,
), ),
allow_empty_value=None, allow_empty_value=None,
timeout_ms=timeout_ms, timeout_ms=timeout_ms,
+138 -14
View File
@@ -21,6 +21,21 @@ class Chat(BaseSDK):
self, self,
*, *,
messages: Union[List[components.Message], List[components.MessageTypedDict]], messages: Union[List[components.Message], List[components.MessageTypedDict]],
provider: OptionalNullable[
Union[
components.ChatGenerationParamsProvider,
components.ChatGenerationParamsProviderTypedDict,
]
] = UNSET,
plugins: Optional[
Union[
List[components.ChatGenerationParamsPluginUnion],
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None,
route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
user: Optional[str] = None,
session_id: Optional[str] = None,
model: Optional[str] = None, model: Optional[str] = None,
models: Optional[List[str]] = None, models: Optional[List[str]] = None,
frequency_penalty: OptionalNullable[float] = UNSET, frequency_penalty: OptionalNullable[float] = UNSET,
@@ -60,7 +75,6 @@ class Chat(BaseSDK):
] ]
] = None, ] = None,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
@@ -72,6 +86,11 @@ class Chat(BaseSDK):
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
:param messages: :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 route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
: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 model: :param model:
:param models: :param models:
:param frequency_penalty: :param frequency_penalty:
@@ -92,7 +111,6 @@ class Chat(BaseSDK):
:param tool_choice: :param tool_choice:
:param tools: :param tools:
:param top_p: :param top_p:
:param user:
:param debug: :param debug:
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method :param server_url: Override the default server URL for this method
@@ -106,6 +124,21 @@ class Chat(BaseSDK):
self, self,
*, *,
messages: Union[List[components.Message], List[components.MessageTypedDict]], messages: Union[List[components.Message], List[components.MessageTypedDict]],
provider: OptionalNullable[
Union[
components.ChatGenerationParamsProvider,
components.ChatGenerationParamsProviderTypedDict,
]
] = UNSET,
plugins: Optional[
Union[
List[components.ChatGenerationParamsPluginUnion],
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None,
route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
user: Optional[str] = None,
session_id: Optional[str] = None,
model: Optional[str] = None, model: Optional[str] = None,
models: Optional[List[str]] = None, models: Optional[List[str]] = None,
frequency_penalty: OptionalNullable[float] = UNSET, frequency_penalty: OptionalNullable[float] = UNSET,
@@ -145,7 +178,6 @@ class Chat(BaseSDK):
] ]
] = None, ] = None,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
@@ -157,6 +189,11 @@ class Chat(BaseSDK):
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
:param messages: :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 route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
: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 model: :param model:
:param models: :param models:
:param frequency_penalty: :param frequency_penalty:
@@ -177,7 +214,6 @@ class Chat(BaseSDK):
:param tool_choice: :param tool_choice:
:param tools: :param tools:
:param top_p: :param top_p:
:param user:
:param debug: :param debug:
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method :param server_url: Override the default server URL for this method
@@ -190,6 +226,21 @@ class Chat(BaseSDK):
self, self,
*, *,
messages: Union[List[components.Message], List[components.MessageTypedDict]], messages: Union[List[components.Message], List[components.MessageTypedDict]],
provider: OptionalNullable[
Union[
components.ChatGenerationParamsProvider,
components.ChatGenerationParamsProviderTypedDict,
]
] = UNSET,
plugins: Optional[
Union[
List[components.ChatGenerationParamsPluginUnion],
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None,
route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
user: Optional[str] = None,
session_id: Optional[str] = None,
model: Optional[str] = None, model: Optional[str] = None,
models: Optional[List[str]] = None, models: Optional[List[str]] = None,
frequency_penalty: OptionalNullable[float] = UNSET, frequency_penalty: OptionalNullable[float] = UNSET,
@@ -229,7 +280,6 @@ class Chat(BaseSDK):
] ]
] = None, ] = None,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
@@ -241,6 +291,11 @@ class Chat(BaseSDK):
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
:param messages: :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 route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
: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 model: :param model:
:param models: :param models:
:param frequency_penalty: :param frequency_penalty:
@@ -261,7 +316,6 @@ class Chat(BaseSDK):
:param tool_choice: :param tool_choice:
:param tools: :param tools:
:param top_p: :param top_p:
:param user:
:param debug: :param debug:
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method :param server_url: Override the default server URL for this method
@@ -280,6 +334,15 @@ class Chat(BaseSDK):
base_url = self._get_url(base_url, url_variables) base_url = self._get_url(base_url, url_variables)
request = components.ChatGenerationParams( request = components.ChatGenerationParams(
provider=utils.get_pydantic_model(
provider, OptionalNullable[components.ChatGenerationParamsProvider]
),
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]), messages=utils.get_pydantic_model(messages, List[components.Message]),
model=model, model=model,
models=models, models=models,
@@ -310,7 +373,6 @@ class Chat(BaseSDK):
tools, Optional[List[components.ToolDefinitionJSON]] tools, Optional[List[components.ToolDefinitionJSON]]
), ),
top_p=top_p, top_p=top_p,
user=user,
debug=utils.get_pydantic_model(debug, Optional[components.Debug]), debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
) )
@@ -406,6 +468,21 @@ class Chat(BaseSDK):
self, self,
*, *,
messages: Union[List[components.Message], List[components.MessageTypedDict]], messages: Union[List[components.Message], List[components.MessageTypedDict]],
provider: OptionalNullable[
Union[
components.ChatGenerationParamsProvider,
components.ChatGenerationParamsProviderTypedDict,
]
] = UNSET,
plugins: Optional[
Union[
List[components.ChatGenerationParamsPluginUnion],
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None,
route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
user: Optional[str] = None,
session_id: Optional[str] = None,
model: Optional[str] = None, model: Optional[str] = None,
models: Optional[List[str]] = None, models: Optional[List[str]] = None,
frequency_penalty: OptionalNullable[float] = UNSET, frequency_penalty: OptionalNullable[float] = UNSET,
@@ -445,7 +522,6 @@ class Chat(BaseSDK):
] ]
] = None, ] = None,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
@@ -457,6 +533,11 @@ class Chat(BaseSDK):
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
:param messages: :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 route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
: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 model: :param model:
:param models: :param models:
:param frequency_penalty: :param frequency_penalty:
@@ -477,7 +558,6 @@ class Chat(BaseSDK):
:param tool_choice: :param tool_choice:
:param tools: :param tools:
:param top_p: :param top_p:
:param user:
:param debug: :param debug:
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method :param server_url: Override the default server URL for this method
@@ -491,6 +571,21 @@ class Chat(BaseSDK):
self, self,
*, *,
messages: Union[List[components.Message], List[components.MessageTypedDict]], messages: Union[List[components.Message], List[components.MessageTypedDict]],
provider: OptionalNullable[
Union[
components.ChatGenerationParamsProvider,
components.ChatGenerationParamsProviderTypedDict,
]
] = UNSET,
plugins: Optional[
Union[
List[components.ChatGenerationParamsPluginUnion],
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None,
route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
user: Optional[str] = None,
session_id: Optional[str] = None,
model: Optional[str] = None, model: Optional[str] = None,
models: Optional[List[str]] = None, models: Optional[List[str]] = None,
frequency_penalty: OptionalNullable[float] = UNSET, frequency_penalty: OptionalNullable[float] = UNSET,
@@ -530,7 +625,6 @@ class Chat(BaseSDK):
] ]
] = None, ] = None,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
@@ -542,6 +636,11 @@ class Chat(BaseSDK):
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
:param messages: :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 route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
: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 model: :param model:
:param models: :param models:
:param frequency_penalty: :param frequency_penalty:
@@ -562,7 +661,6 @@ class Chat(BaseSDK):
:param tool_choice: :param tool_choice:
:param tools: :param tools:
:param top_p: :param top_p:
:param user:
:param debug: :param debug:
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method :param server_url: Override the default server URL for this method
@@ -575,6 +673,21 @@ class Chat(BaseSDK):
self, self,
*, *,
messages: Union[List[components.Message], List[components.MessageTypedDict]], messages: Union[List[components.Message], List[components.MessageTypedDict]],
provider: OptionalNullable[
Union[
components.ChatGenerationParamsProvider,
components.ChatGenerationParamsProviderTypedDict,
]
] = UNSET,
plugins: Optional[
Union[
List[components.ChatGenerationParamsPluginUnion],
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None,
route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
user: Optional[str] = None,
session_id: Optional[str] = None,
model: Optional[str] = None, model: Optional[str] = None,
models: Optional[List[str]] = None, models: Optional[List[str]] = None,
frequency_penalty: OptionalNullable[float] = UNSET, frequency_penalty: OptionalNullable[float] = UNSET,
@@ -614,7 +727,6 @@ class Chat(BaseSDK):
] ]
] = None, ] = None,
top_p: OptionalNullable[float] = UNSET, top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
@@ -626,6 +738,11 @@ class Chat(BaseSDK):
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
:param messages: :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 route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
: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 model: :param model:
:param models: :param models:
:param frequency_penalty: :param frequency_penalty:
@@ -646,7 +763,6 @@ class Chat(BaseSDK):
:param tool_choice: :param tool_choice:
:param tools: :param tools:
:param top_p: :param top_p:
:param user:
:param debug: :param debug:
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method :param server_url: Override the default server URL for this method
@@ -665,6 +781,15 @@ class Chat(BaseSDK):
base_url = self._get_url(base_url, url_variables) base_url = self._get_url(base_url, url_variables)
request = components.ChatGenerationParams( request = components.ChatGenerationParams(
provider=utils.get_pydantic_model(
provider, OptionalNullable[components.ChatGenerationParamsProvider]
),
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]), messages=utils.get_pydantic_model(messages, List[components.Message]),
model=model, model=model,
models=models, models=models,
@@ -695,7 +820,6 @@ class Chat(BaseSDK):
tools, Optional[List[components.ToolDefinitionJSON]] tools, Optional[List[components.ToolDefinitionJSON]]
), ),
top_p=top_p, top_p=top_p,
user=user,
debug=utils.get_pydantic_model(debug, Optional[components.Debug]), debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
) )
+130 -54
View File
@@ -6,6 +6,7 @@ import builtins
import sys import sys
if TYPE_CHECKING: if TYPE_CHECKING:
from ._schema0 import Schema0, Schema0Enum, Schema0TypedDict
from .activityitem import ActivityItem, ActivityItemTypedDict from .activityitem import ActivityItem, ActivityItemTypedDict
from .assistantmessage import ( from .assistantmessage import (
AssistantMessage, AssistantMessage,
@@ -25,6 +26,25 @@ if TYPE_CHECKING:
from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict
from .chatgenerationparams import ( from .chatgenerationparams import (
ChatGenerationParams, ChatGenerationParams,
ChatGenerationParamsDataCollection,
ChatGenerationParamsEngine,
ChatGenerationParamsMaxPrice,
ChatGenerationParamsMaxPriceTypedDict,
ChatGenerationParamsPdf,
ChatGenerationParamsPdfEngine,
ChatGenerationParamsPdfTypedDict,
ChatGenerationParamsPluginFileParser,
ChatGenerationParamsPluginFileParserTypedDict,
ChatGenerationParamsPluginModeration,
ChatGenerationParamsPluginModerationTypedDict,
ChatGenerationParamsPluginResponseHealing,
ChatGenerationParamsPluginResponseHealingTypedDict,
ChatGenerationParamsPluginUnion,
ChatGenerationParamsPluginUnionTypedDict,
ChatGenerationParamsPluginWeb,
ChatGenerationParamsPluginWebTypedDict,
ChatGenerationParamsProvider,
ChatGenerationParamsProviderTypedDict,
ChatGenerationParamsResponseFormatJSONObject, ChatGenerationParamsResponseFormatJSONObject,
ChatGenerationParamsResponseFormatJSONObjectTypedDict, ChatGenerationParamsResponseFormatJSONObjectTypedDict,
ChatGenerationParamsResponseFormatPython, ChatGenerationParamsResponseFormatPython,
@@ -33,14 +53,17 @@ if TYPE_CHECKING:
ChatGenerationParamsResponseFormatTextTypedDict, ChatGenerationParamsResponseFormatTextTypedDict,
ChatGenerationParamsResponseFormatUnion, ChatGenerationParamsResponseFormatUnion,
ChatGenerationParamsResponseFormatUnionTypedDict, ChatGenerationParamsResponseFormatUnionTypedDict,
ChatGenerationParamsRoute,
ChatGenerationParamsStop, ChatGenerationParamsStop,
ChatGenerationParamsStopTypedDict, ChatGenerationParamsStopTypedDict,
ChatGenerationParamsTypedDict, ChatGenerationParamsTypedDict,
Debug, Debug,
DebugTypedDict, DebugTypedDict,
Effort, Effort,
Quantizations,
Reasoning, Reasoning,
ReasoningTypedDict, ReasoningTypedDict,
Sort,
) )
from .chatgenerationtokenusage import ( from .chatgenerationtokenusage import (
ChatGenerationTokenUsage, ChatGenerationTokenUsage,
@@ -421,18 +444,34 @@ if TYPE_CHECKING:
OpenResponsesReasoningSummaryTextDoneEventTypedDict, OpenResponsesReasoningSummaryTextDoneEventTypedDict,
) )
from .openresponsesrequest import ( from .openresponsesrequest import (
Engine,
IDFileParser, IDFileParser,
IDModeration, IDModeration,
IDResponseHealing, IDResponseHealing,
IDWeb, IDWeb,
Ignore, Ignore,
IgnoreTypedDict, IgnoreTypedDict,
MaxPrice,
MaxPriceTypedDict,
Only, Only,
OnlyTypedDict, OnlyTypedDict,
OpenResponsesRequest, OpenResponsesRequest,
OpenResponsesRequestEngine,
OpenResponsesRequestMaxPrice,
OpenResponsesRequestMaxPriceTypedDict,
OpenResponsesRequestPdf,
OpenResponsesRequestPdfEngine,
OpenResponsesRequestPdfTypedDict,
OpenResponsesRequestPluginFileParser,
OpenResponsesRequestPluginFileParserTypedDict,
OpenResponsesRequestPluginModeration,
OpenResponsesRequestPluginModerationTypedDict,
OpenResponsesRequestPluginResponseHealing,
OpenResponsesRequestPluginResponseHealingTypedDict,
OpenResponsesRequestPluginUnion,
OpenResponsesRequestPluginUnionTypedDict,
OpenResponsesRequestPluginWeb,
OpenResponsesRequestPluginWebTypedDict,
OpenResponsesRequestProvider,
OpenResponsesRequestProviderTypedDict,
OpenResponsesRequestRoute,
OpenResponsesRequestToolFunction, OpenResponsesRequestToolFunction,
OpenResponsesRequestToolFunctionTypedDict, OpenResponsesRequestToolFunctionTypedDict,
OpenResponsesRequestToolUnion, OpenResponsesRequestToolUnion,
@@ -441,21 +480,6 @@ if TYPE_CHECKING:
OpenResponsesRequestTypedDict, OpenResponsesRequestTypedDict,
Order, Order,
OrderTypedDict, OrderTypedDict,
Pdf,
PdfEngine,
PdfTypedDict,
Plugin,
PluginFileParser,
PluginFileParserTypedDict,
PluginModeration,
PluginModerationTypedDict,
PluginResponseHealing,
PluginResponseHealingTypedDict,
PluginTypedDict,
PluginWeb,
PluginWebTypedDict,
Provider,
ProviderTypedDict,
ServiceTier, ServiceTier,
Truncation, Truncation,
) )
@@ -810,6 +834,25 @@ __all__ = [
"ChatErrorError", "ChatErrorError",
"ChatErrorErrorTypedDict", "ChatErrorErrorTypedDict",
"ChatGenerationParams", "ChatGenerationParams",
"ChatGenerationParamsDataCollection",
"ChatGenerationParamsEngine",
"ChatGenerationParamsMaxPrice",
"ChatGenerationParamsMaxPriceTypedDict",
"ChatGenerationParamsPdf",
"ChatGenerationParamsPdfEngine",
"ChatGenerationParamsPdfTypedDict",
"ChatGenerationParamsPluginFileParser",
"ChatGenerationParamsPluginFileParserTypedDict",
"ChatGenerationParamsPluginModeration",
"ChatGenerationParamsPluginModerationTypedDict",
"ChatGenerationParamsPluginResponseHealing",
"ChatGenerationParamsPluginResponseHealingTypedDict",
"ChatGenerationParamsPluginUnion",
"ChatGenerationParamsPluginUnionTypedDict",
"ChatGenerationParamsPluginWeb",
"ChatGenerationParamsPluginWebTypedDict",
"ChatGenerationParamsProvider",
"ChatGenerationParamsProviderTypedDict",
"ChatGenerationParamsResponseFormatJSONObject", "ChatGenerationParamsResponseFormatJSONObject",
"ChatGenerationParamsResponseFormatJSONObjectTypedDict", "ChatGenerationParamsResponseFormatJSONObjectTypedDict",
"ChatGenerationParamsResponseFormatPython", "ChatGenerationParamsResponseFormatPython",
@@ -818,6 +861,7 @@ __all__ = [
"ChatGenerationParamsResponseFormatTextTypedDict", "ChatGenerationParamsResponseFormatTextTypedDict",
"ChatGenerationParamsResponseFormatUnion", "ChatGenerationParamsResponseFormatUnion",
"ChatGenerationParamsResponseFormatUnionTypedDict", "ChatGenerationParamsResponseFormatUnionTypedDict",
"ChatGenerationParamsRoute",
"ChatGenerationParamsStop", "ChatGenerationParamsStop",
"ChatGenerationParamsStopTypedDict", "ChatGenerationParamsStopTypedDict",
"ChatGenerationParamsTypedDict", "ChatGenerationParamsTypedDict",
@@ -910,7 +954,6 @@ __all__ = [
"EdgeNetworkTimeoutResponseErrorDataTypedDict", "EdgeNetworkTimeoutResponseErrorDataTypedDict",
"Effort", "Effort",
"EndpointStatus", "EndpointStatus",
"Engine",
"FileCitation", "FileCitation",
"FileCitationType", "FileCitationType",
"FileCitationTypedDict", "FileCitationTypedDict",
@@ -938,8 +981,6 @@ __all__ = [
"JSONSchemaConfigTypedDict", "JSONSchemaConfigTypedDict",
"ListEndpointsResponse", "ListEndpointsResponse",
"ListEndpointsResponseTypedDict", "ListEndpointsResponseTypedDict",
"MaxPrice",
"MaxPriceTypedDict",
"Message", "Message",
"MessageContent", "MessageContent",
"MessageContentTypedDict", "MessageContentTypedDict",
@@ -1112,6 +1153,25 @@ __all__ = [
"OpenResponsesReasoningType", "OpenResponsesReasoningType",
"OpenResponsesReasoningTypedDict", "OpenResponsesReasoningTypedDict",
"OpenResponsesRequest", "OpenResponsesRequest",
"OpenResponsesRequestEngine",
"OpenResponsesRequestMaxPrice",
"OpenResponsesRequestMaxPriceTypedDict",
"OpenResponsesRequestPdf",
"OpenResponsesRequestPdfEngine",
"OpenResponsesRequestPdfTypedDict",
"OpenResponsesRequestPluginFileParser",
"OpenResponsesRequestPluginFileParserTypedDict",
"OpenResponsesRequestPluginModeration",
"OpenResponsesRequestPluginModerationTypedDict",
"OpenResponsesRequestPluginResponseHealing",
"OpenResponsesRequestPluginResponseHealingTypedDict",
"OpenResponsesRequestPluginUnion",
"OpenResponsesRequestPluginUnionTypedDict",
"OpenResponsesRequestPluginWeb",
"OpenResponsesRequestPluginWebTypedDict",
"OpenResponsesRequestProvider",
"OpenResponsesRequestProviderTypedDict",
"OpenResponsesRequestRoute",
"OpenResponsesRequestToolFunction", "OpenResponsesRequestToolFunction",
"OpenResponsesRequestToolFunctionTypedDict", "OpenResponsesRequestToolFunctionTypedDict",
"OpenResponsesRequestToolUnion", "OpenResponsesRequestToolUnion",
@@ -1205,39 +1265,25 @@ __all__ = [
"PayloadTooLargeResponseErrorDataTypedDict", "PayloadTooLargeResponseErrorDataTypedDict",
"PaymentRequiredResponseErrorData", "PaymentRequiredResponseErrorData",
"PaymentRequiredResponseErrorDataTypedDict", "PaymentRequiredResponseErrorDataTypedDict",
"Pdf",
"PdfEngine",
"PdfTypedDict",
"PerRequestLimits", "PerRequestLimits",
"PerRequestLimitsTypedDict", "PerRequestLimitsTypedDict",
"Plugin",
"PluginFileParser",
"PluginFileParserTypedDict",
"PluginModeration",
"PluginModerationTypedDict",
"PluginResponseHealing",
"PluginResponseHealingTypedDict",
"PluginTypedDict",
"PluginWeb",
"PluginWebTypedDict",
"Pricing", "Pricing",
"PricingTypedDict", "PricingTypedDict",
"Prompt", "Prompt",
"PromptTokensDetails", "PromptTokensDetails",
"PromptTokensDetailsTypedDict", "PromptTokensDetailsTypedDict",
"PromptTypedDict", "PromptTypedDict",
"Provider",
"ProviderName", "ProviderName",
"ProviderOverloadedResponseErrorData", "ProviderOverloadedResponseErrorData",
"ProviderOverloadedResponseErrorDataTypedDict", "ProviderOverloadedResponseErrorDataTypedDict",
"ProviderSort", "ProviderSort",
"ProviderTypedDict",
"PublicEndpoint", "PublicEndpoint",
"PublicEndpointQuantization", "PublicEndpointQuantization",
"PublicEndpointTypedDict", "PublicEndpointTypedDict",
"PublicPricing", "PublicPricing",
"PublicPricingTypedDict", "PublicPricingTypedDict",
"Quantization", "Quantization",
"Quantizations",
"Reason", "Reason",
"Reasoning", "Reasoning",
"ReasoningSummaryText", "ReasoningSummaryText",
@@ -1331,11 +1377,15 @@ __all__ = [
"ResponsesWebSearchUserLocation", "ResponsesWebSearchUserLocation",
"ResponsesWebSearchUserLocationType", "ResponsesWebSearchUserLocationType",
"ResponsesWebSearchUserLocationTypedDict", "ResponsesWebSearchUserLocationTypedDict",
"Schema0",
"Schema0Enum",
"Schema0TypedDict",
"Security", "Security",
"SecurityTypedDict", "SecurityTypedDict",
"ServiceTier", "ServiceTier",
"ServiceUnavailableResponseErrorData", "ServiceUnavailableResponseErrorData",
"ServiceUnavailableResponseErrorDataTypedDict", "ServiceUnavailableResponseErrorDataTypedDict",
"Sort",
"StreamOptions", "StreamOptions",
"StreamOptionsTypedDict", "StreamOptionsTypedDict",
"SystemMessage", "SystemMessage",
@@ -1403,6 +1453,9 @@ __all__ = [
] ]
_dynamic_imports: dict[str, str] = { _dynamic_imports: dict[str, str] = {
"Schema0": "._schema0",
"Schema0Enum": "._schema0",
"Schema0TypedDict": "._schema0",
"ActivityItem": ".activityitem", "ActivityItem": ".activityitem",
"ActivityItemTypedDict": ".activityitem", "ActivityItemTypedDict": ".activityitem",
"AssistantMessage": ".assistantmessage", "AssistantMessage": ".assistantmessage",
@@ -1419,6 +1472,25 @@ _dynamic_imports: dict[str, str] = {
"Code": ".chaterror", "Code": ".chaterror",
"CodeTypedDict": ".chaterror", "CodeTypedDict": ".chaterror",
"ChatGenerationParams": ".chatgenerationparams", "ChatGenerationParams": ".chatgenerationparams",
"ChatGenerationParamsDataCollection": ".chatgenerationparams",
"ChatGenerationParamsEngine": ".chatgenerationparams",
"ChatGenerationParamsMaxPrice": ".chatgenerationparams",
"ChatGenerationParamsMaxPriceTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPdf": ".chatgenerationparams",
"ChatGenerationParamsPdfEngine": ".chatgenerationparams",
"ChatGenerationParamsPdfTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginFileParser": ".chatgenerationparams",
"ChatGenerationParamsPluginFileParserTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginModeration": ".chatgenerationparams",
"ChatGenerationParamsPluginModerationTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginResponseHealing": ".chatgenerationparams",
"ChatGenerationParamsPluginResponseHealingTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginUnion": ".chatgenerationparams",
"ChatGenerationParamsPluginUnionTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginWeb": ".chatgenerationparams",
"ChatGenerationParamsPluginWebTypedDict": ".chatgenerationparams",
"ChatGenerationParamsProvider": ".chatgenerationparams",
"ChatGenerationParamsProviderTypedDict": ".chatgenerationparams",
"ChatGenerationParamsResponseFormatJSONObject": ".chatgenerationparams", "ChatGenerationParamsResponseFormatJSONObject": ".chatgenerationparams",
"ChatGenerationParamsResponseFormatJSONObjectTypedDict": ".chatgenerationparams", "ChatGenerationParamsResponseFormatJSONObjectTypedDict": ".chatgenerationparams",
"ChatGenerationParamsResponseFormatPython": ".chatgenerationparams", "ChatGenerationParamsResponseFormatPython": ".chatgenerationparams",
@@ -1427,14 +1499,17 @@ _dynamic_imports: dict[str, str] = {
"ChatGenerationParamsResponseFormatTextTypedDict": ".chatgenerationparams", "ChatGenerationParamsResponseFormatTextTypedDict": ".chatgenerationparams",
"ChatGenerationParamsResponseFormatUnion": ".chatgenerationparams", "ChatGenerationParamsResponseFormatUnion": ".chatgenerationparams",
"ChatGenerationParamsResponseFormatUnionTypedDict": ".chatgenerationparams", "ChatGenerationParamsResponseFormatUnionTypedDict": ".chatgenerationparams",
"ChatGenerationParamsRoute": ".chatgenerationparams",
"ChatGenerationParamsStop": ".chatgenerationparams", "ChatGenerationParamsStop": ".chatgenerationparams",
"ChatGenerationParamsStopTypedDict": ".chatgenerationparams", "ChatGenerationParamsStopTypedDict": ".chatgenerationparams",
"ChatGenerationParamsTypedDict": ".chatgenerationparams", "ChatGenerationParamsTypedDict": ".chatgenerationparams",
"Debug": ".chatgenerationparams", "Debug": ".chatgenerationparams",
"DebugTypedDict": ".chatgenerationparams", "DebugTypedDict": ".chatgenerationparams",
"Effort": ".chatgenerationparams", "Effort": ".chatgenerationparams",
"Quantizations": ".chatgenerationparams",
"Reasoning": ".chatgenerationparams", "Reasoning": ".chatgenerationparams",
"ReasoningTypedDict": ".chatgenerationparams", "ReasoningTypedDict": ".chatgenerationparams",
"Sort": ".chatgenerationparams",
"ChatGenerationTokenUsage": ".chatgenerationtokenusage", "ChatGenerationTokenUsage": ".chatgenerationtokenusage",
"ChatGenerationTokenUsageTypedDict": ".chatgenerationtokenusage", "ChatGenerationTokenUsageTypedDict": ".chatgenerationtokenusage",
"CompletionTokensDetails": ".chatgenerationtokenusage", "CompletionTokensDetails": ".chatgenerationtokenusage",
@@ -1726,18 +1801,34 @@ _dynamic_imports: dict[str, str] = {
"OpenResponsesReasoningSummaryTextDoneEvent": ".openresponsesreasoningsummarytextdoneevent", "OpenResponsesReasoningSummaryTextDoneEvent": ".openresponsesreasoningsummarytextdoneevent",
"OpenResponsesReasoningSummaryTextDoneEventType": ".openresponsesreasoningsummarytextdoneevent", "OpenResponsesReasoningSummaryTextDoneEventType": ".openresponsesreasoningsummarytextdoneevent",
"OpenResponsesReasoningSummaryTextDoneEventTypedDict": ".openresponsesreasoningsummarytextdoneevent", "OpenResponsesReasoningSummaryTextDoneEventTypedDict": ".openresponsesreasoningsummarytextdoneevent",
"Engine": ".openresponsesrequest",
"IDFileParser": ".openresponsesrequest", "IDFileParser": ".openresponsesrequest",
"IDModeration": ".openresponsesrequest", "IDModeration": ".openresponsesrequest",
"IDResponseHealing": ".openresponsesrequest", "IDResponseHealing": ".openresponsesrequest",
"IDWeb": ".openresponsesrequest", "IDWeb": ".openresponsesrequest",
"Ignore": ".openresponsesrequest", "Ignore": ".openresponsesrequest",
"IgnoreTypedDict": ".openresponsesrequest", "IgnoreTypedDict": ".openresponsesrequest",
"MaxPrice": ".openresponsesrequest",
"MaxPriceTypedDict": ".openresponsesrequest",
"Only": ".openresponsesrequest", "Only": ".openresponsesrequest",
"OnlyTypedDict": ".openresponsesrequest", "OnlyTypedDict": ".openresponsesrequest",
"OpenResponsesRequest": ".openresponsesrequest", "OpenResponsesRequest": ".openresponsesrequest",
"OpenResponsesRequestEngine": ".openresponsesrequest",
"OpenResponsesRequestMaxPrice": ".openresponsesrequest",
"OpenResponsesRequestMaxPriceTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPdf": ".openresponsesrequest",
"OpenResponsesRequestPdfEngine": ".openresponsesrequest",
"OpenResponsesRequestPdfTypedDict": ".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",
"OpenResponsesRequestRoute": ".openresponsesrequest",
"OpenResponsesRequestToolFunction": ".openresponsesrequest", "OpenResponsesRequestToolFunction": ".openresponsesrequest",
"OpenResponsesRequestToolFunctionTypedDict": ".openresponsesrequest", "OpenResponsesRequestToolFunctionTypedDict": ".openresponsesrequest",
"OpenResponsesRequestToolUnion": ".openresponsesrequest", "OpenResponsesRequestToolUnion": ".openresponsesrequest",
@@ -1746,21 +1837,6 @@ _dynamic_imports: dict[str, str] = {
"OpenResponsesRequestTypedDict": ".openresponsesrequest", "OpenResponsesRequestTypedDict": ".openresponsesrequest",
"Order": ".openresponsesrequest", "Order": ".openresponsesrequest",
"OrderTypedDict": ".openresponsesrequest", "OrderTypedDict": ".openresponsesrequest",
"Pdf": ".openresponsesrequest",
"PdfEngine": ".openresponsesrequest",
"PdfTypedDict": ".openresponsesrequest",
"Plugin": ".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", "ServiceTier": ".openresponsesrequest",
"Truncation": ".openresponsesrequest", "Truncation": ".openresponsesrequest",
"OpenResponsesResponseText": ".openresponsesresponsetext", "OpenResponsesResponseText": ".openresponsesresponsetext",
+93
View File
@@ -0,0 +1,93 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Literal, Union
from typing_extensions import Annotated, TypeAliasType
Schema0Enum = Union[
Literal[
"AI21",
"AionLabs",
"Alibaba",
"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",
"GoPomelo",
"Google",
"Google AI Studio",
"Groq",
"Hyperbolic",
"Inception",
"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",
"SiliconFlow",
"Sourceful",
"Stealth",
"StreamLake",
"Switchpoint",
"Targon",
"Together",
"Venice",
"WandB",
"Xiaomi",
"xAI",
"Z.AI",
"FakeProvider",
],
UnrecognizedStr,
]
Schema0TypedDict = TypeAliasType("Schema0TypedDict", Union[Schema0Enum, str])
Schema0 = TypeAliasType(
"Schema0",
Union[Annotated[Schema0Enum, PlainValidator(validate_open_enum(False))], str],
)
@@ -1,6 +1,7 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations from __future__ import annotations
from ._schema0 import Schema0, Schema0TypedDict
from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict
from .message import Message, MessageTypedDict from .message import Message, MessageTypedDict
from .reasoningsummaryverbosity import ReasoningSummaryVerbosity from .reasoningsummaryverbosity import ReasoningSummaryVerbosity
@@ -29,6 +30,347 @@ from typing import Any, Dict, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
ChatGenerationParamsDataCollection = Union[
Literal[
"deny",
"allow",
],
UnrecognizedStr,
]
Quantizations = Union[
Literal[
"int4",
"int8",
"fp4",
"fp6",
"fp8",
"fp16",
"bf16",
"fp32",
"unknown",
],
UnrecognizedStr,
]
Sort = Union[
Literal[
"price",
"throughput",
"latency",
],
UnrecognizedStr,
]
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 ChatGenerationParamsProviderTypedDict(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.
"""
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."""
sort: NotRequired[Nullable[Sort]]
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."""
min_throughput: NotRequired[Nullable[float]]
r"""The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used."""
max_latency: NotRequired[Nullable[float]]
r"""The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used."""
class ChatGenerationParamsProvider(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)),
] = 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."""
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."""
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."""
quantizations: OptionalNullable[
List[Annotated[Quantizations, PlainValidator(validate_open_enum(False))]]
] = UNSET
r"""A list of quantization levels to filter the provider by."""
sort: Annotated[
OptionalNullable[Sort], PlainValidator(validate_open_enum(False))
] = 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."""
min_throughput: OptionalNullable[float] = UNSET
r"""The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used."""
max_latency: OptionalNullable[float] = UNSET
r"""The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"allow_fallbacks",
"require_parameters",
"data_collection",
"zdr",
"enforce_distillable_text",
"order",
"only",
"ignore",
"quantizations",
"sort",
"max_price",
"min_throughput",
"max_latency",
]
nullable_fields = [
"allow_fallbacks",
"require_parameters",
"data_collection",
"zdr",
"enforce_distillable_text",
"order",
"only",
"ignore",
"quantizations",
"sort",
"min_throughput",
"max_latency",
]
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 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
ChatGenerationParamsPdfEngine = Union[
Literal[
"mistral-ocr",
"pdf-text",
"native",
],
UnrecognizedStr,
]
class ChatGenerationParamsPdfTypedDict(TypedDict):
engine: NotRequired[ChatGenerationParamsPdfEngine]
class ChatGenerationParamsPdf(BaseModel):
engine: Annotated[
Optional[ChatGenerationParamsPdfEngine],
PlainValidator(validate_open_enum(False)),
] = None
class ChatGenerationParamsPluginFileParserTypedDict(TypedDict):
id: Literal["file-parser"]
enabled: NotRequired[bool]
max_files: NotRequired[float]
pdf: NotRequired[ChatGenerationParamsPdfTypedDict]
class ChatGenerationParamsPluginFileParser(BaseModel):
ID: Annotated[
Annotated[
Literal["file-parser"], AfterValidator(validate_const("file-parser"))
],
pydantic.Field(alias="id"),
] = "file-parser"
enabled: Optional[bool] = None
max_files: Optional[float] = None
pdf: Optional[ChatGenerationParamsPdf] = None
ChatGenerationParamsEngine = Union[
Literal[
"native",
"exa",
],
UnrecognizedStr,
]
class ChatGenerationParamsPluginWebTypedDict(TypedDict):
id: Literal["web"]
enabled: NotRequired[bool]
max_results: NotRequired[float]
search_prompt: NotRequired[str]
engine: NotRequired[ChatGenerationParamsEngine]
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[ChatGenerationParamsEngine], 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"
ChatGenerationParamsPluginUnionTypedDict = TypeAliasType(
"ChatGenerationParamsPluginUnionTypedDict",
Union[
ChatGenerationParamsPluginModerationTypedDict,
ChatGenerationParamsPluginResponseHealingTypedDict,
ChatGenerationParamsPluginFileParserTypedDict,
ChatGenerationParamsPluginWebTypedDict,
],
)
ChatGenerationParamsPluginUnion = Annotated[
Union[
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")),
]
ChatGenerationParamsRoute = Union[
Literal[
"fallback",
"sort",
],
UnrecognizedStr,
]
Effort = Union[ Effort = Union[
Literal[ Literal[
"none", "none",
@@ -36,6 +378,7 @@ Effort = Union[
"low", "low",
"medium", "medium",
"high", "high",
"xhigh",
], ],
UnrecognizedStr, UnrecognizedStr,
] ]
@@ -166,6 +509,15 @@ class Debug(BaseModel):
class ChatGenerationParamsTypedDict(TypedDict): class ChatGenerationParamsTypedDict(TypedDict):
messages: List[MessageTypedDict] 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."""
route: NotRequired[Nullable[ChatGenerationParamsRoute]]
r"""Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria."""
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] model: NotRequired[str]
models: NotRequired[List[str]] models: NotRequired[List[str]]
frequency_penalty: NotRequired[Nullable[float]] frequency_penalty: NotRequired[Nullable[float]]
@@ -186,13 +538,29 @@ class ChatGenerationParamsTypedDict(TypedDict):
tool_choice: NotRequired[Any] tool_choice: NotRequired[Any]
tools: NotRequired[List[ToolDefinitionJSONTypedDict]] tools: NotRequired[List[ToolDefinitionJSONTypedDict]]
top_p: NotRequired[Nullable[float]] top_p: NotRequired[Nullable[float]]
user: NotRequired[str]
debug: NotRequired[DebugTypedDict] debug: NotRequired[DebugTypedDict]
class ChatGenerationParams(BaseModel): class ChatGenerationParams(BaseModel):
messages: List[Message] messages: List[Message]
provider: OptionalNullable[ChatGenerationParamsProvider] = UNSET
r"""When multiple model providers are available, optionally indicate your routing preference."""
plugins: Optional[List[ChatGenerationParamsPluginUnion]] = None
r"""Plugins you want to enable for this request, including their settings."""
route: Annotated[
OptionalNullable[ChatGenerationParamsRoute],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria."""
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 model: Optional[str] = None
models: Optional[List[str]] = None models: Optional[List[str]] = None
@@ -233,13 +601,16 @@ class ChatGenerationParams(BaseModel):
top_p: OptionalNullable[float] = UNSET top_p: OptionalNullable[float] = UNSET
user: Optional[str] = None
debug: Optional[Debug] = None debug: Optional[Debug] = None
@model_serializer(mode="wrap") @model_serializer(mode="wrap")
def serialize_model(self, handler): def serialize_model(self, handler):
optional_fields = [ optional_fields = [
"provider",
"plugins",
"route",
"user",
"session_id",
"model", "model",
"models", "models",
"frequency_penalty", "frequency_penalty",
@@ -260,10 +631,11 @@ class ChatGenerationParams(BaseModel):
"tool_choice", "tool_choice",
"tools", "tools",
"top_p", "top_p",
"user",
"debug", "debug",
] ]
nullable_fields = [ nullable_fields = [
"provider",
"route",
"frequency_penalty", "frequency_penalty",
"logit_bias", "logit_bias",
"logprobs", "logprobs",
@@ -7,6 +7,7 @@ from typing import Literal, Union
OpenAIResponsesReasoningEffort = Union[ OpenAIResponsesReasoningEffort = Union[
Literal[ Literal[
"xhigh",
"high", "high",
"medium", "medium",
"low", "low",
+117 -61
View File
@@ -175,41 +175,41 @@ Ignore = TypeAliasType(
) )
class MaxPriceTypedDict(TypedDict): 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.""" 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] prompt: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
completion: NotRequired[Any] completion: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image: NotRequired[Any] image: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
audio: NotRequired[Any] audio: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
request: NotRequired[Any] request: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
class MaxPrice(BaseModel): 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.""" 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 prompt: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
completion: Optional[Any] = None completion: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image: Optional[Any] = None image: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
audio: Optional[Any] = None audio: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
request: Optional[Any] = None request: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
class ProviderTypedDict(TypedDict): class OpenResponsesRequestProviderTypedDict(TypedDict):
r"""When multiple model providers are available, optionally indicate your routing preference.""" r"""When multiple model providers are available, optionally indicate your routing preference."""
allow_fallbacks: NotRequired[Nullable[bool]] allow_fallbacks: NotRequired[Nullable[bool]]
@@ -240,11 +240,15 @@ class ProviderTypedDict(TypedDict):
r"""A list of quantization levels to filter the provider by.""" r"""A list of quantization levels to filter the provider by."""
sort: NotRequired[Nullable[ProviderSort]] sort: NotRequired[Nullable[ProviderSort]]
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
max_price: NotRequired[MaxPriceTypedDict] max_price: NotRequired[OpenResponsesRequestMaxPriceTypedDict]
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
min_throughput: NotRequired[Nullable[float]]
r"""The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used."""
max_latency: NotRequired[Nullable[float]]
r"""The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used."""
class Provider(BaseModel): class OpenResponsesRequestProvider(BaseModel):
r"""When multiple model providers are available, optionally indicate your routing preference.""" r"""When multiple model providers are available, optionally indicate your routing preference."""
allow_fallbacks: OptionalNullable[bool] = UNSET allow_fallbacks: OptionalNullable[bool] = UNSET
@@ -291,9 +295,15 @@ class Provider(BaseModel):
] = UNSET ] = UNSET
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
max_price: Optional[MaxPrice] = None max_price: Optional[OpenResponsesRequestMaxPrice] = None
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
min_throughput: OptionalNullable[float] = UNSET
r"""The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used."""
max_latency: OptionalNullable[float] = UNSET
r"""The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used."""
@model_serializer(mode="wrap") @model_serializer(mode="wrap")
def serialize_model(self, handler): def serialize_model(self, handler):
optional_fields = [ optional_fields = [
@@ -308,6 +318,8 @@ class Provider(BaseModel):
"quantizations", "quantizations",
"sort", "sort",
"max_price", "max_price",
"min_throughput",
"max_latency",
] ]
nullable_fields = [ nullable_fields = [
"allow_fallbacks", "allow_fallbacks",
@@ -320,6 +332,8 @@ class Provider(BaseModel):
"ignore", "ignore",
"quantizations", "quantizations",
"sort", "sort",
"min_throughput",
"max_latency",
] ]
null_default_fields = [] null_default_fields = []
@@ -351,18 +365,23 @@ class Provider(BaseModel):
IDResponseHealing = Literal["response-healing",] IDResponseHealing = Literal["response-healing",]
class PluginResponseHealingTypedDict(TypedDict): class OpenResponsesRequestPluginResponseHealingTypedDict(TypedDict):
id: IDResponseHealing id: IDResponseHealing
enabled: NotRequired[bool]
r"""Set to false to disable the response-healing plugin for this request. Defaults to true."""
class PluginResponseHealing(BaseModel): class OpenResponsesRequestPluginResponseHealing(BaseModel):
id: IDResponseHealing id: IDResponseHealing
enabled: Optional[bool] = None
r"""Set to false to disable the response-healing plugin for this request. Defaults to true."""
IDFileParser = Literal["file-parser",] IDFileParser = Literal["file-parser",]
PdfEngine = Union[ OpenResponsesRequestPdfEngine = Union[
Literal[ Literal[
"mistral-ocr", "mistral-ocr",
"pdf-text", "pdf-text",
@@ -372,34 +391,40 @@ PdfEngine = Union[
] ]
class PdfTypedDict(TypedDict): class OpenResponsesRequestPdfTypedDict(TypedDict):
engine: NotRequired[PdfEngine] engine: NotRequired[OpenResponsesRequestPdfEngine]
class Pdf(BaseModel): class OpenResponsesRequestPdf(BaseModel):
engine: Annotated[ engine: Annotated[
Optional[PdfEngine], PlainValidator(validate_open_enum(False)) Optional[OpenResponsesRequestPdfEngine],
PlainValidator(validate_open_enum(False)),
] = None ] = None
class PluginFileParserTypedDict(TypedDict): class OpenResponsesRequestPluginFileParserTypedDict(TypedDict):
id: IDFileParser id: IDFileParser
enabled: NotRequired[bool]
r"""Set to false to disable the file-parser plugin for this request. Defaults to true."""
max_files: NotRequired[float] max_files: NotRequired[float]
pdf: NotRequired[PdfTypedDict] pdf: NotRequired[OpenResponsesRequestPdfTypedDict]
class PluginFileParser(BaseModel): class OpenResponsesRequestPluginFileParser(BaseModel):
id: IDFileParser id: IDFileParser
enabled: Optional[bool] = None
r"""Set to false to disable the file-parser plugin for this request. Defaults to true."""
max_files: Optional[float] = None max_files: Optional[float] = None
pdf: Optional[Pdf] = None pdf: Optional[OpenResponsesRequestPdf] = None
IDWeb = Literal["web",] IDWeb = Literal["web",]
Engine = Union[ OpenResponsesRequestEngine = Union[
Literal[ Literal[
"native", "native",
"exa", "exa",
@@ -408,58 +433,73 @@ Engine = Union[
] ]
class PluginWebTypedDict(TypedDict): class OpenResponsesRequestPluginWebTypedDict(TypedDict):
id: IDWeb id: IDWeb
enabled: NotRequired[bool]
r"""Set to false to disable the web-search plugin for this request. Defaults to true."""
max_results: NotRequired[float] max_results: NotRequired[float]
search_prompt: NotRequired[str] search_prompt: NotRequired[str]
engine: NotRequired[Engine] engine: NotRequired[OpenResponsesRequestEngine]
class PluginWeb(BaseModel): class OpenResponsesRequestPluginWeb(BaseModel):
id: IDWeb id: IDWeb
enabled: Optional[bool] = None
r"""Set to false to disable the web-search plugin for this request. Defaults to true."""
max_results: Optional[float] = None max_results: Optional[float] = None
search_prompt: Optional[str] = None search_prompt: Optional[str] = None
engine: Annotated[Optional[Engine], PlainValidator(validate_open_enum(False))] = ( engine: Annotated[
None Optional[OpenResponsesRequestEngine], PlainValidator(validate_open_enum(False))
) ] = None
IDModeration = Literal["moderation",] IDModeration = Literal["moderation",]
class PluginModerationTypedDict(TypedDict): class OpenResponsesRequestPluginModerationTypedDict(TypedDict):
id: IDModeration id: IDModeration
class PluginModeration(BaseModel): class OpenResponsesRequestPluginModeration(BaseModel):
id: IDModeration id: IDModeration
PluginTypedDict = TypeAliasType( OpenResponsesRequestPluginUnionTypedDict = TypeAliasType(
"PluginTypedDict", "OpenResponsesRequestPluginUnionTypedDict",
Union[ Union[
PluginModerationTypedDict, OpenResponsesRequestPluginModerationTypedDict,
PluginResponseHealingTypedDict, OpenResponsesRequestPluginResponseHealingTypedDict,
PluginFileParserTypedDict, OpenResponsesRequestPluginFileParserTypedDict,
PluginWebTypedDict, OpenResponsesRequestPluginWebTypedDict,
], ],
) )
Plugin = Annotated[ OpenResponsesRequestPluginUnion = Annotated[
Union[ Union[
Annotated[PluginModeration, Tag("moderation")], Annotated[OpenResponsesRequestPluginModeration, Tag("moderation")],
Annotated[PluginWeb, Tag("web")], Annotated[OpenResponsesRequestPluginWeb, Tag("web")],
Annotated[PluginFileParser, Tag("file-parser")], Annotated[OpenResponsesRequestPluginFileParser, Tag("file-parser")],
Annotated[PluginResponseHealing, Tag("response-healing")], Annotated[OpenResponsesRequestPluginResponseHealing, Tag("response-healing")],
], ],
Discriminator(lambda m: get_discriminator(m, "id", "id")), Discriminator(lambda m: get_discriminator(m, "id", "id")),
] ]
OpenResponsesRequestRoute = Union[
Literal[
"fallback",
"sort",
],
UnrecognizedStr,
]
r"""Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria."""
class OpenResponsesRequestTypedDict(TypedDict): class OpenResponsesRequestTypedDict(TypedDict):
r"""Request schema for Responses endpoint""" r"""Request schema for Responses endpoint"""
@@ -491,12 +531,16 @@ class OpenResponsesRequestTypedDict(TypedDict):
service_tier: NotRequired[ServiceTier] service_tier: NotRequired[ServiceTier]
truncation: NotRequired[Nullable[Truncation]] truncation: NotRequired[Nullable[Truncation]]
stream: NotRequired[bool] stream: NotRequired[bool]
provider: NotRequired[Nullable[ProviderTypedDict]] provider: NotRequired[Nullable[OpenResponsesRequestProviderTypedDict]]
r"""When multiple model providers are available, optionally indicate your routing preference.""" r"""When multiple model providers are available, optionally indicate your routing preference."""
plugins: NotRequired[List[PluginTypedDict]] plugins: NotRequired[List[OpenResponsesRequestPluginUnionTypedDict]]
r"""Plugins you want to enable for this request, including their settings.""" r"""Plugins you want to enable for this request, including their settings."""
route: NotRequired[Nullable[OpenResponsesRequestRoute]]
r"""Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria."""
user: NotRequired[str] 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.""" 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."""
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."""
class OpenResponsesRequest(BaseModel): class OpenResponsesRequest(BaseModel):
@@ -565,15 +609,24 @@ class OpenResponsesRequest(BaseModel):
stream: Optional[bool] = False stream: Optional[bool] = False
provider: OptionalNullable[Provider] = UNSET provider: OptionalNullable[OpenResponsesRequestProvider] = UNSET
r"""When multiple model providers are available, optionally indicate your routing preference.""" r"""When multiple model providers are available, optionally indicate your routing preference."""
plugins: Optional[List[Plugin]] = None plugins: Optional[List[OpenResponsesRequestPluginUnion]] = None
r"""Plugins you want to enable for this request, including their settings.""" r"""Plugins you want to enable for this request, including their settings."""
route: Annotated[
OptionalNullable[OpenResponsesRequestRoute],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria."""
user: Optional[str] = None user: Optional[str] = None
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.""" 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."""
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_serializer(mode="wrap") @model_serializer(mode="wrap")
def serialize_model(self, handler): def serialize_model(self, handler):
optional_fields = [ optional_fields = [
@@ -603,7 +656,9 @@ class OpenResponsesRequest(BaseModel):
"stream", "stream",
"provider", "provider",
"plugins", "plugins",
"route",
"user", "user",
"session_id",
] ]
nullable_fields = [ nullable_fields = [
"instructions", "instructions",
@@ -621,6 +676,7 @@ class OpenResponsesRequest(BaseModel):
"safety_identifier", "safety_identifier",
"truncation", "truncation",
"provider", "provider",
"route",
] ]
null_default_fields = [] null_default_fields = []
@@ -43,6 +43,7 @@ ProviderName = Union[
"Infermatic", "Infermatic",
"Inflection", "Inflection",
"Liquid", "Liquid",
"Mara",
"Mancer 2", "Mancer 2",
"Minimax", "Minimax",
"ModelRun", "ModelRun",
@@ -63,6 +64,7 @@ ProviderName = Union[
"Relace", "Relace",
"SambaNova", "SambaNova",
"SiliconFlow", "SiliconFlow",
"Sourceful",
"Stealth", "Stealth",
"StreamLake", "StreamLake",
"Switchpoint", "Switchpoint",
@@ -70,6 +72,7 @@ ProviderName = Union[
"Together", "Together",
"Venice", "Venice",
"WandB", "WandB",
"Xiaomi",
"xAI", "xAI",
"Z.AI", "Z.AI",
"FakeProvider", "FakeProvider",
+49 -49
View File
@@ -8,74 +8,74 @@ from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedSt
from openrouter.utils import validate_open_enum from openrouter.utils import validate_open_enum
from pydantic import model_serializer from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator from pydantic.functional_validators import PlainValidator
from typing import Any, List, Literal, Optional, Union from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict from typing_extensions import Annotated, NotRequired, TypedDict
class PricingTypedDict(TypedDict): class PricingTypedDict(TypedDict):
prompt: Any prompt: str
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
completion: Any completion: str
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
request: NotRequired[Any] request: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image: NotRequired[Any] image: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image_token: NotRequired[Any] image_token: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image_output: NotRequired[Any] image_output: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
audio: NotRequired[Any] audio: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
input_audio_cache: NotRequired[Any] input_audio_cache: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
web_search: NotRequired[Any] web_search: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
internal_reasoning: NotRequired[Any] internal_reasoning: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
input_cache_read: NotRequired[Any] input_cache_read: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
input_cache_write: NotRequired[Any] input_cache_write: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
discount: NotRequired[float] discount: NotRequired[float]
class Pricing(BaseModel): class Pricing(BaseModel):
prompt: Any prompt: str
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
completion: Any completion: str
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
request: Optional[Any] = None request: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image: Optional[Any] = None image: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image_token: Optional[Any] = None image_token: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image_output: Optional[Any] = None image_output: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
audio: Optional[Any] = None audio: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
input_audio_cache: Optional[Any] = None input_audio_cache: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
web_search: Optional[Any] = None web_search: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
internal_reasoning: Optional[Any] = None internal_reasoning: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
input_cache_read: Optional[Any] = None input_cache_read: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
input_cache_write: Optional[Any] = None input_cache_write: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
discount: Optional[float] = None discount: Optional[float] = None
+49 -49
View File
@@ -2,77 +2,77 @@
from __future__ import annotations from __future__ import annotations
from openrouter.types import BaseModel from openrouter.types import BaseModel
from typing import Any, Optional from typing import Optional
from typing_extensions import NotRequired, TypedDict from typing_extensions import NotRequired, TypedDict
class PublicPricingTypedDict(TypedDict): class PublicPricingTypedDict(TypedDict):
r"""Pricing information for the model""" r"""Pricing information for the model"""
prompt: Any prompt: str
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
completion: Any completion: str
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
request: NotRequired[Any] request: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image: NotRequired[Any] image: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image_token: NotRequired[Any] image_token: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image_output: NotRequired[Any] image_output: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
audio: NotRequired[Any] audio: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
input_audio_cache: NotRequired[Any] input_audio_cache: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
web_search: NotRequired[Any] web_search: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
internal_reasoning: NotRequired[Any] internal_reasoning: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
input_cache_read: NotRequired[Any] input_cache_read: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
input_cache_write: NotRequired[Any] input_cache_write: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
discount: NotRequired[float] discount: NotRequired[float]
class PublicPricing(BaseModel): class PublicPricing(BaseModel):
r"""Pricing information for the model""" r"""Pricing information for the model"""
prompt: Any prompt: str
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
completion: Any completion: str
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
request: Optional[Any] = None request: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image: Optional[Any] = None image: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image_token: Optional[Any] = None image_token: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image_output: Optional[Any] = None image_output: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
audio: Optional[Any] = None audio: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
input_audio_cache: Optional[Any] = None input_audio_cache: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
web_search: Optional[Any] = None web_search: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
internal_reasoning: Optional[Any] = None internal_reasoning: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
input_cache_read: Optional[Any] = None input_cache_read: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
input_cache_write: Optional[Any] = None input_cache_write: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
discount: Optional[float] = None discount: Optional[float] = None
+22 -4
View File
@@ -1,6 +1,7 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from .basesdk import BaseSDK from .basesdk import BaseSDK
from enum import Enum
from openrouter import components, errors, operations, utils from openrouter import components, errors, operations, utils
from openrouter._hooks import HookContext from openrouter._hooks import HookContext
from openrouter.types import OptionalNullable, UNSET from openrouter.types import OptionalNullable, UNSET
@@ -9,6 +10,11 @@ from openrouter.utils.unmarshal_json_response import unmarshal_json_response
from typing import Any, Mapping, Optional, Union from typing import Any, Mapping, Optional, Union
class GenerateAcceptEnum(str, Enum):
APPLICATION_JSON = "application/json"
TEXT_EVENT_STREAM = "text/event-stream"
class Embeddings(BaseSDK): class Embeddings(BaseSDK):
r"""Text embedding endpoints""" r"""Text embedding endpoints"""
@@ -30,6 +36,7 @@ class Embeddings(BaseSDK):
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
accept_header_override: Optional[GenerateAcceptEnum] = None,
http_headers: Optional[Mapping[str, str]] = None, http_headers: Optional[Mapping[str, str]] = None,
) -> operations.CreateEmbeddingsResponse: ) -> operations.CreateEmbeddingsResponse:
r"""Submit an embedding request r"""Submit an embedding request
@@ -46,6 +53,7 @@ class Embeddings(BaseSDK):
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
:param accept_header_override: Override the default accept header for this method
:param http_headers: Additional headers to set or replace on requests. :param http_headers: Additional headers to set or replace on requests.
""" """
base_url = None base_url = None
@@ -80,7 +88,9 @@ class Embeddings(BaseSDK):
request_has_path_params=False, request_has_path_params=False,
request_has_query_params=True, request_has_query_params=True,
user_agent_header="user-agent", user_agent_header="user-agent",
accept_header_value="application/json", accept_header_value=accept_header_override.value
if accept_header_override is not None
else "application/json;q=1, text/event-stream;q=0",
http_headers=http_headers, http_headers=http_headers,
security=self.sdk_configuration.security, security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body( get_serialized_body=lambda: utils.serialize_request_body(
@@ -129,8 +139,10 @@ class Embeddings(BaseSDK):
response_data: Any = None response_data: Any = None
if utils.match_response(http_res, "200", "application/json"): if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response( return unmarshal_json_response(
operations.CreateEmbeddingsResponse, http_res operations.CreateEmbeddingsResponseBody, http_res
) )
if utils.match_response(http_res, "200", "text/event-stream"):
return http_res.text
if utils.match_response(http_res, "400", "application/json"): if utils.match_response(http_res, "400", "application/json"):
response_data = unmarshal_json_response( response_data = unmarshal_json_response(
errors.BadRequestResponseErrorData, http_res errors.BadRequestResponseErrorData, http_res
@@ -212,6 +224,7 @@ class Embeddings(BaseSDK):
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
accept_header_override: Optional[GenerateAcceptEnum] = None,
http_headers: Optional[Mapping[str, str]] = None, http_headers: Optional[Mapping[str, str]] = None,
) -> operations.CreateEmbeddingsResponse: ) -> operations.CreateEmbeddingsResponse:
r"""Submit an embedding request r"""Submit an embedding request
@@ -228,6 +241,7 @@ class Embeddings(BaseSDK):
:param retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
:param accept_header_override: Override the default accept header for this method
:param http_headers: Additional headers to set or replace on requests. :param http_headers: Additional headers to set or replace on requests.
""" """
base_url = None base_url = None
@@ -262,7 +276,9 @@ class Embeddings(BaseSDK):
request_has_path_params=False, request_has_path_params=False,
request_has_query_params=True, request_has_query_params=True,
user_agent_header="user-agent", user_agent_header="user-agent",
accept_header_value="application/json", accept_header_value=accept_header_override.value
if accept_header_override is not None
else "application/json;q=1, text/event-stream;q=0",
http_headers=http_headers, http_headers=http_headers,
security=self.sdk_configuration.security, security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body( get_serialized_body=lambda: utils.serialize_request_body(
@@ -311,8 +327,10 @@ class Embeddings(BaseSDK):
response_data: Any = None response_data: Any = None
if utils.match_response(http_res, "200", "application/json"): if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response( return unmarshal_json_response(
operations.CreateEmbeddingsResponse, http_res operations.CreateEmbeddingsResponseBody, http_res
) )
if utils.match_response(http_res, "200", "text/event-stream"):
return http_res.text
if utils.match_response(http_res, "400", "application/json"): if utils.match_response(http_res, "400", "application/json"):
response_data = unmarshal_json_response( response_data = unmarshal_json_response(
errors.BadRequestResponseErrorData, http_res errors.BadRequestResponseErrorData, http_res
+6
View File
@@ -45,6 +45,8 @@ if TYPE_CHECKING:
CreateEmbeddingsRequest, CreateEmbeddingsRequest,
CreateEmbeddingsRequestTypedDict, CreateEmbeddingsRequestTypedDict,
CreateEmbeddingsResponse, CreateEmbeddingsResponse,
CreateEmbeddingsResponseBody,
CreateEmbeddingsResponseBodyTypedDict,
CreateEmbeddingsResponseTypedDict, CreateEmbeddingsResponseTypedDict,
Embedding, Embedding,
EmbeddingTypedDict, EmbeddingTypedDict,
@@ -219,6 +221,8 @@ __all__ = [
"CreateEmbeddingsRequest", "CreateEmbeddingsRequest",
"CreateEmbeddingsRequestTypedDict", "CreateEmbeddingsRequestTypedDict",
"CreateEmbeddingsResponse", "CreateEmbeddingsResponse",
"CreateEmbeddingsResponseBody",
"CreateEmbeddingsResponseBodyTypedDict",
"CreateEmbeddingsResponseTypedDict", "CreateEmbeddingsResponseTypedDict",
"CreateKeysData", "CreateKeysData",
"CreateKeysDataTypedDict", "CreateKeysDataTypedDict",
@@ -373,6 +377,8 @@ _dynamic_imports: dict[str, str] = {
"CreateEmbeddingsRequest": ".createembeddings", "CreateEmbeddingsRequest": ".createembeddings",
"CreateEmbeddingsRequestTypedDict": ".createembeddings", "CreateEmbeddingsRequestTypedDict": ".createembeddings",
"CreateEmbeddingsResponse": ".createembeddings", "CreateEmbeddingsResponse": ".createembeddings",
"CreateEmbeddingsResponseBody": ".createembeddings",
"CreateEmbeddingsResponseBodyTypedDict": ".createembeddings",
"CreateEmbeddingsResponseTypedDict": ".createembeddings", "CreateEmbeddingsResponseTypedDict": ".createembeddings",
"Embedding": ".createembeddings", "Embedding": ".createembeddings",
"EmbeddingTypedDict": ".createembeddings", "EmbeddingTypedDict": ".createembeddings",
+48 -23
View File
@@ -18,7 +18,7 @@ from openrouter.types import (
from openrouter.utils import get_discriminator, validate_open_enum from openrouter.utils import get_discriminator, validate_open_enum
from pydantic import Discriminator, Tag, model_serializer from pydantic import Discriminator, Tag, model_serializer
from pydantic.functional_validators import PlainValidator from pydantic.functional_validators import PlainValidator
from typing import Any, List, Literal, Optional, Union from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
@@ -154,35 +154,35 @@ Ignore = TypeAliasType(
class MaxPriceTypedDict(TypedDict): class MaxPriceTypedDict(TypedDict):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" 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] prompt: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
completion: NotRequired[Any] completion: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image: NotRequired[Any] image: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
audio: NotRequired[Any] audio: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
request: NotRequired[Any] request: NotRequired[str]
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
class MaxPrice(BaseModel): class MaxPrice(BaseModel):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" 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 prompt: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
completion: Optional[Any] = None completion: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
image: Optional[Any] = None image: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
audio: Optional[Any] = None audio: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
request: Optional[Any] = None request: Optional[str] = None
r"""A value in string or number format that is a large number""" r"""A value in string format that is a large number"""
class CreateEmbeddingsProviderTypedDict(TypedDict): class CreateEmbeddingsProviderTypedDict(TypedDict):
@@ -216,6 +216,10 @@ class CreateEmbeddingsProviderTypedDict(TypedDict):
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
max_price: NotRequired[MaxPriceTypedDict] max_price: NotRequired[MaxPriceTypedDict]
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
min_throughput: NotRequired[Nullable[float]]
r"""The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used."""
max_latency: NotRequired[Nullable[float]]
r"""The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used."""
class CreateEmbeddingsProvider(BaseModel): class CreateEmbeddingsProvider(BaseModel):
@@ -273,6 +277,12 @@ class CreateEmbeddingsProvider(BaseModel):
max_price: Optional[MaxPrice] = None max_price: Optional[MaxPrice] = None
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
min_throughput: OptionalNullable[float] = UNSET
r"""The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used."""
max_latency: OptionalNullable[float] = UNSET
r"""The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used."""
@model_serializer(mode="wrap") @model_serializer(mode="wrap")
def serialize_model(self, handler): def serialize_model(self, handler):
optional_fields = [ optional_fields = [
@@ -287,6 +297,8 @@ class CreateEmbeddingsProvider(BaseModel):
"quantizations", "quantizations",
"sort", "sort",
"max_price", "max_price",
"min_throughput",
"max_latency",
] ]
nullable_fields = [ nullable_fields = [
"allow_fallbacks", "allow_fallbacks",
@@ -299,6 +311,8 @@ class CreateEmbeddingsProvider(BaseModel):
"ignore", "ignore",
"quantizations", "quantizations",
"sort", "sort",
"min_throughput",
"max_latency",
] ]
null_default_fields = [] null_default_fields = []
@@ -395,7 +409,7 @@ class Usage(BaseModel):
cost: Optional[float] = None cost: Optional[float] = None
class CreateEmbeddingsResponseTypedDict(TypedDict): class CreateEmbeddingsResponseBodyTypedDict(TypedDict):
r"""Embedding response""" r"""Embedding response"""
object: Object object: Object
@@ -405,7 +419,7 @@ class CreateEmbeddingsResponseTypedDict(TypedDict):
usage: NotRequired[UsageTypedDict] usage: NotRequired[UsageTypedDict]
class CreateEmbeddingsResponse(BaseModel): class CreateEmbeddingsResponseBody(BaseModel):
r"""Embedding response""" r"""Embedding response"""
object: Object object: Object
@@ -417,3 +431,14 @@ class CreateEmbeddingsResponse(BaseModel):
id: Optional[str] = None id: Optional[str] = None
usage: Optional[Usage] = None usage: Optional[Usage] = None
CreateEmbeddingsResponseTypedDict = TypeAliasType(
"CreateEmbeddingsResponseTypedDict",
Union[CreateEmbeddingsResponseBodyTypedDict, str],
)
CreateEmbeddingsResponse = TypeAliasType(
"CreateEmbeddingsResponse", Union[CreateEmbeddingsResponseBody, str]
)
@@ -70,6 +70,7 @@ GetParametersProvider = Union[
"Infermatic", "Infermatic",
"Inflection", "Inflection",
"Liquid", "Liquid",
"Mara",
"Mancer 2", "Mancer 2",
"Minimax", "Minimax",
"ModelRun", "ModelRun",
@@ -90,6 +91,7 @@ GetParametersProvider = Union[
"Relace", "Relace",
"SambaNova", "SambaNova",
"SiliconFlow", "SiliconFlow",
"Sourceful",
"Stealth", "Stealth",
"StreamLake", "StreamLake",
"Switchpoint", "Switchpoint",
@@ -97,6 +99,7 @@ GetParametersProvider = Union[
"Together", "Together",
"Venice", "Venice",
"WandB", "WandB",
"Xiaomi",
"xAI", "xAI",
"Z.AI", "Z.AI",
"FakeProvider", "FakeProvider",
+2 -2
View File
@@ -105,7 +105,7 @@ class UpdateKeysRequestBody(BaseModel):
class UpdateKeysRequestTypedDict(TypedDict): class UpdateKeysRequestTypedDict(TypedDict):
hash: str hash: str
r"""The hash identifier of the API key to update""" r"""The hash identifier of the API key to update"""
body: UpdateKeysRequestBodyTypedDict request_body: UpdateKeysRequestBodyTypedDict
class UpdateKeysRequest(BaseModel): class UpdateKeysRequest(BaseModel):
@@ -114,7 +114,7 @@ class UpdateKeysRequest(BaseModel):
] ]
r"""The hash identifier of the API key to update""" r"""The hash identifier of the API key to update"""
body: Annotated[ request_body: Annotated[
UpdateKeysRequestBody, UpdateKeysRequestBody,
FieldMetadata(request=RequestMetadata(media_type="application/json")), FieldMetadata(request=RequestMetadata(media_type="application/json")),
] ]
+80 -16
View File
@@ -73,12 +73,20 @@ class Responses(BaseSDK):
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Union[Literal[False], None] = None, stream: Union[Literal[False], None] = None,
provider: OptionalNullable[ provider: OptionalNullable[
Union[components.Provider, components.ProviderTypedDict] Union[
components.OpenResponsesRequestProvider,
components.OpenResponsesRequestProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[List[components.Plugin], List[components.PluginTypedDict]] Union[
List[components.OpenResponsesRequestPluginUnion],
List[components.OpenResponsesRequestPluginUnionTypedDict],
]
] = None, ] = None,
route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -113,7 +121,9 @@ class Responses(BaseSDK):
:param stream: :param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :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 plugins: Plugins you want to enable for this request, including their settings.
:param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
:param user: 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. :param user: 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.
: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 retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -176,12 +186,20 @@ class Responses(BaseSDK):
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Literal[True], stream: Literal[True],
provider: OptionalNullable[ provider: OptionalNullable[
Union[components.Provider, components.ProviderTypedDict] Union[
components.OpenResponsesRequestProvider,
components.OpenResponsesRequestProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[List[components.Plugin], List[components.PluginTypedDict]] Union[
List[components.OpenResponsesRequestPluginUnion],
List[components.OpenResponsesRequestPluginUnionTypedDict],
]
] = None, ] = None,
route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -216,7 +234,9 @@ class Responses(BaseSDK):
:param stream: :param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :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 plugins: Plugins you want to enable for this request, including their settings.
:param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
:param user: 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. :param user: 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.
: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 retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -278,12 +298,20 @@ class Responses(BaseSDK):
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Optional[bool] = False, stream: Optional[bool] = False,
provider: OptionalNullable[ provider: OptionalNullable[
Union[components.Provider, components.ProviderTypedDict] Union[
components.OpenResponsesRequestProvider,
components.OpenResponsesRequestProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[List[components.Plugin], List[components.PluginTypedDict]] Union[
List[components.OpenResponsesRequestPluginUnion],
List[components.OpenResponsesRequestPluginUnionTypedDict],
]
] = None, ] = None,
route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -318,7 +346,9 @@ class Responses(BaseSDK):
:param stream: :param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :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 plugins: Plugins you want to enable for this request, including their settings.
:param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
:param user: 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. :param user: 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.
: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 retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -372,12 +402,14 @@ class Responses(BaseSDK):
truncation=truncation, truncation=truncation,
stream=stream, stream=stream,
provider=utils.get_pydantic_model( provider=utils.get_pydantic_model(
provider, OptionalNullable[components.Provider] provider, OptionalNullable[components.OpenResponsesRequestProvider]
), ),
plugins=utils.get_pydantic_model( plugins=utils.get_pydantic_model(
plugins, Optional[List[components.Plugin]] plugins, Optional[List[components.OpenResponsesRequestPluginUnion]]
), ),
route=route,
user=user, user=user,
session_id=session_id,
) )
req = self._build_request( req = self._build_request(
@@ -624,12 +656,20 @@ class Responses(BaseSDK):
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Union[Literal[False], None] = None, stream: Union[Literal[False], None] = None,
provider: OptionalNullable[ provider: OptionalNullable[
Union[components.Provider, components.ProviderTypedDict] Union[
components.OpenResponsesRequestProvider,
components.OpenResponsesRequestProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[List[components.Plugin], List[components.PluginTypedDict]] Union[
List[components.OpenResponsesRequestPluginUnion],
List[components.OpenResponsesRequestPluginUnionTypedDict],
]
] = None, ] = None,
route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -664,7 +704,9 @@ class Responses(BaseSDK):
:param stream: :param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :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 plugins: Plugins you want to enable for this request, including their settings.
:param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
:param user: 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. :param user: 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.
: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 retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -727,12 +769,20 @@ class Responses(BaseSDK):
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Literal[True], stream: Literal[True],
provider: OptionalNullable[ provider: OptionalNullable[
Union[components.Provider, components.ProviderTypedDict] Union[
components.OpenResponsesRequestProvider,
components.OpenResponsesRequestProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[List[components.Plugin], List[components.PluginTypedDict]] Union[
List[components.OpenResponsesRequestPluginUnion],
List[components.OpenResponsesRequestPluginUnionTypedDict],
]
] = None, ] = None,
route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -767,7 +817,9 @@ class Responses(BaseSDK):
:param stream: :param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :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 plugins: Plugins you want to enable for this request, including their settings.
:param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
:param user: 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. :param user: 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.
: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 retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -829,12 +881,20 @@ class Responses(BaseSDK):
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Optional[bool] = False, stream: Optional[bool] = False,
provider: OptionalNullable[ provider: OptionalNullable[
Union[components.Provider, components.ProviderTypedDict] Union[
components.OpenResponsesRequestProvider,
components.OpenResponsesRequestProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[List[components.Plugin], List[components.PluginTypedDict]] Union[
List[components.OpenResponsesRequestPluginUnion],
List[components.OpenResponsesRequestPluginUnionTypedDict],
]
] = None, ] = None,
route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None, server_url: Optional[str] = None,
timeout_ms: Optional[int] = None, timeout_ms: Optional[int] = None,
@@ -869,7 +929,9 @@ class Responses(BaseSDK):
:param stream: :param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :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 plugins: Plugins you want to enable for this request, including their settings.
:param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
:param user: 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. :param user: 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.
: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 retries: Override the default retry configuration for this method :param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL 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 timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -923,12 +985,14 @@ class Responses(BaseSDK):
truncation=truncation, truncation=truncation,
stream=stream, stream=stream,
provider=utils.get_pydantic_model( provider=utils.get_pydantic_model(
provider, OptionalNullable[components.Provider] provider, OptionalNullable[components.OpenResponsesRequestProvider]
), ),
plugins=utils.get_pydantic_model( plugins=utils.get_pydantic_model(
plugins, Optional[List[components.Plugin]] plugins, Optional[List[components.OpenResponsesRequestPluginUnion]]
), ),
route=route,
user=user, user=user,
session_id=session_id,
) )
req = self._build_request_async( req = self._build_request_async(