mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-31 12:30:30 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
faa7751056 |
+48
-59
@@ -1,12 +1,12 @@
|
||||
lockVersion: 2.0.0
|
||||
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
|
||||
management:
|
||||
docChecksum: 7136b263714e485a5a96ee056b6e3f36
|
||||
docChecksum: 52c044061097671980a3ac37a4839b7f
|
||||
docVersion: 1.0.0
|
||||
speakeasyVersion: 1.666.0
|
||||
generationVersion: 2.768.0
|
||||
releaseVersion: 0.1.3
|
||||
configChecksum: d03f8606816d7028a10e566c4ff2ac44
|
||||
releaseVersion: 0.5.0
|
||||
configChecksum: 4bcc2dd9900ba2408612f6fa04918561
|
||||
repoURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||
published: true
|
||||
@@ -60,25 +60,7 @@ generatedFiles:
|
||||
- docs/components/chatcompletionfinishreason.md
|
||||
- docs/components/chaterrorerror.md
|
||||
- docs/components/chatgenerationparams.md
|
||||
- docs/components/chatgenerationparamsdatacollection.md
|
||||
- docs/components/chatgenerationparamsimageconfig.md
|
||||
- docs/components/chatgenerationparamsmaxprice.md
|
||||
- docs/components/chatgenerationparamspluginautorouter.md
|
||||
- docs/components/chatgenerationparamspluginfileparser.md
|
||||
- docs/components/chatgenerationparamspluginmoderation.md
|
||||
- docs/components/chatgenerationparamspluginresponsehealing.md
|
||||
- docs/components/chatgenerationparamspluginunion.md
|
||||
- docs/components/chatgenerationparamspluginweb.md
|
||||
- docs/components/chatgenerationparamspreferredmaxlatency.md
|
||||
- docs/components/chatgenerationparamspreferredmaxlatencyunion.md
|
||||
- docs/components/chatgenerationparamspreferredminthroughput.md
|
||||
- docs/components/chatgenerationparamspreferredminthroughputunion.md
|
||||
- docs/components/chatgenerationparamsprovider.md
|
||||
- docs/components/chatgenerationparamsresponseformatjsonobject.md
|
||||
- docs/components/chatgenerationparamsresponseformatpython.md
|
||||
- docs/components/chatgenerationparamsresponseformattext.md
|
||||
- docs/components/chatgenerationparamsresponseformatunion.md
|
||||
- docs/components/chatgenerationparamsstop.md
|
||||
- docs/components/chatgenerationtokenusage.md
|
||||
- docs/components/chatmessagecontentitem.md
|
||||
- docs/components/chatmessagecontentitemaudio.md
|
||||
@@ -109,23 +91,15 @@ generatedFiles:
|
||||
- docs/components/chatstreamoptions.md
|
||||
- docs/components/code.md
|
||||
- docs/components/codeenum.md
|
||||
- docs/components/completionchoice.md
|
||||
- docs/components/completioncreateparams.md
|
||||
- docs/components/completioncreateparamsresponseformatjsonobject.md
|
||||
- docs/components/completioncreateparamsresponseformatpython.md
|
||||
- docs/components/completioncreateparamsresponseformattext.md
|
||||
- docs/components/completioncreateparamsresponseformatunion.md
|
||||
- docs/components/completioncreateparamsstop.md
|
||||
- docs/components/completionfinishreason.md
|
||||
- docs/components/completionlogprobs.md
|
||||
- docs/components/completionresponse.md
|
||||
- docs/components/completion.md
|
||||
- docs/components/completiontokensdetails.md
|
||||
- docs/components/completionusage.md
|
||||
- docs/components/costdetails.md
|
||||
- docs/components/createchargerequest.md
|
||||
- docs/components/datacollection.md
|
||||
- docs/components/debug.md
|
||||
- docs/components/defaultparameters.md
|
||||
- docs/components/developermessage.md
|
||||
- docs/components/developermessagecontent.md
|
||||
- docs/components/edgenetworktimeoutresponseerrordata.md
|
||||
- docs/components/effort.md
|
||||
- docs/components/endpointstatus.md
|
||||
@@ -150,8 +124,6 @@ generatedFiles:
|
||||
- docs/components/listendpointsresponse.md
|
||||
- docs/components/logprob.md
|
||||
- docs/components/message.md
|
||||
- docs/components/messagecontent.md
|
||||
- docs/components/messagedeveloper.md
|
||||
- docs/components/modality.md
|
||||
- docs/components/model.md
|
||||
- docs/components/modelarchitecture.md
|
||||
@@ -273,13 +245,6 @@ generatedFiles:
|
||||
- docs/components/openresponsesrequestmaxprice.md
|
||||
- docs/components/openresponsesrequestonly.md
|
||||
- docs/components/openresponsesrequestorder.md
|
||||
- docs/components/openresponsesrequestpluginautorouter.md
|
||||
- docs/components/openresponsesrequestpluginfileparser.md
|
||||
- docs/components/openresponsesrequestpluginmoderation.md
|
||||
- docs/components/openresponsesrequestpluginresponsehealing.md
|
||||
- docs/components/openresponsesrequestpluginunion.md
|
||||
- docs/components/openresponsesrequestpluginweb.md
|
||||
- docs/components/openresponsesrequestprovider.md
|
||||
- docs/components/openresponsesrequestsort.md
|
||||
- docs/components/openresponsesrequesttoolfunction.md
|
||||
- docs/components/openresponsesrequesttoolunion.md
|
||||
@@ -342,11 +307,18 @@ generatedFiles:
|
||||
- docs/components/percentilestats.md
|
||||
- docs/components/percentilethroughputcutoffs.md
|
||||
- docs/components/perrequestlimits.md
|
||||
- docs/components/plugin.md
|
||||
- docs/components/pluginautorouter.md
|
||||
- docs/components/pluginfileparser.md
|
||||
- docs/components/pluginmoderation.md
|
||||
- docs/components/pluginresponsehealing.md
|
||||
- docs/components/pluginweb.md
|
||||
- docs/components/preferredmaxlatency.md
|
||||
- docs/components/preferredminthroughput.md
|
||||
- docs/components/pricing.md
|
||||
- docs/components/prompt.md
|
||||
- docs/components/prompttokensdetails.md
|
||||
- docs/components/provider.md
|
||||
- docs/components/providername.md
|
||||
- docs/components/provideroverloadedresponseerrordata.md
|
||||
- docs/components/providerpreferences.md
|
||||
@@ -367,7 +339,6 @@ generatedFiles:
|
||||
- docs/components/publicendpointquantization.md
|
||||
- docs/components/publicpricing.md
|
||||
- docs/components/quantization.md
|
||||
- docs/components/quantizations.md
|
||||
- docs/components/reason.md
|
||||
- docs/components/reasoning.md
|
||||
- docs/components/reasoningsummarytext.md
|
||||
@@ -376,7 +347,11 @@ generatedFiles:
|
||||
- docs/components/reasoningtextcontent.md
|
||||
- docs/components/reasoningtextcontenttype.md
|
||||
- docs/components/requesttimeoutresponseerrordata.md
|
||||
- docs/components/responseformat.md
|
||||
- docs/components/responseformatjsonobject.md
|
||||
- docs/components/responseformatjsonschema.md
|
||||
- docs/components/responseformatpython.md
|
||||
- docs/components/responseformattext.md
|
||||
- docs/components/responseformattextconfig.md
|
||||
- docs/components/responseformattextgrammar.md
|
||||
- docs/components/responseinputaudio.md
|
||||
@@ -438,17 +413,30 @@ generatedFiles:
|
||||
- docs/components/responsetextconfigverbosity.md
|
||||
- docs/components/route.md
|
||||
- docs/components/schema0.md
|
||||
- docs/components/schema0enum.md
|
||||
- docs/components/schema2.md
|
||||
- docs/components/schema2reasoningencrypted.md
|
||||
- docs/components/schema2reasoningsummary.md
|
||||
- docs/components/schema2reasoningtext.md
|
||||
- docs/components/schema4.md
|
||||
- docs/components/schema10.md
|
||||
- docs/components/schema14.md
|
||||
- docs/components/schema15.md
|
||||
- docs/components/schema15union.md
|
||||
- docs/components/schema17.md
|
||||
- docs/components/schema17autorouter.md
|
||||
- docs/components/schema17fileparser.md
|
||||
- docs/components/schema17moderation.md
|
||||
- docs/components/schema17responsehealing.md
|
||||
- docs/components/schema17web.md
|
||||
- docs/components/schema19.md
|
||||
- docs/components/schema19reasoningencrypted.md
|
||||
- docs/components/schema19reasoningsummary.md
|
||||
- docs/components/schema19reasoningtext.md
|
||||
- docs/components/schema21.md
|
||||
- docs/components/schema3.md
|
||||
- docs/components/schema5.md
|
||||
- docs/components/schema5enum.md
|
||||
- docs/components/schema8.md
|
||||
- docs/components/security.md
|
||||
- docs/components/servicetier.md
|
||||
- docs/components/serviceunavailableresponseerrordata.md
|
||||
- docs/components/sortenum.md
|
||||
- docs/components/streamoptions.md
|
||||
- docs/components/stop.md
|
||||
- docs/components/systemmessage.md
|
||||
- docs/components/systemmessagecontent.md
|
||||
- docs/components/tokenizer.md
|
||||
@@ -606,6 +594,8 @@ generatedFiles:
|
||||
- docs/operations/metadata.md
|
||||
- docs/operations/object.md
|
||||
- docs/operations/objectembedding.md
|
||||
- docs/operations/providername.md
|
||||
- docs/operations/providerresponse.md
|
||||
- docs/operations/ratelimit.md
|
||||
- docs/operations/sendchatcompletionrequestresponse.md
|
||||
- docs/operations/transferintent.md
|
||||
@@ -627,7 +617,6 @@ generatedFiles:
|
||||
- docs/sdks/analytics/README.md
|
||||
- docs/sdks/apikeys/README.md
|
||||
- docs/sdks/chat/README.md
|
||||
- docs/sdks/completions/README.md
|
||||
- docs/sdks/credits/README.md
|
||||
- docs/sdks/embeddings/README.md
|
||||
- docs/sdks/endpoints/README.md
|
||||
@@ -651,10 +640,12 @@ generatedFiles:
|
||||
- src/openrouter/basesdk.py
|
||||
- src/openrouter/beta.py
|
||||
- src/openrouter/chat.py
|
||||
- src/openrouter/completions.py
|
||||
- src/openrouter/components/__init__.py
|
||||
- src/openrouter/components/_schema0.py
|
||||
- src/openrouter/components/_schema2.py
|
||||
- src/openrouter/components/_schema10.py
|
||||
- src/openrouter/components/_schema14.py
|
||||
- src/openrouter/components/_schema17.py
|
||||
- src/openrouter/components/_schema19.py
|
||||
- src/openrouter/components/_schema5.py
|
||||
- src/openrouter/components/activityitem.py
|
||||
- src/openrouter/components/assistantmessage.py
|
||||
- src/openrouter/components/badgatewayresponseerrordata.py
|
||||
@@ -679,14 +670,10 @@ generatedFiles:
|
||||
- src/openrouter/components/chatstreamingmessagetoolcall.py
|
||||
- src/openrouter/components/chatstreamingresponsechunk.py
|
||||
- src/openrouter/components/chatstreamoptions.py
|
||||
- src/openrouter/components/completionchoice.py
|
||||
- src/openrouter/components/completioncreateparams.py
|
||||
- src/openrouter/components/completionlogprobs.py
|
||||
- src/openrouter/components/completionresponse.py
|
||||
- src/openrouter/components/completionusage.py
|
||||
- src/openrouter/components/createchargerequest.py
|
||||
- src/openrouter/components/datacollection.py
|
||||
- src/openrouter/components/defaultparameters.py
|
||||
- src/openrouter/components/developermessage.py
|
||||
- src/openrouter/components/edgenetworktimeoutresponseerrordata.py
|
||||
- src/openrouter/components/endpointstatus.py
|
||||
- src/openrouter/components/filecitation.py
|
||||
@@ -1021,7 +1008,7 @@ examples:
|
||||
id: "<id>"
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"data": {"id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG", "upstream_id": "chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946", "total_cost": 0.0015, "cache_discount": 0.0002, "upstream_inference_cost": 0.0012, "created_at": "2024-07-15T23:33:19.433273+00:00", "model": "sao10k/l3-stheno-8b", "app_id": 12345, "streamed": true, "cancelled": false, "provider_name": "Infermatic", "latency": 1250, "moderation_latency": 50, "generation_time": 1200, "finish_reason": "stop", "tokens_prompt": 10, "tokens_completion": 25, "native_tokens_prompt": 10, "native_tokens_completion": 25, "native_tokens_completion_images": 0, "native_tokens_reasoning": 5, "native_tokens_cached": 3, "num_media_prompt": 1, "num_input_audio_prompt": 0, "num_media_completion": 0, "num_search_results": 5, "origin": "https://openrouter.ai/", "usage": 0.0015, "is_byok": false, "native_finish_reason": "stop", "external_user": "user-123", "api_type": "completions", "router": "openrouter/auto"}}
|
||||
application/json: {"data": {"id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG", "upstream_id": "chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946", "total_cost": 0.0015, "cache_discount": 0.0002, "upstream_inference_cost": 0.0012, "created_at": "2024-07-15T23:33:19.433273+00:00", "model": "sao10k/l3-stheno-8b", "app_id": 12345, "streamed": true, "cancelled": false, "provider_name": "Infermatic", "latency": 1250, "moderation_latency": 50, "generation_time": 1200, "finish_reason": "stop", "tokens_prompt": 10, "tokens_completion": 25, "native_tokens_prompt": 10, "native_tokens_completion": 25, "native_tokens_completion_images": 0, "native_tokens_reasoning": 5, "native_tokens_cached": 3, "num_media_prompt": 1, "num_input_audio_prompt": 0, "num_media_completion": 0, "num_search_results": 5, "origin": "https://openrouter.ai/", "usage": 0.0015, "is_byok": false, "native_finish_reason": "stop", "external_user": "user-123", "api_type": "completions", "router": "openrouter/auto", "provider_responses": []}}
|
||||
"401":
|
||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||
"402":
|
||||
@@ -1063,6 +1050,8 @@ examples:
|
||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||
"500":
|
||||
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
|
||||
"404":
|
||||
application/json: {"error": {"code": 404, "message": "Resource not found"}}
|
||||
listEndpoints:
|
||||
speakeasy-default-list-endpoints:
|
||||
parameters:
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ generation:
|
||||
skipResponseBodyAssertions: false
|
||||
preApplyUnionDiscriminators: true
|
||||
python:
|
||||
version: 0.1.3
|
||||
version: 0.5.0
|
||||
additionalDependencies:
|
||||
dev: {}
|
||||
main: {}
|
||||
|
||||
+567
-630
File diff suppressed because it is too large
Load Diff
+553
-620
File diff suppressed because it is too large
Load Diff
@@ -8,19 +8,20 @@ sources:
|
||||
- latest
|
||||
OpenRouter API:
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:291e215687f85db05005d79dd87602a75b8086f39a841700fdbaaff7690b4f76
|
||||
sourceBlobDigest: sha256:166639d08f0ae9687cea532ed8a93db59e63293c6a6f4d17d63f015b60d643d2
|
||||
sourceRevisionDigest: sha256:9726bd1a602e2f5f3665445896ccad693820754350ead01d7aef39e0dedeb3dc
|
||||
sourceBlobDigest: sha256:f8e66605c401e126a5f39b6e0272dd792182257c5162fdfbf7c5a815c516c581
|
||||
tags:
|
||||
- latest
|
||||
- main
|
||||
- 1.0.0
|
||||
targets:
|
||||
open-router:
|
||||
source: OpenRouter API
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:291e215687f85db05005d79dd87602a75b8086f39a841700fdbaaff7690b4f76
|
||||
sourceBlobDigest: sha256:166639d08f0ae9687cea532ed8a93db59e63293c6a6f4d17d63f015b60d643d2
|
||||
sourceRevisionDigest: sha256:9726bd1a602e2f5f3665445896ccad693820754350ead01d7aef39e0dedeb3dc
|
||||
sourceBlobDigest: sha256:f8e66605c401e126a5f39b6e0272dd792182257c5162fdfbf7c5a815c516c581
|
||||
codeSamplesNamespace: open-router-python-code-samples
|
||||
codeSamplesRevisionDigest: sha256:f19eae09ec90a23147935f07a86f75dbbc998e6bac3b820351a1e5f147fec590
|
||||
codeSamplesRevisionDigest: sha256:6719e0045ac51c8ab2461cbd23189a7b289fad9032460c92183e5845f9e43f61
|
||||
workflow:
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: 1.666.0
|
||||
|
||||
@@ -11,5 +11,5 @@
|
||||
| `tool_calls` | List[[components.ChatMessageToolCall](../components/chatmessagetoolcall.md)] | :heavy_minus_sign: | N/A |
|
||||
| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning_details` | List[[components.Schema2](../components/schema2.md)] | :heavy_minus_sign: | N/A |
|
||||
| `reasoning_details` | List[[components.Schema19](../components/schema19.md)] | :heavy_minus_sign: | N/A |
|
||||
| `images` | List[[components.Image](../components/image.md)] | :heavy_minus_sign: | N/A |
|
||||
@@ -3,34 +3,34 @@
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `provider` | [OptionalNullable[components.ChatGenerationParamsProvider]](../components/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. |
|
||||
| `plugins` | List[[components.ChatGenerationParamsPluginUnion](../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. |
|
||||
| `route` | [OptionalNullable[components.Route]](../components/route.md) | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. |
|
||||
| `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | N/A |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
|
||||
| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
|
||||
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning` | [Optional[components.Reasoning]](../components/reasoning.md) | :heavy_minus_sign: | N/A |
|
||||
| `response_format` | [Optional[components.ChatGenerationParamsResponseFormatUnion]](../components/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A |
|
||||
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `stop` | [OptionalNullable[components.ChatGenerationParamsStop]](../components/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A |
|
||||
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `debug` | [Optional[components.Debug]](../components/debug.md) | :heavy_minus_sign: | N/A |
|
||||
| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A |
|
||||
| `modalities` | List[[components.Modality](../components/modality.md)] | :heavy_minus_sign: | N/A |
|
||||
| Field | Type | Required | Description |
|
||||
| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
||||
| `provider` | [OptionalNullable[components.Schema0]](../components/schema0.md) | :heavy_minus_sign: | N/A |
|
||||
| `plugins` | List[[components.Schema17](../components/schema17.md)] | :heavy_minus_sign: | N/A |
|
||||
| `route` | [OptionalNullable[components.Route]](../components/route.md) | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `session_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | N/A |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
|
||||
| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
|
||||
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning` | [Optional[components.Reasoning]](../components/reasoning.md) | :heavy_minus_sign: | N/A |
|
||||
| `response_format` | [Optional[components.ResponseFormat]](../components/responseformat.md) | :heavy_minus_sign: | N/A |
|
||||
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `stop` | [OptionalNullable[components.Stop]](../components/stop.md) | :heavy_minus_sign: | N/A |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A |
|
||||
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `debug` | [Optional[components.Debug]](../components/debug.md) | :heavy_minus_sign: | N/A |
|
||||
| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A |
|
||||
| `modalities` | List[[components.Modality](../components/modality.md)] | :heavy_minus_sign: | N/A |
|
||||
@@ -15,3 +15,9 @@ value: str = /* values here */
|
||||
value: float = /* values here */
|
||||
```
|
||||
|
||||
### `List[Any]`
|
||||
|
||||
```python
|
||||
value: List[Any] = /* values here */
|
||||
```
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# ChatGenerationParamsMaxPrice
|
||||
|
||||
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `prompt` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `completion` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `image` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `audio` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `request` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,35 +0,0 @@
|
||||
# ChatGenerationParamsPluginUnion
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.ChatGenerationParamsPluginAutoRouter`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsPluginAutoRouter = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsPluginModeration`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsPluginModeration = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsPluginWeb`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsPluginWeb = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsPluginFileParser`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsPluginFileParser = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsPluginResponseHealing`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsPluginResponseHealing = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
# ChatGenerationParamsPreferredMaxLatencyUnion
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `float`
|
||||
|
||||
```python
|
||||
value: float = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsPreferredMaxLatency`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsPreferredMaxLatency = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# ChatGenerationParamsPreferredMinThroughput
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------- | ------------------------- | ------------------------- | ------------------------- |
|
||||
| `p50` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `p75` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `p90` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `p99` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,17 +0,0 @@
|
||||
# ChatGenerationParamsPreferredMinThroughputUnion
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `float`
|
||||
|
||||
```python
|
||||
value: float = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsPreferredMinThroughput`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsPreferredMinThroughput = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# ChatGenerationParamsProvider
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests<br/>- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.<br/>- false: use only the primary/custom provider, and return the upstream error if it's unavailable.<br/> |
|
||||
| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. |
|
||||
| `data_collection` | [OptionalNullable[components.ChatGenerationParamsDataCollection]](../components/chatgenerationparamsdatacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.<br/>- allow: (default) allow providers which store user data non-transiently and may train on it<br/><br/>- deny: use only providers which do not collect user data. |
|
||||
| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `order` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. |
|
||||
| `only` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. |
|
||||
| `ignore` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. |
|
||||
| `quantizations` | List[[components.Quantizations](../components/quantizations.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. |
|
||||
| `sort` | [OptionalNullable[components.ProviderSortUnion]](../components/providersortunion.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. |
|
||||
| `max_price` | [Optional[components.ChatGenerationParamsMaxPrice]](../components/chatgenerationparamsmaxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. |
|
||||
| `preferred_min_throughput` | [OptionalNullable[components.ChatGenerationParamsPreferredMinThroughputUnion]](../components/chatgenerationparamspreferredminthroughputunion.md) | :heavy_minus_sign: | Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. |
|
||||
| `preferred_max_latency` | [OptionalNullable[components.ChatGenerationParamsPreferredMaxLatencyUnion]](../components/chatgenerationparamspreferredmaxlatencyunion.md) | :heavy_minus_sign: | Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. |
|
||||
@@ -1,35 +0,0 @@
|
||||
# ChatGenerationParamsResponseFormatUnion
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.ChatGenerationParamsResponseFormatText`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsResponseFormatText = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsResponseFormatJSONObject`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsResponseFormatJSONObject = /* values here */
|
||||
```
|
||||
|
||||
### `components.ResponseFormatJSONSchema`
|
||||
|
||||
```python
|
||||
value: components.ResponseFormatJSONSchema = /* values here */
|
||||
```
|
||||
|
||||
### `components.ResponseFormatTextGrammar`
|
||||
|
||||
```python
|
||||
value: components.ResponseFormatTextGrammar = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsResponseFormatPython`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsResponseFormatPython = /* values here */
|
||||
```
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `tool_calls` | List[[components.ChatStreamingMessageToolCall](../components/chatstreamingmessagetoolcall.md)] | :heavy_minus_sign: | N/A |
|
||||
| `reasoning_details` | List[[components.Schema2](../components/schema2.md)] | :heavy_minus_sign: | N/A |
|
||||
| `reasoning_details` | List[[components.Schema19](../components/schema19.md)] | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,23 @@
|
||||
# Completion
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `float`
|
||||
|
||||
```python
|
||||
value: float = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
### `Any`
|
||||
|
||||
```python
|
||||
value: Any = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# CompletionChoice
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
||||
| `text` | *str* | :heavy_check_mark: | N/A |
|
||||
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||
| `logprobs` | [Nullable[components.CompletionLogprobs]](../components/completionlogprobs.md) | :heavy_check_mark: | N/A |
|
||||
| `finish_reason` | [Nullable[components.CompletionFinishReason]](../components/completionfinishreason.md) | :heavy_check_mark: | N/A |
|
||||
| `native_finish_reason` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,28 +0,0 @@
|
||||
# CompletionCreateParams
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `prompt` | [components.Prompt](../components/prompt.md) | :heavy_check_mark: | N/A |
|
||||
| `best_of` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `echo` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
|
||||
| `logprobs` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `n` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `stop` | [OptionalNullable[components.CompletionCreateParamsStop]](../components/completioncreateparamsstop.md) | :heavy_minus_sign: | N/A |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `stream_options` | [OptionalNullable[components.StreamOptions]](../components/streamoptions.md) | :heavy_minus_sign: | N/A |
|
||||
| `suffix` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
|
||||
| `response_format` | [OptionalNullable[components.CompletionCreateParamsResponseFormatUnion]](../components/completioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# CompletionCreateParamsResponseFormatJSONObject
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------ | ------------------------ | ------------------------ | ------------------------ |
|
||||
| `type` | *Literal["json_object"]* | :heavy_check_mark: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# CompletionCreateParamsResponseFormatPython
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------- | ------------------- | ------------------- | ------------------- |
|
||||
| `type` | *Literal["python"]* | :heavy_check_mark: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# CompletionCreateParamsResponseFormatText
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `type` | *Literal["text"]* | :heavy_check_mark: | N/A |
|
||||
@@ -1,35 +0,0 @@
|
||||
# CompletionCreateParamsResponseFormatUnion
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.CompletionCreateParamsResponseFormatText`
|
||||
|
||||
```python
|
||||
value: components.CompletionCreateParamsResponseFormatText = /* values here */
|
||||
```
|
||||
|
||||
### `components.CompletionCreateParamsResponseFormatJSONObject`
|
||||
|
||||
```python
|
||||
value: components.CompletionCreateParamsResponseFormatJSONObject = /* values here */
|
||||
```
|
||||
|
||||
### `components.ResponseFormatJSONSchema`
|
||||
|
||||
```python
|
||||
value: components.ResponseFormatJSONSchema = /* values here */
|
||||
```
|
||||
|
||||
### `components.ResponseFormatTextGrammar`
|
||||
|
||||
```python
|
||||
value: components.ResponseFormatTextGrammar = /* values here */
|
||||
```
|
||||
|
||||
### `components.CompletionCreateParamsResponseFormatPython`
|
||||
|
||||
```python
|
||||
value: components.CompletionCreateParamsResponseFormatPython = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# CompletionFinishReason
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ---------------- | ---------------- |
|
||||
| `STOP` | stop |
|
||||
| `LENGTH` | length |
|
||||
| `CONTENT_FILTER` | content_filter |
|
||||
@@ -1,11 +0,0 @@
|
||||
# CompletionLogprobs
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------ | ------------------------ | ------------------------ | ------------------------ |
|
||||
| `tokens` | List[*str*] | :heavy_check_mark: | N/A |
|
||||
| `token_logprobs` | List[*float*] | :heavy_check_mark: | N/A |
|
||||
| `top_logprobs` | List[Dict[str, *float*]] | :heavy_check_mark: | N/A |
|
||||
| `text_offset` | List[*float*] | :heavy_check_mark: | N/A |
|
||||
@@ -1,15 +0,0 @@
|
||||
# CompletionResponse
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
|
||||
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||
| `object` | *Literal["text_completion"]* | :heavy_check_mark: | N/A |
|
||||
| `created` | *float* | :heavy_check_mark: | N/A |
|
||||
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||
| `provider` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `system_fingerprint` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `choices` | List[[components.CompletionChoice](../components/completionchoice.md)] | :heavy_check_mark: | N/A |
|
||||
| `usage` | [Optional[components.CompletionUsage]](../components/completionusage.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,10 +0,0 @@
|
||||
# CompletionUsage
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------- | ------------------- | ------------------- | ------------------- |
|
||||
| `prompt_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||
| `completion_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||
| `total_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,10 @@
|
||||
# DeveloperMessage
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
||||
| `role` | *Literal["developer"]* | :heavy_check_mark: | N/A |
|
||||
| `content` | [components.DeveloperMessageContent](../components/developermessagecontent.md) | :heavy_check_mark: | N/A |
|
||||
| `name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,4 +1,4 @@
|
||||
# MessageContent
|
||||
# DeveloperMessageContent
|
||||
|
||||
|
||||
## Supported Types
|
||||
@@ -15,10 +15,10 @@ value: components.SystemMessage = /* values here */
|
||||
value: components.UserMessage = /* values here */
|
||||
```
|
||||
|
||||
### `components.MessageDeveloper`
|
||||
### `components.DeveloperMessage`
|
||||
|
||||
```python
|
||||
value: components.MessageDeveloper = /* values here */
|
||||
value: components.DeveloperMessage = /* values here */
|
||||
```
|
||||
|
||||
### `components.AssistantMessage`
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# MessageDeveloper
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| `role` | *Literal["developer"]* | :heavy_check_mark: | N/A |
|
||||
| `content` | [components.MessageContent](../components/messagecontent.md) | :heavy_check_mark: | N/A |
|
||||
| `name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
@@ -37,7 +37,7 @@ Request schema for Responses endpoint
|
||||
| `service_tier` | [Optional[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | |
|
||||
| `truncation` | [OptionalNullable[components.Truncation]](../components/truncation.md) | :heavy_minus_sign: | N/A | auto |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../components/openresponsesrequestprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
| `plugins` | List[[components.OpenResponsesRequestPluginUnion](../components/openresponsesrequestpluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||
| `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
| `plugins` | List[[components.Plugin](../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | |
|
||||
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | |
|
||||
@@ -5,10 +5,10 @@ The object specifying the maximum price you want to pay for this request. USD pr
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
|
||||
| `prompt` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `completion` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- |
|
||||
| `prompt` | *Optional[str]* | :heavy_minus_sign: | Price per million prompt tokens | 1000 |
|
||||
| `completion` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
@@ -1,35 +0,0 @@
|
||||
# OpenResponsesRequestPluginUnion
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.OpenResponsesRequestPluginAutoRouter`
|
||||
|
||||
```python
|
||||
value: components.OpenResponsesRequestPluginAutoRouter = /* values here */
|
||||
```
|
||||
|
||||
### `components.OpenResponsesRequestPluginModeration`
|
||||
|
||||
```python
|
||||
value: components.OpenResponsesRequestPluginModeration = /* values here */
|
||||
```
|
||||
|
||||
### `components.OpenResponsesRequestPluginWeb`
|
||||
|
||||
```python
|
||||
value: components.OpenResponsesRequestPluginWeb = /* values here */
|
||||
```
|
||||
|
||||
### `components.OpenResponsesRequestPluginFileParser`
|
||||
|
||||
```python
|
||||
value: components.OpenResponsesRequestPluginFileParser = /* values here */
|
||||
```
|
||||
|
||||
### `components.OpenResponsesRequestPluginResponseHealing`
|
||||
|
||||
```python
|
||||
value: components.OpenResponsesRequestPluginResponseHealing = /* values here */
|
||||
```
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# Plugin
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.PluginAutoRouter`
|
||||
|
||||
```python
|
||||
value: components.PluginAutoRouter = /* values here */
|
||||
```
|
||||
|
||||
### `components.PluginModeration`
|
||||
|
||||
```python
|
||||
value: components.PluginModeration = /* values here */
|
||||
```
|
||||
|
||||
### `components.PluginWeb`
|
||||
|
||||
```python
|
||||
value: components.PluginWeb = /* values here */
|
||||
```
|
||||
|
||||
### `components.PluginFileParser`
|
||||
|
||||
```python
|
||||
value: components.PluginFileParser = /* values here */
|
||||
```
|
||||
|
||||
### `components.PluginResponseHealing`
|
||||
|
||||
```python
|
||||
value: components.PluginResponseHealing = /* values here */
|
||||
```
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# OpenResponsesRequestPluginAutoRouter
|
||||
# PluginAutoRouter
|
||||
|
||||
|
||||
## Fields
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# OpenResponsesRequestPluginFileParser
|
||||
# PluginFileParser
|
||||
|
||||
|
||||
## Fields
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# OpenResponsesRequestPluginModeration
|
||||
# PluginModeration
|
||||
|
||||
|
||||
## Fields
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# OpenResponsesRequestPluginResponseHealing
|
||||
# PluginResponseHealing
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -1,4 +1,4 @@
|
||||
# OpenResponsesRequestPluginWeb
|
||||
# PluginWeb
|
||||
|
||||
|
||||
## Fields
|
||||
+16
-16
@@ -3,19 +3,19 @@
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
|
||||
| `prompt` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 |
|
||||
| `completion` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 |
|
||||
| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image_token` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `audio_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `web_search` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| -------------------- | -------------------- | -------------------- | -------------------- | -------------------- |
|
||||
| `prompt` | *str* | :heavy_check_mark: | N/A | 1000 |
|
||||
| `completion` | *str* | :heavy_check_mark: | N/A | 1000 |
|
||||
| `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `image_token` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `image_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `audio_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `web_search` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | |
|
||||
@@ -3,27 +3,21 @@
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `float`
|
||||
|
||||
```python
|
||||
value: float = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
### `List[str]`
|
||||
### `Any`
|
||||
|
||||
```python
|
||||
value: List[str] = /* values here */
|
||||
```
|
||||
|
||||
### `List[float]`
|
||||
|
||||
```python
|
||||
value: List[float] = /* values here */
|
||||
```
|
||||
|
||||
### `List[List[float]]`
|
||||
|
||||
```python
|
||||
value: List[List[float]] = /* values here */
|
||||
value: Any = /* values here */
|
||||
```
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# OpenResponsesRequestProvider
|
||||
# Provider
|
||||
|
||||
When multiple model providers are available, optionally indicate your routing preference.
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
| `AI21` | AI21 |
|
||||
| `AION_LABS` | AionLabs |
|
||||
| `ALIBABA` | Alibaba |
|
||||
| `AMBIENT` | Ambient |
|
||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||
| `AMAZON_NOVA` | Amazon Nova |
|
||||
| `ANTHROPIC` | Anthropic |
|
||||
@@ -64,6 +65,7 @@
|
||||
| `SEED` | Seed |
|
||||
| `SILICON_FLOW` | SiliconFlow |
|
||||
| `SOURCEFUL` | Sourceful |
|
||||
| `STEP_FUN` | StepFun |
|
||||
| `STEALTH` | Stealth |
|
||||
| `STREAM_LAKE` | StreamLake |
|
||||
| `SWITCHPOINT` | Switchpoint |
|
||||
|
||||
@@ -5,10 +5,10 @@ The object specifying the maximum price you want to pay for this request. USD pr
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
|
||||
| `prompt` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `completion` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- |
|
||||
| `prompt` | *Optional[str]* | :heavy_minus_sign: | Price per million prompt tokens | 1000 |
|
||||
| `completion` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
@@ -5,19 +5,19 @@ Pricing information for the model
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
|
||||
| `prompt` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 |
|
||||
| `completion` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 |
|
||||
| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image_token` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `image_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `audio_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `web_search` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
|
||||
| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| -------------------- | -------------------- | -------------------- | -------------------- | -------------------- |
|
||||
| `prompt` | *str* | :heavy_check_mark: | N/A | 1000 |
|
||||
| `completion` | *str* | :heavy_check_mark: | N/A | 1000 |
|
||||
| `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `image_token` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `image_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `audio_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `web_search` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | |
|
||||
@@ -0,0 +1,35 @@
|
||||
# ResponseFormat
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.ResponseFormatText`
|
||||
|
||||
```python
|
||||
value: components.ResponseFormatText = /* values here */
|
||||
```
|
||||
|
||||
### `components.ResponseFormatJSONObject`
|
||||
|
||||
```python
|
||||
value: components.ResponseFormatJSONObject = /* values here */
|
||||
```
|
||||
|
||||
### `components.ResponseFormatJSONSchema`
|
||||
|
||||
```python
|
||||
value: components.ResponseFormatJSONSchema = /* values here */
|
||||
```
|
||||
|
||||
### `components.ResponseFormatTextGrammar`
|
||||
|
||||
```python
|
||||
value: components.ResponseFormatTextGrammar = /* values here */
|
||||
```
|
||||
|
||||
### `components.ResponseFormatPython`
|
||||
|
||||
```python
|
||||
value: components.ResponseFormatPython = /* values here */
|
||||
```
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# ChatGenerationParamsResponseFormatJSONObject
|
||||
# ResponseFormatJSONObject
|
||||
|
||||
|
||||
## Fields
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# ChatGenerationParamsResponseFormatPython
|
||||
# ResponseFormatPython
|
||||
|
||||
|
||||
## Fields
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# ChatGenerationParamsResponseFormatText
|
||||
# ResponseFormatText
|
||||
|
||||
|
||||
## Fields
|
||||
+16
-13
@@ -1,17 +1,20 @@
|
||||
# Schema0
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.Schema0Enum`
|
||||
|
||||
```python
|
||||
value: components.Schema0Enum = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
|
||||
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `data_collection` | [OptionalNullable[components.Schema3]](../components/schema3.md) | :heavy_minus_sign: | N/A |
|
||||
| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `order` | List[[components.Schema5](../components/schema5.md)] | :heavy_minus_sign: | N/A |
|
||||
| `only` | List[[components.Schema5](../components/schema5.md)] | :heavy_minus_sign: | N/A |
|
||||
| `ignore` | List[[components.Schema5](../components/schema5.md)] | :heavy_minus_sign: | N/A |
|
||||
| `quantizations` | List[[components.Schema8](../components/schema8.md)] | :heavy_minus_sign: | N/A |
|
||||
| `sort` | [OptionalNullable[components.ProviderSortUnion]](../components/providersortunion.md) | :heavy_minus_sign: | N/A |
|
||||
| `max_price` | [Optional[components.Schema10]](../components/schema10.md) | :heavy_minus_sign: | N/A |
|
||||
| `preferred_min_throughput` | [OptionalNullable[components.Schema15Union]](../components/schema15union.md) | :heavy_minus_sign: | N/A |
|
||||
| `preferred_max_latency` | [OptionalNullable[components.Schema15Union]](../components/schema15union.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,12 @@
|
||||
# Schema10
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- |
|
||||
| `prompt` | [Optional[components.Prompt]](../components/prompt.md) | :heavy_minus_sign: | N/A |
|
||||
| `completion` | [Optional[components.Completion]](../components/completion.md) | :heavy_minus_sign: | N/A |
|
||||
| `image` | [Optional[components.Schema14]](../components/schema14.md) | :heavy_minus_sign: | N/A |
|
||||
| `audio` | [Optional[components.Schema14]](../components/schema14.md) | :heavy_minus_sign: | N/A |
|
||||
| `request` | [Optional[components.Schema14]](../components/schema14.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,23 @@
|
||||
# Schema14
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `float`
|
||||
|
||||
```python
|
||||
value: float = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
### `Any`
|
||||
|
||||
```python
|
||||
value: Any = /* values here */
|
||||
```
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# ChatGenerationParamsPreferredMaxLatency
|
||||
# Schema15
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -0,0 +1,17 @@
|
||||
# Schema15Union
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `float`
|
||||
|
||||
```python
|
||||
value: float = /* values here */
|
||||
```
|
||||
|
||||
### `components.Schema15`
|
||||
|
||||
```python
|
||||
value: components.Schema15 = /* values here */
|
||||
```
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# Schema17
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.Schema17AutoRouter`
|
||||
|
||||
```python
|
||||
value: components.Schema17AutoRouter = /* values here */
|
||||
```
|
||||
|
||||
### `components.Schema17Moderation`
|
||||
|
||||
```python
|
||||
value: components.Schema17Moderation = /* values here */
|
||||
```
|
||||
|
||||
### `components.Schema17Web`
|
||||
|
||||
```python
|
||||
value: components.Schema17Web = /* values here */
|
||||
```
|
||||
|
||||
### `components.Schema17FileParser`
|
||||
|
||||
```python
|
||||
value: components.Schema17FileParser = /* values here */
|
||||
```
|
||||
|
||||
### `components.Schema17ResponseHealing`
|
||||
|
||||
```python
|
||||
value: components.Schema17ResponseHealing = /* values here */
|
||||
```
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# ChatGenerationParamsPluginAutoRouter
|
||||
# Schema17AutoRouter
|
||||
|
||||
|
||||
## Fields
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# ChatGenerationParamsPluginFileParser
|
||||
# Schema17FileParser
|
||||
|
||||
|
||||
## Fields
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# ChatGenerationParamsPluginModeration
|
||||
# Schema17Moderation
|
||||
|
||||
|
||||
## Fields
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# ChatGenerationParamsPluginResponseHealing
|
||||
# Schema17ResponseHealing
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -1,4 +1,4 @@
|
||||
# ChatGenerationParamsPluginWeb
|
||||
# Schema17Web
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -0,0 +1,23 @@
|
||||
# Schema19
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.Schema19ReasoningSummary`
|
||||
|
||||
```python
|
||||
value: components.Schema19ReasoningSummary = /* values here */
|
||||
```
|
||||
|
||||
### `components.Schema19ReasoningEncrypted`
|
||||
|
||||
```python
|
||||
value: components.Schema19ReasoningEncrypted = /* values here */
|
||||
```
|
||||
|
||||
### `components.Schema19ReasoningText`
|
||||
|
||||
```python
|
||||
value: components.Schema19ReasoningText = /* values here */
|
||||
```
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# Schema19ReasoningEncrypted
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
||||
| `type` | *Literal["reasoning.encrypted"]* | :heavy_check_mark: | N/A |
|
||||
| `data` | *str* | :heavy_check_mark: | N/A |
|
||||
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A |
|
||||
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,12 @@
|
||||
# Schema19ReasoningSummary
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
||||
| `type` | *Literal["reasoning.summary"]* | :heavy_check_mark: | N/A |
|
||||
| `summary` | *str* | :heavy_check_mark: | N/A |
|
||||
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A |
|
||||
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,13 @@
|
||||
# Schema19ReasoningText
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
||||
| `type` | *Literal["reasoning.text"]* | :heavy_check_mark: | N/A |
|
||||
| `text` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `signature` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A |
|
||||
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,23 +0,0 @@
|
||||
# Schema2
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.Schema2ReasoningSummary`
|
||||
|
||||
```python
|
||||
value: components.Schema2ReasoningSummary = /* values here */
|
||||
```
|
||||
|
||||
### `components.Schema2ReasoningEncrypted`
|
||||
|
||||
```python
|
||||
value: components.Schema2ReasoningEncrypted = /* values here */
|
||||
```
|
||||
|
||||
### `components.Schema2ReasoningText`
|
||||
|
||||
```python
|
||||
value: components.Schema2ReasoningText = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Schema4
|
||||
# Schema21
|
||||
|
||||
|
||||
## Values
|
||||
@@ -1,12 +0,0 @@
|
||||
# Schema2ReasoningEncrypted
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
|
||||
| `type` | *Literal["reasoning.encrypted"]* | :heavy_check_mark: | N/A |
|
||||
| `data` | *str* | :heavy_check_mark: | N/A |
|
||||
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `format_` | [OptionalNullable[components.Schema4]](../components/schema4.md) | :heavy_minus_sign: | N/A |
|
||||
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,12 +0,0 @@
|
||||
# Schema2ReasoningSummary
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
|
||||
| `type` | *Literal["reasoning.summary"]* | :heavy_check_mark: | N/A |
|
||||
| `summary` | *str* | :heavy_check_mark: | N/A |
|
||||
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `format_` | [OptionalNullable[components.Schema4]](../components/schema4.md) | :heavy_minus_sign: | N/A |
|
||||
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,13 +0,0 @@
|
||||
# Schema2ReasoningText
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
|
||||
| `type` | *Literal["reasoning.text"]* | :heavy_check_mark: | N/A |
|
||||
| `text` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `signature` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `format_` | [OptionalNullable[components.Schema4]](../components/schema4.md) | :heavy_minus_sign: | N/A |
|
||||
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,4 +1,4 @@
|
||||
# ChatGenerationParamsDataCollection
|
||||
# Schema3
|
||||
|
||||
|
||||
## Values
|
||||
@@ -1,17 +1,17 @@
|
||||
# CompletionCreateParamsStop
|
||||
# Schema5
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.Schema5Enum`
|
||||
|
||||
```python
|
||||
value: components.Schema5Enum = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
### `List[str]`
|
||||
|
||||
```python
|
||||
value: List[str] = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Schema0Enum
|
||||
# Schema5Enum
|
||||
|
||||
|
||||
## Values
|
||||
@@ -8,6 +8,7 @@
|
||||
| `AI21` | AI21 |
|
||||
| `AION_LABS` | AionLabs |
|
||||
| `ALIBABA` | Alibaba |
|
||||
| `AMBIENT` | Ambient |
|
||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||
| `AMAZON_NOVA` | Amazon Nova |
|
||||
| `ANTHROPIC` | Anthropic |
|
||||
@@ -64,6 +65,7 @@
|
||||
| `SEED` | Seed |
|
||||
| `SILICON_FLOW` | SiliconFlow |
|
||||
| `SOURCEFUL` | Sourceful |
|
||||
| `STEP_FUN` | StepFun |
|
||||
| `STEALTH` | Stealth |
|
||||
| `STREAM_LAKE` | StreamLake |
|
||||
| `SWITCHPOINT` | Switchpoint |
|
||||
@@ -1,4 +1,4 @@
|
||||
# Quantizations
|
||||
# Schema8
|
||||
|
||||
|
||||
## Values
|
||||
@@ -1,4 +1,4 @@
|
||||
# ChatGenerationParamsStop
|
||||
# Stop
|
||||
|
||||
|
||||
## Supported Types
|
||||
@@ -1,8 +0,0 @@
|
||||
# StreamOptions
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------ | ------------------------ | ------------------------ | ------------------------ |
|
||||
| `include_usage` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
@@ -5,38 +5,39 @@ Generation data
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
|
||||
| `id` | *str* | :heavy_check_mark: | Unique identifier for the generation | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG |
|
||||
| `upstream_id` | *Nullable[str]* | :heavy_check_mark: | Upstream provider's identifier for this generation | chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 |
|
||||
| `total_cost` | *float* | :heavy_check_mark: | Total cost of the generation in USD | 0.0015 |
|
||||
| `cache_discount` | *Nullable[float]* | :heavy_check_mark: | Discount applied due to caching | 0.0002 |
|
||||
| `upstream_inference_cost` | *Nullable[float]* | :heavy_check_mark: | Cost charged by the upstream provider | 0.0012 |
|
||||
| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the generation was created | 2024-07-15T23:33:19.433273+00:00 |
|
||||
| `model` | *str* | :heavy_check_mark: | Model used for the generation | sao10k/l3-stheno-8b |
|
||||
| `app_id` | *Nullable[float]* | :heavy_check_mark: | ID of the app that made the request | 12345 |
|
||||
| `streamed` | *Nullable[bool]* | :heavy_check_mark: | Whether the response was streamed | true |
|
||||
| `cancelled` | *Nullable[bool]* | :heavy_check_mark: | Whether the generation was cancelled | false |
|
||||
| `provider_name` | *Nullable[str]* | :heavy_check_mark: | Name of the provider that served the request | Infermatic |
|
||||
| `latency` | *Nullable[float]* | :heavy_check_mark: | Total latency in milliseconds | 1250 |
|
||||
| `moderation_latency` | *Nullable[float]* | :heavy_check_mark: | Moderation latency in milliseconds | 50 |
|
||||
| `generation_time` | *Nullable[float]* | :heavy_check_mark: | Time taken for generation in milliseconds | 1200 |
|
||||
| `finish_reason` | *Nullable[str]* | :heavy_check_mark: | Reason the generation finished | stop |
|
||||
| `tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the prompt | 10 |
|
||||
| `tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the completion | 25 |
|
||||
| `native_tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Native prompt tokens as reported by provider | 10 |
|
||||
| `native_tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Native completion tokens as reported by provider | 25 |
|
||||
| `native_tokens_completion_images` | *Nullable[float]* | :heavy_check_mark: | Native completion image tokens as reported by provider | 0 |
|
||||
| `native_tokens_reasoning` | *Nullable[float]* | :heavy_check_mark: | Native reasoning tokens as reported by provider | 5 |
|
||||
| `native_tokens_cached` | *Nullable[float]* | :heavy_check_mark: | Native cached tokens as reported by provider | 3 |
|
||||
| `num_media_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the prompt | 1 |
|
||||
| `num_input_audio_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of audio inputs in the prompt | 0 |
|
||||
| `num_media_completion` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the completion | 0 |
|
||||
| `num_search_results` | *Nullable[float]* | :heavy_check_mark: | Number of search results included | 5 |
|
||||
| `origin` | *str* | :heavy_check_mark: | Origin URL of the request | https://openrouter.ai/ |
|
||||
| `usage` | *float* | :heavy_check_mark: | Usage amount in USD | 0.0015 |
|
||||
| `is_byok` | *bool* | :heavy_check_mark: | Whether this used bring-your-own-key | false |
|
||||
| `native_finish_reason` | *Nullable[str]* | :heavy_check_mark: | Native finish reason as reported by provider | stop |
|
||||
| `external_user` | *Nullable[str]* | :heavy_check_mark: | External user identifier | user-123 |
|
||||
| `api_type` | [Nullable[operations.APIType]](../operations/apitype.md) | :heavy_check_mark: | Type of API used for the generation | |
|
||||
| `router` | *Nullable[str]* | :heavy_check_mark: | Router used for the request (e.g., openrouter/auto) | openrouter/auto |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
|
||||
| `id` | *str* | :heavy_check_mark: | Unique identifier for the generation | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG |
|
||||
| `upstream_id` | *Nullable[str]* | :heavy_check_mark: | Upstream provider's identifier for this generation | chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 |
|
||||
| `total_cost` | *float* | :heavy_check_mark: | Total cost of the generation in USD | 0.0015 |
|
||||
| `cache_discount` | *Nullable[float]* | :heavy_check_mark: | Discount applied due to caching | 0.0002 |
|
||||
| `upstream_inference_cost` | *Nullable[float]* | :heavy_check_mark: | Cost charged by the upstream provider | 0.0012 |
|
||||
| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the generation was created | 2024-07-15T23:33:19.433273+00:00 |
|
||||
| `model` | *str* | :heavy_check_mark: | Model used for the generation | sao10k/l3-stheno-8b |
|
||||
| `app_id` | *Nullable[float]* | :heavy_check_mark: | ID of the app that made the request | 12345 |
|
||||
| `streamed` | *Nullable[bool]* | :heavy_check_mark: | Whether the response was streamed | true |
|
||||
| `cancelled` | *Nullable[bool]* | :heavy_check_mark: | Whether the generation was cancelled | false |
|
||||
| `provider_name` | *Nullable[str]* | :heavy_check_mark: | Name of the provider that served the request | Infermatic |
|
||||
| `latency` | *Nullable[float]* | :heavy_check_mark: | Total latency in milliseconds | 1250 |
|
||||
| `moderation_latency` | *Nullable[float]* | :heavy_check_mark: | Moderation latency in milliseconds | 50 |
|
||||
| `generation_time` | *Nullable[float]* | :heavy_check_mark: | Time taken for generation in milliseconds | 1200 |
|
||||
| `finish_reason` | *Nullable[str]* | :heavy_check_mark: | Reason the generation finished | stop |
|
||||
| `tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the prompt | 10 |
|
||||
| `tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the completion | 25 |
|
||||
| `native_tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Native prompt tokens as reported by provider | 10 |
|
||||
| `native_tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Native completion tokens as reported by provider | 25 |
|
||||
| `native_tokens_completion_images` | *Nullable[float]* | :heavy_check_mark: | Native completion image tokens as reported by provider | 0 |
|
||||
| `native_tokens_reasoning` | *Nullable[float]* | :heavy_check_mark: | Native reasoning tokens as reported by provider | 5 |
|
||||
| `native_tokens_cached` | *Nullable[float]* | :heavy_check_mark: | Native cached tokens as reported by provider | 3 |
|
||||
| `num_media_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the prompt | 1 |
|
||||
| `num_input_audio_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of audio inputs in the prompt | 0 |
|
||||
| `num_media_completion` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the completion | 0 |
|
||||
| `num_search_results` | *Nullable[float]* | :heavy_check_mark: | Number of search results included | 5 |
|
||||
| `origin` | *str* | :heavy_check_mark: | Origin URL of the request | https://openrouter.ai/ |
|
||||
| `usage` | *float* | :heavy_check_mark: | Usage amount in USD | 0.0015 |
|
||||
| `is_byok` | *bool* | :heavy_check_mark: | Whether this used bring-your-own-key | false |
|
||||
| `native_finish_reason` | *Nullable[str]* | :heavy_check_mark: | Native finish reason as reported by provider | stop |
|
||||
| `external_user` | *Nullable[str]* | :heavy_check_mark: | External user identifier | user-123 |
|
||||
| `api_type` | [Nullable[operations.APIType]](../operations/apitype.md) | :heavy_check_mark: | Type of API used for the generation | |
|
||||
| `router` | *Nullable[str]* | :heavy_check_mark: | Router used for the request (e.g., openrouter/auto) | openrouter/auto |
|
||||
| `provider_responses` | List[[operations.ProviderResponse](../operations/providerresponse.md)] | :heavy_check_mark: | List of provider responses for this generation, including fallback attempts | |
|
||||
@@ -0,0 +1,107 @@
|
||||
# ProviderName
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------------- | ------------------- |
|
||||
| `ANY_SCALE` | AnyScale |
|
||||
| `ATOMA` | Atoma |
|
||||
| `CENT_ML` | Cent-ML |
|
||||
| `CROF_AI` | CrofAI |
|
||||
| `ENFER` | Enfer |
|
||||
| `GO_POMELO` | GoPomelo |
|
||||
| `HUGGING_FACE` | HuggingFace |
|
||||
| `HYPERBOLIC_2` | Hyperbolic 2 |
|
||||
| `INO_CLOUD` | InoCloud |
|
||||
| `KLUSTER` | Kluster |
|
||||
| `LAMBDA` | Lambda |
|
||||
| `LEPTON` | Lepton |
|
||||
| `LYNN_2` | Lynn 2 |
|
||||
| `LYNN` | Lynn |
|
||||
| `MANCER` | Mancer |
|
||||
| `META` | Meta |
|
||||
| `MODAL` | Modal |
|
||||
| `NINETEEN` | Nineteen |
|
||||
| `OCTO_AI` | OctoAI |
|
||||
| `RECURSAL` | Recursal |
|
||||
| `REFLECTION` | Reflection |
|
||||
| `REPLICATE` | Replicate |
|
||||
| `SAMBA_NOVA_2` | SambaNova 2 |
|
||||
| `SF_COMPUTE` | SF Compute |
|
||||
| `TARGON` | Targon |
|
||||
| `TOGETHER_2` | Together 2 |
|
||||
| `UBICLOUD` | Ubicloud |
|
||||
| `ONE_DOT_AI` | 01.AI |
|
||||
| `AI21` | AI21 |
|
||||
| `AION_LABS` | AionLabs |
|
||||
| `ALIBABA` | Alibaba |
|
||||
| `AMBIENT` | Ambient |
|
||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||
| `AMAZON_NOVA` | Amazon Nova |
|
||||
| `ANTHROPIC` | Anthropic |
|
||||
| `ARCEE_AI` | Arcee AI |
|
||||
| `ATLAS_CLOUD` | AtlasCloud |
|
||||
| `AVIAN` | Avian |
|
||||
| `AZURE` | Azure |
|
||||
| `BASE_TEN` | BaseTen |
|
||||
| `BYTE_PLUS` | BytePlus |
|
||||
| `BLACK_FOREST_LABS` | Black Forest Labs |
|
||||
| `CEREBRAS` | Cerebras |
|
||||
| `CHUTES` | Chutes |
|
||||
| `CIRRASCALE` | Cirrascale |
|
||||
| `CLARIFAI` | Clarifai |
|
||||
| `CLOUDFLARE` | Cloudflare |
|
||||
| `COHERE` | Cohere |
|
||||
| `CRUSOE` | Crusoe |
|
||||
| `DEEP_INFRA` | DeepInfra |
|
||||
| `DEEP_SEEK` | DeepSeek |
|
||||
| `FEATHERLESS` | Featherless |
|
||||
| `FIREWORKS` | Fireworks |
|
||||
| `FRIENDLI` | Friendli |
|
||||
| `GMI_CLOUD` | GMICloud |
|
||||
| `GOOGLE` | Google |
|
||||
| `GOOGLE_AI_STUDIO` | Google AI Studio |
|
||||
| `GROQ` | Groq |
|
||||
| `HYPERBOLIC` | Hyperbolic |
|
||||
| `INCEPTION` | Inception |
|
||||
| `INCEPTRON` | Inceptron |
|
||||
| `INFERENCE_NET` | InferenceNet |
|
||||
| `INFERMATIC` | Infermatic |
|
||||
| `INFLECTION` | Inflection |
|
||||
| `LIQUID` | Liquid |
|
||||
| `MARA` | Mara |
|
||||
| `MANCER_2` | Mancer 2 |
|
||||
| `MINIMAX` | Minimax |
|
||||
| `MODEL_RUN` | ModelRun |
|
||||
| `MISTRAL` | Mistral |
|
||||
| `MODULAR` | Modular |
|
||||
| `MOONSHOT_AI` | Moonshot AI |
|
||||
| `MORPH` | Morph |
|
||||
| `N_COMPASS` | NCompass |
|
||||
| `NEBIUS` | Nebius |
|
||||
| `NEXT_BIT` | NextBit |
|
||||
| `NOVITA` | Novita |
|
||||
| `NVIDIA` | Nvidia |
|
||||
| `OPEN_AI` | OpenAI |
|
||||
| `OPEN_INFERENCE` | OpenInference |
|
||||
| `PARASAIL` | Parasail |
|
||||
| `PERPLEXITY` | Perplexity |
|
||||
| `PHALA` | Phala |
|
||||
| `RELACE` | Relace |
|
||||
| `SAMBA_NOVA` | SambaNova |
|
||||
| `SEED` | Seed |
|
||||
| `SILICON_FLOW` | SiliconFlow |
|
||||
| `SOURCEFUL` | Sourceful |
|
||||
| `STEP_FUN` | StepFun |
|
||||
| `STEALTH` | Stealth |
|
||||
| `STREAM_LAKE` | StreamLake |
|
||||
| `SWITCHPOINT` | Switchpoint |
|
||||
| `TOGETHER` | Together |
|
||||
| `UPSTAGE` | Upstage |
|
||||
| `VENICE` | Venice |
|
||||
| `WAND_B` | WandB |
|
||||
| `XIAOMI` | Xiaomi |
|
||||
| `X_AI` | xAI |
|
||||
| `Z_AI` | Z.AI |
|
||||
| `FAKE_PROVIDER` | FakeProvider |
|
||||
@@ -0,0 +1,14 @@
|
||||
# ProviderResponse
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
||||
| `id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `endpoint_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `model_permaslug` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `provider_name` | [Optional[operations.ProviderName]](../operations/providername.md) | :heavy_minus_sign: | N/A |
|
||||
| `status` | *Nullable[float]* | :heavy_check_mark: | N/A |
|
||||
| `latency` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
| `is_byok` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
+32
-32
@@ -34,38 +34,38 @@ with OpenRouter(
|
||||
|
||||
### Parameters
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `messages` | List[[components.Message](../../components/message.md)] | :heavy_check_mark: | N/A |
|
||||
| `provider` | [OptionalNullable[components.ChatGenerationParamsProvider]](../../components/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. |
|
||||
| `plugins` | List[[components.ChatGenerationParamsPluginUnion](../../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. |
|
||||
| `route` | [OptionalNullable[components.Route]](../../components/route.md) | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
|
||||
| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
|
||||
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning` | [Optional[components.Reasoning]](../../components/reasoning.md) | :heavy_minus_sign: | N/A |
|
||||
| `response_format` | [Optional[components.ChatGenerationParamsResponseFormatUnion]](../../components/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A |
|
||||
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `stop` | [OptionalNullable[components.ChatGenerationParamsStop]](../../components/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A |
|
||||
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `debug` | [Optional[components.Debug]](../../components/debug.md) | :heavy_minus_sign: | N/A |
|
||||
| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A |
|
||||
| `modalities` | List[[components.Modality](../../components/modality.md)] | :heavy_minus_sign: | N/A |
|
||||
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
|
||||
| Parameter | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
|
||||
| `messages` | List[[components.Message](../../components/message.md)] | :heavy_check_mark: | N/A |
|
||||
| `provider` | [OptionalNullable[components.Schema0]](../../components/schema0.md) | :heavy_minus_sign: | N/A |
|
||||
| `plugins` | List[[components.Schema17](../../components/schema17.md)] | :heavy_minus_sign: | N/A |
|
||||
| `route` | [OptionalNullable[components.Route]](../../components/route.md) | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `session_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
|
||||
| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
|
||||
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning` | [Optional[components.Reasoning]](../../components/reasoning.md) | :heavy_minus_sign: | N/A |
|
||||
| `response_format` | [Optional[components.ResponseFormat]](../../components/responseformat.md) | :heavy_minus_sign: | N/A |
|
||||
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `stop` | [OptionalNullable[components.Stop]](../../components/stop.md) | :heavy_minus_sign: | N/A |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A |
|
||||
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `debug` | [Optional[components.Debug]](../../components/debug.md) | :heavy_minus_sign: | N/A |
|
||||
| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A |
|
||||
| `modalities` | List[[components.Modality](../../components/modality.md)] | :heavy_minus_sign: | N/A |
|
||||
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
|
||||
|
||||
### Response
|
||||
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
# Completions
|
||||
(*completions*)
|
||||
|
||||
## Overview
|
||||
|
||||
### Available Operations
|
||||
|
||||
* [generate](#generate) - Create a completion
|
||||
|
||||
## generate
|
||||
|
||||
Creates a completion for the provided prompt and parameters. Supports both streaming and non-streaming modes.
|
||||
|
||||
### Example Usage
|
||||
|
||||
<!-- UsageSnippet language="python" operationID="createCompletions" method="post" path="/completions" -->
|
||||
```python
|
||||
from openrouter import OpenRouter
|
||||
import os
|
||||
|
||||
|
||||
with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.completions.generate(prompt=[], stream=False)
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `prompt` | [components.Prompt](../../components/prompt.md) | :heavy_check_mark: | N/A |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `best_of` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `echo` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
|
||||
| `logprobs` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `n` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `stop` | [OptionalNullable[components.CompletionCreateParamsStop]](../../components/completioncreateparamsstop.md) | :heavy_minus_sign: | N/A |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `stream_options` | [OptionalNullable[components.StreamOptions]](../../components/streamoptions.md) | :heavy_minus_sign: | N/A |
|
||||
| `suffix` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
|
||||
| `response_format` | [OptionalNullable[components.CompletionCreateParamsResponseFormatUnion]](../../components/completioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | N/A |
|
||||
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
|
||||
|
||||
### Response
|
||||
|
||||
**[components.CompletionResponse](../../components/completionresponse.md)**
|
||||
|
||||
### Errors
|
||||
|
||||
| Error Type | Status Code | Content Type |
|
||||
| ----------------------------- | ----------------------------- | ----------------------------- |
|
||||
| errors.ChatError | 400, 401, 429 | application/json |
|
||||
| errors.ChatError | 500 | application/json |
|
||||
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
|
||||
@@ -9,7 +9,7 @@ Model information endpoints
|
||||
|
||||
* [count](#count) - Get total count of available models
|
||||
* [list](#list) - List all models and their properties
|
||||
* [list_for_user](#list_for_user) - List models filtered by user provider preferences
|
||||
* [list_for_user](#list_for_user) - List models filtered by user provider preferences, privacy settings, and guardrails
|
||||
|
||||
## count
|
||||
|
||||
@@ -96,7 +96,7 @@ with OpenRouter(
|
||||
|
||||
## list_for_user
|
||||
|
||||
List models filtered by user provider preferences
|
||||
List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing).
|
||||
|
||||
### Example Usage
|
||||
|
||||
@@ -133,5 +133,6 @@ with OpenRouter() as open_router:
|
||||
| Error Type | Status Code | Content Type |
|
||||
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
|
||||
| errors.UnauthorizedResponseError | 401 | application/json |
|
||||
| errors.NotFoundResponseError | 404 | application/json |
|
||||
| errors.InternalServerResponseError | 500 | application/json |
|
||||
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
|
||||
@@ -67,8 +67,8 @@ with OpenRouter(
|
||||
| `service_tier` | [Optional[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | |
|
||||
| `truncation` | [OptionalNullable[components.Truncation]](../../components/truncation.md) | :heavy_minus_sign: | N/A | auto |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../../components/openresponsesrequestprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
| `plugins` | List[[components.OpenResponsesRequestPluginUnion](../../components/openresponsesrequestpluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||
| `provider` | [OptionalNullable[components.Provider]](../../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
| `plugins` | List[[components.Plugin](../../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | |
|
||||
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | |
|
||||
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "openrouter"
|
||||
version = "0.1.3"
|
||||
version = "0.5.0"
|
||||
description = "Official Python Client SDK for OpenRouter."
|
||||
authors = [{ name = "OpenRouter" },]
|
||||
readme = "README-PYPI.md"
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
import importlib.metadata
|
||||
|
||||
__title__: str = "openrouter"
|
||||
__version__: str = "0.1.3"
|
||||
__version__: str = "0.5.0"
|
||||
__openapi_doc_version__: str = "1.0.0"
|
||||
__gen_version__: str = "2.768.0"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.1.3 2.768.0 1.0.0 openrouter"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.5.0 2.768.0 1.0.0 openrouter"
|
||||
|
||||
try:
|
||||
if __package__ is not None:
|
||||
|
||||
+48
-122
@@ -22,16 +22,10 @@ class Chat(BaseSDK):
|
||||
*,
|
||||
messages: Union[List[components.Message], List[components.MessageTypedDict]],
|
||||
provider: OptionalNullable[
|
||||
Union[
|
||||
components.ChatGenerationParamsProvider,
|
||||
components.ChatGenerationParamsProviderTypedDict,
|
||||
]
|
||||
Union[components.Schema0, components.Schema0TypedDict]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[
|
||||
List[components.ChatGenerationParamsPluginUnion],
|
||||
List[components.ChatGenerationParamsPluginUnionTypedDict],
|
||||
]
|
||||
Union[List[components.Schema17], List[components.Schema17TypedDict]]
|
||||
] = None,
|
||||
route: OptionalNullable[components.Route] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
@@ -50,17 +44,11 @@ class Chat(BaseSDK):
|
||||
Union[components.Reasoning, components.ReasoningTypedDict]
|
||||
] = None,
|
||||
response_format: Optional[
|
||||
Union[
|
||||
components.ChatGenerationParamsResponseFormatUnion,
|
||||
components.ChatGenerationParamsResponseFormatUnionTypedDict,
|
||||
]
|
||||
Union[components.ResponseFormat, components.ResponseFormatTypedDict]
|
||||
] = None,
|
||||
seed: OptionalNullable[int] = UNSET,
|
||||
stop: OptionalNullable[
|
||||
Union[
|
||||
components.ChatGenerationParamsStop,
|
||||
components.ChatGenerationParamsStopTypedDict,
|
||||
]
|
||||
Union[components.Stop, components.StopTypedDict]
|
||||
] = UNSET,
|
||||
stream: Union[Literal[False], None] = None,
|
||||
stream_options: OptionalNullable[
|
||||
@@ -93,11 +81,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 provider:
|
||||
:param plugins:
|
||||
:param route:
|
||||
:param user:
|
||||
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
|
||||
:param session_id:
|
||||
:param model:
|
||||
:param models:
|
||||
:param frequency_penalty:
|
||||
@@ -134,16 +122,10 @@ class Chat(BaseSDK):
|
||||
*,
|
||||
messages: Union[List[components.Message], List[components.MessageTypedDict]],
|
||||
provider: OptionalNullable[
|
||||
Union[
|
||||
components.ChatGenerationParamsProvider,
|
||||
components.ChatGenerationParamsProviderTypedDict,
|
||||
]
|
||||
Union[components.Schema0, components.Schema0TypedDict]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[
|
||||
List[components.ChatGenerationParamsPluginUnion],
|
||||
List[components.ChatGenerationParamsPluginUnionTypedDict],
|
||||
]
|
||||
Union[List[components.Schema17], List[components.Schema17TypedDict]]
|
||||
] = None,
|
||||
route: OptionalNullable[components.Route] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
@@ -162,17 +144,11 @@ class Chat(BaseSDK):
|
||||
Union[components.Reasoning, components.ReasoningTypedDict]
|
||||
] = None,
|
||||
response_format: Optional[
|
||||
Union[
|
||||
components.ChatGenerationParamsResponseFormatUnion,
|
||||
components.ChatGenerationParamsResponseFormatUnionTypedDict,
|
||||
]
|
||||
Union[components.ResponseFormat, components.ResponseFormatTypedDict]
|
||||
] = None,
|
||||
seed: OptionalNullable[int] = UNSET,
|
||||
stop: OptionalNullable[
|
||||
Union[
|
||||
components.ChatGenerationParamsStop,
|
||||
components.ChatGenerationParamsStopTypedDict,
|
||||
]
|
||||
Union[components.Stop, components.StopTypedDict]
|
||||
] = UNSET,
|
||||
stream: Literal[True],
|
||||
stream_options: OptionalNullable[
|
||||
@@ -205,11 +181,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 provider:
|
||||
:param plugins:
|
||||
:param route:
|
||||
:param user:
|
||||
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
|
||||
:param session_id:
|
||||
:param model:
|
||||
:param models:
|
||||
:param frequency_penalty:
|
||||
@@ -245,16 +221,10 @@ class Chat(BaseSDK):
|
||||
*,
|
||||
messages: Union[List[components.Message], List[components.MessageTypedDict]],
|
||||
provider: OptionalNullable[
|
||||
Union[
|
||||
components.ChatGenerationParamsProvider,
|
||||
components.ChatGenerationParamsProviderTypedDict,
|
||||
]
|
||||
Union[components.Schema0, components.Schema0TypedDict]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[
|
||||
List[components.ChatGenerationParamsPluginUnion],
|
||||
List[components.ChatGenerationParamsPluginUnionTypedDict],
|
||||
]
|
||||
Union[List[components.Schema17], List[components.Schema17TypedDict]]
|
||||
] = None,
|
||||
route: OptionalNullable[components.Route] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
@@ -273,17 +243,11 @@ class Chat(BaseSDK):
|
||||
Union[components.Reasoning, components.ReasoningTypedDict]
|
||||
] = None,
|
||||
response_format: Optional[
|
||||
Union[
|
||||
components.ChatGenerationParamsResponseFormatUnion,
|
||||
components.ChatGenerationParamsResponseFormatUnionTypedDict,
|
||||
]
|
||||
Union[components.ResponseFormat, components.ResponseFormatTypedDict]
|
||||
] = None,
|
||||
seed: OptionalNullable[int] = UNSET,
|
||||
stop: OptionalNullable[
|
||||
Union[
|
||||
components.ChatGenerationParamsStop,
|
||||
components.ChatGenerationParamsStopTypedDict,
|
||||
]
|
||||
Union[components.Stop, components.StopTypedDict]
|
||||
] = UNSET,
|
||||
stream: Optional[bool] = False,
|
||||
stream_options: OptionalNullable[
|
||||
@@ -316,11 +280,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 provider:
|
||||
:param plugins:
|
||||
:param route:
|
||||
:param user:
|
||||
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
|
||||
:param session_id:
|
||||
:param model:
|
||||
:param models:
|
||||
:param frequency_penalty:
|
||||
@@ -362,10 +326,10 @@ class Chat(BaseSDK):
|
||||
|
||||
request = components.ChatGenerationParams(
|
||||
provider=utils.get_pydantic_model(
|
||||
provider, OptionalNullable[components.ChatGenerationParamsProvider]
|
||||
provider, OptionalNullable[components.Schema0]
|
||||
),
|
||||
plugins=utils.get_pydantic_model(
|
||||
plugins, Optional[List[components.ChatGenerationParamsPluginUnion]]
|
||||
plugins, Optional[List[components.Schema17]]
|
||||
),
|
||||
route=route,
|
||||
user=user,
|
||||
@@ -385,8 +349,7 @@ class Chat(BaseSDK):
|
||||
reasoning, Optional[components.Reasoning]
|
||||
),
|
||||
response_format=utils.get_pydantic_model(
|
||||
response_format,
|
||||
Optional[components.ChatGenerationParamsResponseFormatUnion],
|
||||
response_format, Optional[components.ResponseFormat]
|
||||
),
|
||||
seed=seed,
|
||||
stop=stop,
|
||||
@@ -498,16 +461,10 @@ class Chat(BaseSDK):
|
||||
*,
|
||||
messages: Union[List[components.Message], List[components.MessageTypedDict]],
|
||||
provider: OptionalNullable[
|
||||
Union[
|
||||
components.ChatGenerationParamsProvider,
|
||||
components.ChatGenerationParamsProviderTypedDict,
|
||||
]
|
||||
Union[components.Schema0, components.Schema0TypedDict]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[
|
||||
List[components.ChatGenerationParamsPluginUnion],
|
||||
List[components.ChatGenerationParamsPluginUnionTypedDict],
|
||||
]
|
||||
Union[List[components.Schema17], List[components.Schema17TypedDict]]
|
||||
] = None,
|
||||
route: OptionalNullable[components.Route] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
@@ -526,17 +483,11 @@ class Chat(BaseSDK):
|
||||
Union[components.Reasoning, components.ReasoningTypedDict]
|
||||
] = None,
|
||||
response_format: Optional[
|
||||
Union[
|
||||
components.ChatGenerationParamsResponseFormatUnion,
|
||||
components.ChatGenerationParamsResponseFormatUnionTypedDict,
|
||||
]
|
||||
Union[components.ResponseFormat, components.ResponseFormatTypedDict]
|
||||
] = None,
|
||||
seed: OptionalNullable[int] = UNSET,
|
||||
stop: OptionalNullable[
|
||||
Union[
|
||||
components.ChatGenerationParamsStop,
|
||||
components.ChatGenerationParamsStopTypedDict,
|
||||
]
|
||||
Union[components.Stop, components.StopTypedDict]
|
||||
] = UNSET,
|
||||
stream: Union[Literal[False], None] = None,
|
||||
stream_options: OptionalNullable[
|
||||
@@ -569,11 +520,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 provider:
|
||||
:param plugins:
|
||||
:param route:
|
||||
:param user:
|
||||
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
|
||||
:param session_id:
|
||||
:param model:
|
||||
:param models:
|
||||
:param frequency_penalty:
|
||||
@@ -610,16 +561,10 @@ class Chat(BaseSDK):
|
||||
*,
|
||||
messages: Union[List[components.Message], List[components.MessageTypedDict]],
|
||||
provider: OptionalNullable[
|
||||
Union[
|
||||
components.ChatGenerationParamsProvider,
|
||||
components.ChatGenerationParamsProviderTypedDict,
|
||||
]
|
||||
Union[components.Schema0, components.Schema0TypedDict]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[
|
||||
List[components.ChatGenerationParamsPluginUnion],
|
||||
List[components.ChatGenerationParamsPluginUnionTypedDict],
|
||||
]
|
||||
Union[List[components.Schema17], List[components.Schema17TypedDict]]
|
||||
] = None,
|
||||
route: OptionalNullable[components.Route] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
@@ -638,17 +583,11 @@ class Chat(BaseSDK):
|
||||
Union[components.Reasoning, components.ReasoningTypedDict]
|
||||
] = None,
|
||||
response_format: Optional[
|
||||
Union[
|
||||
components.ChatGenerationParamsResponseFormatUnion,
|
||||
components.ChatGenerationParamsResponseFormatUnionTypedDict,
|
||||
]
|
||||
Union[components.ResponseFormat, components.ResponseFormatTypedDict]
|
||||
] = None,
|
||||
seed: OptionalNullable[int] = UNSET,
|
||||
stop: OptionalNullable[
|
||||
Union[
|
||||
components.ChatGenerationParamsStop,
|
||||
components.ChatGenerationParamsStopTypedDict,
|
||||
]
|
||||
Union[components.Stop, components.StopTypedDict]
|
||||
] = UNSET,
|
||||
stream: Literal[True],
|
||||
stream_options: OptionalNullable[
|
||||
@@ -681,11 +620,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 provider:
|
||||
:param plugins:
|
||||
:param route:
|
||||
:param user:
|
||||
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
|
||||
:param session_id:
|
||||
:param model:
|
||||
:param models:
|
||||
:param frequency_penalty:
|
||||
@@ -721,16 +660,10 @@ class Chat(BaseSDK):
|
||||
*,
|
||||
messages: Union[List[components.Message], List[components.MessageTypedDict]],
|
||||
provider: OptionalNullable[
|
||||
Union[
|
||||
components.ChatGenerationParamsProvider,
|
||||
components.ChatGenerationParamsProviderTypedDict,
|
||||
]
|
||||
Union[components.Schema0, components.Schema0TypedDict]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[
|
||||
List[components.ChatGenerationParamsPluginUnion],
|
||||
List[components.ChatGenerationParamsPluginUnionTypedDict],
|
||||
]
|
||||
Union[List[components.Schema17], List[components.Schema17TypedDict]]
|
||||
] = None,
|
||||
route: OptionalNullable[components.Route] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
@@ -749,17 +682,11 @@ class Chat(BaseSDK):
|
||||
Union[components.Reasoning, components.ReasoningTypedDict]
|
||||
] = None,
|
||||
response_format: Optional[
|
||||
Union[
|
||||
components.ChatGenerationParamsResponseFormatUnion,
|
||||
components.ChatGenerationParamsResponseFormatUnionTypedDict,
|
||||
]
|
||||
Union[components.ResponseFormat, components.ResponseFormatTypedDict]
|
||||
] = None,
|
||||
seed: OptionalNullable[int] = UNSET,
|
||||
stop: OptionalNullable[
|
||||
Union[
|
||||
components.ChatGenerationParamsStop,
|
||||
components.ChatGenerationParamsStopTypedDict,
|
||||
]
|
||||
Union[components.Stop, components.StopTypedDict]
|
||||
] = UNSET,
|
||||
stream: Optional[bool] = False,
|
||||
stream_options: OptionalNullable[
|
||||
@@ -792,11 +719,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 provider:
|
||||
:param plugins:
|
||||
:param route:
|
||||
:param user:
|
||||
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
|
||||
:param session_id:
|
||||
:param model:
|
||||
:param models:
|
||||
:param frequency_penalty:
|
||||
@@ -838,10 +765,10 @@ class Chat(BaseSDK):
|
||||
|
||||
request = components.ChatGenerationParams(
|
||||
provider=utils.get_pydantic_model(
|
||||
provider, OptionalNullable[components.ChatGenerationParamsProvider]
|
||||
provider, OptionalNullable[components.Schema0]
|
||||
),
|
||||
plugins=utils.get_pydantic_model(
|
||||
plugins, Optional[List[components.ChatGenerationParamsPluginUnion]]
|
||||
plugins, Optional[List[components.Schema17]]
|
||||
),
|
||||
route=route,
|
||||
user=user,
|
||||
@@ -861,8 +788,7 @@ class Chat(BaseSDK):
|
||||
reasoning, Optional[components.Reasoning]
|
||||
),
|
||||
response_format=utils.get_pydantic_model(
|
||||
response_format,
|
||||
Optional[components.ChatGenerationParamsResponseFormatUnion],
|
||||
response_format, Optional[components.ResponseFormat]
|
||||
),
|
||||
seed=seed,
|
||||
stop=stop,
|
||||
|
||||
@@ -1,361 +0,0 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from .basesdk import BaseSDK
|
||||
from openrouter import components, errors, utils
|
||||
from openrouter._hooks import HookContext
|
||||
from openrouter.types import OptionalNullable, UNSET
|
||||
from openrouter.utils import get_security_from_env
|
||||
from openrouter.utils.unmarshal_json_response import unmarshal_json_response
|
||||
from typing import Any, Dict, List, Mapping, Optional, Union
|
||||
|
||||
|
||||
class Completions(BaseSDK):
|
||||
def generate(
|
||||
self,
|
||||
*,
|
||||
prompt: Union[components.Prompt, components.PromptTypedDict],
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
best_of: OptionalNullable[int] = UNSET,
|
||||
echo: OptionalNullable[bool] = UNSET,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
logit_bias: OptionalNullable[Dict[str, float]] = UNSET,
|
||||
logprobs: OptionalNullable[int] = UNSET,
|
||||
max_tokens: OptionalNullable[int] = UNSET,
|
||||
n: OptionalNullable[int] = UNSET,
|
||||
presence_penalty: OptionalNullable[float] = UNSET,
|
||||
seed: OptionalNullable[int] = UNSET,
|
||||
stop: OptionalNullable[
|
||||
Union[
|
||||
components.CompletionCreateParamsStop,
|
||||
components.CompletionCreateParamsStopTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
stream: Optional[bool] = False,
|
||||
stream_options: OptionalNullable[
|
||||
Union[components.StreamOptions, components.StreamOptionsTypedDict]
|
||||
] = UNSET,
|
||||
suffix: OptionalNullable[str] = UNSET,
|
||||
temperature: OptionalNullable[float] = UNSET,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
metadata: OptionalNullable[Dict[str, str]] = UNSET,
|
||||
response_format: OptionalNullable[
|
||||
Union[
|
||||
components.CompletionCreateParamsResponseFormatUnion,
|
||||
components.CompletionCreateParamsResponseFormatUnionTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.CompletionResponse:
|
||||
r"""Create a completion
|
||||
|
||||
Creates a completion for the provided prompt and parameters. Supports both streaming and non-streaming modes.
|
||||
|
||||
:param prompt:
|
||||
:param model:
|
||||
:param models:
|
||||
:param best_of:
|
||||
:param echo:
|
||||
:param frequency_penalty:
|
||||
:param logit_bias:
|
||||
:param logprobs:
|
||||
:param max_tokens:
|
||||
:param n:
|
||||
:param presence_penalty:
|
||||
:param seed:
|
||||
:param stop:
|
||||
:param stream:
|
||||
:param stream_options:
|
||||
:param suffix:
|
||||
:param temperature:
|
||||
:param top_p:
|
||||
:param user:
|
||||
:param metadata:
|
||||
:param response_format:
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = components.CompletionCreateParams(
|
||||
model=model,
|
||||
models=models,
|
||||
prompt=prompt,
|
||||
best_of=best_of,
|
||||
echo=echo,
|
||||
frequency_penalty=frequency_penalty,
|
||||
logit_bias=logit_bias,
|
||||
logprobs=logprobs,
|
||||
max_tokens=max_tokens,
|
||||
n=n,
|
||||
presence_penalty=presence_penalty,
|
||||
seed=seed,
|
||||
stop=stop,
|
||||
stream=stream,
|
||||
stream_options=utils.get_pydantic_model(
|
||||
stream_options, OptionalNullable[components.StreamOptions]
|
||||
),
|
||||
suffix=suffix,
|
||||
temperature=temperature,
|
||||
top_p=top_p,
|
||||
user=user,
|
||||
metadata=metadata,
|
||||
response_format=utils.get_pydantic_model(
|
||||
response_format,
|
||||
OptionalNullable[components.CompletionCreateParamsResponseFormatUnion],
|
||||
),
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
method="POST",
|
||||
path="/completions",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=True,
|
||||
request_has_path_params=False,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", components.CompletionCreateParams
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
||||
|
||||
http_res = self.do_request(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="createCompletions",
|
||||
oauth2_scopes=None,
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, components.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(components.CompletionResponse, http_res)
|
||||
if utils.match_response(http_res, ["400", "401", "429"], "application/json"):
|
||||
response_data = unmarshal_json_response(errors.ChatErrorData, http_res)
|
||||
raise errors.ChatError(response_data, http_res)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
response_data = unmarshal_json_response(errors.ChatErrorData, http_res)
|
||||
raise errors.ChatError(response_data, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
|
||||
async def generate_async(
|
||||
self,
|
||||
*,
|
||||
prompt: Union[components.Prompt, components.PromptTypedDict],
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
best_of: OptionalNullable[int] = UNSET,
|
||||
echo: OptionalNullable[bool] = UNSET,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
logit_bias: OptionalNullable[Dict[str, float]] = UNSET,
|
||||
logprobs: OptionalNullable[int] = UNSET,
|
||||
max_tokens: OptionalNullable[int] = UNSET,
|
||||
n: OptionalNullable[int] = UNSET,
|
||||
presence_penalty: OptionalNullable[float] = UNSET,
|
||||
seed: OptionalNullable[int] = UNSET,
|
||||
stop: OptionalNullable[
|
||||
Union[
|
||||
components.CompletionCreateParamsStop,
|
||||
components.CompletionCreateParamsStopTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
stream: Optional[bool] = False,
|
||||
stream_options: OptionalNullable[
|
||||
Union[components.StreamOptions, components.StreamOptionsTypedDict]
|
||||
] = UNSET,
|
||||
suffix: OptionalNullable[str] = UNSET,
|
||||
temperature: OptionalNullable[float] = UNSET,
|
||||
top_p: OptionalNullable[float] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
metadata: OptionalNullable[Dict[str, str]] = UNSET,
|
||||
response_format: OptionalNullable[
|
||||
Union[
|
||||
components.CompletionCreateParamsResponseFormatUnion,
|
||||
components.CompletionCreateParamsResponseFormatUnionTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.CompletionResponse:
|
||||
r"""Create a completion
|
||||
|
||||
Creates a completion for the provided prompt and parameters. Supports both streaming and non-streaming modes.
|
||||
|
||||
:param prompt:
|
||||
:param model:
|
||||
:param models:
|
||||
:param best_of:
|
||||
:param echo:
|
||||
:param frequency_penalty:
|
||||
:param logit_bias:
|
||||
:param logprobs:
|
||||
:param max_tokens:
|
||||
:param n:
|
||||
:param presence_penalty:
|
||||
:param seed:
|
||||
:param stop:
|
||||
:param stream:
|
||||
:param stream_options:
|
||||
:param suffix:
|
||||
:param temperature:
|
||||
:param top_p:
|
||||
:param user:
|
||||
:param metadata:
|
||||
:param response_format:
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = components.CompletionCreateParams(
|
||||
model=model,
|
||||
models=models,
|
||||
prompt=prompt,
|
||||
best_of=best_of,
|
||||
echo=echo,
|
||||
frequency_penalty=frequency_penalty,
|
||||
logit_bias=logit_bias,
|
||||
logprobs=logprobs,
|
||||
max_tokens=max_tokens,
|
||||
n=n,
|
||||
presence_penalty=presence_penalty,
|
||||
seed=seed,
|
||||
stop=stop,
|
||||
stream=stream,
|
||||
stream_options=utils.get_pydantic_model(
|
||||
stream_options, OptionalNullable[components.StreamOptions]
|
||||
),
|
||||
suffix=suffix,
|
||||
temperature=temperature,
|
||||
top_p=top_p,
|
||||
user=user,
|
||||
metadata=metadata,
|
||||
response_format=utils.get_pydantic_model(
|
||||
response_format,
|
||||
OptionalNullable[components.CompletionCreateParamsResponseFormatUnion],
|
||||
),
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
method="POST",
|
||||
path="/completions",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=True,
|
||||
request_has_path_params=False,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="application/json",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", components.CompletionCreateParams
|
||||
),
|
||||
allow_empty_value=None,
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
||||
|
||||
http_res = await self.do_request_async(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="createCompletions",
|
||||
oauth2_scopes=None,
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, components.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(components.CompletionResponse, http_res)
|
||||
if utils.match_response(http_res, ["400", "401", "429"], "application/json"):
|
||||
response_data = unmarshal_json_response(errors.ChatErrorData, http_res)
|
||||
raise errors.ChatError(response_data, http_res)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
response_data = unmarshal_json_response(errors.ChatErrorData, http_res)
|
||||
raise errors.ChatError(response_data, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
||||
@@ -6,18 +6,45 @@ import builtins
|
||||
import sys
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ._schema0 import Schema0, Schema0Enum, Schema0TypedDict
|
||||
from ._schema2 import (
|
||||
Schema2,
|
||||
Schema2ReasoningEncrypted,
|
||||
Schema2ReasoningEncryptedTypedDict,
|
||||
Schema2ReasoningSummary,
|
||||
Schema2ReasoningSummaryTypedDict,
|
||||
Schema2ReasoningText,
|
||||
Schema2ReasoningTextTypedDict,
|
||||
Schema2TypedDict,
|
||||
Schema4,
|
||||
from ._schema10 import (
|
||||
Completion,
|
||||
CompletionTypedDict,
|
||||
Prompt,
|
||||
PromptTypedDict,
|
||||
Schema10,
|
||||
Schema10TypedDict,
|
||||
)
|
||||
from ._schema14 import Schema14, Schema14TypedDict
|
||||
from ._schema17 import (
|
||||
Engine,
|
||||
Pdf,
|
||||
PdfEngine,
|
||||
PdfTypedDict,
|
||||
Schema17,
|
||||
Schema17AutoRouter,
|
||||
Schema17AutoRouterTypedDict,
|
||||
Schema17FileParser,
|
||||
Schema17FileParserTypedDict,
|
||||
Schema17Moderation,
|
||||
Schema17ModerationTypedDict,
|
||||
Schema17ResponseHealing,
|
||||
Schema17ResponseHealingTypedDict,
|
||||
Schema17TypedDict,
|
||||
Schema17Web,
|
||||
Schema17WebTypedDict,
|
||||
)
|
||||
from ._schema19 import (
|
||||
Schema19,
|
||||
Schema19ReasoningEncrypted,
|
||||
Schema19ReasoningEncryptedTypedDict,
|
||||
Schema19ReasoningSummary,
|
||||
Schema19ReasoningSummaryTypedDict,
|
||||
Schema19ReasoningText,
|
||||
Schema19ReasoningTextTypedDict,
|
||||
Schema19TypedDict,
|
||||
Schema21,
|
||||
)
|
||||
from ._schema5 import Schema5, Schema5Enum, Schema5TypedDict
|
||||
from .activityitem import ActivityItem, ActivityItemTypedDict
|
||||
from .assistantmessage import (
|
||||
AssistantMessage,
|
||||
@@ -41,56 +68,34 @@ if TYPE_CHECKING:
|
||||
from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict
|
||||
from .chatgenerationparams import (
|
||||
ChatGenerationParams,
|
||||
ChatGenerationParamsDataCollection,
|
||||
ChatGenerationParamsImageConfig,
|
||||
ChatGenerationParamsImageConfigTypedDict,
|
||||
ChatGenerationParamsMaxPrice,
|
||||
ChatGenerationParamsMaxPriceTypedDict,
|
||||
ChatGenerationParamsPluginAutoRouter,
|
||||
ChatGenerationParamsPluginAutoRouterTypedDict,
|
||||
ChatGenerationParamsPluginFileParser,
|
||||
ChatGenerationParamsPluginFileParserTypedDict,
|
||||
ChatGenerationParamsPluginModeration,
|
||||
ChatGenerationParamsPluginModerationTypedDict,
|
||||
ChatGenerationParamsPluginResponseHealing,
|
||||
ChatGenerationParamsPluginResponseHealingTypedDict,
|
||||
ChatGenerationParamsPluginUnion,
|
||||
ChatGenerationParamsPluginUnionTypedDict,
|
||||
ChatGenerationParamsPluginWeb,
|
||||
ChatGenerationParamsPluginWebTypedDict,
|
||||
ChatGenerationParamsPreferredMaxLatency,
|
||||
ChatGenerationParamsPreferredMaxLatencyTypedDict,
|
||||
ChatGenerationParamsPreferredMaxLatencyUnion,
|
||||
ChatGenerationParamsPreferredMaxLatencyUnionTypedDict,
|
||||
ChatGenerationParamsPreferredMinThroughput,
|
||||
ChatGenerationParamsPreferredMinThroughputTypedDict,
|
||||
ChatGenerationParamsPreferredMinThroughputUnion,
|
||||
ChatGenerationParamsPreferredMinThroughputUnionTypedDict,
|
||||
ChatGenerationParamsProvider,
|
||||
ChatGenerationParamsProviderTypedDict,
|
||||
ChatGenerationParamsResponseFormatJSONObject,
|
||||
ChatGenerationParamsResponseFormatJSONObjectTypedDict,
|
||||
ChatGenerationParamsResponseFormatPython,
|
||||
ChatGenerationParamsResponseFormatPythonTypedDict,
|
||||
ChatGenerationParamsResponseFormatText,
|
||||
ChatGenerationParamsResponseFormatTextTypedDict,
|
||||
ChatGenerationParamsResponseFormatUnion,
|
||||
ChatGenerationParamsResponseFormatUnionTypedDict,
|
||||
ChatGenerationParamsStop,
|
||||
ChatGenerationParamsStopTypedDict,
|
||||
ChatGenerationParamsTypedDict,
|
||||
Debug,
|
||||
DebugTypedDict,
|
||||
Effort,
|
||||
Engine,
|
||||
Modality,
|
||||
Pdf,
|
||||
PdfEngine,
|
||||
PdfTypedDict,
|
||||
Quantizations,
|
||||
Reasoning,
|
||||
ReasoningTypedDict,
|
||||
ResponseFormat,
|
||||
ResponseFormatJSONObject,
|
||||
ResponseFormatJSONObjectTypedDict,
|
||||
ResponseFormatPython,
|
||||
ResponseFormatPythonTypedDict,
|
||||
ResponseFormatText,
|
||||
ResponseFormatTextTypedDict,
|
||||
ResponseFormatTypedDict,
|
||||
Route,
|
||||
Schema0,
|
||||
Schema0TypedDict,
|
||||
Schema15,
|
||||
Schema15TypedDict,
|
||||
Schema15Union,
|
||||
Schema15UnionTypedDict,
|
||||
Schema3,
|
||||
Schema8,
|
||||
Stop,
|
||||
StopTypedDict,
|
||||
)
|
||||
from .chatgenerationtokenusage import (
|
||||
ChatGenerationTokenUsage,
|
||||
@@ -177,32 +182,6 @@ if TYPE_CHECKING:
|
||||
ChatStreamingResponseChunkTypedDict,
|
||||
)
|
||||
from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict
|
||||
from .completionchoice import (
|
||||
CompletionChoice,
|
||||
CompletionChoiceTypedDict,
|
||||
CompletionFinishReason,
|
||||
)
|
||||
from .completioncreateparams import (
|
||||
CompletionCreateParams,
|
||||
CompletionCreateParamsResponseFormatJSONObject,
|
||||
CompletionCreateParamsResponseFormatJSONObjectTypedDict,
|
||||
CompletionCreateParamsResponseFormatPython,
|
||||
CompletionCreateParamsResponseFormatPythonTypedDict,
|
||||
CompletionCreateParamsResponseFormatText,
|
||||
CompletionCreateParamsResponseFormatTextTypedDict,
|
||||
CompletionCreateParamsResponseFormatUnion,
|
||||
CompletionCreateParamsResponseFormatUnionTypedDict,
|
||||
CompletionCreateParamsStop,
|
||||
CompletionCreateParamsStopTypedDict,
|
||||
CompletionCreateParamsTypedDict,
|
||||
Prompt,
|
||||
PromptTypedDict,
|
||||
StreamOptions,
|
||||
StreamOptionsTypedDict,
|
||||
)
|
||||
from .completionlogprobs import CompletionLogprobs, CompletionLogprobsTypedDict
|
||||
from .completionresponse import CompletionResponse, CompletionResponseTypedDict
|
||||
from .completionusage import CompletionUsage, CompletionUsageTypedDict
|
||||
from .createchargerequest import (
|
||||
ChainID,
|
||||
CreateChargeRequest,
|
||||
@@ -210,6 +189,12 @@ if TYPE_CHECKING:
|
||||
)
|
||||
from .datacollection import DataCollection
|
||||
from .defaultparameters import DefaultParameters, DefaultParametersTypedDict
|
||||
from .developermessage import (
|
||||
DeveloperMessage,
|
||||
DeveloperMessageContent,
|
||||
DeveloperMessageContentTypedDict,
|
||||
DeveloperMessageTypedDict,
|
||||
)
|
||||
from .edgenetworktimeoutresponseerrordata import (
|
||||
EdgeNetworkTimeoutResponseErrorData,
|
||||
EdgeNetworkTimeoutResponseErrorDataTypedDict,
|
||||
@@ -236,14 +221,7 @@ if TYPE_CHECKING:
|
||||
ListEndpointsResponseTypedDict,
|
||||
Tokenizer,
|
||||
)
|
||||
from .message import (
|
||||
Message,
|
||||
MessageContent,
|
||||
MessageContentTypedDict,
|
||||
MessageDeveloper,
|
||||
MessageDeveloperTypedDict,
|
||||
MessageTypedDict,
|
||||
)
|
||||
from .message import Message, MessageTypedDict
|
||||
from .model import Model, ModelTypedDict
|
||||
from .modelarchitecture import (
|
||||
ModelArchitecture,
|
||||
@@ -495,20 +473,6 @@ if TYPE_CHECKING:
|
||||
OpenResponsesRequestOnlyTypedDict,
|
||||
OpenResponsesRequestOrder,
|
||||
OpenResponsesRequestOrderTypedDict,
|
||||
OpenResponsesRequestPluginAutoRouter,
|
||||
OpenResponsesRequestPluginAutoRouterTypedDict,
|
||||
OpenResponsesRequestPluginFileParser,
|
||||
OpenResponsesRequestPluginFileParserTypedDict,
|
||||
OpenResponsesRequestPluginModeration,
|
||||
OpenResponsesRequestPluginModerationTypedDict,
|
||||
OpenResponsesRequestPluginResponseHealing,
|
||||
OpenResponsesRequestPluginResponseHealingTypedDict,
|
||||
OpenResponsesRequestPluginUnion,
|
||||
OpenResponsesRequestPluginUnionTypedDict,
|
||||
OpenResponsesRequestPluginWeb,
|
||||
OpenResponsesRequestPluginWebTypedDict,
|
||||
OpenResponsesRequestProvider,
|
||||
OpenResponsesRequestProviderTypedDict,
|
||||
OpenResponsesRequestSort,
|
||||
OpenResponsesRequestSortTypedDict,
|
||||
OpenResponsesRequestToolFunction,
|
||||
@@ -517,6 +481,20 @@ if TYPE_CHECKING:
|
||||
OpenResponsesRequestToolUnionTypedDict,
|
||||
OpenResponsesRequestType,
|
||||
OpenResponsesRequestTypedDict,
|
||||
Plugin,
|
||||
PluginAutoRouter,
|
||||
PluginAutoRouterTypedDict,
|
||||
PluginFileParser,
|
||||
PluginFileParserTypedDict,
|
||||
PluginModeration,
|
||||
PluginModerationTypedDict,
|
||||
PluginResponseHealing,
|
||||
PluginResponseHealingTypedDict,
|
||||
PluginTypedDict,
|
||||
PluginWeb,
|
||||
PluginWebTypedDict,
|
||||
Provider,
|
||||
ProviderTypedDict,
|
||||
ServiceTier,
|
||||
Truncation,
|
||||
)
|
||||
@@ -929,43 +907,8 @@ __all__ = [
|
||||
"ChatErrorError",
|
||||
"ChatErrorErrorTypedDict",
|
||||
"ChatGenerationParams",
|
||||
"ChatGenerationParamsDataCollection",
|
||||
"ChatGenerationParamsImageConfig",
|
||||
"ChatGenerationParamsImageConfigTypedDict",
|
||||
"ChatGenerationParamsMaxPrice",
|
||||
"ChatGenerationParamsMaxPriceTypedDict",
|
||||
"ChatGenerationParamsPluginAutoRouter",
|
||||
"ChatGenerationParamsPluginAutoRouterTypedDict",
|
||||
"ChatGenerationParamsPluginFileParser",
|
||||
"ChatGenerationParamsPluginFileParserTypedDict",
|
||||
"ChatGenerationParamsPluginModeration",
|
||||
"ChatGenerationParamsPluginModerationTypedDict",
|
||||
"ChatGenerationParamsPluginResponseHealing",
|
||||
"ChatGenerationParamsPluginResponseHealingTypedDict",
|
||||
"ChatGenerationParamsPluginUnion",
|
||||
"ChatGenerationParamsPluginUnionTypedDict",
|
||||
"ChatGenerationParamsPluginWeb",
|
||||
"ChatGenerationParamsPluginWebTypedDict",
|
||||
"ChatGenerationParamsPreferredMaxLatency",
|
||||
"ChatGenerationParamsPreferredMaxLatencyTypedDict",
|
||||
"ChatGenerationParamsPreferredMaxLatencyUnion",
|
||||
"ChatGenerationParamsPreferredMaxLatencyUnionTypedDict",
|
||||
"ChatGenerationParamsPreferredMinThroughput",
|
||||
"ChatGenerationParamsPreferredMinThroughputTypedDict",
|
||||
"ChatGenerationParamsPreferredMinThroughputUnion",
|
||||
"ChatGenerationParamsPreferredMinThroughputUnionTypedDict",
|
||||
"ChatGenerationParamsProvider",
|
||||
"ChatGenerationParamsProviderTypedDict",
|
||||
"ChatGenerationParamsResponseFormatJSONObject",
|
||||
"ChatGenerationParamsResponseFormatJSONObjectTypedDict",
|
||||
"ChatGenerationParamsResponseFormatPython",
|
||||
"ChatGenerationParamsResponseFormatPythonTypedDict",
|
||||
"ChatGenerationParamsResponseFormatText",
|
||||
"ChatGenerationParamsResponseFormatTextTypedDict",
|
||||
"ChatGenerationParamsResponseFormatUnion",
|
||||
"ChatGenerationParamsResponseFormatUnionTypedDict",
|
||||
"ChatGenerationParamsStop",
|
||||
"ChatGenerationParamsStopTypedDict",
|
||||
"ChatGenerationParamsTypedDict",
|
||||
"ChatGenerationTokenUsage",
|
||||
"ChatGenerationTokenUsageTypedDict",
|
||||
@@ -1024,29 +967,10 @@ __all__ = [
|
||||
"Code",
|
||||
"CodeEnum",
|
||||
"CodeTypedDict",
|
||||
"CompletionChoice",
|
||||
"CompletionChoiceTypedDict",
|
||||
"CompletionCreateParams",
|
||||
"CompletionCreateParamsResponseFormatJSONObject",
|
||||
"CompletionCreateParamsResponseFormatJSONObjectTypedDict",
|
||||
"CompletionCreateParamsResponseFormatPython",
|
||||
"CompletionCreateParamsResponseFormatPythonTypedDict",
|
||||
"CompletionCreateParamsResponseFormatText",
|
||||
"CompletionCreateParamsResponseFormatTextTypedDict",
|
||||
"CompletionCreateParamsResponseFormatUnion",
|
||||
"CompletionCreateParamsResponseFormatUnionTypedDict",
|
||||
"CompletionCreateParamsStop",
|
||||
"CompletionCreateParamsStopTypedDict",
|
||||
"CompletionCreateParamsTypedDict",
|
||||
"CompletionFinishReason",
|
||||
"CompletionLogprobs",
|
||||
"CompletionLogprobsTypedDict",
|
||||
"CompletionResponse",
|
||||
"CompletionResponseTypedDict",
|
||||
"Completion",
|
||||
"CompletionTokensDetails",
|
||||
"CompletionTokensDetailsTypedDict",
|
||||
"CompletionUsage",
|
||||
"CompletionUsageTypedDict",
|
||||
"CompletionTypedDict",
|
||||
"CostDetails",
|
||||
"CostDetailsTypedDict",
|
||||
"CreateChargeRequest",
|
||||
@@ -1056,6 +980,10 @@ __all__ = [
|
||||
"DebugTypedDict",
|
||||
"DefaultParameters",
|
||||
"DefaultParametersTypedDict",
|
||||
"DeveloperMessage",
|
||||
"DeveloperMessageContent",
|
||||
"DeveloperMessageContentTypedDict",
|
||||
"DeveloperMessageTypedDict",
|
||||
"EdgeNetworkTimeoutResponseErrorData",
|
||||
"EdgeNetworkTimeoutResponseErrorDataTypedDict",
|
||||
"Effort",
|
||||
@@ -1090,10 +1018,6 @@ __all__ = [
|
||||
"Logprob",
|
||||
"LogprobTypedDict",
|
||||
"Message",
|
||||
"MessageContent",
|
||||
"MessageContentTypedDict",
|
||||
"MessageDeveloper",
|
||||
"MessageDeveloperTypedDict",
|
||||
"MessageTypedDict",
|
||||
"Modality",
|
||||
"Model",
|
||||
@@ -1278,20 +1202,6 @@ __all__ = [
|
||||
"OpenResponsesRequestOnlyTypedDict",
|
||||
"OpenResponsesRequestOrder",
|
||||
"OpenResponsesRequestOrderTypedDict",
|
||||
"OpenResponsesRequestPluginAutoRouter",
|
||||
"OpenResponsesRequestPluginAutoRouterTypedDict",
|
||||
"OpenResponsesRequestPluginFileParser",
|
||||
"OpenResponsesRequestPluginFileParserTypedDict",
|
||||
"OpenResponsesRequestPluginModeration",
|
||||
"OpenResponsesRequestPluginModerationTypedDict",
|
||||
"OpenResponsesRequestPluginResponseHealing",
|
||||
"OpenResponsesRequestPluginResponseHealingTypedDict",
|
||||
"OpenResponsesRequestPluginUnion",
|
||||
"OpenResponsesRequestPluginUnionTypedDict",
|
||||
"OpenResponsesRequestPluginWeb",
|
||||
"OpenResponsesRequestPluginWebTypedDict",
|
||||
"OpenResponsesRequestProvider",
|
||||
"OpenResponsesRequestProviderTypedDict",
|
||||
"OpenResponsesRequestSort",
|
||||
"OpenResponsesRequestSortTypedDict",
|
||||
"OpenResponsesRequestToolFunction",
|
||||
@@ -1400,6 +1310,18 @@ __all__ = [
|
||||
"PercentileStatsTypedDict",
|
||||
"PercentileThroughputCutoffs",
|
||||
"PercentileThroughputCutoffsTypedDict",
|
||||
"Plugin",
|
||||
"PluginAutoRouter",
|
||||
"PluginAutoRouterTypedDict",
|
||||
"PluginFileParser",
|
||||
"PluginFileParserTypedDict",
|
||||
"PluginModeration",
|
||||
"PluginModerationTypedDict",
|
||||
"PluginResponseHealing",
|
||||
"PluginResponseHealingTypedDict",
|
||||
"PluginTypedDict",
|
||||
"PluginWeb",
|
||||
"PluginWebTypedDict",
|
||||
"PreferredMaxLatency",
|
||||
"PreferredMaxLatencyTypedDict",
|
||||
"PreferredMinThroughput",
|
||||
@@ -1410,6 +1332,7 @@ __all__ = [
|
||||
"PromptTokensDetails",
|
||||
"PromptTokensDetailsTypedDict",
|
||||
"PromptTypedDict",
|
||||
"Provider",
|
||||
"ProviderName",
|
||||
"ProviderOverloadedResponseErrorData",
|
||||
"ProviderOverloadedResponseErrorDataTypedDict",
|
||||
@@ -1437,13 +1360,13 @@ __all__ = [
|
||||
"ProviderSortConfigUnionTypedDict",
|
||||
"ProviderSortUnion",
|
||||
"ProviderSortUnionTypedDict",
|
||||
"ProviderTypedDict",
|
||||
"PublicEndpoint",
|
||||
"PublicEndpointQuantization",
|
||||
"PublicEndpointTypedDict",
|
||||
"PublicPricing",
|
||||
"PublicPricingTypedDict",
|
||||
"Quantization",
|
||||
"Quantizations",
|
||||
"Reason",
|
||||
"Reasoning",
|
||||
"ReasoningSummaryText",
|
||||
@@ -1456,12 +1379,20 @@ __all__ = [
|
||||
"ReasoningTypedDict",
|
||||
"RequestTimeoutResponseErrorData",
|
||||
"RequestTimeoutResponseErrorDataTypedDict",
|
||||
"ResponseFormat",
|
||||
"ResponseFormatJSONObject",
|
||||
"ResponseFormatJSONObjectTypedDict",
|
||||
"ResponseFormatJSONSchema",
|
||||
"ResponseFormatJSONSchemaTypedDict",
|
||||
"ResponseFormatPython",
|
||||
"ResponseFormatPythonTypedDict",
|
||||
"ResponseFormatText",
|
||||
"ResponseFormatTextConfig",
|
||||
"ResponseFormatTextConfigTypedDict",
|
||||
"ResponseFormatTextGrammar",
|
||||
"ResponseFormatTextGrammarTypedDict",
|
||||
"ResponseFormatTextTypedDict",
|
||||
"ResponseFormatTypedDict",
|
||||
"ResponseInputAudio",
|
||||
"ResponseInputAudioFormat",
|
||||
"ResponseInputAudioInputAudio",
|
||||
@@ -1546,25 +1477,49 @@ __all__ = [
|
||||
"ResponsesWebSearchUserLocationTypedDict",
|
||||
"Route",
|
||||
"Schema0",
|
||||
"Schema0Enum",
|
||||
"Schema0TypedDict",
|
||||
"Schema2",
|
||||
"Schema2ReasoningEncrypted",
|
||||
"Schema2ReasoningEncryptedTypedDict",
|
||||
"Schema2ReasoningSummary",
|
||||
"Schema2ReasoningSummaryTypedDict",
|
||||
"Schema2ReasoningText",
|
||||
"Schema2ReasoningTextTypedDict",
|
||||
"Schema2TypedDict",
|
||||
"Schema4",
|
||||
"Schema10",
|
||||
"Schema10TypedDict",
|
||||
"Schema14",
|
||||
"Schema14TypedDict",
|
||||
"Schema15",
|
||||
"Schema15TypedDict",
|
||||
"Schema15Union",
|
||||
"Schema15UnionTypedDict",
|
||||
"Schema17",
|
||||
"Schema17AutoRouter",
|
||||
"Schema17AutoRouterTypedDict",
|
||||
"Schema17FileParser",
|
||||
"Schema17FileParserTypedDict",
|
||||
"Schema17Moderation",
|
||||
"Schema17ModerationTypedDict",
|
||||
"Schema17ResponseHealing",
|
||||
"Schema17ResponseHealingTypedDict",
|
||||
"Schema17TypedDict",
|
||||
"Schema17Web",
|
||||
"Schema17WebTypedDict",
|
||||
"Schema19",
|
||||
"Schema19ReasoningEncrypted",
|
||||
"Schema19ReasoningEncryptedTypedDict",
|
||||
"Schema19ReasoningSummary",
|
||||
"Schema19ReasoningSummaryTypedDict",
|
||||
"Schema19ReasoningText",
|
||||
"Schema19ReasoningTextTypedDict",
|
||||
"Schema19TypedDict",
|
||||
"Schema21",
|
||||
"Schema3",
|
||||
"Schema5",
|
||||
"Schema5Enum",
|
||||
"Schema5TypedDict",
|
||||
"Schema8",
|
||||
"Security",
|
||||
"SecurityTypedDict",
|
||||
"ServiceTier",
|
||||
"ServiceUnavailableResponseErrorData",
|
||||
"ServiceUnavailableResponseErrorDataTypedDict",
|
||||
"SortEnum",
|
||||
"StreamOptions",
|
||||
"StreamOptionsTypedDict",
|
||||
"Stop",
|
||||
"StopTypedDict",
|
||||
"SystemMessage",
|
||||
"SystemMessageContent",
|
||||
"SystemMessageContentTypedDict",
|
||||
@@ -1629,18 +1584,42 @@ __all__ = [
|
||||
]
|
||||
|
||||
_dynamic_imports: dict[str, str] = {
|
||||
"Schema0": "._schema0",
|
||||
"Schema0Enum": "._schema0",
|
||||
"Schema0TypedDict": "._schema0",
|
||||
"Schema2": "._schema2",
|
||||
"Schema2ReasoningEncrypted": "._schema2",
|
||||
"Schema2ReasoningEncryptedTypedDict": "._schema2",
|
||||
"Schema2ReasoningSummary": "._schema2",
|
||||
"Schema2ReasoningSummaryTypedDict": "._schema2",
|
||||
"Schema2ReasoningText": "._schema2",
|
||||
"Schema2ReasoningTextTypedDict": "._schema2",
|
||||
"Schema2TypedDict": "._schema2",
|
||||
"Schema4": "._schema2",
|
||||
"Completion": "._schema10",
|
||||
"CompletionTypedDict": "._schema10",
|
||||
"Prompt": "._schema10",
|
||||
"PromptTypedDict": "._schema10",
|
||||
"Schema10": "._schema10",
|
||||
"Schema10TypedDict": "._schema10",
|
||||
"Schema14": "._schema14",
|
||||
"Schema14TypedDict": "._schema14",
|
||||
"Engine": "._schema17",
|
||||
"Pdf": "._schema17",
|
||||
"PdfEngine": "._schema17",
|
||||
"PdfTypedDict": "._schema17",
|
||||
"Schema17": "._schema17",
|
||||
"Schema17AutoRouter": "._schema17",
|
||||
"Schema17AutoRouterTypedDict": "._schema17",
|
||||
"Schema17FileParser": "._schema17",
|
||||
"Schema17FileParserTypedDict": "._schema17",
|
||||
"Schema17Moderation": "._schema17",
|
||||
"Schema17ModerationTypedDict": "._schema17",
|
||||
"Schema17ResponseHealing": "._schema17",
|
||||
"Schema17ResponseHealingTypedDict": "._schema17",
|
||||
"Schema17TypedDict": "._schema17",
|
||||
"Schema17Web": "._schema17",
|
||||
"Schema17WebTypedDict": "._schema17",
|
||||
"Schema19": "._schema19",
|
||||
"Schema19ReasoningEncrypted": "._schema19",
|
||||
"Schema19ReasoningEncryptedTypedDict": "._schema19",
|
||||
"Schema19ReasoningSummary": "._schema19",
|
||||
"Schema19ReasoningSummaryTypedDict": "._schema19",
|
||||
"Schema19ReasoningText": "._schema19",
|
||||
"Schema19ReasoningTextTypedDict": "._schema19",
|
||||
"Schema19TypedDict": "._schema19",
|
||||
"Schema21": "._schema19",
|
||||
"Schema5": "._schema5",
|
||||
"Schema5Enum": "._schema5",
|
||||
"Schema5TypedDict": "._schema5",
|
||||
"ActivityItem": ".activityitem",
|
||||
"ActivityItemTypedDict": ".activityitem",
|
||||
"AssistantMessage": ".assistantmessage",
|
||||
@@ -1661,56 +1640,34 @@ _dynamic_imports: dict[str, str] = {
|
||||
"Code": ".chaterror",
|
||||
"CodeTypedDict": ".chaterror",
|
||||
"ChatGenerationParams": ".chatgenerationparams",
|
||||
"ChatGenerationParamsDataCollection": ".chatgenerationparams",
|
||||
"ChatGenerationParamsImageConfig": ".chatgenerationparams",
|
||||
"ChatGenerationParamsImageConfigTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsMaxPrice": ".chatgenerationparams",
|
||||
"ChatGenerationParamsMaxPriceTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPluginAutoRouter": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPluginAutoRouterTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPluginFileParser": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPluginFileParserTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPluginModeration": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPluginModerationTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPluginResponseHealing": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPluginResponseHealingTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPluginUnion": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPluginUnionTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPluginWeb": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPluginWebTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPreferredMaxLatency": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPreferredMaxLatencyTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPreferredMaxLatencyUnion": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPreferredMaxLatencyUnionTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPreferredMinThroughput": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPreferredMinThroughputTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPreferredMinThroughputUnion": ".chatgenerationparams",
|
||||
"ChatGenerationParamsPreferredMinThroughputUnionTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsProvider": ".chatgenerationparams",
|
||||
"ChatGenerationParamsProviderTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsResponseFormatJSONObject": ".chatgenerationparams",
|
||||
"ChatGenerationParamsResponseFormatJSONObjectTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsResponseFormatPython": ".chatgenerationparams",
|
||||
"ChatGenerationParamsResponseFormatPythonTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsResponseFormatText": ".chatgenerationparams",
|
||||
"ChatGenerationParamsResponseFormatTextTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsResponseFormatUnion": ".chatgenerationparams",
|
||||
"ChatGenerationParamsResponseFormatUnionTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsStop": ".chatgenerationparams",
|
||||
"ChatGenerationParamsStopTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationParamsTypedDict": ".chatgenerationparams",
|
||||
"Debug": ".chatgenerationparams",
|
||||
"DebugTypedDict": ".chatgenerationparams",
|
||||
"Effort": ".chatgenerationparams",
|
||||
"Engine": ".chatgenerationparams",
|
||||
"Modality": ".chatgenerationparams",
|
||||
"Pdf": ".chatgenerationparams",
|
||||
"PdfEngine": ".chatgenerationparams",
|
||||
"PdfTypedDict": ".chatgenerationparams",
|
||||
"Quantizations": ".chatgenerationparams",
|
||||
"Reasoning": ".chatgenerationparams",
|
||||
"ReasoningTypedDict": ".chatgenerationparams",
|
||||
"ResponseFormat": ".chatgenerationparams",
|
||||
"ResponseFormatJSONObject": ".chatgenerationparams",
|
||||
"ResponseFormatJSONObjectTypedDict": ".chatgenerationparams",
|
||||
"ResponseFormatPython": ".chatgenerationparams",
|
||||
"ResponseFormatPythonTypedDict": ".chatgenerationparams",
|
||||
"ResponseFormatText": ".chatgenerationparams",
|
||||
"ResponseFormatTextTypedDict": ".chatgenerationparams",
|
||||
"ResponseFormatTypedDict": ".chatgenerationparams",
|
||||
"Route": ".chatgenerationparams",
|
||||
"Schema0": ".chatgenerationparams",
|
||||
"Schema0TypedDict": ".chatgenerationparams",
|
||||
"Schema15": ".chatgenerationparams",
|
||||
"Schema15TypedDict": ".chatgenerationparams",
|
||||
"Schema15Union": ".chatgenerationparams",
|
||||
"Schema15UnionTypedDict": ".chatgenerationparams",
|
||||
"Schema3": ".chatgenerationparams",
|
||||
"Schema8": ".chatgenerationparams",
|
||||
"Stop": ".chatgenerationparams",
|
||||
"StopTypedDict": ".chatgenerationparams",
|
||||
"ChatGenerationTokenUsage": ".chatgenerationtokenusage",
|
||||
"ChatGenerationTokenUsageTypedDict": ".chatgenerationtokenusage",
|
||||
"CompletionTokensDetails": ".chatgenerationtokenusage",
|
||||
@@ -1774,37 +1731,16 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatStreamingResponseChunkTypedDict": ".chatstreamingresponsechunk",
|
||||
"ChatStreamOptions": ".chatstreamoptions",
|
||||
"ChatStreamOptionsTypedDict": ".chatstreamoptions",
|
||||
"CompletionChoice": ".completionchoice",
|
||||
"CompletionChoiceTypedDict": ".completionchoice",
|
||||
"CompletionFinishReason": ".completionchoice",
|
||||
"CompletionCreateParams": ".completioncreateparams",
|
||||
"CompletionCreateParamsResponseFormatJSONObject": ".completioncreateparams",
|
||||
"CompletionCreateParamsResponseFormatJSONObjectTypedDict": ".completioncreateparams",
|
||||
"CompletionCreateParamsResponseFormatPython": ".completioncreateparams",
|
||||
"CompletionCreateParamsResponseFormatPythonTypedDict": ".completioncreateparams",
|
||||
"CompletionCreateParamsResponseFormatText": ".completioncreateparams",
|
||||
"CompletionCreateParamsResponseFormatTextTypedDict": ".completioncreateparams",
|
||||
"CompletionCreateParamsResponseFormatUnion": ".completioncreateparams",
|
||||
"CompletionCreateParamsResponseFormatUnionTypedDict": ".completioncreateparams",
|
||||
"CompletionCreateParamsStop": ".completioncreateparams",
|
||||
"CompletionCreateParamsStopTypedDict": ".completioncreateparams",
|
||||
"CompletionCreateParamsTypedDict": ".completioncreateparams",
|
||||
"Prompt": ".completioncreateparams",
|
||||
"PromptTypedDict": ".completioncreateparams",
|
||||
"StreamOptions": ".completioncreateparams",
|
||||
"StreamOptionsTypedDict": ".completioncreateparams",
|
||||
"CompletionLogprobs": ".completionlogprobs",
|
||||
"CompletionLogprobsTypedDict": ".completionlogprobs",
|
||||
"CompletionResponse": ".completionresponse",
|
||||
"CompletionResponseTypedDict": ".completionresponse",
|
||||
"CompletionUsage": ".completionusage",
|
||||
"CompletionUsageTypedDict": ".completionusage",
|
||||
"ChainID": ".createchargerequest",
|
||||
"CreateChargeRequest": ".createchargerequest",
|
||||
"CreateChargeRequestTypedDict": ".createchargerequest",
|
||||
"DataCollection": ".datacollection",
|
||||
"DefaultParameters": ".defaultparameters",
|
||||
"DefaultParametersTypedDict": ".defaultparameters",
|
||||
"DeveloperMessage": ".developermessage",
|
||||
"DeveloperMessageContent": ".developermessage",
|
||||
"DeveloperMessageContentTypedDict": ".developermessage",
|
||||
"DeveloperMessageTypedDict": ".developermessage",
|
||||
"EdgeNetworkTimeoutResponseErrorData": ".edgenetworktimeoutresponseerrordata",
|
||||
"EdgeNetworkTimeoutResponseErrorDataTypedDict": ".edgenetworktimeoutresponseerrordata",
|
||||
"EndpointStatus": ".endpointstatus",
|
||||
@@ -1829,10 +1765,6 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ListEndpointsResponseTypedDict": ".listendpointsresponse",
|
||||
"Tokenizer": ".listendpointsresponse",
|
||||
"Message": ".message",
|
||||
"MessageContent": ".message",
|
||||
"MessageContentTypedDict": ".message",
|
||||
"MessageDeveloper": ".message",
|
||||
"MessageDeveloperTypedDict": ".message",
|
||||
"MessageTypedDict": ".message",
|
||||
"Model": ".model",
|
||||
"ModelTypedDict": ".model",
|
||||
@@ -2026,20 +1958,6 @@ _dynamic_imports: dict[str, str] = {
|
||||
"OpenResponsesRequestOnlyTypedDict": ".openresponsesrequest",
|
||||
"OpenResponsesRequestOrder": ".openresponsesrequest",
|
||||
"OpenResponsesRequestOrderTypedDict": ".openresponsesrequest",
|
||||
"OpenResponsesRequestPluginAutoRouter": ".openresponsesrequest",
|
||||
"OpenResponsesRequestPluginAutoRouterTypedDict": ".openresponsesrequest",
|
||||
"OpenResponsesRequestPluginFileParser": ".openresponsesrequest",
|
||||
"OpenResponsesRequestPluginFileParserTypedDict": ".openresponsesrequest",
|
||||
"OpenResponsesRequestPluginModeration": ".openresponsesrequest",
|
||||
"OpenResponsesRequestPluginModerationTypedDict": ".openresponsesrequest",
|
||||
"OpenResponsesRequestPluginResponseHealing": ".openresponsesrequest",
|
||||
"OpenResponsesRequestPluginResponseHealingTypedDict": ".openresponsesrequest",
|
||||
"OpenResponsesRequestPluginUnion": ".openresponsesrequest",
|
||||
"OpenResponsesRequestPluginUnionTypedDict": ".openresponsesrequest",
|
||||
"OpenResponsesRequestPluginWeb": ".openresponsesrequest",
|
||||
"OpenResponsesRequestPluginWebTypedDict": ".openresponsesrequest",
|
||||
"OpenResponsesRequestProvider": ".openresponsesrequest",
|
||||
"OpenResponsesRequestProviderTypedDict": ".openresponsesrequest",
|
||||
"OpenResponsesRequestSort": ".openresponsesrequest",
|
||||
"OpenResponsesRequestSortTypedDict": ".openresponsesrequest",
|
||||
"OpenResponsesRequestToolFunction": ".openresponsesrequest",
|
||||
@@ -2048,6 +1966,20 @@ _dynamic_imports: dict[str, str] = {
|
||||
"OpenResponsesRequestToolUnionTypedDict": ".openresponsesrequest",
|
||||
"OpenResponsesRequestType": ".openresponsesrequest",
|
||||
"OpenResponsesRequestTypedDict": ".openresponsesrequest",
|
||||
"Plugin": ".openresponsesrequest",
|
||||
"PluginAutoRouter": ".openresponsesrequest",
|
||||
"PluginAutoRouterTypedDict": ".openresponsesrequest",
|
||||
"PluginFileParser": ".openresponsesrequest",
|
||||
"PluginFileParserTypedDict": ".openresponsesrequest",
|
||||
"PluginModeration": ".openresponsesrequest",
|
||||
"PluginModerationTypedDict": ".openresponsesrequest",
|
||||
"PluginResponseHealing": ".openresponsesrequest",
|
||||
"PluginResponseHealingTypedDict": ".openresponsesrequest",
|
||||
"PluginTypedDict": ".openresponsesrequest",
|
||||
"PluginWeb": ".openresponsesrequest",
|
||||
"PluginWebTypedDict": ".openresponsesrequest",
|
||||
"Provider": ".openresponsesrequest",
|
||||
"ProviderTypedDict": ".openresponsesrequest",
|
||||
"ServiceTier": ".openresponsesrequest",
|
||||
"Truncation": ".openresponsesrequest",
|
||||
"OpenResponsesResponseText": ".openresponsesresponsetext",
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from ._schema14 import Schema14, Schema14TypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Any, Optional, Union
|
||||
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
PromptTypedDict = TypeAliasType("PromptTypedDict", Union[float, str, Any])
|
||||
|
||||
|
||||
Prompt = TypeAliasType("Prompt", Union[float, str, Any])
|
||||
|
||||
|
||||
CompletionTypedDict = TypeAliasType("CompletionTypedDict", Union[float, str, Any])
|
||||
|
||||
|
||||
Completion = TypeAliasType("Completion", Union[float, str, Any])
|
||||
|
||||
|
||||
class Schema10TypedDict(TypedDict):
|
||||
prompt: NotRequired[PromptTypedDict]
|
||||
completion: NotRequired[CompletionTypedDict]
|
||||
image: NotRequired[Schema14TypedDict]
|
||||
audio: NotRequired[Schema14TypedDict]
|
||||
request: NotRequired[Schema14TypedDict]
|
||||
|
||||
|
||||
class Schema10(BaseModel):
|
||||
prompt: Optional[Prompt] = None
|
||||
|
||||
completion: Optional[Completion] = None
|
||||
|
||||
image: Optional[Schema14] = None
|
||||
|
||||
audio: Optional[Schema14] = None
|
||||
|
||||
request: Optional[Schema14] = None
|
||||
@@ -0,0 +1,11 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from typing import Any, Union
|
||||
from typing_extensions import TypeAliasType
|
||||
|
||||
|
||||
Schema14TypedDict = TypeAliasType("Schema14TypedDict", Union[float, str, Any])
|
||||
|
||||
|
||||
Schema14 = TypeAliasType("Schema14", Union[float, str, Any])
|
||||
@@ -0,0 +1,154 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, UnrecognizedStr
|
||||
from openrouter.utils import get_discriminator, validate_const, validate_open_enum
|
||||
import pydantic
|
||||
from pydantic import Discriminator, Tag
|
||||
from pydantic.functional_validators import AfterValidator, PlainValidator
|
||||
from typing import List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
class Schema17ResponseHealingTypedDict(TypedDict):
|
||||
id: Literal["response-healing"]
|
||||
enabled: NotRequired[bool]
|
||||
|
||||
|
||||
class Schema17ResponseHealing(BaseModel):
|
||||
ID: Annotated[
|
||||
Annotated[
|
||||
Literal["response-healing"],
|
||||
AfterValidator(validate_const("response-healing")),
|
||||
],
|
||||
pydantic.Field(alias="id"),
|
||||
] = "response-healing"
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
|
||||
|
||||
PdfEngine = Union[
|
||||
Literal[
|
||||
"mistral-ocr",
|
||||
"pdf-text",
|
||||
"native",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
class PdfTypedDict(TypedDict):
|
||||
engine: NotRequired[PdfEngine]
|
||||
|
||||
|
||||
class Pdf(BaseModel):
|
||||
engine: Annotated[
|
||||
Optional[PdfEngine], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
|
||||
|
||||
class Schema17FileParserTypedDict(TypedDict):
|
||||
id: Literal["file-parser"]
|
||||
enabled: NotRequired[bool]
|
||||
pdf: NotRequired[PdfTypedDict]
|
||||
|
||||
|
||||
class Schema17FileParser(BaseModel):
|
||||
ID: Annotated[
|
||||
Annotated[
|
||||
Literal["file-parser"], AfterValidator(validate_const("file-parser"))
|
||||
],
|
||||
pydantic.Field(alias="id"),
|
||||
] = "file-parser"
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
|
||||
pdf: Optional[Pdf] = None
|
||||
|
||||
|
||||
Engine = Union[
|
||||
Literal[
|
||||
"native",
|
||||
"exa",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
class Schema17WebTypedDict(TypedDict):
|
||||
id: Literal["web"]
|
||||
enabled: NotRequired[bool]
|
||||
max_results: NotRequired[float]
|
||||
search_prompt: NotRequired[str]
|
||||
engine: NotRequired[Engine]
|
||||
|
||||
|
||||
class Schema17Web(BaseModel):
|
||||
ID: Annotated[
|
||||
Annotated[Literal["web"], AfterValidator(validate_const("web"))],
|
||||
pydantic.Field(alias="id"),
|
||||
] = "web"
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
|
||||
max_results: Optional[float] = None
|
||||
|
||||
search_prompt: Optional[str] = None
|
||||
|
||||
engine: Annotated[Optional[Engine], PlainValidator(validate_open_enum(False))] = (
|
||||
None
|
||||
)
|
||||
|
||||
|
||||
class Schema17ModerationTypedDict(TypedDict):
|
||||
id: Literal["moderation"]
|
||||
|
||||
|
||||
class Schema17Moderation(BaseModel):
|
||||
ID: Annotated[
|
||||
Annotated[Literal["moderation"], AfterValidator(validate_const("moderation"))],
|
||||
pydantic.Field(alias="id"),
|
||||
] = "moderation"
|
||||
|
||||
|
||||
class Schema17AutoRouterTypedDict(TypedDict):
|
||||
id: Literal["auto-router"]
|
||||
enabled: NotRequired[bool]
|
||||
allowed_models: NotRequired[List[str]]
|
||||
|
||||
|
||||
class Schema17AutoRouter(BaseModel):
|
||||
ID: Annotated[
|
||||
Annotated[
|
||||
Literal["auto-router"], AfterValidator(validate_const("auto-router"))
|
||||
],
|
||||
pydantic.Field(alias="id"),
|
||||
] = "auto-router"
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
|
||||
allowed_models: Optional[List[str]] = None
|
||||
|
||||
|
||||
Schema17TypedDict = TypeAliasType(
|
||||
"Schema17TypedDict",
|
||||
Union[
|
||||
Schema17ModerationTypedDict,
|
||||
Schema17ResponseHealingTypedDict,
|
||||
Schema17AutoRouterTypedDict,
|
||||
Schema17FileParserTypedDict,
|
||||
Schema17WebTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
Schema17 = Annotated[
|
||||
Union[
|
||||
Annotated[Schema17AutoRouter, Tag("auto-router")],
|
||||
Annotated[Schema17Moderation, Tag("moderation")],
|
||||
Annotated[Schema17Web, Tag("web")],
|
||||
Annotated[Schema17FileParser, Tag("file-parser")],
|
||||
Annotated[Schema17ResponseHealing, Tag("response-healing")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "id", "id")),
|
||||
]
|
||||
@@ -17,7 +17,7 @@ from typing import Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
Schema4 = Union[
|
||||
Schema21 = Union[
|
||||
Literal[
|
||||
"unknown",
|
||||
"openai-responses-v1",
|
||||
@@ -30,16 +30,16 @@ Schema4 = Union[
|
||||
]
|
||||
|
||||
|
||||
class Schema2ReasoningTextTypedDict(TypedDict):
|
||||
class Schema19ReasoningTextTypedDict(TypedDict):
|
||||
type: Literal["reasoning.text"]
|
||||
text: NotRequired[Nullable[str]]
|
||||
signature: NotRequired[Nullable[str]]
|
||||
id: NotRequired[Nullable[str]]
|
||||
format_: NotRequired[Nullable[Schema4]]
|
||||
format_: NotRequired[Nullable[Schema21]]
|
||||
index: NotRequired[float]
|
||||
|
||||
|
||||
class Schema2ReasoningText(BaseModel):
|
||||
class Schema19ReasoningText(BaseModel):
|
||||
TYPE: Annotated[
|
||||
Annotated[
|
||||
Literal["reasoning.text"], AfterValidator(validate_const("reasoning.text"))
|
||||
@@ -54,7 +54,9 @@ class Schema2ReasoningText(BaseModel):
|
||||
id: OptionalNullable[str] = UNSET
|
||||
|
||||
format_: Annotated[
|
||||
Annotated[OptionalNullable[Schema4], PlainValidator(validate_open_enum(False))],
|
||||
Annotated[
|
||||
OptionalNullable[Schema21], PlainValidator(validate_open_enum(False))
|
||||
],
|
||||
pydantic.Field(alias="format"),
|
||||
] = UNSET
|
||||
|
||||
@@ -91,15 +93,15 @@ class Schema2ReasoningText(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
class Schema2ReasoningEncryptedTypedDict(TypedDict):
|
||||
class Schema19ReasoningEncryptedTypedDict(TypedDict):
|
||||
data: str
|
||||
type: Literal["reasoning.encrypted"]
|
||||
id: NotRequired[Nullable[str]]
|
||||
format_: NotRequired[Nullable[Schema4]]
|
||||
format_: NotRequired[Nullable[Schema21]]
|
||||
index: NotRequired[float]
|
||||
|
||||
|
||||
class Schema2ReasoningEncrypted(BaseModel):
|
||||
class Schema19ReasoningEncrypted(BaseModel):
|
||||
data: str
|
||||
|
||||
TYPE: Annotated[
|
||||
@@ -113,7 +115,9 @@ class Schema2ReasoningEncrypted(BaseModel):
|
||||
id: OptionalNullable[str] = UNSET
|
||||
|
||||
format_: Annotated[
|
||||
Annotated[OptionalNullable[Schema4], PlainValidator(validate_open_enum(False))],
|
||||
Annotated[
|
||||
OptionalNullable[Schema21], PlainValidator(validate_open_enum(False))
|
||||
],
|
||||
pydantic.Field(alias="format"),
|
||||
] = UNSET
|
||||
|
||||
@@ -150,15 +154,15 @@ class Schema2ReasoningEncrypted(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
class Schema2ReasoningSummaryTypedDict(TypedDict):
|
||||
class Schema19ReasoningSummaryTypedDict(TypedDict):
|
||||
summary: str
|
||||
type: Literal["reasoning.summary"]
|
||||
id: NotRequired[Nullable[str]]
|
||||
format_: NotRequired[Nullable[Schema4]]
|
||||
format_: NotRequired[Nullable[Schema21]]
|
||||
index: NotRequired[float]
|
||||
|
||||
|
||||
class Schema2ReasoningSummary(BaseModel):
|
||||
class Schema19ReasoningSummary(BaseModel):
|
||||
summary: str
|
||||
|
||||
TYPE: Annotated[
|
||||
@@ -172,7 +176,9 @@ class Schema2ReasoningSummary(BaseModel):
|
||||
id: OptionalNullable[str] = UNSET
|
||||
|
||||
format_: Annotated[
|
||||
Annotated[OptionalNullable[Schema4], PlainValidator(validate_open_enum(False))],
|
||||
Annotated[
|
||||
OptionalNullable[Schema21], PlainValidator(validate_open_enum(False))
|
||||
],
|
||||
pydantic.Field(alias="format"),
|
||||
] = UNSET
|
||||
|
||||
@@ -209,21 +215,21 @@ class Schema2ReasoningSummary(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
Schema2TypedDict = TypeAliasType(
|
||||
"Schema2TypedDict",
|
||||
Schema19TypedDict = TypeAliasType(
|
||||
"Schema19TypedDict",
|
||||
Union[
|
||||
Schema2ReasoningSummaryTypedDict,
|
||||
Schema2ReasoningEncryptedTypedDict,
|
||||
Schema2ReasoningTextTypedDict,
|
||||
Schema19ReasoningSummaryTypedDict,
|
||||
Schema19ReasoningEncryptedTypedDict,
|
||||
Schema19ReasoningTextTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
Schema2 = Annotated[
|
||||
Schema19 = Annotated[
|
||||
Union[
|
||||
Annotated[Schema2ReasoningSummary, Tag("reasoning.summary")],
|
||||
Annotated[Schema2ReasoningEncrypted, Tag("reasoning.encrypted")],
|
||||
Annotated[Schema2ReasoningText, Tag("reasoning.text")],
|
||||
Annotated[Schema19ReasoningSummary, Tag("reasoning.summary")],
|
||||
Annotated[Schema19ReasoningEncrypted, Tag("reasoning.encrypted")],
|
||||
Annotated[Schema19ReasoningText, Tag("reasoning.text")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
@@ -8,11 +8,12 @@ from typing import Literal, Union
|
||||
from typing_extensions import Annotated, TypeAliasType
|
||||
|
||||
|
||||
Schema0Enum = Union[
|
||||
Schema5Enum = Union[
|
||||
Literal[
|
||||
"AI21",
|
||||
"AionLabs",
|
||||
"Alibaba",
|
||||
"Ambient",
|
||||
"Amazon Bedrock",
|
||||
"Amazon Nova",
|
||||
"Anthropic",
|
||||
@@ -69,6 +70,7 @@ Schema0Enum = Union[
|
||||
"Seed",
|
||||
"SiliconFlow",
|
||||
"Sourceful",
|
||||
"StepFun",
|
||||
"Stealth",
|
||||
"StreamLake",
|
||||
"Switchpoint",
|
||||
@@ -85,10 +87,10 @@ Schema0Enum = Union[
|
||||
]
|
||||
|
||||
|
||||
Schema0TypedDict = TypeAliasType("Schema0TypedDict", Union[Schema0Enum, str])
|
||||
Schema5TypedDict = TypeAliasType("Schema5TypedDict", Union[Schema5Enum, str])
|
||||
|
||||
|
||||
Schema0 = TypeAliasType(
|
||||
"Schema0",
|
||||
Union[Annotated[Schema0Enum, PlainValidator(validate_open_enum(False))], str],
|
||||
Schema5 = TypeAliasType(
|
||||
"Schema5",
|
||||
Union[Annotated[Schema5Enum, PlainValidator(validate_open_enum(False))], str],
|
||||
)
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from ._schema2 import Schema2, Schema2TypedDict
|
||||
from ._schema19 import Schema19, Schema19TypedDict
|
||||
from .chatmessagecontentitem import (
|
||||
ChatMessageContentItem,
|
||||
ChatMessageContentItemTypedDict,
|
||||
@@ -56,7 +56,7 @@ class AssistantMessageTypedDict(TypedDict):
|
||||
tool_calls: NotRequired[List[ChatMessageToolCallTypedDict]]
|
||||
refusal: NotRequired[Nullable[str]]
|
||||
reasoning: NotRequired[Nullable[str]]
|
||||
reasoning_details: NotRequired[List[Schema2TypedDict]]
|
||||
reasoning_details: NotRequired[List[Schema19TypedDict]]
|
||||
images: NotRequired[List[ImageTypedDict]]
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ class AssistantMessage(BaseModel):
|
||||
|
||||
reasoning: OptionalNullable[str] = UNSET
|
||||
|
||||
reasoning_details: Optional[List[Schema2]] = None
|
||||
reasoning_details: Optional[List[Schema19]] = None
|
||||
|
||||
images: Optional[List[Image]] = None
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from ._schema0 import Schema0, Schema0TypedDict
|
||||
from ._schema10 import Schema10, Schema10TypedDict
|
||||
from ._schema17 import Schema17, Schema17TypedDict
|
||||
from ._schema5 import Schema5, Schema5TypedDict
|
||||
from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict
|
||||
from .message import Message, MessageTypedDict
|
||||
from .providersortunion import ProviderSortUnion, ProviderSortUnionTypedDict
|
||||
@@ -31,7 +33,7 @@ from typing import Any, Dict, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
ChatGenerationParamsDataCollection = Union[
|
||||
Schema3 = Union[
|
||||
Literal[
|
||||
"deny",
|
||||
"allow",
|
||||
@@ -40,7 +42,7 @@ ChatGenerationParamsDataCollection = Union[
|
||||
]
|
||||
|
||||
|
||||
Quantizations = Union[
|
||||
Schema8 = Union[
|
||||
Literal[
|
||||
"int4",
|
||||
"int8",
|
||||
@@ -56,38 +58,14 @@ Quantizations = Union[
|
||||
]
|
||||
|
||||
|
||||
class ChatGenerationParamsMaxPriceTypedDict(TypedDict):
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
|
||||
prompt: NotRequired[Any]
|
||||
completion: NotRequired[Any]
|
||||
image: NotRequired[Any]
|
||||
audio: NotRequired[Any]
|
||||
request: NotRequired[Any]
|
||||
|
||||
|
||||
class ChatGenerationParamsMaxPrice(BaseModel):
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
|
||||
prompt: Optional[Any] = None
|
||||
|
||||
completion: Optional[Any] = None
|
||||
|
||||
image: Optional[Any] = None
|
||||
|
||||
audio: Optional[Any] = None
|
||||
|
||||
request: Optional[Any] = None
|
||||
|
||||
|
||||
class ChatGenerationParamsPreferredMinThroughputTypedDict(TypedDict):
|
||||
class Schema15TypedDict(TypedDict):
|
||||
p50: NotRequired[Nullable[float]]
|
||||
p75: NotRequired[Nullable[float]]
|
||||
p90: NotRequired[Nullable[float]]
|
||||
p99: NotRequired[Nullable[float]]
|
||||
|
||||
|
||||
class ChatGenerationParamsPreferredMinThroughput(BaseModel):
|
||||
class Schema15(BaseModel):
|
||||
p50: OptionalNullable[float] = UNSET
|
||||
|
||||
p75: OptionalNullable[float] = UNSET
|
||||
@@ -127,170 +105,60 @@ class ChatGenerationParamsPreferredMinThroughput(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
ChatGenerationParamsPreferredMinThroughputUnionTypedDict = TypeAliasType(
|
||||
"ChatGenerationParamsPreferredMinThroughputUnionTypedDict",
|
||||
Union[ChatGenerationParamsPreferredMinThroughputTypedDict, float],
|
||||
Schema15UnionTypedDict = TypeAliasType(
|
||||
"Schema15UnionTypedDict", Union[Schema15TypedDict, float]
|
||||
)
|
||||
|
||||
|
||||
ChatGenerationParamsPreferredMinThroughputUnion = TypeAliasType(
|
||||
"ChatGenerationParamsPreferredMinThroughputUnion",
|
||||
Union[ChatGenerationParamsPreferredMinThroughput, float],
|
||||
)
|
||||
Schema15Union = TypeAliasType("Schema15Union", Union[Schema15, float])
|
||||
|
||||
|
||||
class ChatGenerationParamsPreferredMaxLatencyTypedDict(TypedDict):
|
||||
p50: NotRequired[Nullable[float]]
|
||||
p75: NotRequired[Nullable[float]]
|
||||
p90: NotRequired[Nullable[float]]
|
||||
p99: NotRequired[Nullable[float]]
|
||||
|
||||
|
||||
class ChatGenerationParamsPreferredMaxLatency(BaseModel):
|
||||
p50: OptionalNullable[float] = UNSET
|
||||
|
||||
p75: OptionalNullable[float] = UNSET
|
||||
|
||||
p90: OptionalNullable[float] = UNSET
|
||||
|
||||
p99: OptionalNullable[float] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["p50", "p75", "p90", "p99"]
|
||||
nullable_fields = ["p50", "p75", "p90", "p99"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
ChatGenerationParamsPreferredMaxLatencyUnionTypedDict = TypeAliasType(
|
||||
"ChatGenerationParamsPreferredMaxLatencyUnionTypedDict",
|
||||
Union[ChatGenerationParamsPreferredMaxLatencyTypedDict, float],
|
||||
)
|
||||
|
||||
|
||||
ChatGenerationParamsPreferredMaxLatencyUnion = TypeAliasType(
|
||||
"ChatGenerationParamsPreferredMaxLatencyUnion",
|
||||
Union[ChatGenerationParamsPreferredMaxLatency, float],
|
||||
)
|
||||
|
||||
|
||||
class ChatGenerationParamsProviderTypedDict(TypedDict):
|
||||
class Schema0TypedDict(TypedDict):
|
||||
allow_fallbacks: NotRequired[Nullable[bool]]
|
||||
r"""Whether to allow backup providers to serve requests
|
||||
- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.
|
||||
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
|
||||
|
||||
"""
|
||||
require_parameters: NotRequired[Nullable[bool]]
|
||||
r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest."""
|
||||
data_collection: NotRequired[Nullable[ChatGenerationParamsDataCollection]]
|
||||
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
"""
|
||||
data_collection: NotRequired[Nullable[Schema3]]
|
||||
zdr: NotRequired[Nullable[bool]]
|
||||
enforce_distillable_text: NotRequired[Nullable[bool]]
|
||||
order: NotRequired[Nullable[List[Schema0TypedDict]]]
|
||||
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
|
||||
only: NotRequired[Nullable[List[Schema0TypedDict]]]
|
||||
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
|
||||
ignore: NotRequired[Nullable[List[Schema0TypedDict]]]
|
||||
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
|
||||
quantizations: NotRequired[Nullable[List[Quantizations]]]
|
||||
r"""A list of quantization levels to filter the provider by."""
|
||||
order: NotRequired[Nullable[List[Schema5TypedDict]]]
|
||||
only: NotRequired[Nullable[List[Schema5TypedDict]]]
|
||||
ignore: NotRequired[Nullable[List[Schema5TypedDict]]]
|
||||
quantizations: NotRequired[Nullable[List[Schema8]]]
|
||||
sort: NotRequired[Nullable[ProviderSortUnionTypedDict]]
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
max_price: NotRequired[ChatGenerationParamsMaxPriceTypedDict]
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
preferred_min_throughput: NotRequired[
|
||||
Nullable[ChatGenerationParamsPreferredMinThroughputUnionTypedDict]
|
||||
]
|
||||
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
|
||||
preferred_max_latency: NotRequired[
|
||||
Nullable[ChatGenerationParamsPreferredMaxLatencyUnionTypedDict]
|
||||
]
|
||||
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
|
||||
max_price: NotRequired[Schema10TypedDict]
|
||||
preferred_min_throughput: NotRequired[Nullable[Schema15UnionTypedDict]]
|
||||
preferred_max_latency: NotRequired[Nullable[Schema15UnionTypedDict]]
|
||||
|
||||
|
||||
class ChatGenerationParamsProvider(BaseModel):
|
||||
class Schema0(BaseModel):
|
||||
allow_fallbacks: OptionalNullable[bool] = UNSET
|
||||
r"""Whether to allow backup providers to serve requests
|
||||
- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.
|
||||
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
|
||||
|
||||
"""
|
||||
|
||||
require_parameters: OptionalNullable[bool] = UNSET
|
||||
r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest."""
|
||||
|
||||
data_collection: Annotated[
|
||||
OptionalNullable[ChatGenerationParamsDataCollection],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
OptionalNullable[Schema3], PlainValidator(validate_open_enum(False))
|
||||
] = UNSET
|
||||
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
"""
|
||||
|
||||
zdr: OptionalNullable[bool] = UNSET
|
||||
|
||||
enforce_distillable_text: OptionalNullable[bool] = UNSET
|
||||
|
||||
order: OptionalNullable[List[Schema0]] = UNSET
|
||||
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
|
||||
order: OptionalNullable[List[Schema5]] = UNSET
|
||||
|
||||
only: OptionalNullable[List[Schema0]] = UNSET
|
||||
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
|
||||
only: OptionalNullable[List[Schema5]] = UNSET
|
||||
|
||||
ignore: OptionalNullable[List[Schema0]] = UNSET
|
||||
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
|
||||
ignore: OptionalNullable[List[Schema5]] = UNSET
|
||||
|
||||
quantizations: OptionalNullable[
|
||||
List[Annotated[Quantizations, PlainValidator(validate_open_enum(False))]]
|
||||
List[Annotated[Schema8, PlainValidator(validate_open_enum(False))]]
|
||||
] = UNSET
|
||||
r"""A list of quantization levels to filter the provider by."""
|
||||
|
||||
sort: OptionalNullable[ProviderSortUnion] = UNSET
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
|
||||
max_price: Optional[ChatGenerationParamsMaxPrice] = None
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
max_price: Optional[Schema10] = None
|
||||
|
||||
preferred_min_throughput: OptionalNullable[
|
||||
ChatGenerationParamsPreferredMinThroughputUnion
|
||||
] = UNSET
|
||||
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
|
||||
preferred_min_throughput: OptionalNullable[Schema15Union] = UNSET
|
||||
|
||||
preferred_max_latency: OptionalNullable[
|
||||
ChatGenerationParamsPreferredMaxLatencyUnion
|
||||
] = UNSET
|
||||
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
|
||||
preferred_max_latency: OptionalNullable[Schema15Union] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
@@ -350,150 +218,6 @@ class ChatGenerationParamsProvider(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
class ChatGenerationParamsPluginResponseHealingTypedDict(TypedDict):
|
||||
id: Literal["response-healing"]
|
||||
enabled: NotRequired[bool]
|
||||
|
||||
|
||||
class ChatGenerationParamsPluginResponseHealing(BaseModel):
|
||||
ID: Annotated[
|
||||
Annotated[
|
||||
Literal["response-healing"],
|
||||
AfterValidator(validate_const("response-healing")),
|
||||
],
|
||||
pydantic.Field(alias="id"),
|
||||
] = "response-healing"
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
|
||||
|
||||
PdfEngine = Union[
|
||||
Literal[
|
||||
"mistral-ocr",
|
||||
"pdf-text",
|
||||
"native",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
class PdfTypedDict(TypedDict):
|
||||
engine: NotRequired[PdfEngine]
|
||||
|
||||
|
||||
class Pdf(BaseModel):
|
||||
engine: Annotated[
|
||||
Optional[PdfEngine], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
|
||||
|
||||
class ChatGenerationParamsPluginFileParserTypedDict(TypedDict):
|
||||
id: Literal["file-parser"]
|
||||
enabled: NotRequired[bool]
|
||||
pdf: NotRequired[PdfTypedDict]
|
||||
|
||||
|
||||
class ChatGenerationParamsPluginFileParser(BaseModel):
|
||||
ID: Annotated[
|
||||
Annotated[
|
||||
Literal["file-parser"], AfterValidator(validate_const("file-parser"))
|
||||
],
|
||||
pydantic.Field(alias="id"),
|
||||
] = "file-parser"
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
|
||||
pdf: Optional[Pdf] = None
|
||||
|
||||
|
||||
Engine = Union[
|
||||
Literal[
|
||||
"native",
|
||||
"exa",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
class ChatGenerationParamsPluginWebTypedDict(TypedDict):
|
||||
id: Literal["web"]
|
||||
enabled: NotRequired[bool]
|
||||
max_results: NotRequired[float]
|
||||
search_prompt: NotRequired[str]
|
||||
engine: NotRequired[Engine]
|
||||
|
||||
|
||||
class ChatGenerationParamsPluginWeb(BaseModel):
|
||||
ID: Annotated[
|
||||
Annotated[Literal["web"], AfterValidator(validate_const("web"))],
|
||||
pydantic.Field(alias="id"),
|
||||
] = "web"
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
|
||||
max_results: Optional[float] = None
|
||||
|
||||
search_prompt: Optional[str] = None
|
||||
|
||||
engine: Annotated[Optional[Engine], PlainValidator(validate_open_enum(False))] = (
|
||||
None
|
||||
)
|
||||
|
||||
|
||||
class ChatGenerationParamsPluginModerationTypedDict(TypedDict):
|
||||
id: Literal["moderation"]
|
||||
|
||||
|
||||
class ChatGenerationParamsPluginModeration(BaseModel):
|
||||
ID: Annotated[
|
||||
Annotated[Literal["moderation"], AfterValidator(validate_const("moderation"))],
|
||||
pydantic.Field(alias="id"),
|
||||
] = "moderation"
|
||||
|
||||
|
||||
class ChatGenerationParamsPluginAutoRouterTypedDict(TypedDict):
|
||||
id: Literal["auto-router"]
|
||||
enabled: NotRequired[bool]
|
||||
allowed_models: NotRequired[List[str]]
|
||||
|
||||
|
||||
class ChatGenerationParamsPluginAutoRouter(BaseModel):
|
||||
ID: Annotated[
|
||||
Annotated[
|
||||
Literal["auto-router"], AfterValidator(validate_const("auto-router"))
|
||||
],
|
||||
pydantic.Field(alias="id"),
|
||||
] = "auto-router"
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
|
||||
allowed_models: Optional[List[str]] = None
|
||||
|
||||
|
||||
ChatGenerationParamsPluginUnionTypedDict = TypeAliasType(
|
||||
"ChatGenerationParamsPluginUnionTypedDict",
|
||||
Union[
|
||||
ChatGenerationParamsPluginModerationTypedDict,
|
||||
ChatGenerationParamsPluginResponseHealingTypedDict,
|
||||
ChatGenerationParamsPluginAutoRouterTypedDict,
|
||||
ChatGenerationParamsPluginFileParserTypedDict,
|
||||
ChatGenerationParamsPluginWebTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
ChatGenerationParamsPluginUnion = Annotated[
|
||||
Union[
|
||||
Annotated[ChatGenerationParamsPluginAutoRouter, Tag("auto-router")],
|
||||
Annotated[ChatGenerationParamsPluginModeration, Tag("moderation")],
|
||||
Annotated[ChatGenerationParamsPluginWeb, Tag("web")],
|
||||
Annotated[ChatGenerationParamsPluginFileParser, Tag("file-parser")],
|
||||
Annotated[ChatGenerationParamsPluginResponseHealing, Tag("response-healing")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "id", "id")),
|
||||
]
|
||||
|
||||
|
||||
Route = Union[
|
||||
Literal[
|
||||
"fallback",
|
||||
@@ -562,22 +286,22 @@ class Reasoning(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
class ChatGenerationParamsResponseFormatPythonTypedDict(TypedDict):
|
||||
class ResponseFormatPythonTypedDict(TypedDict):
|
||||
type: Literal["python"]
|
||||
|
||||
|
||||
class ChatGenerationParamsResponseFormatPython(BaseModel):
|
||||
class ResponseFormatPython(BaseModel):
|
||||
TYPE: Annotated[
|
||||
Annotated[Literal["python"], AfterValidator(validate_const("python"))],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "python"
|
||||
|
||||
|
||||
class ChatGenerationParamsResponseFormatJSONObjectTypedDict(TypedDict):
|
||||
class ResponseFormatJSONObjectTypedDict(TypedDict):
|
||||
type: Literal["json_object"]
|
||||
|
||||
|
||||
class ChatGenerationParamsResponseFormatJSONObject(BaseModel):
|
||||
class ResponseFormatJSONObject(BaseModel):
|
||||
TYPE: Annotated[
|
||||
Annotated[
|
||||
Literal["json_object"], AfterValidator(validate_const("json_object"))
|
||||
@@ -586,49 +310,45 @@ class ChatGenerationParamsResponseFormatJSONObject(BaseModel):
|
||||
] = "json_object"
|
||||
|
||||
|
||||
class ChatGenerationParamsResponseFormatTextTypedDict(TypedDict):
|
||||
class ResponseFormatTextTypedDict(TypedDict):
|
||||
type: Literal["text"]
|
||||
|
||||
|
||||
class ChatGenerationParamsResponseFormatText(BaseModel):
|
||||
class ResponseFormatText(BaseModel):
|
||||
TYPE: Annotated[
|
||||
Annotated[Literal["text"], AfterValidator(validate_const("text"))],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "text"
|
||||
|
||||
|
||||
ChatGenerationParamsResponseFormatUnionTypedDict = TypeAliasType(
|
||||
"ChatGenerationParamsResponseFormatUnionTypedDict",
|
||||
ResponseFormatTypedDict = TypeAliasType(
|
||||
"ResponseFormatTypedDict",
|
||||
Union[
|
||||
ChatGenerationParamsResponseFormatTextTypedDict,
|
||||
ChatGenerationParamsResponseFormatJSONObjectTypedDict,
|
||||
ChatGenerationParamsResponseFormatPythonTypedDict,
|
||||
ResponseFormatTextTypedDict,
|
||||
ResponseFormatJSONObjectTypedDict,
|
||||
ResponseFormatPythonTypedDict,
|
||||
ResponseFormatJSONSchemaTypedDict,
|
||||
ResponseFormatTextGrammarTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
ChatGenerationParamsResponseFormatUnion = Annotated[
|
||||
ResponseFormat = Annotated[
|
||||
Union[
|
||||
Annotated[ChatGenerationParamsResponseFormatText, Tag("text")],
|
||||
Annotated[ChatGenerationParamsResponseFormatJSONObject, Tag("json_object")],
|
||||
Annotated[ResponseFormatText, Tag("text")],
|
||||
Annotated[ResponseFormatJSONObject, Tag("json_object")],
|
||||
Annotated[ResponseFormatJSONSchema, Tag("json_schema")],
|
||||
Annotated[ResponseFormatTextGrammar, Tag("grammar")],
|
||||
Annotated[ChatGenerationParamsResponseFormatPython, Tag("python")],
|
||||
Annotated[ResponseFormatPython, Tag("python")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
ChatGenerationParamsStopTypedDict = TypeAliasType(
|
||||
"ChatGenerationParamsStopTypedDict", Union[str, List[str]]
|
||||
)
|
||||
StopTypedDict = TypeAliasType("StopTypedDict", Union[str, List[str]])
|
||||
|
||||
|
||||
ChatGenerationParamsStop = TypeAliasType(
|
||||
"ChatGenerationParamsStop", Union[str, List[str]]
|
||||
)
|
||||
Stop = TypeAliasType("Stop", Union[str, List[str]])
|
||||
|
||||
|
||||
class DebugTypedDict(TypedDict):
|
||||
@@ -640,12 +360,12 @@ class Debug(BaseModel):
|
||||
|
||||
|
||||
ChatGenerationParamsImageConfigTypedDict = TypeAliasType(
|
||||
"ChatGenerationParamsImageConfigTypedDict", Union[str, float]
|
||||
"ChatGenerationParamsImageConfigTypedDict", Union[str, float, List[Any]]
|
||||
)
|
||||
|
||||
|
||||
ChatGenerationParamsImageConfig = TypeAliasType(
|
||||
"ChatGenerationParamsImageConfig", Union[str, float]
|
||||
"ChatGenerationParamsImageConfig", Union[str, float, List[Any]]
|
||||
)
|
||||
|
||||
|
||||
@@ -660,14 +380,11 @@ Modality = Union[
|
||||
|
||||
class ChatGenerationParamsTypedDict(TypedDict):
|
||||
messages: List[MessageTypedDict]
|
||||
provider: NotRequired[Nullable[ChatGenerationParamsProviderTypedDict]]
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
plugins: NotRequired[List[ChatGenerationParamsPluginUnionTypedDict]]
|
||||
r"""Plugins you want to enable for this request, including their settings."""
|
||||
provider: NotRequired[Nullable[Schema0TypedDict]]
|
||||
plugins: NotRequired[List[Schema17TypedDict]]
|
||||
route: NotRequired[Nullable[Route]]
|
||||
user: NotRequired[str]
|
||||
session_id: NotRequired[str]
|
||||
r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters."""
|
||||
model: NotRequired[str]
|
||||
models: NotRequired[List[str]]
|
||||
frequency_penalty: NotRequired[Nullable[float]]
|
||||
@@ -679,9 +396,9 @@ class ChatGenerationParamsTypedDict(TypedDict):
|
||||
metadata: NotRequired[Dict[str, str]]
|
||||
presence_penalty: NotRequired[Nullable[float]]
|
||||
reasoning: NotRequired[ReasoningTypedDict]
|
||||
response_format: NotRequired[ChatGenerationParamsResponseFormatUnionTypedDict]
|
||||
response_format: NotRequired[ResponseFormatTypedDict]
|
||||
seed: NotRequired[Nullable[int]]
|
||||
stop: NotRequired[Nullable[ChatGenerationParamsStopTypedDict]]
|
||||
stop: NotRequired[Nullable[StopTypedDict]]
|
||||
stream: NotRequired[bool]
|
||||
stream_options: NotRequired[Nullable[ChatStreamOptionsTypedDict]]
|
||||
temperature: NotRequired[Nullable[float]]
|
||||
@@ -696,11 +413,9 @@ class ChatGenerationParamsTypedDict(TypedDict):
|
||||
class ChatGenerationParams(BaseModel):
|
||||
messages: List[Message]
|
||||
|
||||
provider: OptionalNullable[ChatGenerationParamsProvider] = UNSET
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
provider: OptionalNullable[Schema0] = UNSET
|
||||
|
||||
plugins: Optional[List[ChatGenerationParamsPluginUnion]] = None
|
||||
r"""Plugins you want to enable for this request, including their settings."""
|
||||
plugins: Optional[List[Schema17]] = None
|
||||
|
||||
route: Annotated[
|
||||
OptionalNullable[Route], PlainValidator(validate_open_enum(False))
|
||||
@@ -709,7 +424,6 @@ class ChatGenerationParams(BaseModel):
|
||||
user: Optional[str] = None
|
||||
|
||||
session_id: Optional[str] = None
|
||||
r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters."""
|
||||
|
||||
model: Optional[str] = None
|
||||
|
||||
@@ -733,11 +447,11 @@ class ChatGenerationParams(BaseModel):
|
||||
|
||||
reasoning: Optional[Reasoning] = None
|
||||
|
||||
response_format: Optional[ChatGenerationParamsResponseFormatUnion] = None
|
||||
response_format: Optional[ResponseFormat] = None
|
||||
|
||||
seed: OptionalNullable[int] = UNSET
|
||||
|
||||
stop: OptionalNullable[ChatGenerationParamsStop] = UNSET
|
||||
stop: OptionalNullable[Stop] = UNSET
|
||||
|
||||
stream: Optional[bool] = False
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from ._schema2 import Schema2, Schema2TypedDict
|
||||
from ._schema19 import Schema19, Schema19TypedDict
|
||||
from .chatstreamingmessagetoolcall import (
|
||||
ChatStreamingMessageToolCall,
|
||||
ChatStreamingMessageToolCallTypedDict,
|
||||
@@ -27,7 +27,7 @@ class ChatStreamingMessageChunkTypedDict(TypedDict):
|
||||
reasoning: NotRequired[Nullable[str]]
|
||||
refusal: NotRequired[Nullable[str]]
|
||||
tool_calls: NotRequired[List[ChatStreamingMessageToolCallTypedDict]]
|
||||
reasoning_details: NotRequired[List[Schema2TypedDict]]
|
||||
reasoning_details: NotRequired[List[Schema19TypedDict]]
|
||||
|
||||
|
||||
class ChatStreamingMessageChunk(BaseModel):
|
||||
@@ -41,7 +41,7 @@ class ChatStreamingMessageChunk(BaseModel):
|
||||
|
||||
tool_calls: Optional[List[ChatStreamingMessageToolCall]] = None
|
||||
|
||||
reasoning_details: Optional[List[Schema2]] = None
|
||||
reasoning_details: Optional[List[Schema19]] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .completionlogprobs import CompletionLogprobs, CompletionLogprobsTypedDict
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
UnrecognizedStr,
|
||||
)
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
CompletionFinishReason = Union[
|
||||
Literal[
|
||||
"stop",
|
||||
"length",
|
||||
"content_filter",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
class CompletionChoiceTypedDict(TypedDict):
|
||||
text: str
|
||||
index: float
|
||||
logprobs: Nullable[CompletionLogprobsTypedDict]
|
||||
finish_reason: Nullable[CompletionFinishReason]
|
||||
native_finish_reason: NotRequired[str]
|
||||
reasoning: NotRequired[Nullable[str]]
|
||||
|
||||
|
||||
class CompletionChoice(BaseModel):
|
||||
text: str
|
||||
|
||||
index: float
|
||||
|
||||
logprobs: Nullable[CompletionLogprobs]
|
||||
|
||||
finish_reason: Annotated[
|
||||
Nullable[CompletionFinishReason], PlainValidator(validate_open_enum(False))
|
||||
]
|
||||
|
||||
native_finish_reason: Optional[str] = None
|
||||
|
||||
reasoning: OptionalNullable[str] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["native_finish_reason", "reasoning"]
|
||||
nullable_fields = ["logprobs", "finish_reason", "reasoning"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -1,277 +0,0 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .responseformatjsonschema import (
|
||||
ResponseFormatJSONSchema,
|
||||
ResponseFormatJSONSchemaTypedDict,
|
||||
)
|
||||
from .responseformattextgrammar import (
|
||||
ResponseFormatTextGrammar,
|
||||
ResponseFormatTextGrammarTypedDict,
|
||||
)
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from openrouter.utils import get_discriminator, validate_const
|
||||
import pydantic
|
||||
from pydantic import Discriminator, Tag, model_serializer
|
||||
from pydantic.functional_validators import AfterValidator
|
||||
from typing import Dict, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
PromptTypedDict = TypeAliasType(
|
||||
"PromptTypedDict", Union[str, List[str], List[float], List[List[float]]]
|
||||
)
|
||||
|
||||
|
||||
Prompt = TypeAliasType("Prompt", Union[str, List[str], List[float], List[List[float]]])
|
||||
|
||||
|
||||
CompletionCreateParamsStopTypedDict = TypeAliasType(
|
||||
"CompletionCreateParamsStopTypedDict", Union[str, List[str]]
|
||||
)
|
||||
|
||||
|
||||
CompletionCreateParamsStop = TypeAliasType(
|
||||
"CompletionCreateParamsStop", Union[str, List[str]]
|
||||
)
|
||||
|
||||
|
||||
class StreamOptionsTypedDict(TypedDict):
|
||||
include_usage: NotRequired[Nullable[bool]]
|
||||
|
||||
|
||||
class StreamOptions(BaseModel):
|
||||
include_usage: OptionalNullable[bool] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["include_usage"]
|
||||
nullable_fields = ["include_usage"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class CompletionCreateParamsResponseFormatPythonTypedDict(TypedDict):
|
||||
type: Literal["python"]
|
||||
|
||||
|
||||
class CompletionCreateParamsResponseFormatPython(BaseModel):
|
||||
TYPE: Annotated[
|
||||
Annotated[Literal["python"], AfterValidator(validate_const("python"))],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "python"
|
||||
|
||||
|
||||
class CompletionCreateParamsResponseFormatJSONObjectTypedDict(TypedDict):
|
||||
type: Literal["json_object"]
|
||||
|
||||
|
||||
class CompletionCreateParamsResponseFormatJSONObject(BaseModel):
|
||||
TYPE: Annotated[
|
||||
Annotated[
|
||||
Literal["json_object"], AfterValidator(validate_const("json_object"))
|
||||
],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "json_object"
|
||||
|
||||
|
||||
class CompletionCreateParamsResponseFormatTextTypedDict(TypedDict):
|
||||
type: Literal["text"]
|
||||
|
||||
|
||||
class CompletionCreateParamsResponseFormatText(BaseModel):
|
||||
TYPE: Annotated[
|
||||
Annotated[Literal["text"], AfterValidator(validate_const("text"))],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "text"
|
||||
|
||||
|
||||
CompletionCreateParamsResponseFormatUnionTypedDict = TypeAliasType(
|
||||
"CompletionCreateParamsResponseFormatUnionTypedDict",
|
||||
Union[
|
||||
CompletionCreateParamsResponseFormatTextTypedDict,
|
||||
CompletionCreateParamsResponseFormatJSONObjectTypedDict,
|
||||
CompletionCreateParamsResponseFormatPythonTypedDict,
|
||||
ResponseFormatJSONSchemaTypedDict,
|
||||
ResponseFormatTextGrammarTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
CompletionCreateParamsResponseFormatUnion = Annotated[
|
||||
Union[
|
||||
Annotated[CompletionCreateParamsResponseFormatText, Tag("text")],
|
||||
Annotated[CompletionCreateParamsResponseFormatJSONObject, Tag("json_object")],
|
||||
Annotated[ResponseFormatJSONSchema, Tag("json_schema")],
|
||||
Annotated[ResponseFormatTextGrammar, Tag("grammar")],
|
||||
Annotated[CompletionCreateParamsResponseFormatPython, Tag("python")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
class CompletionCreateParamsTypedDict(TypedDict):
|
||||
prompt: PromptTypedDict
|
||||
model: NotRequired[str]
|
||||
models: NotRequired[List[str]]
|
||||
best_of: NotRequired[Nullable[int]]
|
||||
echo: NotRequired[Nullable[bool]]
|
||||
frequency_penalty: NotRequired[Nullable[float]]
|
||||
logit_bias: NotRequired[Nullable[Dict[str, float]]]
|
||||
logprobs: NotRequired[Nullable[int]]
|
||||
max_tokens: NotRequired[Nullable[int]]
|
||||
n: NotRequired[Nullable[int]]
|
||||
presence_penalty: NotRequired[Nullable[float]]
|
||||
seed: NotRequired[Nullable[int]]
|
||||
stop: NotRequired[Nullable[CompletionCreateParamsStopTypedDict]]
|
||||
stream: NotRequired[bool]
|
||||
stream_options: NotRequired[Nullable[StreamOptionsTypedDict]]
|
||||
suffix: NotRequired[Nullable[str]]
|
||||
temperature: NotRequired[Nullable[float]]
|
||||
top_p: NotRequired[Nullable[float]]
|
||||
user: NotRequired[str]
|
||||
metadata: NotRequired[Nullable[Dict[str, str]]]
|
||||
response_format: NotRequired[
|
||||
Nullable[CompletionCreateParamsResponseFormatUnionTypedDict]
|
||||
]
|
||||
|
||||
|
||||
class CompletionCreateParams(BaseModel):
|
||||
prompt: Prompt
|
||||
|
||||
model: Optional[str] = None
|
||||
|
||||
models: Optional[List[str]] = None
|
||||
|
||||
best_of: OptionalNullable[int] = UNSET
|
||||
|
||||
echo: OptionalNullable[bool] = UNSET
|
||||
|
||||
frequency_penalty: OptionalNullable[float] = UNSET
|
||||
|
||||
logit_bias: OptionalNullable[Dict[str, float]] = UNSET
|
||||
|
||||
logprobs: OptionalNullable[int] = UNSET
|
||||
|
||||
max_tokens: OptionalNullable[int] = UNSET
|
||||
|
||||
n: OptionalNullable[int] = UNSET
|
||||
|
||||
presence_penalty: OptionalNullable[float] = UNSET
|
||||
|
||||
seed: OptionalNullable[int] = UNSET
|
||||
|
||||
stop: OptionalNullable[CompletionCreateParamsStop] = UNSET
|
||||
|
||||
stream: Optional[bool] = False
|
||||
|
||||
stream_options: OptionalNullable[StreamOptions] = UNSET
|
||||
|
||||
suffix: OptionalNullable[str] = UNSET
|
||||
|
||||
temperature: OptionalNullable[float] = UNSET
|
||||
|
||||
top_p: OptionalNullable[float] = UNSET
|
||||
|
||||
user: Optional[str] = None
|
||||
|
||||
metadata: OptionalNullable[Dict[str, str]] = UNSET
|
||||
|
||||
response_format: OptionalNullable[CompletionCreateParamsResponseFormatUnion] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"model",
|
||||
"models",
|
||||
"best_of",
|
||||
"echo",
|
||||
"frequency_penalty",
|
||||
"logit_bias",
|
||||
"logprobs",
|
||||
"max_tokens",
|
||||
"n",
|
||||
"presence_penalty",
|
||||
"seed",
|
||||
"stop",
|
||||
"stream",
|
||||
"stream_options",
|
||||
"suffix",
|
||||
"temperature",
|
||||
"top_p",
|
||||
"user",
|
||||
"metadata",
|
||||
"response_format",
|
||||
]
|
||||
nullable_fields = [
|
||||
"best_of",
|
||||
"echo",
|
||||
"frequency_penalty",
|
||||
"logit_bias",
|
||||
"logprobs",
|
||||
"max_tokens",
|
||||
"n",
|
||||
"presence_penalty",
|
||||
"seed",
|
||||
"stop",
|
||||
"stream_options",
|
||||
"suffix",
|
||||
"temperature",
|
||||
"top_p",
|
||||
"metadata",
|
||||
"response_format",
|
||||
]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -1,54 +0,0 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing import Dict, List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class CompletionLogprobsTypedDict(TypedDict):
|
||||
tokens: List[str]
|
||||
token_logprobs: List[float]
|
||||
top_logprobs: Nullable[List[Dict[str, float]]]
|
||||
text_offset: List[float]
|
||||
|
||||
|
||||
class CompletionLogprobs(BaseModel):
|
||||
tokens: List[str]
|
||||
|
||||
token_logprobs: List[float]
|
||||
|
||||
top_logprobs: Nullable[List[Dict[str, float]]]
|
||||
|
||||
text_offset: List[float]
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["top_logprobs"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -1,46 +0,0 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .completionchoice import CompletionChoice, CompletionChoiceTypedDict
|
||||
from .completionusage import CompletionUsage, CompletionUsageTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import validate_const
|
||||
import pydantic
|
||||
from pydantic.functional_validators import AfterValidator
|
||||
from typing import List, Literal, Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class CompletionResponseTypedDict(TypedDict):
|
||||
id: str
|
||||
created: float
|
||||
model: str
|
||||
choices: List[CompletionChoiceTypedDict]
|
||||
object: Literal["text_completion"]
|
||||
provider: NotRequired[str]
|
||||
system_fingerprint: NotRequired[str]
|
||||
usage: NotRequired[CompletionUsageTypedDict]
|
||||
|
||||
|
||||
class CompletionResponse(BaseModel):
|
||||
id: str
|
||||
|
||||
created: float
|
||||
|
||||
model: str
|
||||
|
||||
choices: List[CompletionChoice]
|
||||
|
||||
OBJECT: Annotated[
|
||||
Annotated[
|
||||
Literal["text_completion"],
|
||||
AfterValidator(validate_const("text_completion")),
|
||||
],
|
||||
pydantic.Field(alias="object"),
|
||||
] = "text_completion"
|
||||
|
||||
provider: Optional[str] = None
|
||||
|
||||
system_fingerprint: Optional[str] = None
|
||||
|
||||
usage: Optional[CompletionUsage] = None
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user