mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-31 12:30:30 +08:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d433ce35e8 | ||
|
|
61e5216764 | ||
|
|
67ef52b03e | ||
|
|
d4474da1b8 | ||
|
|
aed8199b2b | ||
|
|
06b2ccc54a | ||
|
|
6cd0d2a76d |
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(python3:*)"
|
||||
"Bash(python3:*)",
|
||||
"Bash(git push:*)",
|
||||
"Bash(gh pr create:*)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
|
||||
+68
-37
@@ -1,12 +1,12 @@
|
||||
lockVersion: 2.0.0
|
||||
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
|
||||
management:
|
||||
docChecksum: 4cc4a9d9115d0eca9a5eb4786505579d
|
||||
docChecksum: e929ecf569d79ab96a315332a4855566
|
||||
docVersion: 1.0.0
|
||||
speakeasyVersion: 1.658.2
|
||||
generationVersion: 2.755.9
|
||||
releaseVersion: 0.0.19
|
||||
configChecksum: 834d5c1cea368e35ab6535ffb2bf9e7a
|
||||
speakeasyVersion: 1.666.0
|
||||
generationVersion: 2.768.0
|
||||
releaseVersion: 0.0.22
|
||||
configChecksum: 0afda3910a58a8d797ac6674fa858711
|
||||
repoURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||
published: true
|
||||
@@ -15,7 +15,7 @@ features:
|
||||
acceptHeaders: 3.0.0
|
||||
additionalDependencies: 1.0.0
|
||||
constsAndDefaults: 1.0.5
|
||||
core: 5.23.9
|
||||
core: 5.23.13
|
||||
defaultEnabledRetries: 0.2.0
|
||||
deprecations: 3.0.2
|
||||
devContainers: 3.0.0
|
||||
@@ -27,6 +27,7 @@ features:
|
||||
globalSecurityCallbacks: 1.0.0
|
||||
globalSecurityFlattening: 1.0.0
|
||||
globalServerURLs: 3.2.0
|
||||
globals: 3.0.0
|
||||
groups: 3.0.1
|
||||
methodArguments: 1.0.2
|
||||
methodSecurity: 3.0.1
|
||||
@@ -34,8 +35,8 @@ features:
|
||||
nullables: 1.0.1
|
||||
openEnums: 1.0.1
|
||||
responseFormat: 1.0.1
|
||||
retries: 3.0.2
|
||||
sdkHooks: 1.1.0
|
||||
retries: 3.0.3
|
||||
sdkHooks: 1.2.0
|
||||
serverEvents: 1.0.11
|
||||
serverEventsSentinels: 0.1.0
|
||||
serverIDs: 3.0.0
|
||||
@@ -57,16 +58,28 @@ 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
|
||||
- docs/components/chatmessagecontentitemaudio.md
|
||||
- docs/components/chatmessagecontentitemaudioformat.md
|
||||
- docs/components/chatmessagecontentitemaudioinputaudio.md
|
||||
- docs/components/chatmessagecontentitemcachecontrol.md
|
||||
- docs/components/chatmessagecontentitemimage.md
|
||||
- docs/components/chatmessagecontentitemimagedetail.md
|
||||
- docs/components/chatmessagecontentitemtext.md
|
||||
@@ -105,11 +118,11 @@ generatedFiles:
|
||||
- docs/components/costdetails.md
|
||||
- docs/components/createchargerequest.md
|
||||
- docs/components/datacollection.md
|
||||
- docs/components/debug.md
|
||||
- docs/components/defaultparameters.md
|
||||
- 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
|
||||
@@ -117,6 +130,7 @@ generatedFiles:
|
||||
- docs/components/forbiddenresponseerrordata.md
|
||||
- docs/components/idfileparser.md
|
||||
- docs/components/idmoderation.md
|
||||
- docs/components/idresponsehealing.md
|
||||
- docs/components/idweb.md
|
||||
- docs/components/ignore.md
|
||||
- docs/components/imagegenerationstatus.md
|
||||
@@ -127,7 +141,6 @@ 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
|
||||
@@ -241,6 +254,17 @@ 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
|
||||
@@ -294,17 +318,10 @@ 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/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
|
||||
@@ -312,6 +329,7 @@ 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
|
||||
@@ -375,9 +393,12 @@ 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
|
||||
@@ -391,6 +412,7 @@ generatedFiles:
|
||||
- docs/components/toplogprob.md
|
||||
- docs/components/topproviderinfo.md
|
||||
- docs/components/truncation.md
|
||||
- docs/components/ttl.md
|
||||
- docs/components/type.md
|
||||
- docs/components/typeresponsecompleted.md
|
||||
- docs/components/typeresponsecontentpartadded.md
|
||||
@@ -436,6 +458,7 @@ generatedFiles:
|
||||
- docs/errors/toomanyrequestsresponseerror.md
|
||||
- docs/errors/unauthorizedresponseerror.md
|
||||
- docs/errors/unprocessableentityresponseerror.md
|
||||
- docs/models/internal/globals.md
|
||||
- docs/models/utils/retryconfig.md
|
||||
- docs/operations/apitype.md
|
||||
- docs/operations/calldata.md
|
||||
@@ -467,6 +490,7 @@ generatedFiles:
|
||||
- docs/operations/exchangeauthcodeforapikeycodechallengemethod.md
|
||||
- docs/operations/exchangeauthcodeforapikeyrequest.md
|
||||
- docs/operations/exchangeauthcodeforapikeyresponse.md
|
||||
- docs/operations/getcreditsdata.md
|
||||
- docs/operations/getcreditsresponse.md
|
||||
- docs/operations/getcurrentkeydata.md
|
||||
- docs/operations/getcurrentkeyresponse.md
|
||||
@@ -545,15 +569,18 @@ 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
|
||||
- src/openrouter/components/badrequestresponseerrordata.py
|
||||
- src/openrouter/components/chatcompletionfinishreason.py
|
||||
- src/openrouter/components/chaterror.py
|
||||
- src/openrouter/components/chatgenerationparams.py
|
||||
- src/openrouter/components/chatgenerationtokenusage.py
|
||||
- src/openrouter/components/chatmessagecontentitem.py
|
||||
- src/openrouter/components/chatmessagecontentitemaudio.py
|
||||
- src/openrouter/components/chatmessagecontentitemcachecontrol.py
|
||||
- src/openrouter/components/chatmessagecontentitemimage.py
|
||||
- src/openrouter/components/chatmessagecontentitemtext.py
|
||||
- src/openrouter/components/chatmessagecontentitemvideo.py
|
||||
@@ -562,6 +589,7 @@ generatedFiles:
|
||||
- src/openrouter/components/chatmessagetoolcall.py
|
||||
- src/openrouter/components/chatresponse.py
|
||||
- src/openrouter/components/chatresponsechoice.py
|
||||
- src/openrouter/components/chatstreamingchoice.py
|
||||
- src/openrouter/components/chatstreamingmessagechunk.py
|
||||
- src/openrouter/components/chatstreamingmessagetoolcall.py
|
||||
- src/openrouter/components/chatstreamingresponsechunk.py
|
||||
@@ -711,6 +739,9 @@ generatedFiles:
|
||||
- src/openrouter/errors/unprocessableentityresponse_error.py
|
||||
- src/openrouter/generations.py
|
||||
- src/openrouter/httpclient.py
|
||||
- src/openrouter/models/__init__.py
|
||||
- src/openrouter/models/internal/__init__.py
|
||||
- src/openrouter/models/internal/globals.py
|
||||
- src/openrouter/models_.py
|
||||
- src/openrouter/oauth.py
|
||||
- src/openrouter/operations/__init__.py
|
||||
@@ -764,10 +795,10 @@ examples:
|
||||
createResponses:
|
||||
speakeasy-default-create-responses:
|
||||
requestBody:
|
||||
application/json: {"input": [{"type": "message", "role": "user", "content": "Hello, how are you?"}], "tools": [{"type": "function", "name": "get_current_weather", "description": "Get the current weather in a given location", "parameters": {"type": "object", "properties": {"location": {"type": "string"}}}}], "model": "anthropic/claude-4.5-sonnet-20250929", "temperature": 0.7, "top_p": 0.9, "stream": false}
|
||||
application/json: {"store": false, "service_tier": "auto", "stream": false}
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"id": "resp-abc123", "object": "response", "created_at": 1704067200, "model": "gpt-4", "status": "completed", "output": [{"id": "msg-abc123", "role": "assistant", "type": "message", "status": "completed", "content": [{"type": "output_text", "text": "Hello! How can I help you today?", "annotations": []}]}], "error": null, "incomplete_details": null, "usage": {"input_tokens": 10, "input_tokens_details": {"cached_tokens": 0}, "output_tokens": 25, "output_tokens_details": {"reasoning_tokens": 0}, "total_tokens": 35}, "max_output_tokens": null, "temperature": null, "top_p": null, "instructions": null, "metadata": null, "tools": [], "tool_choice": "auto", "parallel_tool_calls": true}
|
||||
application/json: {"id": "resp-abc123", "object": "response", "created_at": 1704067200, "model": "gpt-4", "output": [{"id": "msg-abc123", "role": "assistant", "type": "message", "content": [{"type": "output_text", "text": "Hello! How can I help you today?"}]}], "error": null, "incomplete_details": null, "temperature": null, "top_p": null, "instructions": null, "metadata": null, "tools": [], "tool_choice": "auto", "parallel_tool_calls": true}
|
||||
"400":
|
||||
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
||||
"401":
|
||||
@@ -814,7 +845,7 @@ examples:
|
||||
speakeasy-default-get-credits:
|
||||
responses:
|
||||
"200":
|
||||
application/json: {}
|
||||
application/json: {"data": {"total_credits": 100.5, "total_usage": 25.75}}
|
||||
"401":
|
||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||
"403":
|
||||
@@ -839,7 +870,7 @@ examples:
|
||||
createEmbeddings:
|
||||
speakeasy-default-create-embeddings:
|
||||
requestBody:
|
||||
application/json: {"input": "<value>", "model": "Taurus", "provider": {"data_collection": "allow", "zdr": true, "enforce_distillable_text": true, "order": ["OpenAI"], "only": ["OpenAI"], "ignore": ["OpenAI"], "quantizations": ["fp16"], "sort": "price"}}
|
||||
application/json: {"input": "<value>", "model": "Taurus"}
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"object": "list", "data": [], "model": "Land Cruiser"}
|
||||
@@ -868,7 +899,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, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "pricing": {"prompt": "0.00003", "completion": "0.00006", "request": "0", "image": "0"}, "context_length": 8192, "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"context_length": 8192, "max_completion_tokens": 4096, "is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]}
|
||||
application/json: {"data": [{"id": "openai/gpt-4", "canonical_slug": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "context_length": 8192, "architecture": {"modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]}
|
||||
"400":
|
||||
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
||||
"500":
|
||||
@@ -908,7 +939,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, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "pricing": {"prompt": "0.00003", "completion": "0.00006", "request": "0", "image": "0"}, "context_length": 8192, "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"context_length": 8192, "max_completion_tokens": 4096, "is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]}
|
||||
application/json: {"data": [{"id": "openai/gpt-4", "canonical_slug": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "context_length": 8192, "architecture": {"modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]}
|
||||
"400":
|
||||
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
||||
"500":
|
||||
@@ -917,7 +948,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, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "pricing": {"prompt": "0.00003", "completion": "0.00006", "request": "0", "image": "0"}, "context_length": 8192, "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"context_length": 8192, "max_completion_tokens": 4096, "is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]}
|
||||
application/json: {"data": [{"id": "openai/gpt-4", "canonical_slug": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "context_length": 8192, "architecture": {"modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]}
|
||||
"401":
|
||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||
"500":
|
||||
@@ -930,7 +961,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", "request": "0", "image": "0"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "status": -3, "uptime_last_30m": 99.5, "supports_implicit_caching": true}]}}
|
||||
application/json: {"data": {"id": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "endpoints": [{"name": "OpenAI: GPT-4", "model_name": "GPT-4", "context_length": 8192, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "uptime_last_30m": 99.5, "supports_implicit_caching": true}]}}
|
||||
"404":
|
||||
application/json: {"error": {"code": 404, "message": "Resource not found"}}
|
||||
"500":
|
||||
@@ -939,7 +970,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", "request": "0", "image": "0"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens"], "status": 0, "uptime_last_30m": 99.5, "supports_implicit_caching": true}]}
|
||||
application/json: {"data": [{"name": "OpenAI: GPT-4", "model_name": "GPT-4", "context_length": 8192, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens"], "uptime_last_30m": 99.5, "supports_implicit_caching": true}]}
|
||||
"500":
|
||||
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
|
||||
getParameters:
|
||||
@@ -961,7 +992,7 @@ examples:
|
||||
speakeasy-default-list-providers:
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"data": [{"name": "OpenAI", "slug": "openai", "privacy_policy_url": "https://openai.com/privacy", "terms_of_service_url": "https://openai.com/terms", "status_page_url": "https://status.openai.com"}]}
|
||||
application/json: {"data": [{"name": "OpenAI", "slug": "openai", "privacy_policy_url": "https://openai.com/privacy"}]}
|
||||
"500":
|
||||
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
|
||||
list:
|
||||
@@ -972,7 +1003,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", "expires_at": "2027-12-31T23:59:59Z"}]}
|
||||
application/json: {"data": [{"hash": "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", "name": "My Production Key", "label": "Production API Key", "disabled": false, "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "include_byok_in_limit": false, "usage": 25.5, "usage_daily": 25.5, "usage_weekly": 25.5, "usage_monthly": 25.5, "byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_weekly": 17.38, "byok_usage_monthly": 17.38, "created_at": "2025-08-24T10:30:00Z", "updated_at": "2025-08-24T15:45:00Z"}]}
|
||||
"401":
|
||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||
"429":
|
||||
@@ -982,10 +1013,10 @@ examples:
|
||||
createKeys:
|
||||
speakeasy-default-create-keys:
|
||||
requestBody:
|
||||
application/json: {"name": "My New API Key", "limit": 50, "limit_reset": "monthly", "include_byok_in_limit": true, "expires_at": "2027-12-31T23:59:59Z"}
|
||||
application/json: {"name": "My New API Key"}
|
||||
responses:
|
||||
"201":
|
||||
application/json: {"data": {"hash": "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", "name": "My New API Key", "label": "My New API Key", "disabled": false, "limit": 50, "limit_remaining": 50, "limit_reset": "monthly", "include_byok_in_limit": true, "usage": 0, "usage_daily": 0, "usage_weekly": 0, "usage_monthly": 0, "byok_usage": 0, "byok_usage_daily": 0, "byok_usage_weekly": 0, "byok_usage_monthly": 0, "created_at": "2025-08-24T10:30:00Z", "updated_at": null, "expires_at": "2027-12-31T23:59:59Z"}, "key": "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"}
|
||||
application/json: {"data": {"hash": "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", "name": "My New API Key", "label": "My New API Key", "disabled": false, "limit": 50, "limit_remaining": 50, "limit_reset": "monthly", "include_byok_in_limit": true, "usage": 0, "usage_daily": 0, "usage_weekly": 0, "usage_monthly": 0, "byok_usage": 0, "byok_usage_daily": 0, "byok_usage_weekly": 0, "byok_usage_monthly": 0, "created_at": "2025-08-24T10:30:00Z", "updated_at": null}, "key": "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"}
|
||||
"400":
|
||||
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
||||
"401":
|
||||
@@ -1000,10 +1031,10 @@ examples:
|
||||
path:
|
||||
hash: "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"
|
||||
requestBody:
|
||||
application/json: {"name": "Updated API Key Name", "disabled": false, "limit": 75, "limit_reset": "daily", "include_byok_in_limit": true}
|
||||
application/json: {}
|
||||
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", "expires_at": null}}
|
||||
application/json: {"data": {"hash": "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", "name": "Updated API Key Name", "label": "Updated API Key Name", "disabled": false, "limit": 75, "limit_remaining": 49.5, "limit_reset": "daily", "include_byok_in_limit": true, "usage": 25.5, "usage_daily": 25.5, "usage_weekly": 25.5, "usage_monthly": 25.5, "byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_weekly": 17.38, "byok_usage_monthly": 17.38, "created_at": "2025-08-24T10:30:00Z", "updated_at": "2025-08-24T16:00:00Z"}}
|
||||
"400":
|
||||
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
||||
"401":
|
||||
@@ -1037,7 +1068,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", "expires_at": "2027-12-31T23:59:59Z"}}
|
||||
application/json: {"data": {"hash": "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", "name": "My Production Key", "label": "Production API Key", "disabled": false, "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "include_byok_in_limit": false, "usage": 25.5, "usage_daily": 25.5, "usage_weekly": 25.5, "usage_monthly": 25.5, "byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_weekly": 17.38, "byok_usage_monthly": 17.38, "created_at": "2025-08-24T10:30:00Z", "updated_at": "2025-08-24T15:45:00Z"}}
|
||||
"401":
|
||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||
"404":
|
||||
@@ -1050,7 +1081,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, "expires_at": "2027-12-31T23:59:59Z", "rate_limit": {"requests": 1000, "interval": "1h", "note": "This field is deprecated and safe to ignore."}}}
|
||||
application/json: {"data": {"label": "sk-or-v1-au78b3456789012345678901234567890", "limit": 100, "usage": 25.5, "usage_daily": 25.5, "usage_weekly": 25.5, "usage_monthly": 25.5, "byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_weekly": 17.38, "byok_usage_monthly": 17.38, "is_free_tier": false, "is_provisioning_key": false, "limit_remaining": 74.5, "limit_reset": "monthly", "include_byok_in_limit": false, "rate_limit": {"requests": 1000, "interval": "1h", "note": "This field is deprecated and safe to ignore."}}}
|
||||
"401":
|
||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||
"500":
|
||||
@@ -1058,7 +1089,7 @@ examples:
|
||||
exchangeAuthCodeForAPIKey:
|
||||
speakeasy-default-exchange-auth-code-for-API-key:
|
||||
requestBody:
|
||||
application/json: {"code": "auth_code_abc123def456", "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "code_challenge_method": "S256"}
|
||||
application/json: {"code": "auth_code_abc123def456"}
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"key": "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", "user_id": "user_2yOPcMpKoQhcd4bVgSMlELRaIah"}
|
||||
@@ -1071,7 +1102,7 @@ examples:
|
||||
createAuthKeysCode:
|
||||
speakeasy-default-create-auth-keys-code:
|
||||
requestBody:
|
||||
application/json: {"callback_url": "https://myapp.com/auth/callback", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "code_challenge_method": "S256", "limit": 100}
|
||||
application/json: {"callback_url": "https://myapp.com/auth/callback"}
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"data": {"id": "auth_code_xyz789", "app_id": 12345, "created_at": "2025-08-24T10:30:00Z"}}
|
||||
|
||||
+9
-5
@@ -6,7 +6,7 @@ generation:
|
||||
sdkClassName: OpenRouter
|
||||
maintainOpenAPIOrder: true
|
||||
usageSnippets:
|
||||
optionalPropertyRendering: withExample
|
||||
optionalPropertyRendering: never
|
||||
sdkInitStyle: constructor
|
||||
useClassNamesForArrayFields: true
|
||||
fixes:
|
||||
@@ -24,13 +24,14 @@ generation:
|
||||
sdkHooksConfigAccess: true
|
||||
schemas:
|
||||
allOfMergeStrategy: shallowMerge
|
||||
requestBodyFieldName: body
|
||||
requestBodyFieldName: ""
|
||||
tests:
|
||||
generateTests: false
|
||||
generateNewTests: true
|
||||
skipResponseBodyAssertions: false
|
||||
preApplyUnionDiscriminators: true
|
||||
python:
|
||||
version: 0.0.19
|
||||
version: 0.0.22
|
||||
additionalDependencies:
|
||||
dev: {}
|
||||
main: {}
|
||||
@@ -57,17 +58,20 @@ python:
|
||||
imports:
|
||||
option: openapi
|
||||
paths:
|
||||
callbacks: ""
|
||||
callbacks: callbacks
|
||||
errors: errors
|
||||
operations: operations
|
||||
shared: components
|
||||
webhooks: ""
|
||||
webhooks: webhooks
|
||||
inferSSEOverload: true
|
||||
inferUnionDiscriminators: true
|
||||
inputModelSuffix: input
|
||||
legacyPyright: false
|
||||
license: Apache-2.0
|
||||
maxMethodParams: 999
|
||||
methodArguments: infer-optional-args
|
||||
moduleName: ""
|
||||
multipartArrayFormat: legacy
|
||||
outputModelSuffix: output
|
||||
packageManager: uv
|
||||
packageName: openrouter
|
||||
|
||||
+437
-41
@@ -1054,6 +1054,7 @@ components:
|
||||
type: string
|
||||
nullable: true
|
||||
enum:
|
||||
- xhigh
|
||||
- high
|
||||
- medium
|
||||
- low
|
||||
@@ -3447,12 +3448,14 @@ components:
|
||||
- AionLabs
|
||||
- Alibaba
|
||||
- Amazon Bedrock
|
||||
- Amazon Nova
|
||||
- Anthropic
|
||||
- Arcee
|
||||
- Arcee AI
|
||||
- AtlasCloud
|
||||
- Avian
|
||||
- Azure
|
||||
- BaseTen
|
||||
- BytePlus
|
||||
- Black Forest Labs
|
||||
- Cerebras
|
||||
- Chutes
|
||||
@@ -3467,6 +3470,7 @@ components:
|
||||
- Fireworks
|
||||
- Friendli
|
||||
- GMICloud
|
||||
- GoPomelo
|
||||
- Google
|
||||
- Google AI Studio
|
||||
- Groq
|
||||
@@ -3476,6 +3480,7 @@ components:
|
||||
- Infermatic
|
||||
- Inflection
|
||||
- Liquid
|
||||
- Mara
|
||||
- Mancer 2
|
||||
- Minimax
|
||||
- ModelRun
|
||||
@@ -3496,12 +3501,15 @@ components:
|
||||
- Relace
|
||||
- SambaNova
|
||||
- SiliconFlow
|
||||
- Sourceful
|
||||
- Stealth
|
||||
- StreamLake
|
||||
- Switchpoint
|
||||
- Targon
|
||||
- Together
|
||||
- Venice
|
||||
- WandB
|
||||
- Xiaomi
|
||||
- xAI
|
||||
- Z.AI
|
||||
- FakeProvider
|
||||
@@ -3531,12 +3539,8 @@ components:
|
||||
performed.
|
||||
example: price
|
||||
BigNumberUnion:
|
||||
anyOf:
|
||||
- type: number
|
||||
- type: string
|
||||
- type: number
|
||||
example: 1000
|
||||
description: A value in string or number format that is a large number
|
||||
type: string
|
||||
description: A value in string format that is a large number
|
||||
example: 1000
|
||||
OpenResponsesRequest:
|
||||
type: object
|
||||
@@ -3628,17 +3632,13 @@ components:
|
||||
nullable: true
|
||||
store:
|
||||
type: boolean
|
||||
nullable: true
|
||||
const: false
|
||||
default: false
|
||||
service_tier:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/OpenAIResponsesServiceTier'
|
||||
- enum:
|
||||
- auto
|
||||
- default
|
||||
- flex
|
||||
- scale
|
||||
- priority
|
||||
example: auto
|
||||
type: string
|
||||
enum:
|
||||
- auto
|
||||
default: auto
|
||||
truncation:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/OpenAIResponsesTruncation'
|
||||
@@ -3735,10 +3735,23 @@ 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:
|
||||
@@ -3759,6 +3772,9 @@ 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:
|
||||
@@ -3776,6 +3792,9 @@ 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:
|
||||
@@ -3789,7 +3808,27 @@ 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
|
||||
@@ -3797,6 +3836,13 @@ 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
|
||||
@@ -4577,6 +4623,91 @@ 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:
|
||||
@@ -4587,6 +4718,8 @@ components:
|
||||
const: text
|
||||
text:
|
||||
type: string
|
||||
cache_control:
|
||||
$ref: '#/components/schemas/ChatMessageContentItemCacheControl'
|
||||
required:
|
||||
- type
|
||||
- text
|
||||
@@ -4625,14 +4758,6 @@ components:
|
||||
type: string
|
||||
format:
|
||||
type: string
|
||||
enum:
|
||||
- wav
|
||||
- mp3
|
||||
- flac
|
||||
- m4a
|
||||
- ogg
|
||||
- pcm16
|
||||
- pcm24
|
||||
required:
|
||||
- data
|
||||
- format
|
||||
@@ -4810,15 +4935,13 @@ components:
|
||||
- prompt_tokens
|
||||
- total_tokens
|
||||
ChatCompletionFinishReason:
|
||||
anyOf:
|
||||
- type: string
|
||||
enum:
|
||||
- tool_calls
|
||||
- stop
|
||||
- length
|
||||
- content_filter
|
||||
- error
|
||||
- type: 'null'
|
||||
type: string
|
||||
enum:
|
||||
- tool_calls
|
||||
- stop
|
||||
- length
|
||||
- content_filter
|
||||
- error
|
||||
JSONSchemaConfig:
|
||||
type: object
|
||||
properties:
|
||||
@@ -4860,6 +4983,19 @@ 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:
|
||||
@@ -5026,6 +5162,214 @@ 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
|
||||
@@ -5095,6 +5439,7 @@ components:
|
||||
- low
|
||||
- medium
|
||||
- high
|
||||
- xhigh
|
||||
- type: 'null'
|
||||
summary:
|
||||
anyOf:
|
||||
@@ -5168,15 +5513,18 @@ components:
|
||||
minimum: 0
|
||||
maximum: 1
|
||||
- type: 'null'
|
||||
user:
|
||||
type: string
|
||||
debug:
|
||||
type: object
|
||||
properties:
|
||||
echo_upstream_body:
|
||||
type: boolean
|
||||
required:
|
||||
- messages
|
||||
ChatResponseChoice:
|
||||
type: object
|
||||
properties:
|
||||
finish_reason:
|
||||
$ref: '#/components/schemas/ChatCompletionFinishReason'
|
||||
$ref: '#/components/schemas/__schema2'
|
||||
index:
|
||||
type: number
|
||||
message:
|
||||
@@ -5237,7 +5585,7 @@ components:
|
||||
delta:
|
||||
$ref: '#/components/schemas/ChatStreamingMessageChunk'
|
||||
finish_reason:
|
||||
$ref: '#/components/schemas/ChatCompletionFinishReason'
|
||||
$ref: '#/components/schemas/__schema2'
|
||||
index:
|
||||
type: number
|
||||
logprobs:
|
||||
@@ -5569,6 +5917,12 @@ components:
|
||||
- type: 'null'
|
||||
finish_reason:
|
||||
$ref: '#/components/schemas/CompletionFinishReason'
|
||||
native_finish_reason:
|
||||
type: string
|
||||
reasoning:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
required:
|
||||
- text
|
||||
- index
|
||||
@@ -5586,6 +5940,8 @@ components:
|
||||
type: number
|
||||
model:
|
||||
type: string
|
||||
provider:
|
||||
type: string
|
||||
system_fingerprint:
|
||||
type: string
|
||||
choices:
|
||||
@@ -5804,6 +6160,26 @@ 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:
|
||||
@@ -6115,10 +6491,23 @@ 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:
|
||||
@@ -6726,12 +7115,14 @@ paths:
|
||||
- AionLabs
|
||||
- Alibaba
|
||||
- Amazon Bedrock
|
||||
- Amazon Nova
|
||||
- Anthropic
|
||||
- Arcee
|
||||
- Arcee AI
|
||||
- AtlasCloud
|
||||
- Avian
|
||||
- Azure
|
||||
- BaseTen
|
||||
- BytePlus
|
||||
- Black Forest Labs
|
||||
- Cerebras
|
||||
- Chutes
|
||||
@@ -6746,6 +7137,7 @@ paths:
|
||||
- Fireworks
|
||||
- Friendli
|
||||
- GMICloud
|
||||
- GoPomelo
|
||||
- Google
|
||||
- Google AI Studio
|
||||
- Groq
|
||||
@@ -6755,6 +7147,7 @@ paths:
|
||||
- Infermatic
|
||||
- Inflection
|
||||
- Liquid
|
||||
- Mara
|
||||
- Mancer 2
|
||||
- Minimax
|
||||
- ModelRun
|
||||
@@ -6775,12 +7168,15 @@ paths:
|
||||
- Relace
|
||||
- SambaNova
|
||||
- SiliconFlow
|
||||
- Sourceful
|
||||
- Stealth
|
||||
- StreamLake
|
||||
- Switchpoint
|
||||
- Targon
|
||||
- Together
|
||||
- Venice
|
||||
- WandB
|
||||
- Xiaomi
|
||||
- xAI
|
||||
- Z.AI
|
||||
- FakeProvider
|
||||
|
||||
+8690
-8304
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,35 @@
|
||||
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.
|
||||
@@ -0,0 +1,10 @@
|
||||
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
|
||||
@@ -0,0 +1,15 @@
|
||||
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
|
||||
+25
-12
@@ -1,37 +1,50 @@
|
||||
speakeasyVersion: 1.658.2
|
||||
speakeasyVersion: 1.666.0
|
||||
sources:
|
||||
-OAS:
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:fc0c90dc8ebb69ef4a571e4e63dcd7f8f33c3254c17ad2583b628fbbf3d1ac05
|
||||
sourceBlobDigest: sha256:635d63fd18db468c1dcc23700382af788de76594ba3b8292fae9b14c0e5c22c4
|
||||
sourceRevisionDigest: sha256:f1b59b9b643de5e20d6e3299a8274783d8c0854615876f5d7f6f081814842695
|
||||
sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553
|
||||
tags:
|
||||
- latest
|
||||
OpenRouter API:
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:b128cdb6be96021e55feea5e2dcb6e7438de706138fcde4f871b14877885445b
|
||||
sourceBlobDigest: sha256:8b15f72eaabbd77f4642be28a2861fd1cfd5d8cfe96e72fb8a76832387c64fab
|
||||
tags:
|
||||
- latest
|
||||
- 1.0.0
|
||||
targets:
|
||||
open-router:
|
||||
source: -OAS
|
||||
source: OpenRouter API
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:fc0c90dc8ebb69ef4a571e4e63dcd7f8f33c3254c17ad2583b628fbbf3d1ac05
|
||||
sourceBlobDigest: sha256:635d63fd18db468c1dcc23700382af788de76594ba3b8292fae9b14c0e5c22c4
|
||||
sourceRevisionDigest: sha256:b128cdb6be96021e55feea5e2dcb6e7438de706138fcde4f871b14877885445b
|
||||
sourceBlobDigest: sha256:8b15f72eaabbd77f4642be28a2861fd1cfd5d8cfe96e72fb8a76832387c64fab
|
||||
codeSamplesNamespace: open-router-python-code-samples
|
||||
codeSamplesRevisionDigest: sha256:92747cd4c744e6671784b73c124d89adc662799d11caf5e6573880f6bfb52405
|
||||
workflow:
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: latest
|
||||
speakeasyVersion: 1.666.0
|
||||
sources:
|
||||
-OAS:
|
||||
OpenRouter API:
|
||||
inputs:
|
||||
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main
|
||||
- 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
|
||||
output: .speakeasy/out.openapi.yaml
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/-oas
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
|
||||
targets:
|
||||
open-router:
|
||||
target: python
|
||||
source: -OAS
|
||||
source: OpenRouter API
|
||||
publish:
|
||||
pypi:
|
||||
token: $pypi_token
|
||||
codeSamples:
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/-oas-python-code-samples
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-python-code-samples
|
||||
labelOverride:
|
||||
fixedValue: Python (SDK)
|
||||
blocking: false
|
||||
|
||||
@@ -1,22 +1,26 @@
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: latest
|
||||
speakeasyVersion: 1.666.0
|
||||
sources:
|
||||
-OAS:
|
||||
OpenRouter API:
|
||||
inputs:
|
||||
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main
|
||||
- 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
|
||||
output: .speakeasy/out.openapi.yaml
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/-oas
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
|
||||
targets:
|
||||
open-router:
|
||||
target: python
|
||||
source: -OAS
|
||||
source: OpenRouter API
|
||||
publish:
|
||||
pypi:
|
||||
token: $pypi_token
|
||||
codeSamples:
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/-oas-python-code-samples
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-python-code-samples
|
||||
labelOverride:
|
||||
fixedValue: Python (SDK)
|
||||
blocking: false
|
||||
|
||||
@@ -9,61 +9,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
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",
|
||||
})
|
||||
res = open_router.beta.responses.send(service_tier="auto", stream=False)
|
||||
|
||||
with res as event_stream:
|
||||
for event in event_stream:
|
||||
@@ -87,61 +33,7 @@ async def main():
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
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",
|
||||
})
|
||||
res = await open_router.beta.responses.send_async(service_tier="auto", stream=False)
|
||||
|
||||
async with res as event_stream:
|
||||
async for event in event_stream:
|
||||
|
||||
@@ -3,27 +3,32 @@
|
||||
|
||||
## Fields
|
||||
|
||||
| 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 |
|
||||
| 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 |
|
||||
@@ -0,0 +1,9 @@
|
||||
# ChatGenerationParamsDataCollection
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------- | ------- |
|
||||
| `DENY` | deny |
|
||||
| `ALLOW` | allow |
|
||||
@@ -1,4 +1,4 @@
|
||||
# Engine
|
||||
# ChatGenerationParamsEngine
|
||||
|
||||
|
||||
## Values
|
||||
@@ -0,0 +1,14 @@
|
||||
# ChatGenerationParamsMaxPrice
|
||||
|
||||
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `prompt` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `completion` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `image` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `audio` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `request` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,8 @@
|
||||
# ChatGenerationParamsPdf
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `engine` | [Optional[components.ChatGenerationParamsPdfEngine]](../components/chatgenerationparamspdfengine.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,4 +1,4 @@
|
||||
# PdfEngine
|
||||
# ChatGenerationParamsPdfEngine
|
||||
|
||||
|
||||
## Values
|
||||
@@ -0,0 +1,11 @@
|
||||
# ChatGenerationParamsPluginFileParser
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
||||
| `id` | *Literal["file-parser"]* | :heavy_check_mark: | N/A |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `max_files` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
| `pdf` | [Optional[components.ChatGenerationParamsPdf]](../components/chatgenerationparamspdf.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,8 @@
|
||||
# ChatGenerationParamsPluginModeration
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------- | ----------------------- | ----------------------- | ----------------------- |
|
||||
| `id` | *Literal["moderation"]* | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,9 @@
|
||||
# ChatGenerationParamsPluginResponseHealing
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------- | ----------------------------- | ----------------------------- | ----------------------------- |
|
||||
| `id` | *Literal["response-healing"]* | :heavy_check_mark: | N/A |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,29 @@
|
||||
# ChatGenerationParamsPluginUnion
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.ChatGenerationParamsPluginModeration`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsPluginModeration = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsPluginWeb`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsPluginWeb = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsPluginFileParser`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsPluginFileParser = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsPluginResponseHealing`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsPluginResponseHealing = /* values here */
|
||||
```
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# ChatGenerationParamsPluginWeb
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
||||
| `id` | *Literal["web"]* | :heavy_check_mark: | N/A |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `engine` | [Optional[components.ChatGenerationParamsEngine]](../components/chatgenerationparamsengine.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,20 @@
|
||||
# ChatGenerationParamsProvider
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests<br/>- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.<br/>- false: use only the primary/custom provider, and return the upstream error if it's unavailable.<br/> |
|
||||
| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. |
|
||||
| `data_collection` | [OptionalNullable[components.ChatGenerationParamsDataCollection]](../components/chatgenerationparamsdatacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.<br/>- allow: (default) allow providers which store user data non-transiently and may train on it<br/><br/>- deny: use only providers which do not collect user data. |
|
||||
| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `order` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. |
|
||||
| `only` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. |
|
||||
| `ignore` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. |
|
||||
| `quantizations` | List[[components.Quantizations](../components/quantizations.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. |
|
||||
| `sort` | [OptionalNullable[components.Sort]](../components/sort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. |
|
||||
| `max_price` | [Optional[components.ChatGenerationParamsMaxPrice]](../components/chatgenerationparamsmaxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. |
|
||||
| `min_throughput` | *OptionalNullable[float]* | :heavy_minus_sign: | The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used. |
|
||||
| `max_latency` | *OptionalNullable[float]* | :heavy_minus_sign: | The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used. |
|
||||
@@ -0,0 +1,9 @@
|
||||
# ChatGenerationParamsRoute
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ---------- | ---------- |
|
||||
| `FALLBACK` | fallback |
|
||||
| `SORT` | sort |
|
||||
@@ -1,14 +0,0 @@
|
||||
# ChatMessageContentItemAudioFormat
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------- | ------- |
|
||||
| `WAV` | wav |
|
||||
| `MP3` | mp3 |
|
||||
| `FLAC` | flac |
|
||||
| `M4A` | m4a |
|
||||
| `OGG` | ogg |
|
||||
| `PCM16` | pcm16 |
|
||||
| `PCM24` | pcm24 |
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
||||
| `data` | *str* | :heavy_check_mark: | N/A |
|
||||
| `format_` | [components.ChatMessageContentItemAudioFormat](../components/chatmessagecontentitemaudioformat.md) | :heavy_check_mark: | N/A |
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `data` | *str* | :heavy_check_mark: | N/A |
|
||||
| `format_` | *str* | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,9 @@
|
||||
# ChatMessageContentItemCacheControl
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ |
|
||||
| `type` | *Literal["ephemeral"]* | :heavy_check_mark: | N/A |
|
||||
| `ttl` | [Optional[components.TTL]](../components/ttl.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `type` | *Literal["text"]* | :heavy_check_mark: | N/A |
|
||||
| `text` | *str* | :heavy_check_mark: | N/A |
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
||||
| `type` | *Literal["text"]* | :heavy_check_mark: | N/A |
|
||||
| `text` | *str* | :heavy_check_mark: | N/A |
|
||||
| `cache_control` | [Optional[components.ChatMessageContentItemCacheControl]](../components/chatmessagecontentitemcachecontrol.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -8,4 +8,6 @@
|
||||
| `text` | *str* | :heavy_check_mark: | N/A |
|
||||
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||
| `logprobs` | [Nullable[components.CompletionLogprobs]](../components/completionlogprobs.md) | :heavy_check_mark: | N/A |
|
||||
| `finish_reason` | [Nullable[components.CompletionFinishReason]](../components/completionfinishreason.md) | :heavy_check_mark: | N/A |
|
||||
| `finish_reason` | [Nullable[components.CompletionFinishReason]](../components/completionfinishreason.md) | :heavy_check_mark: | N/A |
|
||||
| `native_finish_reason` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
@@ -9,6 +9,7 @@
|
||||
| `object` | *Literal["text_completion"]* | :heavy_check_mark: | N/A |
|
||||
| `created` | *float* | :heavy_check_mark: | N/A |
|
||||
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||
| `provider` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `system_fingerprint` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `choices` | List[[components.CompletionChoice](../components/completionchoice.md)] | :heavy_check_mark: | N/A |
|
||||
| `usage` | [Optional[components.CompletionUsage]](../components/completionusage.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,8 @@
|
||||
# Debug
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------- | -------------------- | -------------------- | -------------------- |
|
||||
| `echo_upstream_body` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
@@ -9,4 +9,5 @@
|
||||
| `MINIMAL` | minimal |
|
||||
| `LOW` | low |
|
||||
| `MEDIUM` | medium |
|
||||
| `HIGH` | high |
|
||||
| `HIGH` | high |
|
||||
| `XHIGH` | xhigh |
|
||||
@@ -0,0 +1,8 @@
|
||||
# IDResponseHealing
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------------ | ------------------ |
|
||||
| `RESPONSE_HEALING` | response-healing |
|
||||
@@ -1,14 +0,0 @@
|
||||
# MaxPrice
|
||||
|
||||
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- |
|
||||
| `prompt` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `completion` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `image` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `audio` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
| `request` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
| Name | Value |
|
||||
| --------- | --------- |
|
||||
| `XHIGH` | xhigh |
|
||||
| `HIGH` | high |
|
||||
| `MEDIUM` | medium |
|
||||
| `LOW` | low |
|
||||
|
||||
@@ -27,10 +27,12 @@ Request schema for Responses endpoint
|
||||
| `include` | List[[components.OpenAIResponsesIncludable](../components/openairesponsesincludable.md)] | :heavy_minus_sign: | N/A | |
|
||||
| `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `safety_identifier` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `store` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `service_tier` | [OptionalNullable[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | auto |
|
||||
| `store` | *Optional[Literal[False]]* | :heavy_minus_sign: | N/A | |
|
||||
| `service_tier` | [Optional[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | |
|
||||
| `truncation` | [OptionalNullable[components.Truncation]](../components/truncation.md) | :heavy_minus_sign: | N/A | auto |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
| `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. | |
|
||||
| `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. | |
|
||||
@@ -0,0 +1,9 @@
|
||||
# OpenResponsesRequestEngine
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| -------- | -------- |
|
||||
| `NATIVE` | native |
|
||||
| `EXA` | exa |
|
||||
@@ -0,0 +1,14 @@
|
||||
# OpenResponsesRequestMaxPrice
|
||||
|
||||
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
|
||||
| `prompt` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `completion` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
@@ -0,0 +1,8 @@
|
||||
# OpenResponsesRequestPdf
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `engine` | [Optional[components.OpenResponsesRequestPdfEngine]](../components/openresponsesrequestpdfengine.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,10 @@
|
||||
# OpenResponsesRequestPdfEngine
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------- | ------------- |
|
||||
| `MISTRAL_OCR` | mistral-ocr |
|
||||
| `PDF_TEXT` | pdf-text |
|
||||
| `NATIVE` | native |
|
||||
@@ -0,0 +1,11 @@
|
||||
# OpenResponsesRequestPluginFileParser
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
||||
| `id` | [components.IDFileParser](../components/idfileparser.md) | :heavy_check_mark: | N/A |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the file-parser plugin for this request. Defaults to true. |
|
||||
| `max_files` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
| `pdf` | [Optional[components.OpenResponsesRequestPdf]](../components/openresponsesrequestpdf.md) | :heavy_minus_sign: | N/A |
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# PluginModeration
|
||||
# OpenResponsesRequestPluginModeration
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -0,0 +1,9 @@
|
||||
# OpenResponsesRequestPluginResponseHealing
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
|
||||
| `id` | [components.IDResponseHealing](../components/idresponsehealing.md) | :heavy_check_mark: | N/A |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the response-healing plugin for this request. Defaults to true. |
|
||||
@@ -0,0 +1,29 @@
|
||||
# OpenResponsesRequestPluginUnion
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.OpenResponsesRequestPluginModeration`
|
||||
|
||||
```python
|
||||
value: components.OpenResponsesRequestPluginModeration = /* values here */
|
||||
```
|
||||
|
||||
### `components.OpenResponsesRequestPluginWeb`
|
||||
|
||||
```python
|
||||
value: components.OpenResponsesRequestPluginWeb = /* values here */
|
||||
```
|
||||
|
||||
### `components.OpenResponsesRequestPluginFileParser`
|
||||
|
||||
```python
|
||||
value: components.OpenResponsesRequestPluginFileParser = /* values here */
|
||||
```
|
||||
|
||||
### `components.OpenResponsesRequestPluginResponseHealing`
|
||||
|
||||
```python
|
||||
value: components.OpenResponsesRequestPluginResponseHealing = /* values here */
|
||||
```
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# OpenResponsesRequestPluginWeb
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
||||
| `id` | [components.IDWeb](../components/idweb.md) | :heavy_check_mark: | N/A |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the web-search plugin for this request. Defaults to true. |
|
||||
| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `engine` | [Optional[components.OpenResponsesRequestEngine]](../components/openresponsesrequestengine.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,4 +1,4 @@
|
||||
# Provider
|
||||
# OpenResponsesRequestProvider
|
||||
|
||||
When multiple model providers are available, optionally indicate your routing preference.
|
||||
|
||||
@@ -17,4 +17,6 @@ When multiple model providers are available, optionally indicate your routing pr
|
||||
| `ignore` | List[[components.Ignore](../components/ignore.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | |
|
||||
| `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.MaxPrice]](../components/maxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | |
|
||||
| `max_price` | [Optional[components.OpenResponsesRequestMaxPrice]](../components/openresponsesrequestmaxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | |
|
||||
| `min_throughput` | *OptionalNullable[float]* | :heavy_minus_sign: | The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used. | 100 |
|
||||
| `max_latency` | *OptionalNullable[float]* | :heavy_minus_sign: | The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used. | 5 |
|
||||
@@ -0,0 +1,11 @@
|
||||
# OpenResponsesRequestRoute
|
||||
|
||||
Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria.
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ---------- | ---------- |
|
||||
| `FALLBACK` | fallback |
|
||||
| `SORT` | sort |
|
||||
@@ -1,8 +0,0 @@
|
||||
# Pdf
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| `engine` | [Optional[components.PdfEngine]](../components/pdfengine.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,23 +0,0 @@
|
||||
# Plugin
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.PluginModeration`
|
||||
|
||||
```python
|
||||
value: components.PluginModeration = /* values here */
|
||||
```
|
||||
|
||||
### `components.PluginWeb`
|
||||
|
||||
```python
|
||||
value: components.PluginWeb = /* values here */
|
||||
```
|
||||
|
||||
### `components.PluginFileParser`
|
||||
|
||||
```python
|
||||
value: components.PluginFileParser = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# PluginFileParser
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
|
||||
| `id` | [components.IDFileParser](../components/idfileparser.md) | :heavy_check_mark: | N/A |
|
||||
| `max_files` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
| `pdf` | [Optional[components.Pdf]](../components/pdf.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,11 +0,0 @@
|
||||
# PluginWeb
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ |
|
||||
| `id` | [components.IDWeb](../components/idweb.md) | :heavy_check_mark: | N/A |
|
||||
| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `engine` | [Optional[components.Engine]](../components/engine.md) | :heavy_minus_sign: | N/A |
|
||||
+15
-15
@@ -3,18 +3,18 @@
|
||||
|
||||
## Fields
|
||||
|
||||
| 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 |
|
||||
| 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 | |
|
||||
@@ -9,12 +9,14 @@
|
||||
| `AION_LABS` | AionLabs |
|
||||
| `ALIBABA` | Alibaba |
|
||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||
| `AMAZON_NOVA` | Amazon Nova |
|
||||
| `ANTHROPIC` | Anthropic |
|
||||
| `ARCEE` | Arcee |
|
||||
| `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 |
|
||||
@@ -29,6 +31,7 @@
|
||||
| `FIREWORKS` | Fireworks |
|
||||
| `FRIENDLI` | Friendli |
|
||||
| `GMI_CLOUD` | GMICloud |
|
||||
| `GO_POMELO` | GoPomelo |
|
||||
| `GOOGLE` | Google |
|
||||
| `GOOGLE_AI_STUDIO` | Google AI Studio |
|
||||
| `GROQ` | Groq |
|
||||
@@ -38,6 +41,7 @@
|
||||
| `INFERMATIC` | Infermatic |
|
||||
| `INFLECTION` | Inflection |
|
||||
| `LIQUID` | Liquid |
|
||||
| `MARA` | Mara |
|
||||
| `MANCER_2` | Mancer 2 |
|
||||
| `MINIMAX` | Minimax |
|
||||
| `MODEL_RUN` | ModelRun |
|
||||
@@ -58,12 +62,15 @@
|
||||
| `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 |
|
||||
@@ -5,18 +5,18 @@ Pricing information for the model
|
||||
|
||||
## Fields
|
||||
|
||||
| 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 |
|
||||
| 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 | |
|
||||
@@ -0,0 +1,16 @@
|
||||
# Quantizations
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| --------- | --------- |
|
||||
| `INT4` | int4 |
|
||||
| `INT8` | int8 |
|
||||
| `FP4` | fp4 |
|
||||
| `FP6` | fp6 |
|
||||
| `FP8` | fp8 |
|
||||
| `FP16` | fp16 |
|
||||
| `BF16` | bf16 |
|
||||
| `FP32` | fp32 |
|
||||
| `UNKNOWN` | unknown |
|
||||
@@ -0,0 +1,17 @@
|
||||
# Schema0
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.Schema0Enum`
|
||||
|
||||
```python
|
||||
value: components.Schema0Enum = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
# Schema0Enum
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------------- | ------------------- |
|
||||
| `AI21` | AI21 |
|
||||
| `AION_LABS` | AionLabs |
|
||||
| `ALIBABA` | Alibaba |
|
||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||
| `AMAZON_NOVA` | Amazon Nova |
|
||||
| `ANTHROPIC` | Anthropic |
|
||||
| `ARCEE_AI` | Arcee AI |
|
||||
| `ATLAS_CLOUD` | AtlasCloud |
|
||||
| `AVIAN` | Avian |
|
||||
| `AZURE` | Azure |
|
||||
| `BASE_TEN` | BaseTen |
|
||||
| `BYTE_PLUS` | BytePlus |
|
||||
| `BLACK_FOREST_LABS` | Black Forest Labs |
|
||||
| `CEREBRAS` | Cerebras |
|
||||
| `CHUTES` | Chutes |
|
||||
| `CIRRASCALE` | Cirrascale |
|
||||
| `CLARIFAI` | Clarifai |
|
||||
| `CLOUDFLARE` | Cloudflare |
|
||||
| `COHERE` | Cohere |
|
||||
| `CRUSOE` | Crusoe |
|
||||
| `DEEP_INFRA` | DeepInfra |
|
||||
| `DEEP_SEEK` | DeepSeek |
|
||||
| `FEATHERLESS` | Featherless |
|
||||
| `FIREWORKS` | Fireworks |
|
||||
| `FRIENDLI` | Friendli |
|
||||
| `GMI_CLOUD` | GMICloud |
|
||||
| `GO_POMELO` | GoPomelo |
|
||||
| `GOOGLE` | Google |
|
||||
| `GOOGLE_AI_STUDIO` | Google AI Studio |
|
||||
| `GROQ` | Groq |
|
||||
| `HYPERBOLIC` | Hyperbolic |
|
||||
| `INCEPTION` | Inception |
|
||||
| `INFERENCE_NET` | InferenceNet |
|
||||
| `INFERMATIC` | Infermatic |
|
||||
| `INFLECTION` | Inflection |
|
||||
| `LIQUID` | Liquid |
|
||||
| `MARA` | Mara |
|
||||
| `MANCER_2` | Mancer 2 |
|
||||
| `MINIMAX` | Minimax |
|
||||
| `MODEL_RUN` | ModelRun |
|
||||
| `MISTRAL` | Mistral |
|
||||
| `MODULAR` | Modular |
|
||||
| `MOONSHOT_AI` | Moonshot AI |
|
||||
| `MORPH` | Morph |
|
||||
| `N_COMPASS` | NCompass |
|
||||
| `NEBIUS` | Nebius |
|
||||
| `NEXT_BIT` | NextBit |
|
||||
| `NOVITA` | Novita |
|
||||
| `NVIDIA` | Nvidia |
|
||||
| `OPEN_AI` | OpenAI |
|
||||
| `OPEN_INFERENCE` | OpenInference |
|
||||
| `PARASAIL` | Parasail |
|
||||
| `PERPLEXITY` | Perplexity |
|
||||
| `PHALA` | Phala |
|
||||
| `RELACE` | Relace |
|
||||
| `SAMBA_NOVA` | SambaNova |
|
||||
| `SILICON_FLOW` | SiliconFlow |
|
||||
| `SOURCEFUL` | Sourceful |
|
||||
| `STEALTH` | Stealth |
|
||||
| `STREAM_LAKE` | StreamLake |
|
||||
| `SWITCHPOINT` | Switchpoint |
|
||||
| `TARGON` | Targon |
|
||||
| `TOGETHER` | Together |
|
||||
| `VENICE` | Venice |
|
||||
| `WAND_B` | WandB |
|
||||
| `XIAOMI` | Xiaomi |
|
||||
| `X_AI` | xAI |
|
||||
| `Z_AI` | Z.AI |
|
||||
| `FAKE_PROVIDER` | FakeProvider |
|
||||
@@ -3,10 +3,6 @@
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ---------- | ---------- |
|
||||
| `AUTO` | auto |
|
||||
| `DEFAULT` | default |
|
||||
| `FLEX` | flex |
|
||||
| `PRIORITY` | priority |
|
||||
| `SCALE` | scale |
|
||||
| Name | Value |
|
||||
| ------ | ------ |
|
||||
| `AUTO` | auto |
|
||||
@@ -0,0 +1,10 @@
|
||||
# Sort
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------ | ------------ |
|
||||
| `PRICE` | price |
|
||||
| `THROUGHPUT` | throughput |
|
||||
| `LATENCY` | latency |
|
||||
@@ -0,0 +1,9 @@
|
||||
# TTL
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------- | ------- |
|
||||
| `FIVEM` | 5m |
|
||||
| `ONEH` | 1h |
|
||||
@@ -0,0 +1,9 @@
|
||||
# Globals
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.<br/>This is used to track API usage per application.<br/> |
|
||||
| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.<br/> |
|
||||
@@ -15,4 +15,6 @@
|
||||
| `ignore` | List[[operations.Ignore](../operations/ignore.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | |
|
||||
| `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. | |
|
||||
| `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 |
|
||||
@@ -0,0 +1,9 @@
|
||||
# GetCreditsData
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------- | ----------------------- | ----------------------- | ----------------------- | ----------------------- |
|
||||
| `total_credits` | *float* | :heavy_check_mark: | Total credits purchased | 100.5 |
|
||||
| `total_usage` | *float* | :heavy_check_mark: | Total credits used | 25.75 |
|
||||
@@ -5,5 +5,6 @@ Total credits purchased and used
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------- | ----------- | ----------- | ----------- |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| `data` | [operations.GetCreditsData](../operations/getcreditsdata.md) | :heavy_check_mark: | N/A | {<br/>"total_credits": 100.5,<br/>"total_usage": 25.75<br/>} |
|
||||
@@ -9,12 +9,14 @@
|
||||
| `AION_LABS` | AionLabs |
|
||||
| `ALIBABA` | Alibaba |
|
||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||
| `AMAZON_NOVA` | Amazon Nova |
|
||||
| `ANTHROPIC` | Anthropic |
|
||||
| `ARCEE` | Arcee |
|
||||
| `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 |
|
||||
@@ -29,6 +31,7 @@
|
||||
| `FIREWORKS` | Fireworks |
|
||||
| `FRIENDLI` | Friendli |
|
||||
| `GMI_CLOUD` | GMICloud |
|
||||
| `GO_POMELO` | GoPomelo |
|
||||
| `GOOGLE` | Google |
|
||||
| `GOOGLE_AI_STUDIO` | Google AI Studio |
|
||||
| `GROQ` | Groq |
|
||||
@@ -38,6 +41,7 @@
|
||||
| `INFERMATIC` | Infermatic |
|
||||
| `INFLECTION` | Inflection |
|
||||
| `LIQUID` | Liquid |
|
||||
| `MARA` | Mara |
|
||||
| `MANCER_2` | Mancer 2 |
|
||||
| `MINIMAX` | Minimax |
|
||||
| `MODEL_RUN` | ModelRun |
|
||||
@@ -58,12 +62,15 @@
|
||||
| `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 |
|
||||
@@ -5,10 +5,10 @@ The object specifying the maximum price you want to pay for this request. USD pr
|
||||
|
||||
## 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 |
|
||||
| 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 |
|
||||
@@ -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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 |
|
||||
| `body` | [operations.UpdateKeysRequestBody](../operations/updatekeysrequestbody.md) | :heavy_check_mark: | N/A | {<br/>"name": "Updated API Key Name",<br/>"disabled": false,<br/>"limit": 75,<br/>"limit_reset": "daily",<br/>"include_byok_in_limit": true<br/>} |
|
||||
| `request_body` | [operations.UpdateKeysRequestBody](../operations/updatekeysrequestbody.md) | :heavy_check_mark: | N/A | {<br/>"name": "Updated API Key Name",<br/>"disabled": false,<br/>"limit": 75,<br/>"limit_reset": "daily",<br/>"include_byok_in_limit": true<br/>} |
|
||||
@@ -67,7 +67,6 @@ 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
|
||||
|
||||
|
||||
@@ -75,7 +74,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.api_keys.create(name="My New API Key", limit=50, limit_reset="monthly", include_byok_in_limit=True, expires_at=parse_datetime("2027-12-31T23:59:59Z"))
|
||||
res = open_router.api_keys.create(name="My New API Key")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
@@ -123,7 +122,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.api_keys.update(hash="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", name="Updated API Key Name", disabled=False, limit=75, limit_reset="daily", include_byok_in_limit=True)
|
||||
res = open_router.api_keys.update(hash="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")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
+30
-25
@@ -34,31 +34,36 @@ with OpenRouter(
|
||||
|
||||
### Parameters
|
||||
|
||||
| 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 |
|
||||
| `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 |
|
||||
| `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. |
|
||||
|
||||
### Response
|
||||
|
||||
|
||||
@@ -26,24 +26,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
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",
|
||||
})
|
||||
res = open_router.embeddings.generate(input="<value>", model="Taurus")
|
||||
|
||||
# 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", code_verifier="dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", code_challenge_method="S256")
|
||||
res = open_router.o_auth.exchange_auth_code_for_api_key(code="auth_code_abc123def456")
|
||||
|
||||
# Handle response
|
||||
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", code_challenge="E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", code_challenge_method="S256", limit=100)
|
||||
res = open_router.o_auth.create_auth_code(callback_url="https://myapp.com/auth/callback")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
@@ -25,61 +25,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
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",
|
||||
})
|
||||
res = open_router.beta.responses.send(service_tier="auto", stream=False)
|
||||
|
||||
with res as event_stream:
|
||||
for event in event_stream:
|
||||
@@ -112,13 +58,14 @@ with OpenRouter(
|
||||
| `include` | List[[components.OpenAIResponsesIncludable](../../components/openairesponsesincludable.md)] | :heavy_minus_sign: | N/A | |
|
||||
| `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `safety_identifier` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `store` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `service_tier` | [OptionalNullable[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | auto |
|
||||
| `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.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. | |
|
||||
| `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. | |
|
||||
| `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.19"
|
||||
version = "0.0.22"
|
||||
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.19"
|
||||
__version__: str = "0.0.22"
|
||||
__openapi_doc_version__: str = "1.0.0"
|
||||
__gen_version__: str = "2.755.9"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.0.19 2.755.9 1.0.0 openrouter"
|
||||
__gen_version__: str = "2.768.0"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.0.22 2.768.0 1.0.0 openrouter"
|
||||
|
||||
try:
|
||||
if __package__ is not None:
|
||||
|
||||
@@ -58,6 +58,7 @@ class Analytics(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -166,6 +167,7 @@ class Analytics(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -164,6 +165,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -280,6 +282,7 @@ class APIKeys(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", operations.CreateKeysRequest
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -401,6 +404,7 @@ class APIKeys(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", operations.CreateKeysRequest
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -502,7 +506,7 @@ class APIKeys(BaseSDK):
|
||||
|
||||
request = operations.UpdateKeysRequest(
|
||||
hash=hash,
|
||||
body=operations.UpdateKeysRequestBody(
|
||||
request_body=operations.UpdateKeysRequestBody(
|
||||
name=name,
|
||||
disabled=disabled,
|
||||
limit=limit,
|
||||
@@ -525,8 +529,13 @@ class APIKeys(BaseSDK):
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request.body, False, False, "json", operations.UpdateKeysRequestBody
|
||||
request.request_body,
|
||||
False,
|
||||
False,
|
||||
"json",
|
||||
operations.UpdateKeysRequestBody,
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -633,7 +642,7 @@ class APIKeys(BaseSDK):
|
||||
|
||||
request = operations.UpdateKeysRequest(
|
||||
hash=hash,
|
||||
body=operations.UpdateKeysRequestBody(
|
||||
request_body=operations.UpdateKeysRequestBody(
|
||||
name=name,
|
||||
disabled=disabled,
|
||||
limit=limit,
|
||||
@@ -656,8 +665,13 @@ class APIKeys(BaseSDK):
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request.body, False, False, "json", operations.UpdateKeysRequestBody
|
||||
request.request_body,
|
||||
False,
|
||||
False,
|
||||
"json",
|
||||
operations.UpdateKeysRequestBody,
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -769,6 +783,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -875,6 +890,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -981,6 +997,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -1087,6 +1104,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -1188,6 +1206,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -1279,6 +1298,7 @@ class APIKeys(BaseSDK):
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ class BaseSDK:
|
||||
] = None,
|
||||
url_override: Optional[str] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
allow_empty_value: Optional[List[str]] = None,
|
||||
) -> httpx.Request:
|
||||
client = self.sdk_configuration.async_client
|
||||
return self._build_request_with_client(
|
||||
@@ -80,6 +81,7 @@ class BaseSDK:
|
||||
get_serialized_body,
|
||||
url_override,
|
||||
http_headers,
|
||||
allow_empty_value,
|
||||
)
|
||||
|
||||
def _build_request(
|
||||
@@ -102,6 +104,7 @@ class BaseSDK:
|
||||
] = None,
|
||||
url_override: Optional[str] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
allow_empty_value: Optional[List[str]] = None,
|
||||
) -> httpx.Request:
|
||||
client = self.sdk_configuration.client
|
||||
return self._build_request_with_client(
|
||||
@@ -122,6 +125,7 @@ class BaseSDK:
|
||||
get_serialized_body,
|
||||
url_override,
|
||||
http_headers,
|
||||
allow_empty_value,
|
||||
)
|
||||
|
||||
def _build_request_with_client(
|
||||
@@ -145,6 +149,7 @@ class BaseSDK:
|
||||
] = None,
|
||||
url_override: Optional[str] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
allow_empty_value: Optional[List[str]] = None,
|
||||
) -> httpx.Request:
|
||||
query_params = {}
|
||||
|
||||
@@ -160,6 +165,7 @@ class BaseSDK:
|
||||
query_params = utils.get_query_params(
|
||||
request if request_has_query_params else None,
|
||||
_globals if request_has_query_params else None,
|
||||
allow_empty_value,
|
||||
)
|
||||
else:
|
||||
# Pick up the query parameter from the override so they can be
|
||||
|
||||
+154
-14
@@ -21,6 +21,21 @@ 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,
|
||||
@@ -60,7 +75,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,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -71,6 +86,11 @@ class Chat(BaseSDK):
|
||||
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
||||
|
||||
: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:
|
||||
@@ -91,7 +111,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
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -104,6 +124,21 @@ 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,
|
||||
@@ -143,7 +178,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,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -154,6 +189,11 @@ class Chat(BaseSDK):
|
||||
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
||||
|
||||
: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:
|
||||
@@ -174,7 +214,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
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -186,6 +226,21 @@ 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,
|
||||
@@ -225,7 +280,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,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -236,6 +291,11 @@ class Chat(BaseSDK):
|
||||
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
||||
|
||||
: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:
|
||||
@@ -256,7 +316,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
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -274,6 +334,15 @@ 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,
|
||||
@@ -304,7 +373,7 @@ class Chat(BaseSDK):
|
||||
tools, Optional[List[components.ToolDefinitionJSON]]
|
||||
),
|
||||
top_p=top_p,
|
||||
user=user,
|
||||
debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
@@ -323,6 +392,7 @@ class Chat(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", components.ChatGenerationParams
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -398,6 +468,21 @@ 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,
|
||||
@@ -437,7 +522,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,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -448,6 +533,11 @@ class Chat(BaseSDK):
|
||||
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
||||
|
||||
: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:
|
||||
@@ -468,7 +558,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
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -481,6 +571,21 @@ 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,
|
||||
@@ -520,7 +625,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,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -531,6 +636,11 @@ class Chat(BaseSDK):
|
||||
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
||||
|
||||
: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:
|
||||
@@ -551,7 +661,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
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -563,6 +673,21 @@ 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,
|
||||
@@ -602,7 +727,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,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -613,6 +738,11 @@ class Chat(BaseSDK):
|
||||
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
||||
|
||||
: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:
|
||||
@@ -633,7 +763,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
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -651,6 +781,15 @@ 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,
|
||||
@@ -681,7 +820,7 @@ class Chat(BaseSDK):
|
||||
tools, Optional[List[components.ToolDefinitionJSON]]
|
||||
),
|
||||
top_p=top_p,
|
||||
user=user,
|
||||
debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
@@ -700,6 +839,7 @@ class Chat(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", components.ChatGenerationParams
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
|
||||
@@ -136,6 +136,7 @@ class Completions(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", components.CompletionCreateParams
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
@@ -310,6 +311,7 @@ class Completions(BaseSDK):
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", components.CompletionCreateParams
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import builtins
|
||||
import sys
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ._schema0 import Schema0, Schema0Enum, Schema0TypedDict
|
||||
from .activityitem import ActivityItem, ActivityItemTypedDict
|
||||
from .assistantmessage import (
|
||||
AssistantMessage,
|
||||
@@ -21,9 +22,29 @@ if TYPE_CHECKING:
|
||||
BadRequestResponseErrorData,
|
||||
BadRequestResponseErrorDataTypedDict,
|
||||
)
|
||||
from .chatcompletionfinishreason import ChatCompletionFinishReason
|
||||
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,
|
||||
@@ -32,12 +53,17 @@ if TYPE_CHECKING:
|
||||
ChatGenerationParamsResponseFormatTextTypedDict,
|
||||
ChatGenerationParamsResponseFormatUnion,
|
||||
ChatGenerationParamsResponseFormatUnionTypedDict,
|
||||
ChatGenerationParamsRoute,
|
||||
ChatGenerationParamsStop,
|
||||
ChatGenerationParamsStopTypedDict,
|
||||
ChatGenerationParamsTypedDict,
|
||||
Debug,
|
||||
DebugTypedDict,
|
||||
Effort,
|
||||
Quantizations,
|
||||
Reasoning,
|
||||
ReasoningTypedDict,
|
||||
Sort,
|
||||
)
|
||||
from .chatgenerationtokenusage import (
|
||||
ChatGenerationTokenUsage,
|
||||
@@ -53,11 +79,15 @@ if TYPE_CHECKING:
|
||||
)
|
||||
from .chatmessagecontentitemaudio import (
|
||||
ChatMessageContentItemAudio,
|
||||
ChatMessageContentItemAudioFormat,
|
||||
ChatMessageContentItemAudioInputAudio,
|
||||
ChatMessageContentItemAudioInputAudioTypedDict,
|
||||
ChatMessageContentItemAudioTypedDict,
|
||||
)
|
||||
from .chatmessagecontentitemcachecontrol import (
|
||||
ChatMessageContentItemCacheControl,
|
||||
ChatMessageContentItemCacheControlTypedDict,
|
||||
TTL,
|
||||
)
|
||||
from .chatmessagecontentitemimage import (
|
||||
ChatMessageContentItemImage,
|
||||
ChatMessageContentItemImageDetail,
|
||||
@@ -98,13 +128,8 @@ if TYPE_CHECKING:
|
||||
ChatMessageToolCallTypedDict,
|
||||
)
|
||||
from .chatresponse import ChatResponse, ChatResponseTypedDict
|
||||
from .chatresponsechoice import (
|
||||
ChatCompletionFinishReason,
|
||||
ChatResponseChoice,
|
||||
ChatResponseChoiceTypedDict,
|
||||
ChatStreamingChoice,
|
||||
ChatStreamingChoiceTypedDict,
|
||||
)
|
||||
from .chatresponsechoice import ChatResponseChoice, ChatResponseChoiceTypedDict
|
||||
from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
|
||||
from .chatstreamingmessagechunk import (
|
||||
ChatStreamingMessageChunk,
|
||||
ChatStreamingMessageChunkRole,
|
||||
@@ -419,17 +444,34 @@ 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,
|
||||
@@ -438,19 +480,6 @@ if TYPE_CHECKING:
|
||||
OpenResponsesRequestTypedDict,
|
||||
Order,
|
||||
OrderTypedDict,
|
||||
Pdf,
|
||||
PdfEngine,
|
||||
PdfTypedDict,
|
||||
Plugin,
|
||||
PluginFileParser,
|
||||
PluginFileParserTypedDict,
|
||||
PluginModeration,
|
||||
PluginModerationTypedDict,
|
||||
PluginTypedDict,
|
||||
PluginWeb,
|
||||
PluginWebTypedDict,
|
||||
Provider,
|
||||
ProviderTypedDict,
|
||||
ServiceTier,
|
||||
Truncation,
|
||||
)
|
||||
@@ -805,6 +834,25 @@ __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",
|
||||
@@ -813,6 +861,7 @@ __all__ = [
|
||||
"ChatGenerationParamsResponseFormatTextTypedDict",
|
||||
"ChatGenerationParamsResponseFormatUnion",
|
||||
"ChatGenerationParamsResponseFormatUnionTypedDict",
|
||||
"ChatGenerationParamsRoute",
|
||||
"ChatGenerationParamsStop",
|
||||
"ChatGenerationParamsStopTypedDict",
|
||||
"ChatGenerationParamsTypedDict",
|
||||
@@ -820,10 +869,11 @@ __all__ = [
|
||||
"ChatGenerationTokenUsageTypedDict",
|
||||
"ChatMessageContentItem",
|
||||
"ChatMessageContentItemAudio",
|
||||
"ChatMessageContentItemAudioFormat",
|
||||
"ChatMessageContentItemAudioInputAudio",
|
||||
"ChatMessageContentItemAudioInputAudioTypedDict",
|
||||
"ChatMessageContentItemAudioTypedDict",
|
||||
"ChatMessageContentItemCacheControl",
|
||||
"ChatMessageContentItemCacheControlTypedDict",
|
||||
"ChatMessageContentItemImage",
|
||||
"ChatMessageContentItemImageDetail",
|
||||
"ChatMessageContentItemImageTypedDict",
|
||||
@@ -896,13 +946,14 @@ __all__ = [
|
||||
"CreateChargeRequest",
|
||||
"CreateChargeRequestTypedDict",
|
||||
"DataCollection",
|
||||
"Debug",
|
||||
"DebugTypedDict",
|
||||
"DefaultParameters",
|
||||
"DefaultParametersTypedDict",
|
||||
"EdgeNetworkTimeoutResponseErrorData",
|
||||
"EdgeNetworkTimeoutResponseErrorDataTypedDict",
|
||||
"Effort",
|
||||
"EndpointStatus",
|
||||
"Engine",
|
||||
"FileCitation",
|
||||
"FileCitationType",
|
||||
"FileCitationTypedDict",
|
||||
@@ -913,6 +964,7 @@ __all__ = [
|
||||
"ForbiddenResponseErrorDataTypedDict",
|
||||
"IDFileParser",
|
||||
"IDModeration",
|
||||
"IDResponseHealing",
|
||||
"IDWeb",
|
||||
"Ignore",
|
||||
"IgnoreTypedDict",
|
||||
@@ -929,8 +981,6 @@ __all__ = [
|
||||
"JSONSchemaConfigTypedDict",
|
||||
"ListEndpointsResponse",
|
||||
"ListEndpointsResponseTypedDict",
|
||||
"MaxPrice",
|
||||
"MaxPriceTypedDict",
|
||||
"Message",
|
||||
"MessageContent",
|
||||
"MessageContentTypedDict",
|
||||
@@ -1103,6 +1153,25 @@ __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",
|
||||
@@ -1196,37 +1265,25 @@ __all__ = [
|
||||
"PayloadTooLargeResponseErrorDataTypedDict",
|
||||
"PaymentRequiredResponseErrorData",
|
||||
"PaymentRequiredResponseErrorDataTypedDict",
|
||||
"Pdf",
|
||||
"PdfEngine",
|
||||
"PdfTypedDict",
|
||||
"PerRequestLimits",
|
||||
"PerRequestLimitsTypedDict",
|
||||
"Plugin",
|
||||
"PluginFileParser",
|
||||
"PluginFileParserTypedDict",
|
||||
"PluginModeration",
|
||||
"PluginModerationTypedDict",
|
||||
"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",
|
||||
@@ -1320,17 +1377,22 @@ __all__ = [
|
||||
"ResponsesWebSearchUserLocation",
|
||||
"ResponsesWebSearchUserLocationType",
|
||||
"ResponsesWebSearchUserLocationTypedDict",
|
||||
"Schema0",
|
||||
"Schema0Enum",
|
||||
"Schema0TypedDict",
|
||||
"Security",
|
||||
"SecurityTypedDict",
|
||||
"ServiceTier",
|
||||
"ServiceUnavailableResponseErrorData",
|
||||
"ServiceUnavailableResponseErrorDataTypedDict",
|
||||
"Sort",
|
||||
"StreamOptions",
|
||||
"StreamOptionsTypedDict",
|
||||
"SystemMessage",
|
||||
"SystemMessageContent",
|
||||
"SystemMessageContentTypedDict",
|
||||
"SystemMessageTypedDict",
|
||||
"TTL",
|
||||
"Tokenizer",
|
||||
"TooManyRequestsResponseErrorData",
|
||||
"TooManyRequestsResponseErrorDataTypedDict",
|
||||
@@ -1391,6 +1453,9 @@ __all__ = [
|
||||
]
|
||||
|
||||
_dynamic_imports: dict[str, str] = {
|
||||
"Schema0": "._schema0",
|
||||
"Schema0Enum": "._schema0",
|
||||
"Schema0TypedDict": "._schema0",
|
||||
"ActivityItem": ".activityitem",
|
||||
"ActivityItemTypedDict": ".activityitem",
|
||||
"AssistantMessage": ".assistantmessage",
|
||||
@@ -1401,11 +1466,31 @@ _dynamic_imports: dict[str, str] = {
|
||||
"BadGatewayResponseErrorDataTypedDict": ".badgatewayresponseerrordata",
|
||||
"BadRequestResponseErrorData": ".badrequestresponseerrordata",
|
||||
"BadRequestResponseErrorDataTypedDict": ".badrequestresponseerrordata",
|
||||
"ChatCompletionFinishReason": ".chatcompletionfinishreason",
|
||||
"ChatErrorError": ".chaterror",
|
||||
"ChatErrorErrorTypedDict": ".chaterror",
|
||||
"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",
|
||||
@@ -1414,12 +1499,17 @@ _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",
|
||||
@@ -1429,10 +1519,12 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatMessageContentItem": ".chatmessagecontentitem",
|
||||
"ChatMessageContentItemTypedDict": ".chatmessagecontentitem",
|
||||
"ChatMessageContentItemAudio": ".chatmessagecontentitemaudio",
|
||||
"ChatMessageContentItemAudioFormat": ".chatmessagecontentitemaudio",
|
||||
"ChatMessageContentItemAudioInputAudio": ".chatmessagecontentitemaudio",
|
||||
"ChatMessageContentItemAudioInputAudioTypedDict": ".chatmessagecontentitemaudio",
|
||||
"ChatMessageContentItemAudioTypedDict": ".chatmessagecontentitemaudio",
|
||||
"ChatMessageContentItemCacheControl": ".chatmessagecontentitemcachecontrol",
|
||||
"ChatMessageContentItemCacheControlTypedDict": ".chatmessagecontentitemcachecontrol",
|
||||
"TTL": ".chatmessagecontentitemcachecontrol",
|
||||
"ChatMessageContentItemImage": ".chatmessagecontentitemimage",
|
||||
"ChatMessageContentItemImageDetail": ".chatmessagecontentitemimage",
|
||||
"ChatMessageContentItemImageTypedDict": ".chatmessagecontentitemimage",
|
||||
@@ -1462,11 +1554,10 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatMessageToolCallTypedDict": ".chatmessagetoolcall",
|
||||
"ChatResponse": ".chatresponse",
|
||||
"ChatResponseTypedDict": ".chatresponse",
|
||||
"ChatCompletionFinishReason": ".chatresponsechoice",
|
||||
"ChatResponseChoice": ".chatresponsechoice",
|
||||
"ChatResponseChoiceTypedDict": ".chatresponsechoice",
|
||||
"ChatStreamingChoice": ".chatresponsechoice",
|
||||
"ChatStreamingChoiceTypedDict": ".chatresponsechoice",
|
||||
"ChatStreamingChoice": ".chatstreamingchoice",
|
||||
"ChatStreamingChoiceTypedDict": ".chatstreamingchoice",
|
||||
"ChatStreamingMessageChunk": ".chatstreamingmessagechunk",
|
||||
"ChatStreamingMessageChunkRole": ".chatstreamingmessagechunk",
|
||||
"ChatStreamingMessageChunkTypedDict": ".chatstreamingmessagechunk",
|
||||
@@ -1710,17 +1801,34 @@ _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",
|
||||
@@ -1729,19 +1837,6 @@ _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",
|
||||
"PluginTypedDict": ".openresponsesrequest",
|
||||
"PluginWeb": ".openresponsesrequest",
|
||||
"PluginWebTypedDict": ".openresponsesrequest",
|
||||
"Provider": ".openresponsesrequest",
|
||||
"ProviderTypedDict": ".openresponsesrequest",
|
||||
"ServiceTier": ".openresponsesrequest",
|
||||
"Truncation": ".openresponsesrequest",
|
||||
"OpenResponsesResponseText": ".openresponsesresponsetext",
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import UnrecognizedStr
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Literal, Union
|
||||
from typing_extensions import Annotated, TypeAliasType
|
||||
|
||||
|
||||
Schema0Enum = Union[
|
||||
Literal[
|
||||
"AI21",
|
||||
"AionLabs",
|
||||
"Alibaba",
|
||||
"Amazon Bedrock",
|
||||
"Amazon Nova",
|
||||
"Anthropic",
|
||||
"Arcee AI",
|
||||
"AtlasCloud",
|
||||
"Avian",
|
||||
"Azure",
|
||||
"BaseTen",
|
||||
"BytePlus",
|
||||
"Black Forest Labs",
|
||||
"Cerebras",
|
||||
"Chutes",
|
||||
"Cirrascale",
|
||||
"Clarifai",
|
||||
"Cloudflare",
|
||||
"Cohere",
|
||||
"Crusoe",
|
||||
"DeepInfra",
|
||||
"DeepSeek",
|
||||
"Featherless",
|
||||
"Fireworks",
|
||||
"Friendli",
|
||||
"GMICloud",
|
||||
"GoPomelo",
|
||||
"Google",
|
||||
"Google AI Studio",
|
||||
"Groq",
|
||||
"Hyperbolic",
|
||||
"Inception",
|
||||
"InferenceNet",
|
||||
"Infermatic",
|
||||
"Inflection",
|
||||
"Liquid",
|
||||
"Mara",
|
||||
"Mancer 2",
|
||||
"Minimax",
|
||||
"ModelRun",
|
||||
"Mistral",
|
||||
"Modular",
|
||||
"Moonshot AI",
|
||||
"Morph",
|
||||
"NCompass",
|
||||
"Nebius",
|
||||
"NextBit",
|
||||
"Novita",
|
||||
"Nvidia",
|
||||
"OpenAI",
|
||||
"OpenInference",
|
||||
"Parasail",
|
||||
"Perplexity",
|
||||
"Phala",
|
||||
"Relace",
|
||||
"SambaNova",
|
||||
"SiliconFlow",
|
||||
"Sourceful",
|
||||
"Stealth",
|
||||
"StreamLake",
|
||||
"Switchpoint",
|
||||
"Targon",
|
||||
"Together",
|
||||
"Venice",
|
||||
"WandB",
|
||||
"Xiaomi",
|
||||
"xAI",
|
||||
"Z.AI",
|
||||
"FakeProvider",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
Schema0TypedDict = TypeAliasType("Schema0TypedDict", Union[Schema0Enum, str])
|
||||
|
||||
|
||||
Schema0 = TypeAliasType(
|
||||
"Schema0",
|
||||
Union[Annotated[Schema0Enum, PlainValidator(validate_open_enum(False))], str],
|
||||
)
|
||||
@@ -0,0 +1,17 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import UnrecognizedStr
|
||||
from typing import Literal, Union
|
||||
|
||||
|
||||
ChatCompletionFinishReason = Union[
|
||||
Literal[
|
||||
"tool_calls",
|
||||
"stop",
|
||||
"length",
|
||||
"content_filter",
|
||||
"error",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
@@ -1,6 +1,7 @@
|
||||
"""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
|
||||
@@ -21,14 +22,355 @@ from openrouter.types import (
|
||||
UNSET_SENTINEL,
|
||||
UnrecognizedStr,
|
||||
)
|
||||
from openrouter.utils import validate_const, validate_open_enum
|
||||
from openrouter.utils import get_discriminator, validate_const, validate_open_enum
|
||||
import pydantic
|
||||
from pydantic import model_serializer
|
||||
from pydantic import Discriminator, Tag, model_serializer
|
||||
from pydantic.functional_validators import AfterValidator, PlainValidator
|
||||
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",
|
||||
@@ -36,6 +378,7 @@ Effort = Union[
|
||||
"low",
|
||||
"medium",
|
||||
"high",
|
||||
"xhigh",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
@@ -134,16 +477,16 @@ ChatGenerationParamsResponseFormatUnionTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
ChatGenerationParamsResponseFormatUnion = TypeAliasType(
|
||||
"ChatGenerationParamsResponseFormatUnion",
|
||||
ChatGenerationParamsResponseFormatUnion = Annotated[
|
||||
Union[
|
||||
ChatGenerationParamsResponseFormatText,
|
||||
ChatGenerationParamsResponseFormatJSONObject,
|
||||
ChatGenerationParamsResponseFormatPython,
|
||||
ResponseFormatJSONSchema,
|
||||
ResponseFormatTextGrammar,
|
||||
Annotated[ChatGenerationParamsResponseFormatText, Tag("text")],
|
||||
Annotated[ChatGenerationParamsResponseFormatJSONObject, Tag("json_object")],
|
||||
Annotated[ResponseFormatJSONSchema, Tag("json_schema")],
|
||||
Annotated[ResponseFormatTextGrammar, Tag("grammar")],
|
||||
Annotated[ChatGenerationParamsResponseFormatPython, Tag("python")],
|
||||
],
|
||||
)
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
ChatGenerationParamsStopTypedDict = TypeAliasType(
|
||||
@@ -156,8 +499,25 @@ ChatGenerationParamsStop = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
class DebugTypedDict(TypedDict):
|
||||
echo_upstream_body: NotRequired[bool]
|
||||
|
||||
|
||||
class Debug(BaseModel):
|
||||
echo_upstream_body: Optional[bool] = None
|
||||
|
||||
|
||||
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]]
|
||||
@@ -178,12 +538,29 @@ 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
|
||||
@@ -224,11 +601,16 @@ 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",
|
||||
@@ -249,9 +631,11 @@ class ChatGenerationParams(BaseModel):
|
||||
"tool_choice",
|
||||
"tools",
|
||||
"top_p",
|
||||
"user",
|
||||
"debug",
|
||||
]
|
||||
nullable_fields = [
|
||||
"provider",
|
||||
"route",
|
||||
"frequency_penalty",
|
||||
"logit_bias",
|
||||
"logprobs",
|
||||
|
||||
@@ -26,9 +26,9 @@ from typing_extensions import Annotated, TypeAliasType
|
||||
ChatMessageContentItemTypedDict = TypeAliasType(
|
||||
"ChatMessageContentItemTypedDict",
|
||||
Union[
|
||||
ChatMessageContentItemTextTypedDict,
|
||||
ChatMessageContentItemImageTypedDict,
|
||||
ChatMessageContentItemAudioTypedDict,
|
||||
ChatMessageContentItemTextTypedDict,
|
||||
ChatMessageContentItemVideoTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
@@ -1,42 +1,23 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, UnrecognizedStr
|
||||
from openrouter.utils import validate_const, validate_open_enum
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import validate_const
|
||||
import pydantic
|
||||
from pydantic.functional_validators import AfterValidator, PlainValidator
|
||||
from typing import Literal, Union
|
||||
from pydantic.functional_validators import AfterValidator
|
||||
from typing import Literal
|
||||
from typing_extensions import Annotated, TypedDict
|
||||
|
||||
|
||||
ChatMessageContentItemAudioFormat = Union[
|
||||
Literal[
|
||||
"wav",
|
||||
"mp3",
|
||||
"flac",
|
||||
"m4a",
|
||||
"ogg",
|
||||
"pcm16",
|
||||
"pcm24",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
class ChatMessageContentItemAudioInputAudioTypedDict(TypedDict):
|
||||
data: str
|
||||
format_: ChatMessageContentItemAudioFormat
|
||||
format_: str
|
||||
|
||||
|
||||
class ChatMessageContentItemAudioInputAudio(BaseModel):
|
||||
data: str
|
||||
|
||||
format_: Annotated[
|
||||
Annotated[
|
||||
ChatMessageContentItemAudioFormat, PlainValidator(validate_open_enum(False))
|
||||
],
|
||||
pydantic.Field(alias="format"),
|
||||
]
|
||||
format_: Annotated[str, pydantic.Field(alias="format")]
|
||||
|
||||
|
||||
class ChatMessageContentItemAudioTypedDict(TypedDict):
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, UnrecognizedStr
|
||||
from openrouter.utils import validate_const, validate_open_enum
|
||||
import pydantic
|
||||
from pydantic.functional_validators import AfterValidator, PlainValidator
|
||||
from typing import Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
TTL = Union[
|
||||
Literal[
|
||||
"5m",
|
||||
"1h",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
class ChatMessageContentItemCacheControlTypedDict(TypedDict):
|
||||
type: Literal["ephemeral"]
|
||||
ttl: NotRequired[TTL]
|
||||
|
||||
|
||||
class ChatMessageContentItemCacheControl(BaseModel):
|
||||
TYPE: Annotated[
|
||||
Annotated[Literal["ephemeral"], AfterValidator(validate_const("ephemeral"))],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "ephemeral"
|
||||
|
||||
ttl: Annotated[Optional[TTL], PlainValidator(validate_open_enum(False))] = None
|
||||
@@ -1,17 +1,22 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatmessagecontentitemcachecontrol import (
|
||||
ChatMessageContentItemCacheControl,
|
||||
ChatMessageContentItemCacheControlTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import validate_const
|
||||
import pydantic
|
||||
from pydantic.functional_validators import AfterValidator
|
||||
from typing import Literal
|
||||
from typing_extensions import Annotated, TypedDict
|
||||
from typing import Literal, Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class ChatMessageContentItemTextTypedDict(TypedDict):
|
||||
text: str
|
||||
type: Literal["text"]
|
||||
cache_control: NotRequired[ChatMessageContentItemCacheControlTypedDict]
|
||||
|
||||
|
||||
class ChatMessageContentItemText(BaseModel):
|
||||
@@ -21,3 +26,5 @@ class ChatMessageContentItemText(BaseModel):
|
||||
Annotated[Literal["text"], AfterValidator(validate_const("text"))],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "text"
|
||||
|
||||
cache_control: Optional[ChatMessageContentItemCacheControl] = None
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import validate_const
|
||||
from openrouter.utils import get_discriminator, validate_const
|
||||
import pydantic
|
||||
from pydantic import Discriminator, Tag
|
||||
from pydantic.functional_validators import AfterValidator
|
||||
from typing import Literal, Union
|
||||
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
||||
@@ -64,7 +65,10 @@ ChatMessageContentItemVideoTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
ChatMessageContentItemVideo = TypeAliasType(
|
||||
"ChatMessageContentItemVideo",
|
||||
Union[ChatMessageContentItemVideoInputVideo, ChatMessageContentItemVideoVideoURL],
|
||||
)
|
||||
ChatMessageContentItemVideo = Annotated[
|
||||
Union[
|
||||
Annotated[ChatMessageContentItemVideoInputVideo, Tag("input_video")],
|
||||
Annotated[ChatMessageContentItemVideoVideoURL, Tag("video_url")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
@@ -2,41 +2,24 @@
|
||||
|
||||
from __future__ import annotations
|
||||
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
|
||||
from .chatcompletionfinishreason import ChatCompletionFinishReason
|
||||
from .chatmessagetokenlogprobs import (
|
||||
ChatMessageTokenLogprobs,
|
||||
ChatMessageTokenLogprobsTypedDict,
|
||||
)
|
||||
from .chatstreamingmessagechunk import (
|
||||
ChatStreamingMessageChunk,
|
||||
ChatStreamingMessageChunkTypedDict,
|
||||
)
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
UnrecognizedStr,
|
||||
)
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Literal, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
ChatCompletionFinishReason = Union[
|
||||
Literal[
|
||||
"tool_calls",
|
||||
"stop",
|
||||
"length",
|
||||
"content_filter",
|
||||
"error",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
class ChatResponseChoiceTypedDict(TypedDict):
|
||||
finish_reason: Nullable[ChatCompletionFinishReason]
|
||||
index: float
|
||||
@@ -84,52 +67,3 @@ class ChatResponseChoice(BaseModel):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class ChatStreamingChoiceTypedDict(TypedDict):
|
||||
delta: ChatStreamingMessageChunkTypedDict
|
||||
finish_reason: Nullable[ChatCompletionFinishReason]
|
||||
index: float
|
||||
logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]]
|
||||
|
||||
|
||||
class ChatStreamingChoice(BaseModel):
|
||||
delta: ChatStreamingMessageChunk
|
||||
|
||||
finish_reason: Annotated[
|
||||
Nullable[ChatCompletionFinishReason], PlainValidator(validate_open_enum(False))
|
||||
]
|
||||
|
||||
index: float
|
||||
|
||||
logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["logprobs"]
|
||||
nullable_fields = ["finish_reason", "logprobs"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletionfinishreason import ChatCompletionFinishReason
|
||||
from .chatmessagetokenlogprobs import (
|
||||
ChatMessageTokenLogprobs,
|
||||
ChatMessageTokenLogprobsTypedDict,
|
||||
)
|
||||
from .chatstreamingmessagechunk import (
|
||||
ChatStreamingMessageChunk,
|
||||
ChatStreamingMessageChunkTypedDict,
|
||||
)
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class ChatStreamingChoiceTypedDict(TypedDict):
|
||||
delta: ChatStreamingMessageChunkTypedDict
|
||||
finish_reason: Nullable[ChatCompletionFinishReason]
|
||||
index: float
|
||||
logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]]
|
||||
|
||||
|
||||
class ChatStreamingChoice(BaseModel):
|
||||
delta: ChatStreamingMessageChunk
|
||||
|
||||
finish_reason: Annotated[
|
||||
Nullable[ChatCompletionFinishReason], PlainValidator(validate_open_enum(False))
|
||||
]
|
||||
|
||||
index: float
|
||||
|
||||
logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["logprobs"]
|
||||
nullable_fields = ["finish_reason", "logprobs"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -5,7 +5,7 @@ from .chatgenerationtokenusage import (
|
||||
ChatGenerationTokenUsage,
|
||||
ChatGenerationTokenUsageTypedDict,
|
||||
)
|
||||
from .chatresponsechoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
|
||||
from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
|
||||
@@ -2,12 +2,19 @@
|
||||
|
||||
from __future__ import annotations
|
||||
from .completionlogprobs import CompletionLogprobs, CompletionLogprobsTypedDict
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
UnrecognizedStr,
|
||||
)
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Literal, Union
|
||||
from typing_extensions import Annotated, TypedDict
|
||||
from typing import Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
CompletionFinishReason = Union[
|
||||
@@ -25,6 +32,8 @@ class CompletionChoiceTypedDict(TypedDict):
|
||||
index: float
|
||||
logprobs: Nullable[CompletionLogprobsTypedDict]
|
||||
finish_reason: Nullable[CompletionFinishReason]
|
||||
native_finish_reason: NotRequired[str]
|
||||
reasoning: NotRequired[Nullable[str]]
|
||||
|
||||
|
||||
class CompletionChoice(BaseModel):
|
||||
@@ -38,10 +47,14 @@ class CompletionChoice(BaseModel):
|
||||
Nullable[CompletionFinishReason], PlainValidator(validate_open_enum(False))
|
||||
]
|
||||
|
||||
native_finish_reason: Optional[str] = None
|
||||
|
||||
reasoning: OptionalNullable[str] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["logprobs", "finish_reason"]
|
||||
optional_fields = ["native_finish_reason", "reasoning"]
|
||||
nullable_fields = ["logprobs", "finish_reason", "reasoning"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
@@ -16,9 +16,9 @@ from openrouter.types import (
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from openrouter.utils import validate_const
|
||||
from openrouter.utils import get_discriminator, validate_const
|
||||
import pydantic
|
||||
from pydantic import model_serializer
|
||||
from pydantic import Discriminator, Tag, model_serializer
|
||||
from pydantic.functional_validators import AfterValidator
|
||||
from typing import Dict, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
@@ -127,16 +127,16 @@ CompletionCreateParamsResponseFormatUnionTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
CompletionCreateParamsResponseFormatUnion = TypeAliasType(
|
||||
"CompletionCreateParamsResponseFormatUnion",
|
||||
CompletionCreateParamsResponseFormatUnion = Annotated[
|
||||
Union[
|
||||
CompletionCreateParamsResponseFormatText,
|
||||
CompletionCreateParamsResponseFormatJSONObject,
|
||||
CompletionCreateParamsResponseFormatPython,
|
||||
ResponseFormatJSONSchema,
|
||||
ResponseFormatTextGrammar,
|
||||
Annotated[CompletionCreateParamsResponseFormatText, Tag("text")],
|
||||
Annotated[CompletionCreateParamsResponseFormatJSONObject, Tag("json_object")],
|
||||
Annotated[ResponseFormatJSONSchema, Tag("json_schema")],
|
||||
Annotated[ResponseFormatTextGrammar, Tag("grammar")],
|
||||
Annotated[CompletionCreateParamsResponseFormatPython, Tag("python")],
|
||||
],
|
||||
)
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
class CompletionCreateParamsTypedDict(TypedDict):
|
||||
|
||||
@@ -17,6 +17,7 @@ class CompletionResponseTypedDict(TypedDict):
|
||||
model: str
|
||||
choices: List[CompletionChoiceTypedDict]
|
||||
object: Literal["text_completion"]
|
||||
provider: NotRequired[str]
|
||||
system_fingerprint: NotRequired[str]
|
||||
usage: NotRequired[CompletionUsageTypedDict]
|
||||
|
||||
@@ -38,6 +39,8 @@ class CompletionResponse(BaseModel):
|
||||
pydantic.Field(alias="object"),
|
||||
] = "text_completion"
|
||||
|
||||
provider: Optional[str] = None
|
||||
|
||||
system_fingerprint: Optional[str] = None
|
||||
|
||||
usage: Optional[CompletionUsage] = None
|
||||
|
||||
@@ -10,8 +10,9 @@ from .systemmessage import SystemMessage, SystemMessageTypedDict
|
||||
from .toolresponsemessage import ToolResponseMessage, ToolResponseMessageTypedDict
|
||||
from .usermessage import UserMessage, UserMessageTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import validate_const
|
||||
from openrouter.utils import get_discriminator, validate_const
|
||||
import pydantic
|
||||
from pydantic import Discriminator, Tag
|
||||
from pydantic.functional_validators import AfterValidator
|
||||
from typing import List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
@@ -56,13 +57,13 @@ MessageTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
Message = TypeAliasType(
|
||||
"Message",
|
||||
Message = Annotated[
|
||||
Union[
|
||||
SystemMessage,
|
||||
UserMessage,
|
||||
MessageDeveloper,
|
||||
ToolResponseMessage,
|
||||
AssistantMessage,
|
||||
Annotated[SystemMessage, Tag("system")],
|
||||
Annotated[UserMessage, Tag("user")],
|
||||
Annotated[MessageDeveloper, Tag("developer")],
|
||||
Annotated[AssistantMessage, Tag("assistant")],
|
||||
Annotated[ToolResponseMessage, Tag("tool")],
|
||||
],
|
||||
)
|
||||
Discriminator(lambda m: get_discriminator(m, "role", "role")),
|
||||
]
|
||||
|
||||
@@ -4,8 +4,10 @@ from __future__ import annotations
|
||||
from .filecitation import FileCitation, FileCitationTypedDict
|
||||
from .filepath import FilePath, FilePathTypedDict
|
||||
from .urlcitation import URLCitation, URLCitationTypedDict
|
||||
from openrouter.utils import get_discriminator
|
||||
from pydantic import Discriminator, Tag
|
||||
from typing import Union
|
||||
from typing_extensions import TypeAliasType
|
||||
from typing_extensions import Annotated, TypeAliasType
|
||||
|
||||
|
||||
OpenAIResponsesAnnotationTypedDict = TypeAliasType(
|
||||
@@ -14,6 +16,11 @@ OpenAIResponsesAnnotationTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
OpenAIResponsesAnnotation = TypeAliasType(
|
||||
"OpenAIResponsesAnnotation", Union[FilePath, FileCitation, URLCitation]
|
||||
)
|
||||
OpenAIResponsesAnnotation = Annotated[
|
||||
Union[
|
||||
Annotated[FileCitation, Tag("file_citation")],
|
||||
Annotated[URLCitation, Tag("url_citation")],
|
||||
Annotated[FilePath, Tag("file_path")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
@@ -7,6 +7,7 @@ from typing import Literal, Union
|
||||
|
||||
OpenAIResponsesReasoningEffort = Union[
|
||||
Literal[
|
||||
"xhigh",
|
||||
"high",
|
||||
"medium",
|
||||
"low",
|
||||
|
||||
@@ -48,8 +48,8 @@ from openrouter.types import (
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
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 Any, Dict, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
@@ -127,16 +127,19 @@ OpenResponsesNonStreamingResponseToolUnionTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
OpenResponsesNonStreamingResponseToolUnion = TypeAliasType(
|
||||
"OpenResponsesNonStreamingResponseToolUnion",
|
||||
OpenResponsesNonStreamingResponseToolUnion = Annotated[
|
||||
Union[
|
||||
OpenResponsesWebSearchPreviewTool,
|
||||
OpenResponsesWebSearchPreview20250311Tool,
|
||||
OpenResponsesWebSearchTool,
|
||||
OpenResponsesWebSearch20250826Tool,
|
||||
OpenResponsesNonStreamingResponseToolFunction,
|
||||
Annotated[OpenResponsesNonStreamingResponseToolFunction, Tag("function")],
|
||||
Annotated[OpenResponsesWebSearchPreviewTool, Tag("web_search_preview")],
|
||||
Annotated[
|
||||
OpenResponsesWebSearchPreview20250311Tool,
|
||||
Tag("web_search_preview_2025_03_11"),
|
||||
],
|
||||
Annotated[OpenResponsesWebSearchTool, Tag("web_search")],
|
||||
Annotated[OpenResponsesWebSearch20250826Tool, Tag("web_search_2025_08_26")],
|
||||
],
|
||||
)
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
class OpenResponsesNonStreamingResponseTypedDict(TypedDict):
|
||||
|
||||
@@ -44,9 +44,10 @@ from openrouter.types import (
|
||||
UNSET_SENTINEL,
|
||||
UnrecognizedStr,
|
||||
)
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from openrouter.utils import get_discriminator, validate_const, validate_open_enum
|
||||
import pydantic
|
||||
from pydantic import Discriminator, Tag, model_serializer
|
||||
from pydantic.functional_validators import AfterValidator, PlainValidator
|
||||
from typing import Any, Dict, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
@@ -120,30 +121,24 @@ OpenResponsesRequestToolUnionTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
OpenResponsesRequestToolUnion = TypeAliasType(
|
||||
"OpenResponsesRequestToolUnion",
|
||||
OpenResponsesRequestToolUnion = Annotated[
|
||||
Union[
|
||||
OpenResponsesWebSearchPreviewTool,
|
||||
OpenResponsesWebSearchPreview20250311Tool,
|
||||
OpenResponsesWebSearchTool,
|
||||
OpenResponsesWebSearch20250826Tool,
|
||||
OpenResponsesRequestToolFunction,
|
||||
Annotated[OpenResponsesRequestToolFunction, Tag("function")],
|
||||
Annotated[OpenResponsesWebSearchPreviewTool, Tag("web_search_preview")],
|
||||
Annotated[
|
||||
OpenResponsesWebSearchPreview20250311Tool,
|
||||
Tag("web_search_preview_2025_03_11"),
|
||||
],
|
||||
Annotated[OpenResponsesWebSearchTool, Tag("web_search")],
|
||||
Annotated[OpenResponsesWebSearch20250826Tool, Tag("web_search_2025_08_26")],
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
ServiceTier = Union[
|
||||
Literal[
|
||||
"auto",
|
||||
"default",
|
||||
"flex",
|
||||
"priority",
|
||||
"scale",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
ServiceTier = Literal["auto",]
|
||||
|
||||
|
||||
Truncation = Union[
|
||||
Literal[
|
||||
"auto",
|
||||
@@ -180,41 +175,41 @@ Ignore = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
class MaxPriceTypedDict(TypedDict):
|
||||
class OpenResponsesRequestMaxPriceTypedDict(TypedDict):
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
|
||||
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"""
|
||||
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"""
|
||||
|
||||
|
||||
class MaxPrice(BaseModel):
|
||||
class OpenResponsesRequestMaxPrice(BaseModel):
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
|
||||
prompt: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
prompt: 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"""
|
||||
completion: 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: 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"""
|
||||
audio: 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"""
|
||||
request: Optional[str] = None
|
||||
r"""A value in string format that is a large number"""
|
||||
|
||||
|
||||
class ProviderTypedDict(TypedDict):
|
||||
class OpenResponsesRequestProviderTypedDict(TypedDict):
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
|
||||
allow_fallbacks: NotRequired[Nullable[bool]]
|
||||
@@ -245,11 +240,15 @@ class ProviderTypedDict(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[MaxPriceTypedDict]
|
||||
max_price: NotRequired[OpenResponsesRequestMaxPriceTypedDict]
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
min_throughput: NotRequired[Nullable[float]]
|
||||
r"""The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used."""
|
||||
max_latency: NotRequired[Nullable[float]]
|
||||
r"""The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used."""
|
||||
|
||||
|
||||
class Provider(BaseModel):
|
||||
class OpenResponsesRequestProvider(BaseModel):
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
|
||||
allow_fallbacks: OptionalNullable[bool] = UNSET
|
||||
@@ -296,9 +295,15 @@ class Provider(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[MaxPrice] = None
|
||||
max_price: Optional[OpenResponsesRequestMaxPrice] = None
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
|
||||
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 = [
|
||||
@@ -313,6 +318,8 @@ class Provider(BaseModel):
|
||||
"quantizations",
|
||||
"sort",
|
||||
"max_price",
|
||||
"min_throughput",
|
||||
"max_latency",
|
||||
]
|
||||
nullable_fields = [
|
||||
"allow_fallbacks",
|
||||
@@ -325,6 +332,8 @@ class Provider(BaseModel):
|
||||
"ignore",
|
||||
"quantizations",
|
||||
"sort",
|
||||
"min_throughput",
|
||||
"max_latency",
|
||||
]
|
||||
null_default_fields = []
|
||||
|
||||
@@ -353,10 +362,26 @@ class Provider(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
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):
|
||||
id: IDResponseHealing
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
r"""Set to false to disable the response-healing plugin for this request. Defaults to true."""
|
||||
|
||||
|
||||
IDFileParser = Literal["file-parser",]
|
||||
|
||||
|
||||
PdfEngine = Union[
|
||||
OpenResponsesRequestPdfEngine = Union[
|
||||
Literal[
|
||||
"mistral-ocr",
|
||||
"pdf-text",
|
||||
@@ -366,34 +391,40 @@ PdfEngine = Union[
|
||||
]
|
||||
|
||||
|
||||
class PdfTypedDict(TypedDict):
|
||||
engine: NotRequired[PdfEngine]
|
||||
class OpenResponsesRequestPdfTypedDict(TypedDict):
|
||||
engine: NotRequired[OpenResponsesRequestPdfEngine]
|
||||
|
||||
|
||||
class Pdf(BaseModel):
|
||||
class OpenResponsesRequestPdf(BaseModel):
|
||||
engine: Annotated[
|
||||
Optional[PdfEngine], PlainValidator(validate_open_enum(False))
|
||||
Optional[OpenResponsesRequestPdfEngine],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
] = None
|
||||
|
||||
|
||||
class PluginFileParserTypedDict(TypedDict):
|
||||
class OpenResponsesRequestPluginFileParserTypedDict(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[PdfTypedDict]
|
||||
pdf: NotRequired[OpenResponsesRequestPdfTypedDict]
|
||||
|
||||
|
||||
class PluginFileParser(BaseModel):
|
||||
class OpenResponsesRequestPluginFileParser(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[Pdf] = None
|
||||
pdf: Optional[OpenResponsesRequestPdf] = None
|
||||
|
||||
|
||||
IDWeb = Literal["web",]
|
||||
|
||||
|
||||
Engine = Union[
|
||||
OpenResponsesRequestEngine = Union[
|
||||
Literal[
|
||||
"native",
|
||||
"exa",
|
||||
@@ -402,43 +433,71 @@ Engine = Union[
|
||||
]
|
||||
|
||||
|
||||
class PluginWebTypedDict(TypedDict):
|
||||
class OpenResponsesRequestPluginWebTypedDict(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[Engine]
|
||||
engine: NotRequired[OpenResponsesRequestEngine]
|
||||
|
||||
|
||||
class PluginWeb(BaseModel):
|
||||
class OpenResponsesRequestPluginWeb(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[Engine], PlainValidator(validate_open_enum(False))] = (
|
||||
None
|
||||
)
|
||||
engine: Annotated[
|
||||
Optional[OpenResponsesRequestEngine], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
|
||||
|
||||
IDModeration = Literal["moderation",]
|
||||
|
||||
|
||||
class PluginModerationTypedDict(TypedDict):
|
||||
class OpenResponsesRequestPluginModerationTypedDict(TypedDict):
|
||||
id: IDModeration
|
||||
|
||||
|
||||
class PluginModeration(BaseModel):
|
||||
class OpenResponsesRequestPluginModeration(BaseModel):
|
||||
id: IDModeration
|
||||
|
||||
|
||||
PluginTypedDict = TypeAliasType(
|
||||
"PluginTypedDict",
|
||||
Union[PluginModerationTypedDict, PluginFileParserTypedDict, PluginWebTypedDict],
|
||||
OpenResponsesRequestPluginUnionTypedDict = TypeAliasType(
|
||||
"OpenResponsesRequestPluginUnionTypedDict",
|
||||
Union[
|
||||
OpenResponsesRequestPluginModerationTypedDict,
|
||||
OpenResponsesRequestPluginResponseHealingTypedDict,
|
||||
OpenResponsesRequestPluginFileParserTypedDict,
|
||||
OpenResponsesRequestPluginWebTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
Plugin = TypeAliasType("Plugin", Union[PluginModeration, PluginFileParser, PluginWeb])
|
||||
OpenResponsesRequestPluginUnion = Annotated[
|
||||
Union[
|
||||
Annotated[OpenResponsesRequestPluginModeration, Tag("moderation")],
|
||||
Annotated[OpenResponsesRequestPluginWeb, Tag("web")],
|
||||
Annotated[OpenResponsesRequestPluginFileParser, Tag("file-parser")],
|
||||
Annotated[OpenResponsesRequestPluginResponseHealing, 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):
|
||||
@@ -468,16 +527,20 @@ class OpenResponsesRequestTypedDict(TypedDict):
|
||||
include: NotRequired[Nullable[List[OpenAIResponsesIncludable]]]
|
||||
background: NotRequired[Nullable[bool]]
|
||||
safety_identifier: NotRequired[Nullable[str]]
|
||||
store: NotRequired[Nullable[bool]]
|
||||
service_tier: NotRequired[Nullable[ServiceTier]]
|
||||
store: Literal[False]
|
||||
service_tier: NotRequired[ServiceTier]
|
||||
truncation: NotRequired[Nullable[Truncation]]
|
||||
stream: NotRequired[bool]
|
||||
provider: NotRequired[Nullable[ProviderTypedDict]]
|
||||
provider: NotRequired[Nullable[OpenResponsesRequestProviderTypedDict]]
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
plugins: NotRequired[List[PluginTypedDict]]
|
||||
plugins: NotRequired[List[OpenResponsesRequestPluginUnionTypedDict]]
|
||||
r"""Plugins you want to enable for this request, including their settings."""
|
||||
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):
|
||||
@@ -533,11 +596,12 @@ class OpenResponsesRequest(BaseModel):
|
||||
|
||||
safety_identifier: OptionalNullable[str] = UNSET
|
||||
|
||||
store: OptionalNullable[bool] = UNSET
|
||||
STORE: Annotated[
|
||||
Annotated[Optional[Literal[False]], AfterValidator(validate_const(False))],
|
||||
pydantic.Field(alias="store"),
|
||||
] = False
|
||||
|
||||
service_tier: Annotated[
|
||||
OptionalNullable[ServiceTier], PlainValidator(validate_open_enum(False))
|
||||
] = UNSET
|
||||
service_tier: Optional[ServiceTier] = "auto"
|
||||
|
||||
truncation: Annotated[
|
||||
OptionalNullable[Truncation], PlainValidator(validate_open_enum(False))
|
||||
@@ -545,15 +609,24 @@ class OpenResponsesRequest(BaseModel):
|
||||
|
||||
stream: Optional[bool] = False
|
||||
|
||||
provider: OptionalNullable[Provider] = UNSET
|
||||
provider: OptionalNullable[OpenResponsesRequestProvider] = UNSET
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
|
||||
plugins: Optional[List[Plugin]] = None
|
||||
plugins: Optional[List[OpenResponsesRequestPluginUnion]] = None
|
||||
r"""Plugins you want to enable for this request, including their settings."""
|
||||
|
||||
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 = [
|
||||
@@ -583,7 +656,9 @@ class OpenResponsesRequest(BaseModel):
|
||||
"stream",
|
||||
"provider",
|
||||
"plugins",
|
||||
"route",
|
||||
"user",
|
||||
"session_id",
|
||||
]
|
||||
nullable_fields = [
|
||||
"instructions",
|
||||
@@ -599,10 +674,9 @@ class OpenResponsesRequest(BaseModel):
|
||||
"include",
|
||||
"background",
|
||||
"safety_identifier",
|
||||
"store",
|
||||
"service_tier",
|
||||
"truncation",
|
||||
"provider",
|
||||
"route",
|
||||
]
|
||||
null_default_fields = []
|
||||
|
||||
|
||||
@@ -59,8 +59,10 @@ from .reasoningtextcontent import ReasoningTextContent, ReasoningTextContentType
|
||||
from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict
|
||||
from .responsesoutputitem import ResponsesOutputItem, ResponsesOutputItemTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import get_discriminator
|
||||
from pydantic import Discriminator, Tag
|
||||
from typing import List, Literal, Union
|
||||
from typing_extensions import TypeAliasType, TypedDict
|
||||
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
TypeResponseReasoningSummaryPartDone = Literal["response.reasoning_summary_part.done",]
|
||||
@@ -328,10 +330,14 @@ Part2TypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
Part2 = TypeAliasType(
|
||||
"Part2",
|
||||
Union[ReasoningTextContent, OpenAIResponsesRefusalContent, ResponseOutputText],
|
||||
)
|
||||
Part2 = Annotated[
|
||||
Union[
|
||||
Annotated[ResponseOutputText, Tag("output_text")],
|
||||
Annotated[ReasoningTextContent, Tag("reasoning_text")],
|
||||
Annotated[OpenAIResponsesRefusalContent, Tag("refusal")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
class OpenResponsesStreamEventResponseContentPartDoneTypedDict(TypedDict):
|
||||
@@ -374,10 +380,14 @@ Part1TypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
Part1 = TypeAliasType(
|
||||
"Part1",
|
||||
Union[ReasoningTextContent, OpenAIResponsesRefusalContent, ResponseOutputText],
|
||||
)
|
||||
Part1 = Annotated[
|
||||
Union[
|
||||
Annotated[ResponseOutputText, Tag("output_text")],
|
||||
Annotated[ReasoningTextContent, Tag("reasoning_text")],
|
||||
Annotated[OpenAIResponsesRefusalContent, Tag("refusal")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
class OpenResponsesStreamEventResponseContentPartAddedTypedDict(TypedDict):
|
||||
@@ -609,36 +619,97 @@ OpenResponsesStreamEventTypedDict = TypeAliasType(
|
||||
r"""Union of all possible event types emitted during response streaming"""
|
||||
|
||||
|
||||
OpenResponsesStreamEvent = TypeAliasType(
|
||||
"OpenResponsesStreamEvent",
|
||||
OpenResponsesStreamEvent = Annotated[
|
||||
Union[
|
||||
OpenResponsesStreamEventResponseCreated,
|
||||
OpenResponsesStreamEventResponseInProgress,
|
||||
OpenResponsesStreamEventResponseCompleted,
|
||||
OpenResponsesStreamEventResponseIncomplete,
|
||||
OpenResponsesStreamEventResponseFailed,
|
||||
OpenResponsesStreamEventResponseOutputItemAdded,
|
||||
OpenResponsesStreamEventResponseOutputItemDone,
|
||||
OpenResponsesImageGenCallCompleted,
|
||||
OpenResponsesImageGenCallGenerating,
|
||||
OpenResponsesImageGenCallInProgress,
|
||||
OpenResponsesErrorEvent,
|
||||
OpenResponsesStreamEventResponseFunctionCallArgumentsDelta,
|
||||
OpenResponsesStreamEventResponseRefusalDelta,
|
||||
OpenResponsesReasoningSummaryPartAddedEvent,
|
||||
OpenResponsesStreamEventResponseContentPartAdded,
|
||||
OpenResponsesImageGenCallPartialImage,
|
||||
OpenResponsesStreamEventResponseFunctionCallArgumentsDone,
|
||||
OpenResponsesReasoningDeltaEvent,
|
||||
OpenResponsesReasoningDoneEvent,
|
||||
OpenResponsesStreamEventResponseRefusalDone,
|
||||
OpenResponsesStreamEventResponseReasoningSummaryPartDone,
|
||||
OpenResponsesReasoningSummaryTextDeltaEvent,
|
||||
OpenResponsesReasoningSummaryTextDoneEvent,
|
||||
OpenResponsesStreamEventResponseContentPartDone,
|
||||
OpenResponsesStreamEventResponseOutputTextDelta,
|
||||
OpenResponsesStreamEventResponseOutputTextDone,
|
||||
OpenResponsesStreamEventResponseOutputTextAnnotationAdded,
|
||||
Annotated[OpenResponsesStreamEventResponseCreated, Tag("response.created")],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseInProgress, Tag("response.in_progress")
|
||||
],
|
||||
Annotated[OpenResponsesStreamEventResponseCompleted, Tag("response.completed")],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseIncomplete, Tag("response.incomplete")
|
||||
],
|
||||
Annotated[OpenResponsesStreamEventResponseFailed, Tag("response.failed")],
|
||||
Annotated[OpenResponsesErrorEvent, Tag("error")],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseOutputItemAdded,
|
||||
Tag("response.output_item.added"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseOutputItemDone,
|
||||
Tag("response.output_item.done"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseContentPartAdded,
|
||||
Tag("response.content_part.added"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseContentPartDone,
|
||||
Tag("response.content_part.done"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseOutputTextDelta,
|
||||
Tag("response.output_text.delta"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseOutputTextDone,
|
||||
Tag("response.output_text.done"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseRefusalDelta, Tag("response.refusal.delta")
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseRefusalDone, Tag("response.refusal.done")
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseOutputTextAnnotationAdded,
|
||||
Tag("response.output_text.annotation.added"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseFunctionCallArgumentsDelta,
|
||||
Tag("response.function_call_arguments.delta"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseFunctionCallArgumentsDone,
|
||||
Tag("response.function_call_arguments.done"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesReasoningDeltaEvent, Tag("response.reasoning_text.delta")
|
||||
],
|
||||
Annotated[OpenResponsesReasoningDoneEvent, Tag("response.reasoning_text.done")],
|
||||
Annotated[
|
||||
OpenResponsesReasoningSummaryPartAddedEvent,
|
||||
Tag("response.reasoning_summary_part.added"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesStreamEventResponseReasoningSummaryPartDone,
|
||||
Tag("response.reasoning_summary_part.done"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesReasoningSummaryTextDeltaEvent,
|
||||
Tag("response.reasoning_summary_text.delta"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesReasoningSummaryTextDoneEvent,
|
||||
Tag("response.reasoning_summary_text.done"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesImageGenCallInProgress,
|
||||
Tag("response.image_generation_call.in_progress"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesImageGenCallGenerating,
|
||||
Tag("response.image_generation_call.generating"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesImageGenCallPartialImage,
|
||||
Tag("response.image_generation_call.partial_image"),
|
||||
],
|
||||
Annotated[
|
||||
OpenResponsesImageGenCallCompleted,
|
||||
Tag("response.image_generation_call.completed"),
|
||||
],
|
||||
],
|
||||
)
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
r"""Union of all possible event types emitted during response streaming"""
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user