mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-31 12:30:30 +08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f812f831d | ||
|
|
95cb1260c7 |
@@ -1,9 +1,7 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(python3:*)",
|
||||
"Bash(git push:*)",
|
||||
"Bash(gh pr create:*)"
|
||||
"Bash(python3:*)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
|
||||
+34
-52
@@ -1,12 +1,12 @@
|
||||
lockVersion: 2.0.0
|
||||
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
|
||||
management:
|
||||
docChecksum: e929ecf569d79ab96a315332a4855566
|
||||
docChecksum: d2e69fbbac1477d094fdfc212c13670c
|
||||
docVersion: 1.0.0
|
||||
speakeasyVersion: 1.666.0
|
||||
generationVersion: 2.768.0
|
||||
releaseVersion: 0.0.22
|
||||
configChecksum: 0afda3910a58a8d797ac6674fa858711
|
||||
speakeasyVersion: 1.668.0
|
||||
generationVersion: 2.770.0
|
||||
releaseVersion: 0.1.0
|
||||
configChecksum: fa0d13fb5fd38982a589d64e64b0d87d
|
||||
repoURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||
published: true
|
||||
@@ -58,22 +58,10 @@ generatedFiles:
|
||||
- docs/components/chatcompletionfinishreason.md
|
||||
- docs/components/chaterrorerror.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/chatgenerationparamsresponseformatpython.md
|
||||
- docs/components/chatgenerationparamsresponseformattext.md
|
||||
- docs/components/chatgenerationparamsresponseformatunion.md
|
||||
- docs/components/chatgenerationparamsroute.md
|
||||
- docs/components/chatgenerationparamsstop.md
|
||||
- docs/components/chatgenerationtokenusage.md
|
||||
- docs/components/chatmessagecontentitem.md
|
||||
@@ -123,6 +111,7 @@ generatedFiles:
|
||||
- docs/components/edgenetworktimeoutresponseerrordata.md
|
||||
- docs/components/effort.md
|
||||
- docs/components/endpointstatus.md
|
||||
- docs/components/engine.md
|
||||
- docs/components/filecitation.md
|
||||
- docs/components/filecitationtype.md
|
||||
- docs/components/filepath.md
|
||||
@@ -141,6 +130,7 @@ generatedFiles:
|
||||
- docs/components/internalserverresponseerrordata.md
|
||||
- docs/components/jsonschemaconfig.md
|
||||
- docs/components/listendpointsresponse.md
|
||||
- docs/components/maxprice.md
|
||||
- docs/components/message.md
|
||||
- docs/components/messagecontent.md
|
||||
- docs/components/messagedeveloper.md
|
||||
@@ -254,17 +244,6 @@ generatedFiles:
|
||||
- docs/components/openresponsesreasoningsummarytextdoneeventtype.md
|
||||
- docs/components/openresponsesreasoningtype.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/openresponsesrequesttoolunion.md
|
||||
- docs/components/openresponsesrequesttype.md
|
||||
@@ -318,10 +297,18 @@ generatedFiles:
|
||||
- docs/components/part2.md
|
||||
- docs/components/payloadtoolargeresponseerrordata.md
|
||||
- docs/components/paymentrequiredresponseerrordata.md
|
||||
- docs/components/pdf.md
|
||||
- docs/components/pdfengine.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/prompt.md
|
||||
- docs/components/prompttokensdetails.md
|
||||
- docs/components/provider.md
|
||||
- docs/components/providername.md
|
||||
- docs/components/provideroverloadedresponseerrordata.md
|
||||
- docs/components/providersort.md
|
||||
@@ -329,7 +316,6 @@ generatedFiles:
|
||||
- docs/components/publicendpointquantization.md
|
||||
- docs/components/publicpricing.md
|
||||
- docs/components/quantization.md
|
||||
- docs/components/quantizations.md
|
||||
- docs/components/reason.md
|
||||
- docs/components/reasoning.md
|
||||
- docs/components/reasoningsummarytext.md
|
||||
@@ -393,12 +379,9 @@ generatedFiles:
|
||||
- docs/components/responseswebsearchuserlocationtype.md
|
||||
- docs/components/responsetextconfig.md
|
||||
- docs/components/responsetextconfigverbosity.md
|
||||
- docs/components/schema0.md
|
||||
- docs/components/schema0enum.md
|
||||
- docs/components/security.md
|
||||
- docs/components/servicetier.md
|
||||
- docs/components/serviceunavailableresponseerrordata.md
|
||||
- docs/components/sort.md
|
||||
- docs/components/streamoptions.md
|
||||
- docs/components/systemmessage.md
|
||||
- docs/components/systemmessagecontent.md
|
||||
@@ -476,7 +459,6 @@ generatedFiles:
|
||||
- docs/operations/createembeddingsprovider.md
|
||||
- docs/operations/createembeddingsrequest.md
|
||||
- docs/operations/createembeddingsresponse.md
|
||||
- docs/operations/createembeddingsresponsebody.md
|
||||
- docs/operations/createkeysdata.md
|
||||
- docs/operations/createkeyslimitreset.md
|
||||
- docs/operations/createkeysrequest.md
|
||||
@@ -569,7 +551,6 @@ generatedFiles:
|
||||
- src/openrouter/chat.py
|
||||
- src/openrouter/completions.py
|
||||
- src/openrouter/components/__init__.py
|
||||
- src/openrouter/components/_schema0.py
|
||||
- src/openrouter/components/activityitem.py
|
||||
- src/openrouter/components/assistantmessage.py
|
||||
- src/openrouter/components/badgatewayresponseerrordata.py
|
||||
@@ -795,10 +776,10 @@ examples:
|
||||
createResponses:
|
||||
speakeasy-default-create-responses:
|
||||
requestBody:
|
||||
application/json: {"store": false, "service_tier": "auto", "stream": false}
|
||||
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}
|
||||
responses:
|
||||
"200":
|
||||
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}
|
||||
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}
|
||||
"400":
|
||||
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
||||
"401":
|
||||
@@ -870,7 +851,7 @@ examples:
|
||||
createEmbeddings:
|
||||
speakeasy-default-create-embeddings:
|
||||
requestBody:
|
||||
application/json: {"input": "<value>", "model": "Taurus"}
|
||||
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"}}
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"object": "list", "data": [], "model": "Land Cruiser"}
|
||||
@@ -899,7 +880,7 @@ examples:
|
||||
speakeasy-default-list-embeddings-models:
|
||||
responses:
|
||||
"200":
|
||||
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}]}
|
||||
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}]}
|
||||
"400":
|
||||
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
||||
"500":
|
||||
@@ -939,7 +920,7 @@ examples:
|
||||
speakeasy-default-get-models:
|
||||
responses:
|
||||
"200":
|
||||
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}]}
|
||||
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}]}
|
||||
"400":
|
||||
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
||||
"500":
|
||||
@@ -948,7 +929,7 @@ examples:
|
||||
speakeasy-default-list-models-user:
|
||||
responses:
|
||||
"200":
|
||||
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}]}
|
||||
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}]}
|
||||
"401":
|
||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||
"500":
|
||||
@@ -961,7 +942,7 @@ examples:
|
||||
slug: "<value>"
|
||||
responses:
|
||||
"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"}, "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}]}}
|
||||
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}]}}
|
||||
"404":
|
||||
application/json: {"error": {"code": 404, "message": "Resource not found"}}
|
||||
"500":
|
||||
@@ -970,7 +951,7 @@ examples:
|
||||
speakeasy-default-list-endpoints-zdr:
|
||||
responses:
|
||||
"200":
|
||||
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}]}
|
||||
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}]}
|
||||
"500":
|
||||
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
|
||||
getParameters:
|
||||
@@ -992,7 +973,7 @@ examples:
|
||||
speakeasy-default-list-providers:
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"data": [{"name": "OpenAI", "slug": "openai", "privacy_policy_url": "https://openai.com/privacy"}]}
|
||||
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"}]}
|
||||
"500":
|
||||
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
|
||||
list:
|
||||
@@ -1003,7 +984,7 @@ examples:
|
||||
offset: "0"
|
||||
responses:
|
||||
"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"}]}
|
||||
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"}]}
|
||||
"401":
|
||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||
"429":
|
||||
@@ -1013,10 +994,10 @@ examples:
|
||||
createKeys:
|
||||
speakeasy-default-create-keys:
|
||||
requestBody:
|
||||
application/json: {"name": "My New API Key"}
|
||||
application/json: {"name": "My New API Key", "limit": 50, "limit_reset": "monthly", "include_byok_in_limit": true, "expires_at": "2027-12-31T23:59:59Z"}
|
||||
responses:
|
||||
"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}, "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, "expires_at": "2027-12-31T23:59:59Z"}, "key": "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"}
|
||||
"400":
|
||||
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
||||
"401":
|
||||
@@ -1031,10 +1012,10 @@ examples:
|
||||
path:
|
||||
hash: "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"
|
||||
requestBody:
|
||||
application/json: {}
|
||||
application/json: {"name": "Updated API Key Name", "disabled": false, "limit": 75, "limit_reset": "daily", "include_byok_in_limit": true}
|
||||
responses:
|
||||
"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"}}
|
||||
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}}
|
||||
"400":
|
||||
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
||||
"401":
|
||||
@@ -1068,7 +1049,7 @@ examples:
|
||||
hash: "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"
|
||||
responses:
|
||||
"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"}}
|
||||
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"}}
|
||||
"401":
|
||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||
"404":
|
||||
@@ -1081,7 +1062,7 @@ examples:
|
||||
speakeasy-default-get-current-key:
|
||||
responses:
|
||||
"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, "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, "expires_at": "2027-12-31T23:59:59Z", "rate_limit": {"requests": 1000, "interval": "1h", "note": "This field is deprecated and safe to ignore."}}}
|
||||
"401":
|
||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||
"500":
|
||||
@@ -1089,7 +1070,7 @@ examples:
|
||||
exchangeAuthCodeForAPIKey:
|
||||
speakeasy-default-exchange-auth-code-for-API-key:
|
||||
requestBody:
|
||||
application/json: {"code": "auth_code_abc123def456"}
|
||||
application/json: {"code": "auth_code_abc123def456", "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "code_challenge_method": "S256"}
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"key": "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", "user_id": "user_2yOPcMpKoQhcd4bVgSMlELRaIah"}
|
||||
@@ -1102,7 +1083,7 @@ examples:
|
||||
createAuthKeysCode:
|
||||
speakeasy-default-create-auth-keys-code:
|
||||
requestBody:
|
||||
application/json: {"callback_url": "https://myapp.com/auth/callback"}
|
||||
application/json: {"callback_url": "https://myapp.com/auth/callback", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "code_challenge_method": "S256", "limit": 100}
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"data": {"id": "auth_code_xyz789", "app_id": 12345, "created_at": "2025-08-24T10:30:00Z"}}
|
||||
@@ -1135,3 +1116,4 @@ examples:
|
||||
"500":
|
||||
application/json: {"error": {"code": "<value>", "message": "<value>"}}
|
||||
examplesVersion: 1.0.2
|
||||
releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: `request` **Changed** **Breaking** :warning:\n* `open_router.embeddings.generate()`: `response.status[200].content[text/event-stream` **Removed** **Breaking** :warning:\n* `open_router.chat.send()`: \n * `request` **Changed** **Breaking** :warning:\n * `response.choices.[].message.content.[array].[]` **Changed** **Breaking** :warning:\n* `open_router.credits.get_credits()`: `response.data` **Added**\n* `open_router.parameters.get_parameters()`: `request.provider` **Changed**\n* `open_router.completions.generate()`: `response` **Changed**\n"
|
||||
|
||||
+5
-7
@@ -6,7 +6,7 @@ generation:
|
||||
sdkClassName: OpenRouter
|
||||
maintainOpenAPIOrder: true
|
||||
usageSnippets:
|
||||
optionalPropertyRendering: never
|
||||
optionalPropertyRendering: withExample
|
||||
sdkInitStyle: constructor
|
||||
useClassNamesForArrayFields: true
|
||||
fixes:
|
||||
@@ -24,14 +24,13 @@ generation:
|
||||
sdkHooksConfigAccess: true
|
||||
schemas:
|
||||
allOfMergeStrategy: shallowMerge
|
||||
requestBodyFieldName: ""
|
||||
requestBodyFieldName: body
|
||||
tests:
|
||||
generateTests: false
|
||||
generateNewTests: true
|
||||
skipResponseBodyAssertions: false
|
||||
preApplyUnionDiscriminators: true
|
||||
python:
|
||||
version: 0.0.22
|
||||
version: 0.1.0
|
||||
additionalDependencies:
|
||||
dev: {}
|
||||
main: {}
|
||||
@@ -58,12 +57,11 @@ python:
|
||||
imports:
|
||||
option: openapi
|
||||
paths:
|
||||
callbacks: callbacks
|
||||
callbacks: ""
|
||||
errors: errors
|
||||
operations: operations
|
||||
shared: components
|
||||
webhooks: webhooks
|
||||
inferSSEOverload: true
|
||||
webhooks: ""
|
||||
inferUnionDiscriminators: true
|
||||
inputModelSuffix: input
|
||||
legacyPyright: false
|
||||
|
||||
+41
-437
@@ -1054,7 +1054,6 @@ components:
|
||||
type: string
|
||||
nullable: true
|
||||
enum:
|
||||
- xhigh
|
||||
- high
|
||||
- medium
|
||||
- low
|
||||
@@ -3448,14 +3447,12 @@ components:
|
||||
- AionLabs
|
||||
- Alibaba
|
||||
- Amazon Bedrock
|
||||
- Amazon Nova
|
||||
- Anthropic
|
||||
- Arcee AI
|
||||
- Arcee
|
||||
- AtlasCloud
|
||||
- Avian
|
||||
- Azure
|
||||
- BaseTen
|
||||
- BytePlus
|
||||
- Black Forest Labs
|
||||
- Cerebras
|
||||
- Chutes
|
||||
@@ -3470,7 +3467,6 @@ components:
|
||||
- Fireworks
|
||||
- Friendli
|
||||
- GMICloud
|
||||
- GoPomelo
|
||||
- Google
|
||||
- Google AI Studio
|
||||
- Groq
|
||||
@@ -3480,7 +3476,6 @@ components:
|
||||
- Infermatic
|
||||
- Inflection
|
||||
- Liquid
|
||||
- Mara
|
||||
- Mancer 2
|
||||
- Minimax
|
||||
- ModelRun
|
||||
@@ -3501,15 +3496,12 @@ components:
|
||||
- Relace
|
||||
- SambaNova
|
||||
- SiliconFlow
|
||||
- Sourceful
|
||||
- Stealth
|
||||
- StreamLake
|
||||
- Switchpoint
|
||||
- Targon
|
||||
- Together
|
||||
- Venice
|
||||
- WandB
|
||||
- Xiaomi
|
||||
- xAI
|
||||
- Z.AI
|
||||
- FakeProvider
|
||||
@@ -3539,8 +3531,12 @@ components:
|
||||
performed.
|
||||
example: price
|
||||
BigNumberUnion:
|
||||
type: string
|
||||
description: A value in string format that is a large number
|
||||
anyOf:
|
||||
- type: number
|
||||
- type: string
|
||||
- type: number
|
||||
example: 1000
|
||||
description: A value in string or number format that is a large number
|
||||
example: 1000
|
||||
OpenResponsesRequest:
|
||||
type: object
|
||||
@@ -3632,13 +3628,17 @@ components:
|
||||
nullable: true
|
||||
store:
|
||||
type: boolean
|
||||
const: false
|
||||
default: false
|
||||
nullable: true
|
||||
service_tier:
|
||||
type: string
|
||||
enum:
|
||||
- auto
|
||||
default: auto
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/OpenAIResponsesServiceTier'
|
||||
- enum:
|
||||
- auto
|
||||
- default
|
||||
- flex
|
||||
- scale
|
||||
- priority
|
||||
example: auto
|
||||
truncation:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/OpenAIResponsesTruncation'
|
||||
@@ -3735,23 +3735,10 @@ components:
|
||||
$ref: '#/components/schemas/BigNumberUnion'
|
||||
request:
|
||||
$ref: '#/components/schemas/BigNumberUnion'
|
||||
additionalProperties: false
|
||||
description: >-
|
||||
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
|
||||
description: When multiple model providers are available, optionally indicate your routing preference.
|
||||
plugins:
|
||||
@@ -3772,9 +3759,6 @@ components:
|
||||
type: string
|
||||
enum:
|
||||
- web
|
||||
enabled:
|
||||
type: boolean
|
||||
description: Set to false to disable the web-search plugin for this request. Defaults to true.
|
||||
max_results:
|
||||
type: number
|
||||
search_prompt:
|
||||
@@ -3792,9 +3776,6 @@ components:
|
||||
type: string
|
||||
enum:
|
||||
- file-parser
|
||||
enabled:
|
||||
type: boolean
|
||||
description: Set to false to disable the file-parser plugin for this request. Defaults to true.
|
||||
max_files:
|
||||
type: number
|
||||
pdf:
|
||||
@@ -3808,27 +3789,7 @@ components:
|
||||
- native
|
||||
required:
|
||||
- id
|
||||
- type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
enum:
|
||||
- response-healing
|
||||
enabled:
|
||||
type: boolean
|
||||
description: Set to false to disable the response-healing plugin for this request. Defaults to true.
|
||||
required:
|
||||
- id
|
||||
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:
|
||||
type: string
|
||||
maxLength: 128
|
||||
@@ -3836,13 +3797,6 @@ components:
|
||||
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
|
||||
example:
|
||||
model: anthropic/claude-4.5-sonnet-20250929
|
||||
@@ -4623,91 +4577,6 @@ components:
|
||||
status: default
|
||||
uptime_last_30m: 99.5
|
||||
supports_implicit_caching: true
|
||||
__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:
|
||||
- $ref: '#/components/schemas/ChatCompletionFinishReason'
|
||||
- type: 'null'
|
||||
ModelName:
|
||||
type: string
|
||||
ChatMessageContentItemText:
|
||||
@@ -4718,8 +4587,6 @@ components:
|
||||
const: text
|
||||
text:
|
||||
type: string
|
||||
cache_control:
|
||||
$ref: '#/components/schemas/ChatMessageContentItemCacheControl'
|
||||
required:
|
||||
- type
|
||||
- text
|
||||
@@ -4758,6 +4625,14 @@ components:
|
||||
type: string
|
||||
format:
|
||||
type: string
|
||||
enum:
|
||||
- wav
|
||||
- mp3
|
||||
- flac
|
||||
- m4a
|
||||
- ogg
|
||||
- pcm16
|
||||
- pcm24
|
||||
required:
|
||||
- data
|
||||
- format
|
||||
@@ -4935,13 +4810,15 @@ components:
|
||||
- prompt_tokens
|
||||
- total_tokens
|
||||
ChatCompletionFinishReason:
|
||||
type: string
|
||||
enum:
|
||||
- tool_calls
|
||||
- stop
|
||||
- length
|
||||
- content_filter
|
||||
- error
|
||||
anyOf:
|
||||
- type: string
|
||||
enum:
|
||||
- tool_calls
|
||||
- stop
|
||||
- length
|
||||
- content_filter
|
||||
- error
|
||||
- type: 'null'
|
||||
JSONSchemaConfig:
|
||||
type: object
|
||||
properties:
|
||||
@@ -4983,19 +4860,6 @@ components:
|
||||
required:
|
||||
- type
|
||||
- grammar
|
||||
ChatMessageContentItemCacheControl:
|
||||
type: object
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
const: ephemeral
|
||||
ttl:
|
||||
type: string
|
||||
enum:
|
||||
- 5m
|
||||
- 1h
|
||||
required:
|
||||
- type
|
||||
SystemMessage:
|
||||
type: object
|
||||
properties:
|
||||
@@ -5162,214 +5026,6 @@ components:
|
||||
ChatGenerationParams:
|
||||
type: object
|
||||
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:
|
||||
minItems: 1
|
||||
type: array
|
||||
@@ -5439,7 +5095,6 @@ components:
|
||||
- low
|
||||
- medium
|
||||
- high
|
||||
- xhigh
|
||||
- type: 'null'
|
||||
summary:
|
||||
anyOf:
|
||||
@@ -5513,18 +5168,15 @@ components:
|
||||
minimum: 0
|
||||
maximum: 1
|
||||
- type: 'null'
|
||||
debug:
|
||||
type: object
|
||||
properties:
|
||||
echo_upstream_body:
|
||||
type: boolean
|
||||
user:
|
||||
type: string
|
||||
required:
|
||||
- messages
|
||||
ChatResponseChoice:
|
||||
type: object
|
||||
properties:
|
||||
finish_reason:
|
||||
$ref: '#/components/schemas/__schema2'
|
||||
$ref: '#/components/schemas/ChatCompletionFinishReason'
|
||||
index:
|
||||
type: number
|
||||
message:
|
||||
@@ -5585,7 +5237,7 @@ components:
|
||||
delta:
|
||||
$ref: '#/components/schemas/ChatStreamingMessageChunk'
|
||||
finish_reason:
|
||||
$ref: '#/components/schemas/__schema2'
|
||||
$ref: '#/components/schemas/ChatCompletionFinishReason'
|
||||
index:
|
||||
type: number
|
||||
logprobs:
|
||||
@@ -5917,12 +5569,6 @@ components:
|
||||
- type: 'null'
|
||||
finish_reason:
|
||||
$ref: '#/components/schemas/CompletionFinishReason'
|
||||
native_finish_reason:
|
||||
type: string
|
||||
reasoning:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
required:
|
||||
- text
|
||||
- index
|
||||
@@ -5940,8 +5586,6 @@ components:
|
||||
type: number
|
||||
model:
|
||||
type: string
|
||||
provider:
|
||||
type: string
|
||||
system_fingerprint:
|
||||
type: string
|
||||
choices:
|
||||
@@ -6160,26 +5804,6 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
data:
|
||||
type: object
|
||||
properties:
|
||||
total_credits:
|
||||
type: number
|
||||
description: Total credits purchased
|
||||
example: 100.5
|
||||
total_usage:
|
||||
type: number
|
||||
description: Total credits used
|
||||
example: 25.75
|
||||
required:
|
||||
- total_credits
|
||||
- total_usage
|
||||
example:
|
||||
total_credits: 100.5
|
||||
total_usage: 25.75
|
||||
required:
|
||||
- data
|
||||
description: Total credits purchased and used
|
||||
example:
|
||||
data:
|
||||
@@ -6491,23 +6115,10 @@ paths:
|
||||
$ref: '#/components/schemas/BigNumberUnion'
|
||||
request:
|
||||
$ref: '#/components/schemas/BigNumberUnion'
|
||||
additionalProperties: false
|
||||
description: >-
|
||||
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:
|
||||
type: string
|
||||
required:
|
||||
@@ -7115,14 +6726,12 @@ paths:
|
||||
- AionLabs
|
||||
- Alibaba
|
||||
- Amazon Bedrock
|
||||
- Amazon Nova
|
||||
- Anthropic
|
||||
- Arcee AI
|
||||
- Arcee
|
||||
- AtlasCloud
|
||||
- Avian
|
||||
- Azure
|
||||
- BaseTen
|
||||
- BytePlus
|
||||
- Black Forest Labs
|
||||
- Cerebras
|
||||
- Chutes
|
||||
@@ -7137,7 +6746,6 @@ paths:
|
||||
- Fireworks
|
||||
- Friendli
|
||||
- GMICloud
|
||||
- GoPomelo
|
||||
- Google
|
||||
- Google AI Studio
|
||||
- Groq
|
||||
@@ -7147,7 +6755,6 @@ paths:
|
||||
- Infermatic
|
||||
- Inflection
|
||||
- Liquid
|
||||
- Mara
|
||||
- Mancer 2
|
||||
- Minimax
|
||||
- ModelRun
|
||||
@@ -7168,15 +6775,12 @@ paths:
|
||||
- Relace
|
||||
- SambaNova
|
||||
- SiliconFlow
|
||||
- Sourceful
|
||||
- Stealth
|
||||
- StreamLake
|
||||
- Switchpoint
|
||||
- Targon
|
||||
- Together
|
||||
- Venice
|
||||
- WandB
|
||||
- Xiaomi
|
||||
- xAI
|
||||
- Z.AI
|
||||
- FakeProvider
|
||||
|
||||
+8364
-8698
File diff suppressed because it is too large
Load Diff
@@ -1,35 +0,0 @@
|
||||
overlay: 1.0.0
|
||||
x-speakeasy-jsonpath: rfc9535
|
||||
info:
|
||||
title: Add HTTP-Referer and X-Title as global parameters
|
||||
version: 0.0.0
|
||||
actions:
|
||||
# Add global parameters for app identification
|
||||
- target: $
|
||||
description: Add x-speakeasy-globals for HTTP-Referer and X-Title headers
|
||||
update:
|
||||
x-speakeasy-globals:
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/AppIdentifier"
|
||||
- $ref: "#/components/parameters/AppDisplayName"
|
||||
|
||||
# Add component parameters
|
||||
- target: $.components
|
||||
description: Add parameters for app identification headers
|
||||
update:
|
||||
parameters:
|
||||
AppIdentifier:
|
||||
name: HTTP-Referer
|
||||
in: header
|
||||
schema:
|
||||
type: string
|
||||
description: |
|
||||
The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
AppDisplayName:
|
||||
name: X-Title
|
||||
in: header
|
||||
schema:
|
||||
type: string
|
||||
description: |
|
||||
The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
@@ -1,10 +0,0 @@
|
||||
overlay: 1.0.0
|
||||
x-speakeasy-jsonpath: rfc9535
|
||||
info:
|
||||
title: Add open enums
|
||||
version: 0.0.0
|
||||
actions:
|
||||
- target: $..[?length(@.enum) > 1]
|
||||
description: Automatically open all enums that have length > 1
|
||||
update:
|
||||
x-speakeasy-unknown-values: allow
|
||||
@@ -1,15 +0,0 @@
|
||||
overlay: 1.0.0
|
||||
x-speakeasy-jsonpath: rfc9535
|
||||
info:
|
||||
title: Remove RSS+XML response schemas and related parameters
|
||||
version: 0.0.0
|
||||
actions:
|
||||
- target: $..responses.*.content["application/rss+xml"]
|
||||
description: Remove application/rss+xml response schemas
|
||||
remove: true
|
||||
- target: $..parameters[?@.name == "use_rss"]
|
||||
description: Remove use_rss parameter
|
||||
remove: true
|
||||
- target: $..parameters[?@.name == "use_rss_chat_links"]
|
||||
description: Remove use_rss_chat_links parameter
|
||||
remove: true
|
||||
+13
-25
@@ -1,50 +1,38 @@
|
||||
speakeasyVersion: 1.666.0
|
||||
speakeasyVersion: 1.668.0
|
||||
sources:
|
||||
-OAS:
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:f1b59b9b643de5e20d6e3299a8274783d8c0854615876f5d7f6f081814842695
|
||||
sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553
|
||||
sourceRevisionDigest: sha256:697f956356ab0195b9a9b9a5106e4ac979caa551709b3614c723df972c661829
|
||||
sourceBlobDigest: sha256:a286a09ceced7f78a685731aef81d1498b89a6a46f3794219dc93fa2d822853b
|
||||
tags:
|
||||
- latest
|
||||
OpenRouter API:
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:b128cdb6be96021e55feea5e2dcb6e7438de706138fcde4f871b14877885445b
|
||||
sourceBlobDigest: sha256:8b15f72eaabbd77f4642be28a2861fd1cfd5d8cfe96e72fb8a76832387c64fab
|
||||
tags:
|
||||
- latest
|
||||
- 1.0.0
|
||||
- speakeasy-sdk-regen-1763684529
|
||||
targets:
|
||||
open-router:
|
||||
source: OpenRouter API
|
||||
source: -OAS
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:b128cdb6be96021e55feea5e2dcb6e7438de706138fcde4f871b14877885445b
|
||||
sourceBlobDigest: sha256:8b15f72eaabbd77f4642be28a2861fd1cfd5d8cfe96e72fb8a76832387c64fab
|
||||
codeSamplesNamespace: open-router-python-code-samples
|
||||
codeSamplesRevisionDigest: sha256:92747cd4c744e6671784b73c124d89adc662799d11caf5e6573880f6bfb52405
|
||||
sourceRevisionDigest: sha256:697f956356ab0195b9a9b9a5106e4ac979caa551709b3614c723df972c661829
|
||||
sourceBlobDigest: sha256:a286a09ceced7f78a685731aef81d1498b89a6a46f3794219dc93fa2d822853b
|
||||
workflow:
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: 1.666.0
|
||||
speakeasyVersion: latest
|
||||
sources:
|
||||
OpenRouter API:
|
||||
-OAS:
|
||||
inputs:
|
||||
- location: .speakeasy/in.openapi.yaml
|
||||
overlays:
|
||||
- location: .speakeasy/overlays/open-enums.overlay.yaml
|
||||
- location: .speakeasy/overlays/remove-rss-responses.overlay.yaml
|
||||
- location: .speakeasy/overlays/add-headers.overlay.yaml
|
||||
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main
|
||||
output: .speakeasy/out.openapi.yaml
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/-oas
|
||||
targets:
|
||||
open-router:
|
||||
target: python
|
||||
source: OpenRouter API
|
||||
source: -OAS
|
||||
publish:
|
||||
pypi:
|
||||
token: $pypi_token
|
||||
codeSamples:
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-python-code-samples
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/-oas-python-code-samples
|
||||
labelOverride:
|
||||
fixedValue: Python (SDK)
|
||||
blocking: false
|
||||
|
||||
@@ -1,26 +1,22 @@
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: 1.666.0
|
||||
speakeasyVersion: latest
|
||||
sources:
|
||||
OpenRouter API:
|
||||
-OAS:
|
||||
inputs:
|
||||
- location: .speakeasy/in.openapi.yaml
|
||||
overlays:
|
||||
- location: .speakeasy/overlays/open-enums.overlay.yaml
|
||||
- location: .speakeasy/overlays/remove-rss-responses.overlay.yaml
|
||||
- location: .speakeasy/overlays/add-headers.overlay.yaml
|
||||
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main
|
||||
output: .speakeasy/out.openapi.yaml
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/-oas
|
||||
targets:
|
||||
open-router:
|
||||
target: python
|
||||
source: OpenRouter API
|
||||
source: -OAS
|
||||
publish:
|
||||
pypi:
|
||||
token: $pypi_token
|
||||
codeSamples:
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-python-code-samples
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/-oas-python-code-samples
|
||||
labelOverride:
|
||||
fixedValue: Python (SDK)
|
||||
blocking: false
|
||||
|
||||
+11
-1
@@ -8,4 +8,14 @@ Based on:
|
||||
### Generated
|
||||
- [python v0.0.16] .
|
||||
### Releases
|
||||
- [PyPI v0.0.16] https://pypi.org/project/openrouter/0.0.16 - .
|
||||
- [PyPI v0.0.16] https://pypi.org/project/openrouter/0.0.16 - .
|
||||
|
||||
## 2025-12-04 00:22:56
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.668.0 (2.770.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.1.0] .
|
||||
### Releases
|
||||
- [PyPI v0.1.0] https://pypi.org/project/openrouter/0.1.0 - .
|
||||
@@ -9,7 +9,61 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.beta.responses.send(service_tier="auto", stream=False)
|
||||
res = open_router.beta.responses.send(input=[
|
||||
{
|
||||
"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:
|
||||
for event in event_stream:
|
||||
@@ -33,7 +87,61 @@ async def main():
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = await open_router.beta.responses.send_async(service_tier="auto", stream=False)
|
||||
res = await open_router.beta.responses.send_async(input=[
|
||||
{
|
||||
"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 for event in event_stream:
|
||||
|
||||
@@ -3,32 +3,28 @@
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `provider` | [OptionalNullable[components.ChatGenerationParamsProvider]](../components/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. |
|
||||
| `plugins` | List[[components.ChatGenerationParamsPluginUnion](../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. |
|
||||
| `route` | [OptionalNullable[components.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. |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. |
|
||||
| `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | N/A |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
|
||||
| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
|
||||
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning` | [Optional[components.Reasoning]](../components/reasoning.md) | :heavy_minus_sign: | N/A |
|
||||
| `response_format` | [Optional[components.ChatGenerationParamsResponseFormatUnion]](../components/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A |
|
||||
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `stop` | [OptionalNullable[components.ChatGenerationParamsStop]](../components/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A |
|
||||
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `debug` | [Optional[components.Debug]](../components/debug.md) | :heavy_minus_sign: | N/A |
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | N/A |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
|
||||
| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
|
||||
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning` | [Optional[components.Reasoning]](../components/reasoning.md) | :heavy_minus_sign: | N/A |
|
||||
| `response_format` | [Optional[components.ChatGenerationParamsResponseFormatUnion]](../components/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A |
|
||||
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `stop` | [OptionalNullable[components.ChatGenerationParamsStop]](../components/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A |
|
||||
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `debug` | [Optional[components.Debug]](../components/debug.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatGenerationParamsDataCollection
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------- | ------- |
|
||||
| `DENY` | deny |
|
||||
| `ALLOW` | allow |
|
||||
@@ -1,14 +0,0 @@
|
||||
# ChatGenerationParamsMaxPrice
|
||||
|
||||
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `prompt` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `completion` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `image` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `audio` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `request` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# ChatGenerationParamsPdf
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `engine` | [Optional[components.ChatGenerationParamsPdfEngine]](../components/chatgenerationparamspdfengine.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,10 +0,0 @@
|
||||
# ChatGenerationParamsPdfEngine
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------- | ------------- |
|
||||
| `MISTRAL_OCR` | mistral-ocr |
|
||||
| `PDF_TEXT` | pdf-text |
|
||||
| `NATIVE` | native |
|
||||
@@ -1,11 +0,0 @@
|
||||
# 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 |
|
||||
@@ -1,8 +0,0 @@
|
||||
# ChatGenerationParamsPluginModeration
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------- | ----------------------- | ----------------------- | ----------------------- |
|
||||
| `id` | *Literal["moderation"]* | :heavy_check_mark: | N/A |
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatGenerationParamsPluginResponseHealing
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------- | ----------------------------- | ----------------------------- | ----------------------------- |
|
||||
| `id` | *Literal["response-healing"]* | :heavy_check_mark: | N/A |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,29 +0,0 @@
|
||||
# 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 */
|
||||
```
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# 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 |
|
||||
@@ -1,20 +0,0 @@
|
||||
# ChatGenerationParamsProvider
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests<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. |
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatGenerationParamsRoute
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ---------- | ---------- |
|
||||
| `FALLBACK` | fallback |
|
||||
| `SORT` | sort |
|
||||
@@ -9,5 +9,4 @@
|
||||
| `MINIMAL` | minimal |
|
||||
| `LOW` | low |
|
||||
| `MEDIUM` | medium |
|
||||
| `HIGH` | high |
|
||||
| `XHIGH` | xhigh |
|
||||
| `HIGH` | high |
|
||||
@@ -1,4 +1,4 @@
|
||||
# ChatGenerationParamsEngine
|
||||
# Engine
|
||||
|
||||
|
||||
## Values
|
||||
@@ -0,0 +1,14 @@
|
||||
# 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,7 +5,6 @@
|
||||
|
||||
| Name | Value |
|
||||
| --------- | --------- |
|
||||
| `XHIGH` | xhigh |
|
||||
| `HIGH` | high |
|
||||
| `MEDIUM` | medium |
|
||||
| `LOW` | low |
|
||||
|
||||
@@ -31,8 +31,6 @@ Request schema for Responses endpoint
|
||||
| `service_tier` | [Optional[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | |
|
||||
| `truncation` | [OptionalNullable[components.Truncation]](../components/truncation.md) | :heavy_minus_sign: | N/A | auto |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../components/openresponsesrequestprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
| `plugins` | List[[components.OpenResponsesRequestPluginUnion](../components/openresponsesrequestpluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||
| `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. | |
|
||||
| `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
| `plugins` | List[[components.Plugin](../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | |
|
||||
@@ -1,9 +0,0 @@
|
||||
# OpenResponsesRequestEngine
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| -------- | -------- |
|
||||
| `NATIVE` | native |
|
||||
| `EXA` | exa |
|
||||
@@ -1,14 +0,0 @@
|
||||
# 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 |
|
||||
@@ -1,8 +0,0 @@
|
||||
# OpenResponsesRequestPdf
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `engine` | [Optional[components.OpenResponsesRequestPdfEngine]](../components/openresponsesrequestpdfengine.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,11 +0,0 @@
|
||||
# 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,9 +0,0 @@
|
||||
# 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. |
|
||||
@@ -1,29 +0,0 @@
|
||||
# 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 */
|
||||
```
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# 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,11 +0,0 @@
|
||||
# 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 |
|
||||
@@ -0,0 +1,8 @@
|
||||
# Pdf
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| `engine` | [Optional[components.PdfEngine]](../components/pdfengine.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,4 +1,4 @@
|
||||
# OpenResponsesRequestPdfEngine
|
||||
# PdfEngine
|
||||
|
||||
|
||||
## Values
|
||||
@@ -0,0 +1,29 @@
|
||||
# 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 */
|
||||
```
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# 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 |
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# OpenResponsesRequestPluginModeration
|
||||
# PluginModeration
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -0,0 +1,8 @@
|
||||
# PluginResponseHealing
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
||||
| `id` | [components.IDResponseHealing](../components/idresponsehealing.md) | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,11 @@
|
||||
# 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
@@ -3,18 +3,18 @@
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
|
||||
| `prompt` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 |
|
||||
| `completion` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 |
|
||||
| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image_token` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `web_search` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | |
|
||||
| Field | Type | Required | Description |
|
||||
| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- |
|
||||
| `prompt` | *Any* | :heavy_check_mark: | A value in string or number format that is a large number |
|
||||
| `completion` | *Any* | :heavy_check_mark: | 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 |
|
||||
| `image` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `image_token` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `image_output` | *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 |
|
||||
| `input_audio_cache` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `web_search` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `internal_reasoning` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `input_cache_read` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `input_cache_write` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,4 +1,4 @@
|
||||
# OpenResponsesRequestProvider
|
||||
# Provider
|
||||
|
||||
When multiple model providers are available, optionally indicate your routing preference.
|
||||
|
||||
@@ -17,6 +17,4 @@ 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. | |
|
||||
| `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 |
|
||||
| `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 |
|
||||
| `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. | |
|
||||
@@ -41,7 +41,6 @@
|
||||
| `INFERMATIC` | Infermatic |
|
||||
| `INFLECTION` | Inflection |
|
||||
| `LIQUID` | Liquid |
|
||||
| `MARA` | Mara |
|
||||
| `MANCER_2` | Mancer 2 |
|
||||
| `MINIMAX` | Minimax |
|
||||
| `MODEL_RUN` | ModelRun |
|
||||
@@ -62,7 +61,6 @@
|
||||
| `RELACE` | Relace |
|
||||
| `SAMBA_NOVA` | SambaNova |
|
||||
| `SILICON_FLOW` | SiliconFlow |
|
||||
| `SOURCEFUL` | Sourceful |
|
||||
| `STEALTH` | Stealth |
|
||||
| `STREAM_LAKE` | StreamLake |
|
||||
| `SWITCHPOINT` | Switchpoint |
|
||||
@@ -70,7 +68,6 @@
|
||||
| `TOGETHER` | Together |
|
||||
| `VENICE` | Venice |
|
||||
| `WAND_B` | WandB |
|
||||
| `XIAOMI` | Xiaomi |
|
||||
| `X_AI` | xAI |
|
||||
| `Z_AI` | Z.AI |
|
||||
| `FAKE_PROVIDER` | FakeProvider |
|
||||
@@ -5,18 +5,18 @@ Pricing information for the model
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
|
||||
| `prompt` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 |
|
||||
| `completion` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 |
|
||||
| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image_token` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `web_search` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | |
|
||||
| Field | Type | Required | Description |
|
||||
| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- |
|
||||
| `prompt` | *Any* | :heavy_check_mark: | A value in string or number format that is a large number |
|
||||
| `completion` | *Any* | :heavy_check_mark: | 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 |
|
||||
| `image` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `image_token` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `image_output` | *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 |
|
||||
| `input_audio_cache` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `web_search` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `internal_reasoning` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `input_cache_read` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `input_cache_write` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,16 +0,0 @@
|
||||
# Quantizations
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| --------- | --------- |
|
||||
| `INT4` | int4 |
|
||||
| `INT8` | int8 |
|
||||
| `FP4` | fp4 |
|
||||
| `FP6` | fp6 |
|
||||
| `FP8` | fp8 |
|
||||
| `FP16` | fp16 |
|
||||
| `BF16` | bf16 |
|
||||
| `FP32` | fp32 |
|
||||
| `UNKNOWN` | unknown |
|
||||
@@ -1,17 +0,0 @@
|
||||
# Schema0
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.Schema0Enum`
|
||||
|
||||
```python
|
||||
value: components.Schema0Enum = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
# 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 |
|
||||
@@ -1,10 +0,0 @@
|
||||
# Sort
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------ | ------------ |
|
||||
| `PRICE` | price |
|
||||
| `THROUGHPUT` | throughput |
|
||||
| `LATENCY` | latency |
|
||||
@@ -15,6 +15,4 @@
|
||||
| `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. | |
|
||||
| `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. | |
|
||||
| `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 |
|
||||
| `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. | |
|
||||
@@ -1,17 +1,14 @@
|
||||
# CreateEmbeddingsResponse
|
||||
|
||||
Embedding response
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `operations.CreateEmbeddingsResponseBody`
|
||||
|
||||
```python
|
||||
value: operations.CreateEmbeddingsResponseBody = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
## 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 |
|
||||
@@ -1,14 +0,0 @@
|
||||
# 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 |
|
||||
@@ -41,7 +41,6 @@
|
||||
| `INFERMATIC` | Infermatic |
|
||||
| `INFLECTION` | Inflection |
|
||||
| `LIQUID` | Liquid |
|
||||
| `MARA` | Mara |
|
||||
| `MANCER_2` | Mancer 2 |
|
||||
| `MINIMAX` | Minimax |
|
||||
| `MODEL_RUN` | ModelRun |
|
||||
@@ -62,7 +61,6 @@
|
||||
| `RELACE` | Relace |
|
||||
| `SAMBA_NOVA` | SambaNova |
|
||||
| `SILICON_FLOW` | SiliconFlow |
|
||||
| `SOURCEFUL` | Sourceful |
|
||||
| `STEALTH` | Stealth |
|
||||
| `STREAM_LAKE` | StreamLake |
|
||||
| `SWITCHPOINT` | Switchpoint |
|
||||
@@ -70,7 +68,6 @@
|
||||
| `TOGETHER` | Together |
|
||||
| `VENICE` | Venice |
|
||||
| `WAND_B` | WandB |
|
||||
| `XIAOMI` | Xiaomi |
|
||||
| `X_AI` | xAI |
|
||||
| `Z_AI` | Z.AI |
|
||||
| `FAKE_PROVIDER` | FakeProvider |
|
||||
@@ -5,10 +5,10 @@ The object specifying the maximum price you want to pay for this request. USD pr
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
|
||||
| `prompt` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `completion` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| 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 |
|
||||
@@ -6,4 +6,4 @@
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to update | 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 |
|
||||
| `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/>} |
|
||||
| `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/>} |
|
||||
@@ -67,6 +67,7 @@ Create a new API key
|
||||
<!-- UsageSnippet language="python" operationID="createKeys" method="post" path="/keys" -->
|
||||
```python
|
||||
from openrouter import OpenRouter
|
||||
from openrouter.utils import parse_datetime
|
||||
import os
|
||||
|
||||
|
||||
@@ -74,7 +75,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.api_keys.create(name="My New API Key")
|
||||
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"))
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
@@ -122,7 +123,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.api_keys.update(hash="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")
|
||||
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)
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
+26
-30
@@ -34,36 +34,32 @@ with OpenRouter(
|
||||
|
||||
### Parameters
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `messages` | List[[components.Message](../../components/message.md)] | :heavy_check_mark: | N/A |
|
||||
| `provider` | [OptionalNullable[components.ChatGenerationParamsProvider]](../../components/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. |
|
||||
| `plugins` | List[[components.ChatGenerationParamsPluginUnion](../../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. |
|
||||
| `route` | [OptionalNullable[components.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. |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
|
||||
| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
|
||||
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning` | [Optional[components.Reasoning]](../../components/reasoning.md) | :heavy_minus_sign: | N/A |
|
||||
| `response_format` | [Optional[components.ChatGenerationParamsResponseFormatUnion]](../../components/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A |
|
||||
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `stop` | [OptionalNullable[components.ChatGenerationParamsStop]](../../components/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A |
|
||||
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `debug` | [Optional[components.Debug]](../../components/debug.md) | :heavy_minus_sign: | N/A |
|
||||
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `messages` | List[[components.Message](../../components/message.md)] | :heavy_check_mark: | N/A |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
|
||||
| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
|
||||
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning` | [Optional[components.Reasoning]](../../components/reasoning.md) | :heavy_minus_sign: | N/A |
|
||||
| `response_format` | [Optional[components.ChatGenerationParamsResponseFormatUnion]](../../components/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A |
|
||||
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `stop` | [OptionalNullable[components.ChatGenerationParamsStop]](../../components/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A |
|
||||
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :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
|
||||
|
||||
|
||||
@@ -26,7 +26,24 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.embeddings.generate(input="<value>", model="Taurus")
|
||||
res = open_router.embeddings.generate(input="<value>", model="Taurus", provider={
|
||||
"data_collection": "allow",
|
||||
"zdr": True,
|
||||
"enforce_distillable_text": True,
|
||||
"order": [
|
||||
"OpenAI",
|
||||
],
|
||||
"only": [
|
||||
"OpenAI",
|
||||
],
|
||||
"ignore": [
|
||||
"OpenAI",
|
||||
],
|
||||
"quantizations": [
|
||||
"fp16",
|
||||
],
|
||||
"sort": "price",
|
||||
})
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
@@ -26,7 +26,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.o_auth.exchange_auth_code_for_api_key(code="auth_code_abc123def456")
|
||||
res = open_router.o_auth.exchange_auth_code_for_api_key(code="auth_code_abc123def456", code_verifier="dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", code_challenge_method="S256")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
@@ -71,7 +71,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.o_auth.create_auth_code(callback_url="https://myapp.com/auth/callback")
|
||||
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)
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
@@ -25,7 +25,61 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.beta.responses.send(service_tier="auto", stream=False)
|
||||
res = open_router.beta.responses.send(input=[
|
||||
{
|
||||
"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:
|
||||
for event in event_stream:
|
||||
@@ -61,11 +115,9 @@ with OpenRouter(
|
||||
| `service_tier` | [Optional[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | |
|
||||
| `truncation` | [OptionalNullable[components.Truncation]](../../components/truncation.md) | :heavy_minus_sign: | N/A | auto |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../../components/openresponsesrequestprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
| `plugins` | List[[components.OpenResponsesRequestPluginUnion](../../components/openresponsesrequestpluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||
| `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. | |
|
||||
| `provider` | [OptionalNullable[components.Provider]](../../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
| `plugins` | List[[components.Plugin](../../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | |
|
||||
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | |
|
||||
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
|
||||
|
||||
### Response
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "openrouter"
|
||||
version = "0.0.22"
|
||||
version = "0.1.0"
|
||||
description = "Official Python Client SDK for OpenRouter."
|
||||
authors = [{ name = "OpenRouter" },]
|
||||
readme = "README-PYPI.md"
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
import importlib.metadata
|
||||
|
||||
__title__: str = "openrouter"
|
||||
__version__: str = "0.0.22"
|
||||
__version__: str = "0.1.0"
|
||||
__openapi_doc_version__: str = "1.0.0"
|
||||
__gen_version__: str = "2.768.0"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.0.22 2.768.0 1.0.0 openrouter"
|
||||
__gen_version__: str = "2.770.0"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.1.0 2.770.0 1.0.0 openrouter"
|
||||
|
||||
try:
|
||||
if __package__ is not None:
|
||||
|
||||
@@ -506,7 +506,7 @@ class APIKeys(BaseSDK):
|
||||
|
||||
request = operations.UpdateKeysRequest(
|
||||
hash=hash,
|
||||
request_body=operations.UpdateKeysRequestBody(
|
||||
body=operations.UpdateKeysRequestBody(
|
||||
name=name,
|
||||
disabled=disabled,
|
||||
limit=limit,
|
||||
@@ -529,11 +529,7 @@ class APIKeys(BaseSDK):
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request.request_body,
|
||||
False,
|
||||
False,
|
||||
"json",
|
||||
operations.UpdateKeysRequestBody,
|
||||
request.body, False, False, "json", operations.UpdateKeysRequestBody
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
@@ -642,7 +638,7 @@ class APIKeys(BaseSDK):
|
||||
|
||||
request = operations.UpdateKeysRequest(
|
||||
hash=hash,
|
||||
request_body=operations.UpdateKeysRequestBody(
|
||||
body=operations.UpdateKeysRequestBody(
|
||||
name=name,
|
||||
disabled=disabled,
|
||||
limit=limit,
|
||||
@@ -665,11 +661,7 @@ class APIKeys(BaseSDK):
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request.request_body,
|
||||
False,
|
||||
False,
|
||||
"json",
|
||||
operations.UpdateKeysRequestBody,
|
||||
request.body, False, False, "json", operations.UpdateKeysRequestBody
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
|
||||
+14
-138
@@ -21,21 +21,6 @@ class Chat(BaseSDK):
|
||||
self,
|
||||
*,
|
||||
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,
|
||||
models: Optional[List[str]] = None,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
@@ -75,6 +60,7 @@ class Chat(BaseSDK):
|
||||
]
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
@@ -86,11 +72,6 @@ class Chat(BaseSDK):
|
||||
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
||||
|
||||
:param messages:
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
:param 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 models:
|
||||
:param frequency_penalty:
|
||||
@@ -111,6 +92,7 @@ class Chat(BaseSDK):
|
||||
:param tool_choice:
|
||||
:param tools:
|
||||
:param top_p:
|
||||
:param user:
|
||||
:param debug:
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
@@ -124,21 +106,6 @@ class Chat(BaseSDK):
|
||||
self,
|
||||
*,
|
||||
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,
|
||||
models: Optional[List[str]] = None,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
@@ -178,6 +145,7 @@ class Chat(BaseSDK):
|
||||
]
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
@@ -189,11 +157,6 @@ class Chat(BaseSDK):
|
||||
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
||||
|
||||
:param messages:
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
:param 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 models:
|
||||
:param frequency_penalty:
|
||||
@@ -214,6 +177,7 @@ class Chat(BaseSDK):
|
||||
:param tool_choice:
|
||||
:param tools:
|
||||
:param top_p:
|
||||
:param user:
|
||||
:param debug:
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
@@ -226,21 +190,6 @@ class Chat(BaseSDK):
|
||||
self,
|
||||
*,
|
||||
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,
|
||||
models: Optional[List[str]] = None,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
@@ -280,6 +229,7 @@ class Chat(BaseSDK):
|
||||
]
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
@@ -291,11 +241,6 @@ class Chat(BaseSDK):
|
||||
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
||||
|
||||
:param messages:
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
:param 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 models:
|
||||
:param frequency_penalty:
|
||||
@@ -316,6 +261,7 @@ class Chat(BaseSDK):
|
||||
:param tool_choice:
|
||||
:param tools:
|
||||
:param top_p:
|
||||
:param user:
|
||||
:param debug:
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
@@ -334,15 +280,6 @@ class Chat(BaseSDK):
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
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]),
|
||||
model=model,
|
||||
models=models,
|
||||
@@ -373,6 +310,7 @@ class Chat(BaseSDK):
|
||||
tools, Optional[List[components.ToolDefinitionJSON]]
|
||||
),
|
||||
top_p=top_p,
|
||||
user=user,
|
||||
debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
|
||||
)
|
||||
|
||||
@@ -468,21 +406,6 @@ class Chat(BaseSDK):
|
||||
self,
|
||||
*,
|
||||
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,
|
||||
models: Optional[List[str]] = None,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
@@ -522,6 +445,7 @@ class Chat(BaseSDK):
|
||||
]
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
@@ -533,11 +457,6 @@ class Chat(BaseSDK):
|
||||
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
||||
|
||||
:param messages:
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
:param 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 models:
|
||||
:param frequency_penalty:
|
||||
@@ -558,6 +477,7 @@ class Chat(BaseSDK):
|
||||
:param tool_choice:
|
||||
:param tools:
|
||||
:param top_p:
|
||||
:param user:
|
||||
:param debug:
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
@@ -571,21 +491,6 @@ class Chat(BaseSDK):
|
||||
self,
|
||||
*,
|
||||
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,
|
||||
models: Optional[List[str]] = None,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
@@ -625,6 +530,7 @@ class Chat(BaseSDK):
|
||||
]
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
@@ -636,11 +542,6 @@ class Chat(BaseSDK):
|
||||
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
||||
|
||||
:param messages:
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
:param 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 models:
|
||||
:param frequency_penalty:
|
||||
@@ -661,6 +562,7 @@ class Chat(BaseSDK):
|
||||
:param tool_choice:
|
||||
:param tools:
|
||||
:param top_p:
|
||||
:param user:
|
||||
:param debug:
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
@@ -673,21 +575,6 @@ class Chat(BaseSDK):
|
||||
self,
|
||||
*,
|
||||
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,
|
||||
models: Optional[List[str]] = None,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
@@ -727,6 +614,7 @@ class Chat(BaseSDK):
|
||||
]
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
@@ -738,11 +626,6 @@ class Chat(BaseSDK):
|
||||
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
||||
|
||||
:param messages:
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
:param 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 models:
|
||||
:param frequency_penalty:
|
||||
@@ -763,6 +646,7 @@ class Chat(BaseSDK):
|
||||
:param tool_choice:
|
||||
:param tools:
|
||||
:param top_p:
|
||||
:param user:
|
||||
:param debug:
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
@@ -781,15 +665,6 @@ class Chat(BaseSDK):
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
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]),
|
||||
model=model,
|
||||
models=models,
|
||||
@@ -820,6 +695,7 @@ class Chat(BaseSDK):
|
||||
tools, Optional[List[components.ToolDefinitionJSON]]
|
||||
),
|
||||
top_p=top_p,
|
||||
user=user,
|
||||
debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
|
||||
)
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import builtins
|
||||
import sys
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ._schema0 import Schema0, Schema0Enum, Schema0TypedDict
|
||||
from .activityitem import ActivityItem, ActivityItemTypedDict
|
||||
from .assistantmessage import (
|
||||
AssistantMessage,
|
||||
@@ -26,25 +25,6 @@ if TYPE_CHECKING:
|
||||
from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict
|
||||
from .chatgenerationparams import (
|
||||
ChatGenerationParams,
|
||||
ChatGenerationParamsDataCollection,
|
||||
ChatGenerationParamsEngine,
|
||||
ChatGenerationParamsMaxPrice,
|
||||
ChatGenerationParamsMaxPriceTypedDict,
|
||||
ChatGenerationParamsPdf,
|
||||
ChatGenerationParamsPdfEngine,
|
||||
ChatGenerationParamsPdfTypedDict,
|
||||
ChatGenerationParamsPluginFileParser,
|
||||
ChatGenerationParamsPluginFileParserTypedDict,
|
||||
ChatGenerationParamsPluginModeration,
|
||||
ChatGenerationParamsPluginModerationTypedDict,
|
||||
ChatGenerationParamsPluginResponseHealing,
|
||||
ChatGenerationParamsPluginResponseHealingTypedDict,
|
||||
ChatGenerationParamsPluginUnion,
|
||||
ChatGenerationParamsPluginUnionTypedDict,
|
||||
ChatGenerationParamsPluginWeb,
|
||||
ChatGenerationParamsPluginWebTypedDict,
|
||||
ChatGenerationParamsProvider,
|
||||
ChatGenerationParamsProviderTypedDict,
|
||||
ChatGenerationParamsResponseFormatJSONObject,
|
||||
ChatGenerationParamsResponseFormatJSONObjectTypedDict,
|
||||
ChatGenerationParamsResponseFormatPython,
|
||||
@@ -53,17 +33,14 @@ if TYPE_CHECKING:
|
||||
ChatGenerationParamsResponseFormatTextTypedDict,
|
||||
ChatGenerationParamsResponseFormatUnion,
|
||||
ChatGenerationParamsResponseFormatUnionTypedDict,
|
||||
ChatGenerationParamsRoute,
|
||||
ChatGenerationParamsStop,
|
||||
ChatGenerationParamsStopTypedDict,
|
||||
ChatGenerationParamsTypedDict,
|
||||
Debug,
|
||||
DebugTypedDict,
|
||||
Effort,
|
||||
Quantizations,
|
||||
Reasoning,
|
||||
ReasoningTypedDict,
|
||||
Sort,
|
||||
)
|
||||
from .chatgenerationtokenusage import (
|
||||
ChatGenerationTokenUsage,
|
||||
@@ -444,34 +421,18 @@ if TYPE_CHECKING:
|
||||
OpenResponsesReasoningSummaryTextDoneEventTypedDict,
|
||||
)
|
||||
from .openresponsesrequest import (
|
||||
Engine,
|
||||
IDFileParser,
|
||||
IDModeration,
|
||||
IDResponseHealing,
|
||||
IDWeb,
|
||||
Ignore,
|
||||
IgnoreTypedDict,
|
||||
MaxPrice,
|
||||
MaxPriceTypedDict,
|
||||
Only,
|
||||
OnlyTypedDict,
|
||||
OpenResponsesRequest,
|
||||
OpenResponsesRequestEngine,
|
||||
OpenResponsesRequestMaxPrice,
|
||||
OpenResponsesRequestMaxPriceTypedDict,
|
||||
OpenResponsesRequestPdf,
|
||||
OpenResponsesRequestPdfEngine,
|
||||
OpenResponsesRequestPdfTypedDict,
|
||||
OpenResponsesRequestPluginFileParser,
|
||||
OpenResponsesRequestPluginFileParserTypedDict,
|
||||
OpenResponsesRequestPluginModeration,
|
||||
OpenResponsesRequestPluginModerationTypedDict,
|
||||
OpenResponsesRequestPluginResponseHealing,
|
||||
OpenResponsesRequestPluginResponseHealingTypedDict,
|
||||
OpenResponsesRequestPluginUnion,
|
||||
OpenResponsesRequestPluginUnionTypedDict,
|
||||
OpenResponsesRequestPluginWeb,
|
||||
OpenResponsesRequestPluginWebTypedDict,
|
||||
OpenResponsesRequestProvider,
|
||||
OpenResponsesRequestProviderTypedDict,
|
||||
OpenResponsesRequestRoute,
|
||||
OpenResponsesRequestToolFunction,
|
||||
OpenResponsesRequestToolFunctionTypedDict,
|
||||
OpenResponsesRequestToolUnion,
|
||||
@@ -480,6 +441,21 @@ if TYPE_CHECKING:
|
||||
OpenResponsesRequestTypedDict,
|
||||
Order,
|
||||
OrderTypedDict,
|
||||
Pdf,
|
||||
PdfEngine,
|
||||
PdfTypedDict,
|
||||
Plugin,
|
||||
PluginFileParser,
|
||||
PluginFileParserTypedDict,
|
||||
PluginModeration,
|
||||
PluginModerationTypedDict,
|
||||
PluginResponseHealing,
|
||||
PluginResponseHealingTypedDict,
|
||||
PluginTypedDict,
|
||||
PluginWeb,
|
||||
PluginWebTypedDict,
|
||||
Provider,
|
||||
ProviderTypedDict,
|
||||
ServiceTier,
|
||||
Truncation,
|
||||
)
|
||||
@@ -834,25 +810,6 @@ __all__ = [
|
||||
"ChatErrorError",
|
||||
"ChatErrorErrorTypedDict",
|
||||
"ChatGenerationParams",
|
||||
"ChatGenerationParamsDataCollection",
|
||||
"ChatGenerationParamsEngine",
|
||||
"ChatGenerationParamsMaxPrice",
|
||||
"ChatGenerationParamsMaxPriceTypedDict",
|
||||
"ChatGenerationParamsPdf",
|
||||
"ChatGenerationParamsPdfEngine",
|
||||
"ChatGenerationParamsPdfTypedDict",
|
||||
"ChatGenerationParamsPluginFileParser",
|
||||
"ChatGenerationParamsPluginFileParserTypedDict",
|
||||
"ChatGenerationParamsPluginModeration",
|
||||
"ChatGenerationParamsPluginModerationTypedDict",
|
||||
"ChatGenerationParamsPluginResponseHealing",
|
||||
"ChatGenerationParamsPluginResponseHealingTypedDict",
|
||||
"ChatGenerationParamsPluginUnion",
|
||||
"ChatGenerationParamsPluginUnionTypedDict",
|
||||
"ChatGenerationParamsPluginWeb",
|
||||
"ChatGenerationParamsPluginWebTypedDict",
|
||||
"ChatGenerationParamsProvider",
|
||||
"ChatGenerationParamsProviderTypedDict",
|
||||
"ChatGenerationParamsResponseFormatJSONObject",
|
||||
"ChatGenerationParamsResponseFormatJSONObjectTypedDict",
|
||||
"ChatGenerationParamsResponseFormatPython",
|
||||
@@ -861,7 +818,6 @@ __all__ = [
|
||||
"ChatGenerationParamsResponseFormatTextTypedDict",
|
||||
"ChatGenerationParamsResponseFormatUnion",
|
||||
"ChatGenerationParamsResponseFormatUnionTypedDict",
|
||||
"ChatGenerationParamsRoute",
|
||||
"ChatGenerationParamsStop",
|
||||
"ChatGenerationParamsStopTypedDict",
|
||||
"ChatGenerationParamsTypedDict",
|
||||
@@ -954,6 +910,7 @@ __all__ = [
|
||||
"EdgeNetworkTimeoutResponseErrorDataTypedDict",
|
||||
"Effort",
|
||||
"EndpointStatus",
|
||||
"Engine",
|
||||
"FileCitation",
|
||||
"FileCitationType",
|
||||
"FileCitationTypedDict",
|
||||
@@ -981,6 +938,8 @@ __all__ = [
|
||||
"JSONSchemaConfigTypedDict",
|
||||
"ListEndpointsResponse",
|
||||
"ListEndpointsResponseTypedDict",
|
||||
"MaxPrice",
|
||||
"MaxPriceTypedDict",
|
||||
"Message",
|
||||
"MessageContent",
|
||||
"MessageContentTypedDict",
|
||||
@@ -1153,25 +1112,6 @@ __all__ = [
|
||||
"OpenResponsesReasoningType",
|
||||
"OpenResponsesReasoningTypedDict",
|
||||
"OpenResponsesRequest",
|
||||
"OpenResponsesRequestEngine",
|
||||
"OpenResponsesRequestMaxPrice",
|
||||
"OpenResponsesRequestMaxPriceTypedDict",
|
||||
"OpenResponsesRequestPdf",
|
||||
"OpenResponsesRequestPdfEngine",
|
||||
"OpenResponsesRequestPdfTypedDict",
|
||||
"OpenResponsesRequestPluginFileParser",
|
||||
"OpenResponsesRequestPluginFileParserTypedDict",
|
||||
"OpenResponsesRequestPluginModeration",
|
||||
"OpenResponsesRequestPluginModerationTypedDict",
|
||||
"OpenResponsesRequestPluginResponseHealing",
|
||||
"OpenResponsesRequestPluginResponseHealingTypedDict",
|
||||
"OpenResponsesRequestPluginUnion",
|
||||
"OpenResponsesRequestPluginUnionTypedDict",
|
||||
"OpenResponsesRequestPluginWeb",
|
||||
"OpenResponsesRequestPluginWebTypedDict",
|
||||
"OpenResponsesRequestProvider",
|
||||
"OpenResponsesRequestProviderTypedDict",
|
||||
"OpenResponsesRequestRoute",
|
||||
"OpenResponsesRequestToolFunction",
|
||||
"OpenResponsesRequestToolFunctionTypedDict",
|
||||
"OpenResponsesRequestToolUnion",
|
||||
@@ -1265,25 +1205,39 @@ __all__ = [
|
||||
"PayloadTooLargeResponseErrorDataTypedDict",
|
||||
"PaymentRequiredResponseErrorData",
|
||||
"PaymentRequiredResponseErrorDataTypedDict",
|
||||
"Pdf",
|
||||
"PdfEngine",
|
||||
"PdfTypedDict",
|
||||
"PerRequestLimits",
|
||||
"PerRequestLimitsTypedDict",
|
||||
"Plugin",
|
||||
"PluginFileParser",
|
||||
"PluginFileParserTypedDict",
|
||||
"PluginModeration",
|
||||
"PluginModerationTypedDict",
|
||||
"PluginResponseHealing",
|
||||
"PluginResponseHealingTypedDict",
|
||||
"PluginTypedDict",
|
||||
"PluginWeb",
|
||||
"PluginWebTypedDict",
|
||||
"Pricing",
|
||||
"PricingTypedDict",
|
||||
"Prompt",
|
||||
"PromptTokensDetails",
|
||||
"PromptTokensDetailsTypedDict",
|
||||
"PromptTypedDict",
|
||||
"Provider",
|
||||
"ProviderName",
|
||||
"ProviderOverloadedResponseErrorData",
|
||||
"ProviderOverloadedResponseErrorDataTypedDict",
|
||||
"ProviderSort",
|
||||
"ProviderTypedDict",
|
||||
"PublicEndpoint",
|
||||
"PublicEndpointQuantization",
|
||||
"PublicEndpointTypedDict",
|
||||
"PublicPricing",
|
||||
"PublicPricingTypedDict",
|
||||
"Quantization",
|
||||
"Quantizations",
|
||||
"Reason",
|
||||
"Reasoning",
|
||||
"ReasoningSummaryText",
|
||||
@@ -1377,15 +1331,11 @@ __all__ = [
|
||||
"ResponsesWebSearchUserLocation",
|
||||
"ResponsesWebSearchUserLocationType",
|
||||
"ResponsesWebSearchUserLocationTypedDict",
|
||||
"Schema0",
|
||||
"Schema0Enum",
|
||||
"Schema0TypedDict",
|
||||
"Security",
|
||||
"SecurityTypedDict",
|
||||
"ServiceTier",
|
||||
"ServiceUnavailableResponseErrorData",
|
||||
"ServiceUnavailableResponseErrorDataTypedDict",
|
||||
"Sort",
|
||||
"StreamOptions",
|
||||
"StreamOptionsTypedDict",
|
||||
"SystemMessage",
|
||||
@@ -1453,9 +1403,6 @@ __all__ = [
|
||||
]
|
||||
|
||||
_dynamic_imports: dict[str, str] = {
|
||||
"Schema0": "._schema0",
|
||||
"Schema0Enum": "._schema0",
|
||||
"Schema0TypedDict": "._schema0",
|
||||
"ActivityItem": ".activityitem",
|
||||
"ActivityItemTypedDict": ".activityitem",
|
||||
"AssistantMessage": ".assistantmessage",
|
||||
@@ -1472,25 +1419,6 @@ _dynamic_imports: dict[str, str] = {
|
||||
"Code": ".chaterror",
|
||||
"CodeTypedDict": ".chaterror",
|
||||
"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",
|
||||
"ChatGenerationParamsResponseFormatJSONObjectTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsResponseFormatPython": ".chatgenerationparams",
|
||||
@@ -1499,17 +1427,14 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatGenerationParamsResponseFormatTextTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsResponseFormatUnion": ".chatgenerationparams",
|
||||
"ChatGenerationParamsResponseFormatUnionTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsRoute": ".chatgenerationparams",
|
||||
"ChatGenerationParamsStop": ".chatgenerationparams",
|
||||
"ChatGenerationParamsStopTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsTypedDict": ".chatgenerationparams",
|
||||
"Debug": ".chatgenerationparams",
|
||||
"DebugTypedDict": ".chatgenerationparams",
|
||||
"Effort": ".chatgenerationparams",
|
||||
"Quantizations": ".chatgenerationparams",
|
||||
"Reasoning": ".chatgenerationparams",
|
||||
"ReasoningTypedDict": ".chatgenerationparams",
|
||||
"Sort": ".chatgenerationparams",
|
||||
"ChatGenerationTokenUsage": ".chatgenerationtokenusage",
|
||||
"ChatGenerationTokenUsageTypedDict": ".chatgenerationtokenusage",
|
||||
"CompletionTokensDetails": ".chatgenerationtokenusage",
|
||||
@@ -1801,34 +1726,18 @@ _dynamic_imports: dict[str, str] = {
|
||||
"OpenResponsesReasoningSummaryTextDoneEvent": ".openresponsesreasoningsummarytextdoneevent",
|
||||
"OpenResponsesReasoningSummaryTextDoneEventType": ".openresponsesreasoningsummarytextdoneevent",
|
||||
"OpenResponsesReasoningSummaryTextDoneEventTypedDict": ".openresponsesreasoningsummarytextdoneevent",
|
||||
"Engine": ".openresponsesrequest",
|
||||
"IDFileParser": ".openresponsesrequest",
|
||||
"IDModeration": ".openresponsesrequest",
|
||||
"IDResponseHealing": ".openresponsesrequest",
|
||||
"IDWeb": ".openresponsesrequest",
|
||||
"Ignore": ".openresponsesrequest",
|
||||
"IgnoreTypedDict": ".openresponsesrequest",
|
||||
"MaxPrice": ".openresponsesrequest",
|
||||
"MaxPriceTypedDict": ".openresponsesrequest",
|
||||
"Only": ".openresponsesrequest",
|
||||
"OnlyTypedDict": ".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",
|
||||
"OpenResponsesRequestToolFunctionTypedDict": ".openresponsesrequest",
|
||||
"OpenResponsesRequestToolUnion": ".openresponsesrequest",
|
||||
@@ -1837,6 +1746,21 @@ _dynamic_imports: dict[str, str] = {
|
||||
"OpenResponsesRequestTypedDict": ".openresponsesrequest",
|
||||
"Order": ".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",
|
||||
"Truncation": ".openresponsesrequest",
|
||||
"OpenResponsesResponseText": ".openresponsesresponsetext",
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
"""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,7 +1,6 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from ._schema0 import Schema0, Schema0TypedDict
|
||||
from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict
|
||||
from .message import Message, MessageTypedDict
|
||||
from .reasoningsummaryverbosity import ReasoningSummaryVerbosity
|
||||
@@ -30,347 +29,6 @@ from typing import Any, Dict, List, Literal, Optional, Union
|
||||
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[
|
||||
Literal[
|
||||
"none",
|
||||
@@ -378,7 +36,6 @@ Effort = Union[
|
||||
"low",
|
||||
"medium",
|
||||
"high",
|
||||
"xhigh",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
@@ -509,15 +166,6 @@ class Debug(BaseModel):
|
||||
|
||||
class ChatGenerationParamsTypedDict(TypedDict):
|
||||
messages: List[MessageTypedDict]
|
||||
provider: NotRequired[Nullable[ChatGenerationParamsProviderTypedDict]]
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
plugins: NotRequired[List[ChatGenerationParamsPluginUnionTypedDict]]
|
||||
r"""Plugins you want to enable for this request, including their settings."""
|
||||
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]
|
||||
models: NotRequired[List[str]]
|
||||
frequency_penalty: NotRequired[Nullable[float]]
|
||||
@@ -538,29 +186,13 @@ class ChatGenerationParamsTypedDict(TypedDict):
|
||||
tool_choice: NotRequired[Any]
|
||||
tools: NotRequired[List[ToolDefinitionJSONTypedDict]]
|
||||
top_p: NotRequired[Nullable[float]]
|
||||
user: NotRequired[str]
|
||||
debug: NotRequired[DebugTypedDict]
|
||||
|
||||
|
||||
class ChatGenerationParams(BaseModel):
|
||||
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
|
||||
|
||||
models: Optional[List[str]] = None
|
||||
@@ -601,16 +233,13 @@ class ChatGenerationParams(BaseModel):
|
||||
|
||||
top_p: OptionalNullable[float] = UNSET
|
||||
|
||||
user: Optional[str] = None
|
||||
|
||||
debug: Optional[Debug] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"provider",
|
||||
"plugins",
|
||||
"route",
|
||||
"user",
|
||||
"session_id",
|
||||
"model",
|
||||
"models",
|
||||
"frequency_penalty",
|
||||
@@ -631,11 +260,10 @@ class ChatGenerationParams(BaseModel):
|
||||
"tool_choice",
|
||||
"tools",
|
||||
"top_p",
|
||||
"user",
|
||||
"debug",
|
||||
]
|
||||
nullable_fields = [
|
||||
"provider",
|
||||
"route",
|
||||
"frequency_penalty",
|
||||
"logit_bias",
|
||||
"logprobs",
|
||||
|
||||
@@ -7,7 +7,6 @@ from typing import Literal, Union
|
||||
|
||||
OpenAIResponsesReasoningEffort = Union[
|
||||
Literal[
|
||||
"xhigh",
|
||||
"high",
|
||||
"medium",
|
||||
"low",
|
||||
|
||||
@@ -175,41 +175,41 @@ Ignore = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
class OpenResponsesRequestMaxPriceTypedDict(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."""
|
||||
|
||||
prompt: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
completion: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
image: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
audio: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
request: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
prompt: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
completion: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
audio: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
request: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
|
||||
class OpenResponsesRequestMaxPrice(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."""
|
||||
|
||||
prompt: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
prompt: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
completion: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
completion: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
image: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
audio: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
audio: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
request: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
request: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
|
||||
class OpenResponsesRequestProviderTypedDict(TypedDict):
|
||||
class ProviderTypedDict(TypedDict):
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
|
||||
allow_fallbacks: NotRequired[Nullable[bool]]
|
||||
@@ -240,15 +240,11 @@ class OpenResponsesRequestProviderTypedDict(TypedDict):
|
||||
r"""A list of quantization levels to filter the provider by."""
|
||||
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."""
|
||||
max_price: NotRequired[OpenResponsesRequestMaxPriceTypedDict]
|
||||
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."""
|
||||
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 OpenResponsesRequestProvider(BaseModel):
|
||||
class Provider(BaseModel):
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
|
||||
allow_fallbacks: OptionalNullable[bool] = UNSET
|
||||
@@ -295,15 +291,9 @@ class OpenResponsesRequestProvider(BaseModel):
|
||||
] = 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[OpenResponsesRequestMaxPrice] = 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."""
|
||||
|
||||
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 = [
|
||||
@@ -318,8 +308,6 @@ class OpenResponsesRequestProvider(BaseModel):
|
||||
"quantizations",
|
||||
"sort",
|
||||
"max_price",
|
||||
"min_throughput",
|
||||
"max_latency",
|
||||
]
|
||||
nullable_fields = [
|
||||
"allow_fallbacks",
|
||||
@@ -332,8 +320,6 @@ class OpenResponsesRequestProvider(BaseModel):
|
||||
"ignore",
|
||||
"quantizations",
|
||||
"sort",
|
||||
"min_throughput",
|
||||
"max_latency",
|
||||
]
|
||||
null_default_fields = []
|
||||
|
||||
@@ -365,23 +351,18 @@ class OpenResponsesRequestProvider(BaseModel):
|
||||
IDResponseHealing = Literal["response-healing",]
|
||||
|
||||
|
||||
class OpenResponsesRequestPluginResponseHealingTypedDict(TypedDict):
|
||||
id: IDResponseHealing
|
||||
enabled: NotRequired[bool]
|
||||
r"""Set to false to disable the response-healing plugin for this request. Defaults to true."""
|
||||
|
||||
|
||||
class OpenResponsesRequestPluginResponseHealing(BaseModel):
|
||||
class PluginResponseHealingTypedDict(TypedDict):
|
||||
id: IDResponseHealing
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
r"""Set to false to disable the response-healing plugin for this request. Defaults to true."""
|
||||
|
||||
class PluginResponseHealing(BaseModel):
|
||||
id: IDResponseHealing
|
||||
|
||||
|
||||
IDFileParser = Literal["file-parser",]
|
||||
|
||||
|
||||
OpenResponsesRequestPdfEngine = Union[
|
||||
PdfEngine = Union[
|
||||
Literal[
|
||||
"mistral-ocr",
|
||||
"pdf-text",
|
||||
@@ -391,40 +372,34 @@ OpenResponsesRequestPdfEngine = Union[
|
||||
]
|
||||
|
||||
|
||||
class OpenResponsesRequestPdfTypedDict(TypedDict):
|
||||
engine: NotRequired[OpenResponsesRequestPdfEngine]
|
||||
class PdfTypedDict(TypedDict):
|
||||
engine: NotRequired[PdfEngine]
|
||||
|
||||
|
||||
class OpenResponsesRequestPdf(BaseModel):
|
||||
class Pdf(BaseModel):
|
||||
engine: Annotated[
|
||||
Optional[OpenResponsesRequestPdfEngine],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
Optional[PdfEngine], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
|
||||
|
||||
class OpenResponsesRequestPluginFileParserTypedDict(TypedDict):
|
||||
class PluginFileParserTypedDict(TypedDict):
|
||||
id: IDFileParser
|
||||
enabled: NotRequired[bool]
|
||||
r"""Set to false to disable the file-parser plugin for this request. Defaults to true."""
|
||||
max_files: NotRequired[float]
|
||||
pdf: NotRequired[OpenResponsesRequestPdfTypedDict]
|
||||
pdf: NotRequired[PdfTypedDict]
|
||||
|
||||
|
||||
class OpenResponsesRequestPluginFileParser(BaseModel):
|
||||
class PluginFileParser(BaseModel):
|
||||
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
|
||||
|
||||
pdf: Optional[OpenResponsesRequestPdf] = None
|
||||
pdf: Optional[Pdf] = None
|
||||
|
||||
|
||||
IDWeb = Literal["web",]
|
||||
|
||||
|
||||
OpenResponsesRequestEngine = Union[
|
||||
Engine = Union[
|
||||
Literal[
|
||||
"native",
|
||||
"exa",
|
||||
@@ -433,73 +408,58 @@ OpenResponsesRequestEngine = Union[
|
||||
]
|
||||
|
||||
|
||||
class OpenResponsesRequestPluginWebTypedDict(TypedDict):
|
||||
class PluginWebTypedDict(TypedDict):
|
||||
id: IDWeb
|
||||
enabled: NotRequired[bool]
|
||||
r"""Set to false to disable the web-search plugin for this request. Defaults to true."""
|
||||
max_results: NotRequired[float]
|
||||
search_prompt: NotRequired[str]
|
||||
engine: NotRequired[OpenResponsesRequestEngine]
|
||||
engine: NotRequired[Engine]
|
||||
|
||||
|
||||
class OpenResponsesRequestPluginWeb(BaseModel):
|
||||
class PluginWeb(BaseModel):
|
||||
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
|
||||
|
||||
search_prompt: Optional[str] = None
|
||||
|
||||
engine: Annotated[
|
||||
Optional[OpenResponsesRequestEngine], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
engine: Annotated[Optional[Engine], PlainValidator(validate_open_enum(False))] = (
|
||||
None
|
||||
)
|
||||
|
||||
|
||||
IDModeration = Literal["moderation",]
|
||||
|
||||
|
||||
class OpenResponsesRequestPluginModerationTypedDict(TypedDict):
|
||||
class PluginModerationTypedDict(TypedDict):
|
||||
id: IDModeration
|
||||
|
||||
|
||||
class OpenResponsesRequestPluginModeration(BaseModel):
|
||||
class PluginModeration(BaseModel):
|
||||
id: IDModeration
|
||||
|
||||
|
||||
OpenResponsesRequestPluginUnionTypedDict = TypeAliasType(
|
||||
"OpenResponsesRequestPluginUnionTypedDict",
|
||||
PluginTypedDict = TypeAliasType(
|
||||
"PluginTypedDict",
|
||||
Union[
|
||||
OpenResponsesRequestPluginModerationTypedDict,
|
||||
OpenResponsesRequestPluginResponseHealingTypedDict,
|
||||
OpenResponsesRequestPluginFileParserTypedDict,
|
||||
OpenResponsesRequestPluginWebTypedDict,
|
||||
PluginModerationTypedDict,
|
||||
PluginResponseHealingTypedDict,
|
||||
PluginFileParserTypedDict,
|
||||
PluginWebTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
OpenResponsesRequestPluginUnion = Annotated[
|
||||
Plugin = Annotated[
|
||||
Union[
|
||||
Annotated[OpenResponsesRequestPluginModeration, Tag("moderation")],
|
||||
Annotated[OpenResponsesRequestPluginWeb, Tag("web")],
|
||||
Annotated[OpenResponsesRequestPluginFileParser, Tag("file-parser")],
|
||||
Annotated[OpenResponsesRequestPluginResponseHealing, Tag("response-healing")],
|
||||
Annotated[PluginModeration, Tag("moderation")],
|
||||
Annotated[PluginWeb, Tag("web")],
|
||||
Annotated[PluginFileParser, Tag("file-parser")],
|
||||
Annotated[PluginResponseHealing, Tag("response-healing")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "id", "id")),
|
||||
]
|
||||
|
||||
|
||||
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):
|
||||
r"""Request schema for Responses endpoint"""
|
||||
|
||||
@@ -531,16 +491,12 @@ class OpenResponsesRequestTypedDict(TypedDict):
|
||||
service_tier: NotRequired[ServiceTier]
|
||||
truncation: NotRequired[Nullable[Truncation]]
|
||||
stream: NotRequired[bool]
|
||||
provider: NotRequired[Nullable[OpenResponsesRequestProviderTypedDict]]
|
||||
provider: NotRequired[Nullable[ProviderTypedDict]]
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
plugins: NotRequired[List[OpenResponsesRequestPluginUnionTypedDict]]
|
||||
plugins: NotRequired[List[PluginTypedDict]]
|
||||
r"""Plugins you want to enable for this request, including their settings."""
|
||||
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]
|
||||
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):
|
||||
@@ -609,24 +565,15 @@ class OpenResponsesRequest(BaseModel):
|
||||
|
||||
stream: Optional[bool] = False
|
||||
|
||||
provider: OptionalNullable[OpenResponsesRequestProvider] = UNSET
|
||||
provider: OptionalNullable[Provider] = UNSET
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
|
||||
plugins: Optional[List[OpenResponsesRequestPluginUnion]] = None
|
||||
plugins: Optional[List[Plugin]] = None
|
||||
r"""Plugins you want to enable for this request, including their settings."""
|
||||
|
||||
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
|
||||
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")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
@@ -656,9 +603,7 @@ class OpenResponsesRequest(BaseModel):
|
||||
"stream",
|
||||
"provider",
|
||||
"plugins",
|
||||
"route",
|
||||
"user",
|
||||
"session_id",
|
||||
]
|
||||
nullable_fields = [
|
||||
"instructions",
|
||||
@@ -676,7 +621,6 @@ class OpenResponsesRequest(BaseModel):
|
||||
"safety_identifier",
|
||||
"truncation",
|
||||
"provider",
|
||||
"route",
|
||||
]
|
||||
null_default_fields = []
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ ProviderName = Union[
|
||||
"Infermatic",
|
||||
"Inflection",
|
||||
"Liquid",
|
||||
"Mara",
|
||||
"Mancer 2",
|
||||
"Minimax",
|
||||
"ModelRun",
|
||||
@@ -64,7 +63,6 @@ ProviderName = Union[
|
||||
"Relace",
|
||||
"SambaNova",
|
||||
"SiliconFlow",
|
||||
"Sourceful",
|
||||
"Stealth",
|
||||
"StreamLake",
|
||||
"Switchpoint",
|
||||
@@ -72,7 +70,6 @@ ProviderName = Union[
|
||||
"Together",
|
||||
"Venice",
|
||||
"WandB",
|
||||
"Xiaomi",
|
||||
"xAI",
|
||||
"Z.AI",
|
||||
"FakeProvider",
|
||||
|
||||
@@ -8,74 +8,74 @@ from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedSt
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import List, Literal, Optional, Union
|
||||
from typing import Any, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class PricingTypedDict(TypedDict):
|
||||
prompt: str
|
||||
r"""A value in string format that is a large number"""
|
||||
completion: str
|
||||
r"""A value in string format that is a large number"""
|
||||
request: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
image: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
image_token: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
image_output: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
audio: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
input_audio_cache: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
web_search: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
internal_reasoning: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
input_cache_read: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
input_cache_write: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
prompt: Any
|
||||
r"""A value in string or number format that is a large number"""
|
||||
completion: Any
|
||||
r"""A value in string or number format that is a large number"""
|
||||
request: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_token: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_output: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
audio: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
input_audio_cache: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
web_search: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
internal_reasoning: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
input_cache_read: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
input_cache_write: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
discount: NotRequired[float]
|
||||
|
||||
|
||||
class Pricing(BaseModel):
|
||||
prompt: str
|
||||
r"""A value in string format that is a large number"""
|
||||
prompt: Any
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
completion: str
|
||||
r"""A value in string format that is a large number"""
|
||||
completion: Any
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
request: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
request: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
image: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_token: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
image_token: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_output: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
image_output: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
audio: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
audio: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
input_audio_cache: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
input_audio_cache: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
web_search: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
web_search: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
internal_reasoning: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
internal_reasoning: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
input_cache_read: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
input_cache_read: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
input_cache_write: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
input_cache_write: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
discount: Optional[float] = None
|
||||
|
||||
|
||||
@@ -2,77 +2,77 @@
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Optional
|
||||
from typing import Any, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class PublicPricingTypedDict(TypedDict):
|
||||
r"""Pricing information for the model"""
|
||||
|
||||
prompt: str
|
||||
r"""A value in string format that is a large number"""
|
||||
completion: str
|
||||
r"""A value in string format that is a large number"""
|
||||
request: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
image: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
image_token: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
image_output: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
audio: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
input_audio_cache: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
web_search: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
internal_reasoning: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
input_cache_read: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
input_cache_write: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
prompt: Any
|
||||
r"""A value in string or number format that is a large number"""
|
||||
completion: Any
|
||||
r"""A value in string or number format that is a large number"""
|
||||
request: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_token: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_output: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
audio: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
input_audio_cache: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
web_search: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
internal_reasoning: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
input_cache_read: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
input_cache_write: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
discount: NotRequired[float]
|
||||
|
||||
|
||||
class PublicPricing(BaseModel):
|
||||
r"""Pricing information for the model"""
|
||||
|
||||
prompt: str
|
||||
r"""A value in string format that is a large number"""
|
||||
prompt: Any
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
completion: str
|
||||
r"""A value in string format that is a large number"""
|
||||
completion: Any
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
request: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
request: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
image: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_token: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
image_token: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_output: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
image_output: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
audio: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
audio: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
input_audio_cache: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
input_audio_cache: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
web_search: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
web_search: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
internal_reasoning: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
internal_reasoning: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
input_cache_read: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
input_cache_read: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
input_cache_write: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
input_cache_write: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
discount: Optional[float] = None
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from .basesdk import BaseSDK
|
||||
from enum import Enum
|
||||
from openrouter import components, errors, operations, utils
|
||||
from openrouter._hooks import HookContext
|
||||
from openrouter.types import OptionalNullable, UNSET
|
||||
@@ -10,11 +9,6 @@ from openrouter.utils.unmarshal_json_response import unmarshal_json_response
|
||||
from typing import Any, Mapping, Optional, Union
|
||||
|
||||
|
||||
class GenerateAcceptEnum(str, Enum):
|
||||
APPLICATION_JSON = "application/json"
|
||||
TEXT_EVENT_STREAM = "text/event-stream"
|
||||
|
||||
|
||||
class Embeddings(BaseSDK):
|
||||
r"""Text embedding endpoints"""
|
||||
|
||||
@@ -36,7 +30,6 @@ class Embeddings(BaseSDK):
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
accept_header_override: Optional[GenerateAcceptEnum] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> operations.CreateEmbeddingsResponse:
|
||||
r"""Submit an embedding request
|
||||
@@ -53,7 +46,6 @@ class Embeddings(BaseSDK):
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param accept_header_override: Override the default accept header for this method
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
@@ -88,9 +80,7 @@ class Embeddings(BaseSDK):
|
||||
request_has_path_params=False,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value=accept_header_override.value
|
||||
if accept_header_override is not None
|
||||
else "application/json;q=1, text/event-stream;q=0",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
@@ -139,10 +129,8 @@ class Embeddings(BaseSDK):
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(
|
||||
operations.CreateEmbeddingsResponseBody, http_res
|
||||
operations.CreateEmbeddingsResponse, 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"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.BadRequestResponseErrorData, http_res
|
||||
@@ -224,7 +212,6 @@ class Embeddings(BaseSDK):
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
accept_header_override: Optional[GenerateAcceptEnum] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> operations.CreateEmbeddingsResponse:
|
||||
r"""Submit an embedding request
|
||||
@@ -241,7 +228,6 @@ class Embeddings(BaseSDK):
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param accept_header_override: Override the default accept header for this method
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
@@ -276,9 +262,7 @@ class Embeddings(BaseSDK):
|
||||
request_has_path_params=False,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value=accept_header_override.value
|
||||
if accept_header_override is not None
|
||||
else "application/json;q=1, text/event-stream;q=0",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
@@ -327,10 +311,8 @@ class Embeddings(BaseSDK):
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(
|
||||
operations.CreateEmbeddingsResponseBody, http_res
|
||||
operations.CreateEmbeddingsResponse, 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"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.BadRequestResponseErrorData, http_res
|
||||
|
||||
@@ -45,8 +45,6 @@ if TYPE_CHECKING:
|
||||
CreateEmbeddingsRequest,
|
||||
CreateEmbeddingsRequestTypedDict,
|
||||
CreateEmbeddingsResponse,
|
||||
CreateEmbeddingsResponseBody,
|
||||
CreateEmbeddingsResponseBodyTypedDict,
|
||||
CreateEmbeddingsResponseTypedDict,
|
||||
Embedding,
|
||||
EmbeddingTypedDict,
|
||||
@@ -221,8 +219,6 @@ __all__ = [
|
||||
"CreateEmbeddingsRequest",
|
||||
"CreateEmbeddingsRequestTypedDict",
|
||||
"CreateEmbeddingsResponse",
|
||||
"CreateEmbeddingsResponseBody",
|
||||
"CreateEmbeddingsResponseBodyTypedDict",
|
||||
"CreateEmbeddingsResponseTypedDict",
|
||||
"CreateKeysData",
|
||||
"CreateKeysDataTypedDict",
|
||||
@@ -377,8 +373,6 @@ _dynamic_imports: dict[str, str] = {
|
||||
"CreateEmbeddingsRequest": ".createembeddings",
|
||||
"CreateEmbeddingsRequestTypedDict": ".createembeddings",
|
||||
"CreateEmbeddingsResponse": ".createembeddings",
|
||||
"CreateEmbeddingsResponseBody": ".createembeddings",
|
||||
"CreateEmbeddingsResponseBodyTypedDict": ".createembeddings",
|
||||
"CreateEmbeddingsResponseTypedDict": ".createembeddings",
|
||||
"Embedding": ".createembeddings",
|
||||
"EmbeddingTypedDict": ".createembeddings",
|
||||
|
||||
@@ -18,7 +18,7 @@ from openrouter.types import (
|
||||
from openrouter.utils import get_discriminator, validate_open_enum
|
||||
from pydantic import Discriminator, Tag, model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import List, Literal, Optional, Union
|
||||
from typing import Any, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
@@ -154,35 +154,35 @@ Ignore = TypeAliasType(
|
||||
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."""
|
||||
|
||||
prompt: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
completion: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
image: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
audio: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
request: NotRequired[str]
|
||||
r"""A value in string format that is a large number"""
|
||||
prompt: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
completion: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
audio: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
request: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
|
||||
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."""
|
||||
|
||||
prompt: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
prompt: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
completion: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
completion: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
image: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
audio: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
audio: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
request: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
request: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
|
||||
class CreateEmbeddingsProviderTypedDict(TypedDict):
|
||||
@@ -216,10 +216,6 @@ class CreateEmbeddingsProviderTypedDict(TypedDict):
|
||||
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]
|
||||
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):
|
||||
@@ -277,12 +273,6 @@ class CreateEmbeddingsProvider(BaseModel):
|
||||
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."""
|
||||
|
||||
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 = [
|
||||
@@ -297,8 +287,6 @@ class CreateEmbeddingsProvider(BaseModel):
|
||||
"quantizations",
|
||||
"sort",
|
||||
"max_price",
|
||||
"min_throughput",
|
||||
"max_latency",
|
||||
]
|
||||
nullable_fields = [
|
||||
"allow_fallbacks",
|
||||
@@ -311,8 +299,6 @@ class CreateEmbeddingsProvider(BaseModel):
|
||||
"ignore",
|
||||
"quantizations",
|
||||
"sort",
|
||||
"min_throughput",
|
||||
"max_latency",
|
||||
]
|
||||
null_default_fields = []
|
||||
|
||||
@@ -409,7 +395,7 @@ class Usage(BaseModel):
|
||||
cost: Optional[float] = None
|
||||
|
||||
|
||||
class CreateEmbeddingsResponseBodyTypedDict(TypedDict):
|
||||
class CreateEmbeddingsResponseTypedDict(TypedDict):
|
||||
r"""Embedding response"""
|
||||
|
||||
object: Object
|
||||
@@ -419,7 +405,7 @@ class CreateEmbeddingsResponseBodyTypedDict(TypedDict):
|
||||
usage: NotRequired[UsageTypedDict]
|
||||
|
||||
|
||||
class CreateEmbeddingsResponseBody(BaseModel):
|
||||
class CreateEmbeddingsResponse(BaseModel):
|
||||
r"""Embedding response"""
|
||||
|
||||
object: Object
|
||||
@@ -431,14 +417,3 @@ class CreateEmbeddingsResponseBody(BaseModel):
|
||||
id: Optional[str] = None
|
||||
|
||||
usage: Optional[Usage] = None
|
||||
|
||||
|
||||
CreateEmbeddingsResponseTypedDict = TypeAliasType(
|
||||
"CreateEmbeddingsResponseTypedDict",
|
||||
Union[CreateEmbeddingsResponseBodyTypedDict, str],
|
||||
)
|
||||
|
||||
|
||||
CreateEmbeddingsResponse = TypeAliasType(
|
||||
"CreateEmbeddingsResponse", Union[CreateEmbeddingsResponseBody, str]
|
||||
)
|
||||
|
||||
@@ -70,7 +70,6 @@ GetParametersProvider = Union[
|
||||
"Infermatic",
|
||||
"Inflection",
|
||||
"Liquid",
|
||||
"Mara",
|
||||
"Mancer 2",
|
||||
"Minimax",
|
||||
"ModelRun",
|
||||
@@ -91,7 +90,6 @@ GetParametersProvider = Union[
|
||||
"Relace",
|
||||
"SambaNova",
|
||||
"SiliconFlow",
|
||||
"Sourceful",
|
||||
"Stealth",
|
||||
"StreamLake",
|
||||
"Switchpoint",
|
||||
@@ -99,7 +97,6 @@ GetParametersProvider = Union[
|
||||
"Together",
|
||||
"Venice",
|
||||
"WandB",
|
||||
"Xiaomi",
|
||||
"xAI",
|
||||
"Z.AI",
|
||||
"FakeProvider",
|
||||
|
||||
@@ -105,7 +105,7 @@ class UpdateKeysRequestBody(BaseModel):
|
||||
class UpdateKeysRequestTypedDict(TypedDict):
|
||||
hash: str
|
||||
r"""The hash identifier of the API key to update"""
|
||||
request_body: UpdateKeysRequestBodyTypedDict
|
||||
body: UpdateKeysRequestBodyTypedDict
|
||||
|
||||
|
||||
class UpdateKeysRequest(BaseModel):
|
||||
@@ -114,7 +114,7 @@ class UpdateKeysRequest(BaseModel):
|
||||
]
|
||||
r"""The hash identifier of the API key to update"""
|
||||
|
||||
request_body: Annotated[
|
||||
body: Annotated[
|
||||
UpdateKeysRequestBody,
|
||||
FieldMetadata(request=RequestMetadata(media_type="application/json")),
|
||||
]
|
||||
|
||||
+16
-80
@@ -73,20 +73,12 @@ class Responses(BaseSDK):
|
||||
truncation: OptionalNullable[components.Truncation] = UNSET,
|
||||
stream: Union[Literal[False], None] = None,
|
||||
provider: OptionalNullable[
|
||||
Union[
|
||||
components.OpenResponsesRequestProvider,
|
||||
components.OpenResponsesRequestProviderTypedDict,
|
||||
]
|
||||
Union[components.Provider, components.ProviderTypedDict]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[
|
||||
List[components.OpenResponsesRequestPluginUnion],
|
||||
List[components.OpenResponsesRequestPluginUnionTypedDict],
|
||||
]
|
||||
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
||||
] = None,
|
||||
route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -121,9 +113,7 @@ class Responses(BaseSDK):
|
||||
:param stream:
|
||||
: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: 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 server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -186,20 +176,12 @@ class Responses(BaseSDK):
|
||||
truncation: OptionalNullable[components.Truncation] = UNSET,
|
||||
stream: Literal[True],
|
||||
provider: OptionalNullable[
|
||||
Union[
|
||||
components.OpenResponsesRequestProvider,
|
||||
components.OpenResponsesRequestProviderTypedDict,
|
||||
]
|
||||
Union[components.Provider, components.ProviderTypedDict]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[
|
||||
List[components.OpenResponsesRequestPluginUnion],
|
||||
List[components.OpenResponsesRequestPluginUnionTypedDict],
|
||||
]
|
||||
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
||||
] = None,
|
||||
route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -234,9 +216,7 @@ class Responses(BaseSDK):
|
||||
:param stream:
|
||||
: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: 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 server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -298,20 +278,12 @@ class Responses(BaseSDK):
|
||||
truncation: OptionalNullable[components.Truncation] = UNSET,
|
||||
stream: Optional[bool] = False,
|
||||
provider: OptionalNullable[
|
||||
Union[
|
||||
components.OpenResponsesRequestProvider,
|
||||
components.OpenResponsesRequestProviderTypedDict,
|
||||
]
|
||||
Union[components.Provider, components.ProviderTypedDict]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[
|
||||
List[components.OpenResponsesRequestPluginUnion],
|
||||
List[components.OpenResponsesRequestPluginUnionTypedDict],
|
||||
]
|
||||
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
||||
] = None,
|
||||
route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -346,9 +318,7 @@ class Responses(BaseSDK):
|
||||
:param stream:
|
||||
: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: 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 server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -402,14 +372,12 @@ class Responses(BaseSDK):
|
||||
truncation=truncation,
|
||||
stream=stream,
|
||||
provider=utils.get_pydantic_model(
|
||||
provider, OptionalNullable[components.OpenResponsesRequestProvider]
|
||||
provider, OptionalNullable[components.Provider]
|
||||
),
|
||||
plugins=utils.get_pydantic_model(
|
||||
plugins, Optional[List[components.OpenResponsesRequestPluginUnion]]
|
||||
plugins, Optional[List[components.Plugin]]
|
||||
),
|
||||
route=route,
|
||||
user=user,
|
||||
session_id=session_id,
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
@@ -656,20 +624,12 @@ class Responses(BaseSDK):
|
||||
truncation: OptionalNullable[components.Truncation] = UNSET,
|
||||
stream: Union[Literal[False], None] = None,
|
||||
provider: OptionalNullable[
|
||||
Union[
|
||||
components.OpenResponsesRequestProvider,
|
||||
components.OpenResponsesRequestProviderTypedDict,
|
||||
]
|
||||
Union[components.Provider, components.ProviderTypedDict]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[
|
||||
List[components.OpenResponsesRequestPluginUnion],
|
||||
List[components.OpenResponsesRequestPluginUnionTypedDict],
|
||||
]
|
||||
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
||||
] = None,
|
||||
route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -704,9 +664,7 @@ class Responses(BaseSDK):
|
||||
:param stream:
|
||||
: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: 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 server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -769,20 +727,12 @@ class Responses(BaseSDK):
|
||||
truncation: OptionalNullable[components.Truncation] = UNSET,
|
||||
stream: Literal[True],
|
||||
provider: OptionalNullable[
|
||||
Union[
|
||||
components.OpenResponsesRequestProvider,
|
||||
components.OpenResponsesRequestProviderTypedDict,
|
||||
]
|
||||
Union[components.Provider, components.ProviderTypedDict]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[
|
||||
List[components.OpenResponsesRequestPluginUnion],
|
||||
List[components.OpenResponsesRequestPluginUnionTypedDict],
|
||||
]
|
||||
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
||||
] = None,
|
||||
route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -817,9 +767,7 @@ class Responses(BaseSDK):
|
||||
:param stream:
|
||||
: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: 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 server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -881,20 +829,12 @@ class Responses(BaseSDK):
|
||||
truncation: OptionalNullable[components.Truncation] = UNSET,
|
||||
stream: Optional[bool] = False,
|
||||
provider: OptionalNullable[
|
||||
Union[
|
||||
components.OpenResponsesRequestProvider,
|
||||
components.OpenResponsesRequestProviderTypedDict,
|
||||
]
|
||||
Union[components.Provider, components.ProviderTypedDict]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[
|
||||
List[components.OpenResponsesRequestPluginUnion],
|
||||
List[components.OpenResponsesRequestPluginUnionTypedDict],
|
||||
]
|
||||
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
||||
] = None,
|
||||
route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -929,9 +869,7 @@ class Responses(BaseSDK):
|
||||
:param stream:
|
||||
: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: 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 server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -985,14 +923,12 @@ class Responses(BaseSDK):
|
||||
truncation=truncation,
|
||||
stream=stream,
|
||||
provider=utils.get_pydantic_model(
|
||||
provider, OptionalNullable[components.OpenResponsesRequestProvider]
|
||||
provider, OptionalNullable[components.Provider]
|
||||
),
|
||||
plugins=utils.get_pydantic_model(
|
||||
plugins, Optional[List[components.OpenResponsesRequestPluginUnion]]
|
||||
plugins, Optional[List[components.Plugin]]
|
||||
),
|
||||
route=route,
|
||||
user=user,
|
||||
session_id=session_id,
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
|
||||
Reference in New Issue
Block a user