Compare commits

..
Author SHA1 Message Date
yogasanasandgithub-actions[bot] 21688ff51c chore: update OpenAPI specification from openrouter-web 2025-10-24 18:47:41 +00:00
565f022323 chore: update OpenAPI specification from openrouter-web (#11)
Co-authored-by: yogasanas <124478414+yogasanas@users.noreply.github.com>
2025-10-23 16:17:47 -04:00
07e2eff913 chore: update OpenAPI specification from openrouter-web (#10)
Co-authored-by: mattapperson <192433+mattapperson@users.noreply.github.com>
2025-10-23 13:23:22 -04:00
8e8271ba55 chore: update OpenAPI specification from openrouter-web (#9)
Co-authored-by: mattapperson <192433+mattapperson@users.noreply.github.com>
2025-10-22 18:21:14 -04:00
1eeecdae96 chore: update OpenAPI specification from openrouter-web (#8)
Co-authored-by: mattapperson <192433+mattapperson@users.noreply.github.com>
2025-10-20 18:17:33 -04:00
a8eb01c8b9 chore: update OpenAPI specification from openrouter-web (#7)
Co-authored-by: abhinav-pola <215316900+abhinav-pola@users.noreply.github.com>
2025-10-18 17:35:05 -04:00
8c4224dc15 chore: update OpenAPI specification from openrouter-web (#6)
Co-authored-by: louisgv <6723574+louisgv@users.noreply.github.com>
2025-10-18 15:29:46 -04:00
aa968e2897 chore: update OpenAPI specification from openrouter-web (#5)
Co-authored-by: yogasanas <124478414+yogasanas@users.noreply.github.com>
2025-10-18 01:44:03 -04:00
Sheldon Vaughn 5d06b0a7b4 add open enums, server selection, update description 2025-09-18 07:54:13 -05:00
Sheldon Vaughn 540701c0a3 reset to v0.1.0 2025-09-17 09:19:51 -05:00
David Alberto Adler 80fd801021 feat: move to overload typing for stream:true intent for sse 2025-09-08 12:21:06 +01:00
David Alberto Adler 2988b5e385 fix: examples, enums and regenerate (#2) 2025-09-07 21:50:22 +01:00
145 changed files with 7395 additions and 5464 deletions
-5
View File
@@ -1,9 +1,4 @@
<div align="center">
<a href="https://codespaces.new/speakeasy-sdks/openrouter-python-sdk.git/tree/main"><img src="https://github.com/codespaces/badge.svg" /></a>
</div>
<br>
> **Remember to shutdown a GitHub Codespace when it is not in use!**
# Dev Containers Quick Start
+1
View File
@@ -1,3 +1,4 @@
.env.local
.venv/
venv/
src/*.egg-info/
+63 -116
View File
@@ -1,37 +1,39 @@
lockVersion: 2.0.0
id: 232c6d4f-b0fd-4172-8f1b-e2421566e9b4
id: 03e733ff-14c6-48f8-87a5-37a1a4588594
management:
docChecksum: 98b4f227e767bb91333b3b3469d93fa5
docChecksum: 7849dd264d8d3676743d325682310ed7
docVersion: 1.0.0
speakeasyVersion: 1.611.1
generationVersion: 2.694.1
releaseVersion: 0.5.2
configChecksum: 4619605fbeb6f4488feb5336aa62bab6
repoURL: https://github.com/speakeasy-sdks/openrouter-python-sdk.git
installationURL: https://github.com/speakeasy-sdks/openrouter-python-sdk.git
speakeasyVersion: 1.618.1
generationVersion: 2.702.0
releaseVersion: 0.1.0
configChecksum: 9b2fc6a03dd7103d87270af55bb29a50
features:
python:
acceptHeaders: 3.0.0
additionalDependencies: 1.0.0
constsAndDefaults: 1.0.5
core: 5.20.3
core: 5.20.4
customCodeRegions: 0.1.1
defaultEnabledRetries: 0.2.0
devContainers: 3.0.0
enumUnions: 0.1.0
envVarSecurityUsage: 0.3.2
flatRequests: 1.0.1
globalSecurity: 3.0.3
globalSecurity: 3.0.4
globalSecurityCallbacks: 1.0.0
globalSecurityFlattening: 1.0.0
globalServerURLs: 3.1.1
groups: 3.0.0
methodArguments: 1.0.2
nameOverrides: 3.0.1
nullables: 1.0.1
openEnums: 1.0.1
responseFormat: 1.0.1
retries: 3.0.2
sdkHooks: 1.1.0
serverEvents: 1.0.8
serverEvents: 1.0.9
serverEventsSentinels: 0.1.0
serverIDs: 3.0.0
unions: 3.0.4
generatedFiles:
- .devcontainer/README.md
@@ -42,6 +44,7 @@ generatedFiles:
- USAGE.md
- docs/errors/chatcompletionerror.md
- docs/models/annotationdetail.md
- docs/models/audio.md
- docs/models/chatcompletion.md
- docs/models/chatcompletionassistantmessageparam.md
- docs/models/chatcompletionassistantmessageparamcontent.md
@@ -57,6 +60,7 @@ generatedFiles:
- docs/models/chatcompletionchunkchoicedeltatoolcalltype.md
- docs/models/chatcompletionchunkchoicefinishreason.md
- docs/models/chatcompletionchunkobject.md
- docs/models/chatcompletionchunkwrapper.md
- docs/models/chatcompletioncontentpart.md
- docs/models/chatcompletioncontentpartaudio.md
- docs/models/chatcompletioncontentpartaudioformat.md
@@ -67,50 +71,6 @@ generatedFiles:
- docs/models/chatcompletioncontentparttext.md
- docs/models/chatcompletioncontentparttexttype.md
- docs/models/chatcompletioncreateparams.md
- docs/models/chatcompletioncreateparamsaudio.md
- docs/models/chatcompletioncreateparamscompletion.md
- docs/models/chatcompletioncreateparamsdatacollection.md
- docs/models/chatcompletioncreateparamseffort.md
- docs/models/chatcompletioncreateparamsengine.md
- docs/models/chatcompletioncreateparamsidchainofthought.md
- docs/models/chatcompletioncreateparamsidfileparser.md
- docs/models/chatcompletioncreateparamsidmoderation.md
- docs/models/chatcompletioncreateparamsidweb.md
- docs/models/chatcompletioncreateparamsignoreenum.md
- docs/models/chatcompletioncreateparamsignoreunion.md
- docs/models/chatcompletioncreateparamsimage.md
- docs/models/chatcompletioncreateparamsjsonschema.md
- docs/models/chatcompletioncreateparamsmaxprice.md
- docs/models/chatcompletioncreateparamsonlyenum.md
- docs/models/chatcompletioncreateparamsonlyunion.md
- docs/models/chatcompletioncreateparamsorderenum.md
- docs/models/chatcompletioncreateparamsorderunion.md
- docs/models/chatcompletioncreateparamspdf.md
- docs/models/chatcompletioncreateparamspdfengine.md
- docs/models/chatcompletioncreateparamspluginchainofthought.md
- docs/models/chatcompletioncreateparamspluginfileparser.md
- docs/models/chatcompletioncreateparamspluginmoderation.md
- docs/models/chatcompletioncreateparamspluginunion.md
- docs/models/chatcompletioncreateparamspluginweb.md
- docs/models/chatcompletioncreateparamsprompt.md
- docs/models/chatcompletioncreateparamsprovider.md
- docs/models/chatcompletioncreateparamsquantization.md
- docs/models/chatcompletioncreateparamsreasoning.md
- docs/models/chatcompletioncreateparamsreasoningeffort.md
- docs/models/chatcompletioncreateparamsrequest.md
- docs/models/chatcompletioncreateparamsresponseformatgrammar.md
- docs/models/chatcompletioncreateparamsresponseformatjsonobject.md
- docs/models/chatcompletioncreateparamsresponseformatjsonschema.md
- docs/models/chatcompletioncreateparamsresponseformatpython.md
- docs/models/chatcompletioncreateparamsresponseformattext.md
- docs/models/chatcompletioncreateparamsresponseformatunion.md
- docs/models/chatcompletioncreateparamssort.md
- docs/models/chatcompletioncreateparamsstop.md
- docs/models/chatcompletioncreateparamsstreamoptions.md
- docs/models/chatcompletioncreateparamstypegrammar.md
- docs/models/chatcompletioncreateparamstypejsonobject.md
- docs/models/chatcompletioncreateparamstypejsonschema.md
- docs/models/chatcompletioncreateparamstypepython.md
- docs/models/chatcompletioncreateparamstypetext.md
- docs/models/chatcompletionmessage.md
- docs/models/chatcompletionmessageparam.md
@@ -140,67 +100,50 @@ generatedFiles:
- docs/models/chatcompletionusermessageparam.md
- docs/models/chatcompletionusermessageparamcontent.md
- docs/models/chatcompletionusermessageparamrole.md
- docs/models/chatstreamcompletioncreateparams.md
- docs/models/chatstreamcompletioncreateparamsaudio.md
- docs/models/chatstreamcompletioncreateparamscompletion.md
- docs/models/chatstreamcompletioncreateparamsdatacollection.md
- docs/models/chatstreamcompletioncreateparamseffort.md
- docs/models/chatstreamcompletioncreateparamsengine.md
- docs/models/chatstreamcompletioncreateparamsidchainofthought.md
- docs/models/chatstreamcompletioncreateparamsidfileparser.md
- docs/models/chatstreamcompletioncreateparamsidmoderation.md
- docs/models/chatstreamcompletioncreateparamsidweb.md
- docs/models/chatstreamcompletioncreateparamsignoreenum.md
- docs/models/chatstreamcompletioncreateparamsignoreunion.md
- docs/models/chatstreamcompletioncreateparamsimage.md
- docs/models/chatstreamcompletioncreateparamsjsonschema.md
- docs/models/chatstreamcompletioncreateparamsmaxprice.md
- docs/models/chatstreamcompletioncreateparamsonlyenum.md
- docs/models/chatstreamcompletioncreateparamsonlyunion.md
- docs/models/chatstreamcompletioncreateparamsorderenum.md
- docs/models/chatstreamcompletioncreateparamsorderunion.md
- docs/models/chatstreamcompletioncreateparamspdf.md
- docs/models/chatstreamcompletioncreateparamspdfengine.md
- docs/models/chatstreamcompletioncreateparamspluginchainofthought.md
- docs/models/chatstreamcompletioncreateparamspluginfileparser.md
- docs/models/chatstreamcompletioncreateparamspluginmoderation.md
- docs/models/chatstreamcompletioncreateparamspluginunion.md
- docs/models/chatstreamcompletioncreateparamspluginweb.md
- docs/models/chatstreamcompletioncreateparamsprompt.md
- docs/models/chatstreamcompletioncreateparamsprovider.md
- docs/models/chatstreamcompletioncreateparamsquantization.md
- docs/models/chatstreamcompletioncreateparamsreasoning.md
- docs/models/chatstreamcompletioncreateparamsreasoningeffort.md
- docs/models/chatstreamcompletioncreateparamsrequest.md
- docs/models/chatstreamcompletioncreateparamsresponseformatgrammar.md
- docs/models/chatstreamcompletioncreateparamsresponseformatjsonobject.md
- docs/models/chatstreamcompletioncreateparamsresponseformatjsonschema.md
- docs/models/chatstreamcompletioncreateparamsresponseformatpython.md
- docs/models/chatstreamcompletioncreateparamsresponseformattext.md
- docs/models/chatstreamcompletioncreateparamsresponseformatunion.md
- docs/models/chatstreamcompletioncreateparamssort.md
- docs/models/chatstreamcompletioncreateparamsstop.md
- docs/models/chatstreamcompletioncreateparamsstreamoptions.md
- docs/models/chatstreamcompletioncreateparamstypegrammar.md
- docs/models/chatstreamcompletioncreateparamstypejsonobject.md
- docs/models/chatstreamcompletioncreateparamstypejsonschema.md
- docs/models/chatstreamcompletioncreateparamstypepython.md
- docs/models/chatstreamcompletioncreateparamstypetext.md
- docs/models/completion.md
- docs/models/completiontokensdetails.md
- docs/models/completionusage.md
- docs/models/contentimageurl.md
- docs/models/contenttext.md
- docs/models/contenttypeimageurl.md
- docs/models/contenttypetext.md
- docs/models/createchatcompletionresponse.md
- docs/models/datacollection.md
- docs/models/detail.md
- docs/models/effort.md
- docs/models/engine.md
- docs/models/error.md
- docs/models/file.md
- docs/models/fileannotationdetail.md
- docs/models/fileannotationdetailcontentunion.md
- docs/models/fileannotationdetailimageurl.md
- docs/models/idchainofthought.md
- docs/models/idfileparser.md
- docs/models/idmoderation.md
- docs/models/idweb.md
- docs/models/ignore.md
- docs/models/ignoreenum.md
- docs/models/image.md
- docs/models/inputaudio.md
- docs/models/jsonschema.md
- docs/models/maxprice.md
- docs/models/only.md
- docs/models/onlyenum.md
- docs/models/order.md
- docs/models/orderenum.md
- docs/models/parameters.md
- docs/models/pdf.md
- docs/models/pdfengine.md
- docs/models/plugin.md
- docs/models/pluginchainofthought.md
- docs/models/pluginfileparser.md
- docs/models/pluginmoderation.md
- docs/models/pluginweb.md
- docs/models/prompt.md
- docs/models/prompttokensdetails.md
- docs/models/provider.md
- docs/models/quantization.md
- docs/models/reasoning.md
- docs/models/reasoningdetail.md
- docs/models/reasoningdetailencrypted.md
- docs/models/reasoningdetailencryptedformat.md
@@ -211,11 +154,25 @@ generatedFiles:
- docs/models/reasoningdetailtext.md
- docs/models/reasoningdetailtextformat.md
- docs/models/reasoningdetailtexttype.md
- docs/models/reasoningeffort.md
- docs/models/request.md
- docs/models/responseformat.md
- docs/models/responseformatgrammar.md
- docs/models/responseformatjsonobject.md
- docs/models/responseformatjsonschema.md
- docs/models/responseformatjsonschemaschema.md
- docs/models/responseformatpython.md
- docs/models/responseformattext.md
- docs/models/security.md
- docs/models/streamchatcompletionresponsebody.md
- docs/models/sort.md
- docs/models/stop.md
- docs/models/streamoptions.md
- docs/models/toplogprob.md
- docs/models/typefile.md
- docs/models/typegrammar.md
- docs/models/typejsonobject.md
- docs/models/typejsonschema.md
- docs/models/typepython.md
- docs/models/urlcitation.md
- docs/models/urlcitationannotationdetail.md
- docs/models/urlcitationannotationdetailtype.md
@@ -225,7 +182,6 @@ generatedFiles:
- py.typed
- pylintrc
- pyproject.toml
- scripts/prepare_readme.py
- scripts/publish.sh
- src/openrouter/__init__.py
- src/openrouter/_hooks/__init__.py
@@ -250,6 +206,7 @@ generatedFiles:
- src/openrouter/models/chatcompletionchunkchoice.py
- src/openrouter/models/chatcompletionchunkchoicedelta.py
- src/openrouter/models/chatcompletionchunkchoicedeltatoolcall.py
- src/openrouter/models/chatcompletionchunkwrapper.py
- src/openrouter/models/chatcompletioncontentpart.py
- src/openrouter/models/chatcompletioncontentpartaudio.py
- src/openrouter/models/chatcompletioncontentpartimage.py
@@ -267,8 +224,8 @@ generatedFiles:
- src/openrouter/models/chatcompletiontoolchoiceoption.py
- src/openrouter/models/chatcompletiontoolmessageparam.py
- src/openrouter/models/chatcompletionusermessageparam.py
- src/openrouter/models/chatstreamcompletioncreateparams.py
- src/openrouter/models/completionusage.py
- src/openrouter/models/createchatcompletionop.py
- src/openrouter/models/fileannotationdetail.py
- src/openrouter/models/reasoningdetail.py
- src/openrouter/models/reasoningdetailencrypted.py
@@ -276,7 +233,6 @@ generatedFiles:
- src/openrouter/models/reasoningdetailtext.py
- src/openrouter/models/responseformatjsonschemaschema.py
- src/openrouter/models/security.py
- src/openrouter/models/streamchatcompletionop.py
- src/openrouter/models/urlcitationannotationdetail.py
- src/openrouter/py.typed
- src/openrouter/sdk.py
@@ -309,16 +265,7 @@ examples:
"200":
application/json: {"id": "<id>", "choices": [], "created": 6977.95, "model": "El Camino", "object": "chat.completion"}
"400":
application/json: {"error": {"code": null, "message": "<value>"}}
application/json: {"error": {"code": 8588.53, "message": "<value>"}}
"500":
application/json: {"error": {"code": null, "message": "<value>"}}
streamChatCompletion:
speakeasy-default-stream-chat-completion:
requestBody:
application/json: {"messages": [{"role": "user", "content": "Hello, how are you?"}], "stream": true, "temperature": 1, "top_p": 1}
responses:
"400":
application/json: {"error": {"code": null, "message": "<value>"}}
"500":
application/json: {"error": {"code": null, "message": "<value>"}}
application/json: {"error": {"code": 8588.53, "message": "<value>"}}
examplesVersion: 1.0.2
+5 -2
View File
@@ -19,13 +19,15 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: true
oAuth2PasswordEnabled: true
hoistGlobalSecurity: true
inferSSEOverload: true
sdkHooksConfigAccess: true
tests:
generateTests: false
generateNewTests: true
skipResponseBodyAssertions: false
python:
version: 0.5.2
version: 0.1.0
additionalDependencies:
dev: {}
main: {}
@@ -37,7 +39,7 @@ python:
baseErrorName: OpenRouterError
clientServerStatusCodesAsErrors: true
defaultErrorName: OpenRouterDefaultError
description: Python Client SDK Generated by Speakeasy.
description: The OpenRouter Python SDK.
enableCustomCodeRegions: true
enumFormat: union
envVarPrefix: OPENROUTER
@@ -64,4 +66,5 @@ python:
pytestFilterWarnings: []
pytestTimeout: 0
responseFormat: flat
sseFlatResponse: true
templateVersion: v2
+5819 -1345
View File
File diff suppressed because it is too large Load Diff
+10 -60
View File
@@ -12,6 +12,7 @@ info:
url: https://opensource.org/licenses/MIT
servers:
- url: https://{provider_url}/api/v1
x-speakeasy-server-id: production
variables:
provider_url:
default: openrouter.ai
@@ -77,6 +78,7 @@ components:
type: string
nullable: true
format:
x-speakeasy-unknown-values: allow
type: string
nullable: true
enum:
@@ -103,6 +105,7 @@ components:
type: string
nullable: true
format:
x-speakeasy-unknown-values: allow
type: string
nullable: true
enum:
@@ -133,6 +136,7 @@ components:
type: string
nullable: true
format:
x-speakeasy-unknown-values: allow
type: string
nullable: true
enum:
@@ -351,6 +355,7 @@ components:
type: object
properties:
finish_reason:
x-speakeasy-unknown-values: allow
type: string
nullable: true
enum:
@@ -541,6 +546,7 @@ components:
delta:
$ref: '#/components/schemas/ChatCompletionChunkChoiceDelta'
finish_reason:
x-speakeasy-unknown-values: allow
type: string
nullable: true
enum:
@@ -649,6 +655,7 @@ components:
type: string
description: Base64 encoded audio data
format:
x-speakeasy-unknown-values: allow
type: string
enum:
- wav
@@ -1499,22 +1506,13 @@ components:
required:
- messages
description: Chat completion request parameters
ChatStreamCompletionCreateParams:
allOf:
- $ref: '#/components/schemas/ChatCompletionCreateParams'
- type: object
properties:
stream:
type: boolean
enum:
- true
default: true
description: Enable streaming response
parameters: {}
paths:
/chat/completions:
post:
operationId: createChatCompletion
x-speakeasy-group: chat
x-speakeasy-name-override: complete
summary: Create a chat completion
description: Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes.
tags:
@@ -1534,57 +1532,10 @@ paths:
schema:
$ref: '#/components/schemas/ChatCompletion'
description: Non-streaming response when stream=false
'400':
description: Bad request - invalid parameters
content:
application/json:
schema:
$ref: '#/components/schemas/ChatCompletionError'
'401':
description: Unauthorized - invalid API key
content:
application/json:
schema:
$ref: '#/components/schemas/ChatCompletionError'
'429':
description: Too many requests - rate limit exceeded
content:
application/json:
schema:
$ref: '#/components/schemas/ChatCompletionError'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ChatCompletionError'
x-speakeasy-name-override: complete
/chat/completions#stream:
post:
operationId: streamChatCompletion
summary: Create a chat completion
description: Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes.
tags:
- Chat
requestBody:
description: Chat completion request parameters
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ChatStreamCompletionCreateParams'
responses:
'200':
description: Successful chat completion response
content:
text/event-stream:
x-speakeasy-sse-sentinel: '[DONE]'
schema:
type: object
required: [data]
properties:
data:
$ref: '#/components/schemas/ChatCompletionChunk'
$ref: '#/components/schemas/ChatCompletionChunkWrapper'
'400':
description: Bad request - invalid parameters
content:
@@ -1609,4 +1560,3 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ChatCompletionError'
x-speakeasy-name-override: completeStream
+9 -8
View File
@@ -1,19 +1,20 @@
speakeasyVersion: 1.611.1
speakeasyVersion: 1.618.1
sources:
OpenRouter Chat Completions API:
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:30b19a8759608792fb4d27f6bf28d5982d7e2a8cf5b3faf34ba3507a62f9f106
sourceBlobDigest: sha256:454f1b880a0882a70f78eacccb2c33e3d9d19134a0738b0e21487984a7bf2e63
sourceRevisionDigest: sha256:74ae52780983745871d33efc788abba37d1d8b271f358771b180ddb8546d6f7f
sourceBlobDigest: sha256:2fd2132e64b77adae1fc045512364d6517f47916c553e757226e5b9012d2170d
tags:
- latest
- speakeasy-sdk-regen-1755878373
- 1.0.0
targets:
open-router:
source: OpenRouter Chat Completions API
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:30b19a8759608792fb4d27f6bf28d5982d7e2a8cf5b3faf34ba3507a62f9f106
sourceBlobDigest: sha256:454f1b880a0882a70f78eacccb2c33e3d9d19134a0738b0e21487984a7bf2e63
sourceRevisionDigest: sha256:74ae52780983745871d33efc788abba37d1d8b271f358771b180ddb8546d6f7f
sourceBlobDigest: sha256:2fd2132e64b77adae1fc045512364d6517f47916c553e757226e5b9012d2170d
codeSamplesNamespace: open-router-chat-completions-api-python-code-samples
codeSamplesRevisionDigest: sha256:fd8ed35536e452d20ff16d6c33d311ebd405bf7e0f9188cfafcba4cd81539d96
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
@@ -23,14 +24,14 @@ workflow:
- location: .speakeasy/in.openapi.yaml
output: .speakeasy/out.openapi.yaml
registry:
location: registry.speakeasyapi.dev/sheldon-vaughn-test/sandbox/open-router-chat-completions-api
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
targets:
open-router:
target: python
source: OpenRouter Chat Completions API
codeSamples:
registry:
location: registry.speakeasyapi.dev/sheldon-vaughn-test/sandbox/open-router-chat-completions-api-python-code-samples
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api-python-code-samples
labelOverride:
fixedValue: Python (SDK)
blocking: false
+2 -2
View File
@@ -6,14 +6,14 @@ sources:
- location: .speakeasy/in.openapi.yaml
output: .speakeasy/out.openapi.yaml
registry:
location: registry.speakeasyapi.dev/sheldon-vaughn-test/sandbox/open-router-chat-completions-api
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
targets:
open-router:
target: python
source: OpenRouter Chat Completions API
codeSamples:
registry:
location: registry.speakeasyapi.dev/sheldon-vaughn-test/sandbox/open-router-chat-completions-api-python-code-samples
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api-python-code-samples
labelOverride:
fixedValue: Python (SDK)
blocking: false
+34 -19
View File
@@ -140,8 +140,10 @@ with OpenRouter(
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
```
</br>
@@ -166,8 +168,10 @@ async def main():
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
async with res as event_stream:
async for event in event_stream:
# handle event
print(event, flush=True)
asyncio.run(main())
```
@@ -201,8 +205,10 @@ with OpenRouter(
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
```
<!-- End Authentication [security] -->
@@ -216,7 +222,6 @@ with OpenRouter(
### [chat](https://github.com/speakeasy-sdks/openrouter-python-sdk/blob/master/docs/sdks/chat/README.md)
* [complete](https://github.com/speakeasy-sdks/openrouter-python-sdk/blob/master/docs/sdks/chat/README.md#complete) - Create a chat completion
* [complete_stream](https://github.com/speakeasy-sdks/openrouter-python-sdk/blob/master/docs/sdks/chat/README.md#complete_stream) - Create a chat completion
</details>
@@ -243,12 +248,12 @@ with OpenRouter(
api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router:
res = open_router.chat.complete_stream(messages=[
res = open_router.chat.complete(messages=[
{
"role": "user",
"content": "Hello, how are you?",
},
], stream=True, temperature=1, top_p=1)
], stream=False, temperature=1, top_p=1)
with res as event_stream:
for event in event_stream:
@@ -286,8 +291,10 @@ with OpenRouter(
], stream=False, temperature=1, top_p=1,
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
# Handle response
print(res)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
```
@@ -310,8 +317,10 @@ with OpenRouter(
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
```
<!-- End Retries [retries] -->
@@ -349,8 +358,10 @@ with OpenRouter(
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
except errors.OpenRouterError as e:
@@ -417,8 +428,10 @@ with OpenRouter(
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
```
@@ -442,8 +455,10 @@ with OpenRouter(
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
```
<!-- End Server Selection [server] -->
+47 -25
View File
@@ -57,7 +57,7 @@ The SDK can be installed with *uv*, *pip*, or *poetry* package managers.
*uv* is a fast Python package installer and resolver, designed as a drop-in replacement for pip and pip-tools. It's recommended for its speed and modern Python tooling capabilities.
```bash
uv add git+https://github.com/speakeasy-sdks/openrouter-python-sdk.git
uv add git+<UNSET>.git
```
### PIP
@@ -65,7 +65,7 @@ uv add git+https://github.com/speakeasy-sdks/openrouter-python-sdk.git
*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
```bash
pip install git+https://github.com/speakeasy-sdks/openrouter-python-sdk.git
pip install git+<UNSET>.git
```
### Poetry
@@ -73,7 +73,7 @@ pip install git+https://github.com/speakeasy-sdks/openrouter-python-sdk.git
*Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies.
```bash
poetry add git+https://github.com/speakeasy-sdks/openrouter-python-sdk.git
poetry add git+<UNSET>.git
```
### Shell and script usage with `uv`
@@ -140,8 +140,10 @@ with OpenRouter(
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
```
</br>
@@ -166,8 +168,10 @@ async def main():
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
async with res as event_stream:
async for event in event_stream:
# handle event
print(event, flush=True)
asyncio.run(main())
```
@@ -201,8 +205,10 @@ with OpenRouter(
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
```
<!-- End Authentication [security] -->
@@ -216,7 +222,6 @@ with OpenRouter(
### [chat](docs/sdks/chat/README.md)
* [complete](docs/sdks/chat/README.md#complete) - Create a chat completion
* [complete_stream](docs/sdks/chat/README.md#complete_stream) - Create a chat completion
</details>
@@ -243,12 +248,12 @@ with OpenRouter(
api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router:
res = open_router.chat.complete_stream(messages=[
res = open_router.chat.complete(messages=[
{
"role": "user",
"content": "Hello, how are you?",
},
], stream=True, temperature=1, top_p=1)
], stream=False, temperature=1, top_p=1)
with res as event_stream:
for event in event_stream:
@@ -286,8 +291,10 @@ with OpenRouter(
], stream=False, temperature=1, top_p=1,
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
# Handle response
print(res)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
```
@@ -310,8 +317,10 @@ with OpenRouter(
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
```
<!-- End Retries [retries] -->
@@ -349,8 +358,10 @@ with OpenRouter(
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
except errors.OpenRouterError as e:
@@ -390,9 +401,15 @@ with OpenRouter(
<!-- Start Server Selection [server] -->
## Server Selection
### Server Variables
### Select Server by Name
The default server `https://{provider_url}/api/v1` contains variables and is set to `https://openrouter.ai/api/v1` by default. To override default values, the following parameters are available when initializing the SDK client instance:
You can override the default server globally by passing a server name to the `server: str` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:
| Name | Server | Variables | Description |
| ------------ | ------------------------------- | -------------- | ----------------- |
| `production` | `https://{provider_url}/api/v1` | `provider_url` | Production server |
If the selected server has variables, you may override its default values through the additional parameters made available in the SDK constructor:
| Variable | Parameter | Default | Description |
| -------------- | ------------------- | ----------------- | ----------- |
@@ -406,6 +423,7 @@ import os
with OpenRouter(
server="production",
provider_url="https://ruddy-guacamole.info/"
api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router:
@@ -417,14 +435,16 @@ with OpenRouter(
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
```
### Override Server URL Per-Client
The default server can be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
```python
from openrouter import OpenRouter
import os
@@ -442,8 +462,10 @@ with OpenRouter(
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
```
<!-- End Server Selection [server] -->
+8 -4
View File
@@ -16,8 +16,10 @@ with OpenRouter(
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
```
</br>
@@ -42,8 +44,10 @@ async def main():
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
async with res as event_stream:
async for event in event_stream:
# handle event
print(event, flush=True)
asyncio.run(main())
```
@@ -1,4 +1,4 @@
# ChatCompletionCreateParamsAudio
# Audio
## Supported Types
@@ -1,6 +1,4 @@
# StreamChatCompletionResponseBody
Successful chat completion response
# ChatCompletionChunkWrapper
## Fields
+27 -27
View File
@@ -5,30 +5,30 @@ Chat completion request parameters
## Fields
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `messages` | List[[models.ChatCompletionMessageParam](../models/chatcompletionmessageparam.md)] | :heavy_check_mark: | List of messages for the conversation | [<br/>{<br/>"role": "user",<br/>"content": "Hello, how are you?"<br/>}<br/>] |
| `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | |
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | |
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | Token logit bias adjustments | |
| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | Return log probabilities | |
| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | Number of top log probabilities to return (0-20) | |
| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens in completion | |
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens (deprecated, use max_completion_tokens) | |
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) | |
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | |
| `reasoning` | [OptionalNullable[models.ChatCompletionCreateParamsReasoning]](../models/chatcompletioncreateparamsreasoning.md) | :heavy_minus_sign: | Reasoning configuration | |
| `response_format` | [Optional[models.ChatCompletionCreateParamsResponseFormatUnion]](../models/chatcompletioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | Response format configuration | |
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | |
| `stop` | [OptionalNullable[models.ChatCompletionCreateParamsStop]](../models/chatcompletioncreateparamsstop.md) | :heavy_minus_sign: | Stop sequences (up to 4) | |
| `stream` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable streaming response | |
| `stream_options` | [OptionalNullable[models.ChatCompletionCreateParamsStreamOptions]](../models/chatcompletioncreateparamsstreamoptions.md) | :heavy_minus_sign: | N/A | |
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | |
| `tool_choice` | [Optional[models.ChatCompletionToolChoiceOption]](../models/chatcompletiontoolchoiceoption.md) | :heavy_minus_sign: | Tool choice configuration | |
| `tools` | List[[models.ChatCompletionTool](../models/chatcompletiontool.md)] | :heavy_minus_sign: | Available tools for function calling | |
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | |
| `user` | *Optional[str]* | :heavy_minus_sign: | Unique user identifier | |
| `fallback_models` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | |
| `reasoning_effort` | [OptionalNullable[models.ChatCompletionCreateParamsReasoningEffort]](../models/chatcompletioncreateparamsreasoningeffort.md) | :heavy_minus_sign: | Reasoning effort | |
| `provider` | [OptionalNullable[models.ChatCompletionCreateParamsProvider]](../models/chatcompletioncreateparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
| `plugins` | List[[models.ChatCompletionCreateParamsPluginUnion](../models/chatcompletioncreateparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
| Field | Type | Required | Description | Example |
| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| `messages` | List[[models.ChatCompletionMessageParam](../models/chatcompletionmessageparam.md)] | :heavy_check_mark: | List of messages for the conversation | [<br/>{<br/>"role": "user",<br/>"content": "Hello, how are you?"<br/>}<br/>] |
| `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | |
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | |
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | Token logit bias adjustments | |
| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | Return log probabilities | |
| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | Number of top log probabilities to return (0-20) | |
| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens in completion | |
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens (deprecated, use max_completion_tokens) | |
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) | |
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | |
| `reasoning` | [OptionalNullable[models.Reasoning]](../models/reasoning.md) | :heavy_minus_sign: | Reasoning configuration | |
| `response_format` | [Optional[models.ResponseFormat]](../models/responseformat.md) | :heavy_minus_sign: | Response format configuration | |
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | |
| `stop` | [OptionalNullable[models.Stop]](../models/stop.md) | :heavy_minus_sign: | Stop sequences (up to 4) | |
| `stream` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable streaming response | |
| `stream_options` | [OptionalNullable[models.StreamOptions]](../models/streamoptions.md) | :heavy_minus_sign: | N/A | |
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | |
| `tool_choice` | [Optional[models.ChatCompletionToolChoiceOption]](../models/chatcompletiontoolchoiceoption.md) | :heavy_minus_sign: | Tool choice configuration | |
| `tools` | List[[models.ChatCompletionTool](../models/chatcompletiontool.md)] | :heavy_minus_sign: | Available tools for function calling | |
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | |
| `user` | *Optional[str]* | :heavy_minus_sign: | Unique user identifier | |
| `fallback_models` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | |
| `reasoning_effort` | [OptionalNullable[models.ReasoningEffort]](../models/reasoningeffort.md) | :heavy_minus_sign: | Reasoning effort | |
| `provider` | [OptionalNullable[models.Provider]](../models/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
| `plugins` | List[[models.Plugin](../models/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
@@ -1,23 +0,0 @@
# ChatCompletionCreateParamsCompletion
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `str`
```python
value: str = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
@@ -1,17 +0,0 @@
# ChatCompletionCreateParamsIgnoreUnion
## Supported Types
### `models.ChatCompletionCreateParamsIgnoreEnum`
```python
value: models.ChatCompletionCreateParamsIgnoreEnum = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -1,14 +0,0 @@
# ChatCompletionCreateParamsMaxPrice
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[models.ChatCompletionCreateParamsPrompt]](../models/chatcompletioncreateparamsprompt.md) | :heavy_minus_sign: | N/A |
| `completion` | [Optional[models.ChatCompletionCreateParamsCompletion]](../models/chatcompletioncreateparamscompletion.md) | :heavy_minus_sign: | N/A |
| `image` | [Optional[models.ChatCompletionCreateParamsImage]](../models/chatcompletioncreateparamsimage.md) | :heavy_minus_sign: | N/A |
| `audio` | [Optional[models.ChatCompletionCreateParamsAudio]](../models/chatcompletioncreateparamsaudio.md) | :heavy_minus_sign: | N/A |
| `request` | [Optional[models.ChatCompletionCreateParamsRequest]](../models/chatcompletioncreateparamsrequest.md) | :heavy_minus_sign: | N/A |
@@ -1,17 +0,0 @@
# ChatCompletionCreateParamsOnlyUnion
## Supported Types
### `models.ChatCompletionCreateParamsOnlyEnum`
```python
value: models.ChatCompletionCreateParamsOnlyEnum = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -1,17 +0,0 @@
# ChatCompletionCreateParamsOrderUnion
## Supported Types
### `models.ChatCompletionCreateParamsOrderEnum`
```python
value: models.ChatCompletionCreateParamsOrderEnum = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -1,8 +0,0 @@
# ChatCompletionCreateParamsPdf
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `engine` | [Optional[models.ChatCompletionCreateParamsPdfEngine]](../models/chatcompletioncreateparamspdfengine.md) | :heavy_minus_sign: | N/A |
@@ -1,8 +0,0 @@
# ChatCompletionCreateParamsPluginChainOfThought
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| `id` | [models.ChatCompletionCreateParamsIDChainOfThought](../models/chatcompletioncreateparamsidchainofthought.md) | :heavy_check_mark: | N/A |
@@ -1,10 +0,0 @@
# ChatCompletionCreateParamsPluginFileParser
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `id` | [models.ChatCompletionCreateParamsIDFileParser](../models/chatcompletioncreateparamsidfileparser.md) | :heavy_check_mark: | N/A |
| `max_files` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `pdf` | [Optional[models.ChatCompletionCreateParamsPdf]](../models/chatcompletioncreateparamspdf.md) | :heavy_minus_sign: | N/A |
@@ -1,8 +0,0 @@
# ChatCompletionCreateParamsPluginModeration
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `id` | [models.ChatCompletionCreateParamsIDModeration](../models/chatcompletioncreateparamsidmoderation.md) | :heavy_check_mark: | N/A |
@@ -1,29 +0,0 @@
# ChatCompletionCreateParamsPluginUnion
## Supported Types
### `models.ChatCompletionCreateParamsPluginModeration`
```python
value: models.ChatCompletionCreateParamsPluginModeration = /* values here */
```
### `models.ChatCompletionCreateParamsPluginWeb`
```python
value: models.ChatCompletionCreateParamsPluginWeb = /* values here */
```
### `models.ChatCompletionCreateParamsPluginChainOfThought`
```python
value: models.ChatCompletionCreateParamsPluginChainOfThought = /* values here */
```
### `models.ChatCompletionCreateParamsPluginFileParser`
```python
value: models.ChatCompletionCreateParamsPluginFileParser = /* values here */
```
@@ -1,11 +0,0 @@
# ChatCompletionCreateParamsPluginWeb
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `id` | [models.ChatCompletionCreateParamsIDWeb](../models/chatcompletioncreateparamsidweb.md) | :heavy_check_mark: | N/A |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `engine` | [Optional[models.ChatCompletionCreateParamsEngine]](../models/chatcompletioncreateparamsengine.md) | :heavy_minus_sign: | N/A |
@@ -1,13 +0,0 @@
# ChatCompletionCreateParamsReasoning
Reasoning configuration
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Enables reasoning with default settings. Only work for some models. |
| `effort` | [OptionalNullable[models.ChatCompletionCreateParamsEffort]](../models/chatcompletioncreateparamseffort.md) | :heavy_minus_sign: | OpenAI-style reasoning effort setting |
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | non-OpenAI-style reasoning effort setting |
| `exclude` | *Optional[bool]* | :heavy_minus_sign: | N/A |
@@ -1,11 +0,0 @@
# ChatCompletionCreateParamsResponseFormatGrammar
Custom grammar response format
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `type` | [models.ChatCompletionCreateParamsTypeGrammar](../models/chatcompletioncreateparamstypegrammar.md) | :heavy_check_mark: | N/A |
| `grammar` | *str* | :heavy_check_mark: | Custom grammar for text generation |
@@ -1,10 +0,0 @@
# ChatCompletionCreateParamsResponseFormatJSONObject
JSON object response format
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `type` | [models.ChatCompletionCreateParamsTypeJSONObject](../models/chatcompletioncreateparamstypejsonobject.md) | :heavy_check_mark: | N/A |
@@ -1,11 +0,0 @@
# ChatCompletionCreateParamsResponseFormatJSONSchema
JSON Schema response format for structured outputs
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `type` | [models.ChatCompletionCreateParamsTypeJSONSchema](../models/chatcompletioncreateparamstypejsonschema.md) | :heavy_check_mark: | N/A |
| `json_schema` | [models.ChatCompletionCreateParamsJSONSchema](../models/chatcompletioncreateparamsjsonschema.md) | :heavy_check_mark: | N/A |
@@ -1,10 +0,0 @@
# ChatCompletionCreateParamsResponseFormatPython
Python code response format
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
| `type` | [models.ChatCompletionCreateParamsTypePython](../models/chatcompletioncreateparamstypepython.md) | :heavy_check_mark: | N/A |
@@ -1,37 +0,0 @@
# ChatCompletionCreateParamsResponseFormatUnion
Response format configuration
## Supported Types
### `models.ChatCompletionCreateParamsResponseFormatText`
```python
value: models.ChatCompletionCreateParamsResponseFormatText = /* values here */
```
### `models.ChatCompletionCreateParamsResponseFormatJSONObject`
```python
value: models.ChatCompletionCreateParamsResponseFormatJSONObject = /* values here */
```
### `models.ChatCompletionCreateParamsResponseFormatJSONSchema`
```python
value: models.ChatCompletionCreateParamsResponseFormatJSONSchema = /* values here */
```
### `models.ChatCompletionCreateParamsResponseFormatGrammar`
```python
value: models.ChatCompletionCreateParamsResponseFormatGrammar = /* values here */
```
### `models.ChatCompletionCreateParamsResponseFormatPython`
```python
value: models.ChatCompletionCreateParamsResponseFormatPython = /* values here */
```
@@ -1,34 +0,0 @@
# ChatStreamCompletionCreateParams
Chat completion request parameters
## Fields
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `messages` | List[[models.ChatCompletionMessageParam](../models/chatcompletionmessageparam.md)] | :heavy_check_mark: | List of messages for the conversation | [<br/>{<br/>"role": "user",<br/>"content": "Hello, how are you?"<br/>}<br/>] |
| `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | |
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | |
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | Token logit bias adjustments | |
| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | Return log probabilities | |
| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | Number of top log probabilities to return (0-20) | |
| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens in completion | |
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens (deprecated, use max_completion_tokens) | |
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) | |
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | |
| `reasoning` | [OptionalNullable[models.ChatStreamCompletionCreateParamsReasoning]](../models/chatstreamcompletioncreateparamsreasoning.md) | :heavy_minus_sign: | Reasoning configuration | |
| `response_format` | [Optional[models.ChatStreamCompletionCreateParamsResponseFormatUnion]](../models/chatstreamcompletioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | Response format configuration | |
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | |
| `stop` | [OptionalNullable[models.ChatStreamCompletionCreateParamsStop]](../models/chatstreamcompletioncreateparamsstop.md) | :heavy_minus_sign: | Stop sequences (up to 4) | |
| `stream` | *Optional[bool]* | :heavy_minus_sign: | Enable streaming response | |
| `stream_options` | [OptionalNullable[models.ChatStreamCompletionCreateParamsStreamOptions]](../models/chatstreamcompletioncreateparamsstreamoptions.md) | :heavy_minus_sign: | N/A | |
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | |
| `tool_choice` | [Optional[models.ChatCompletionToolChoiceOption]](../models/chatcompletiontoolchoiceoption.md) | :heavy_minus_sign: | Tool choice configuration | |
| `tools` | List[[models.ChatCompletionTool](../models/chatcompletiontool.md)] | :heavy_minus_sign: | Available tools for function calling | |
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | |
| `user` | *Optional[str]* | :heavy_minus_sign: | Unique user identifier | |
| `fallback_models` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | |
| `reasoning_effort` | [OptionalNullable[models.ChatStreamCompletionCreateParamsReasoningEffort]](../models/chatstreamcompletioncreateparamsreasoningeffort.md) | :heavy_minus_sign: | Reasoning effort | |
| `provider` | [OptionalNullable[models.ChatStreamCompletionCreateParamsProvider]](../models/chatstreamcompletioncreateparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
| `plugins` | List[[models.ChatStreamCompletionCreateParamsPluginUnion](../models/chatstreamcompletioncreateparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
@@ -1,23 +0,0 @@
# ChatStreamCompletionCreateParamsAudio
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `str`
```python
value: str = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
@@ -1,23 +0,0 @@
# ChatStreamCompletionCreateParamsCompletion
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `str`
```python
value: str = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
@@ -1,14 +0,0 @@
# ChatStreamCompletionCreateParamsDataCollection
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.
## Values
| Name | Value |
| ------- | ------- |
| `DENY` | deny |
| `ALLOW` | allow |
@@ -1,13 +0,0 @@
# ChatStreamCompletionCreateParamsEffort
OpenAI-style reasoning effort setting
## Values
| Name | Value |
| --------- | --------- |
| `HIGH` | high |
| `MEDIUM` | medium |
| `LOW` | low |
| `MINIMAL` | minimal |
@@ -1,9 +0,0 @@
# ChatStreamCompletionCreateParamsEngine
## Values
| Name | Value |
| -------- | -------- |
| `NATIVE` | native |
| `EXA` | exa |
@@ -1,8 +0,0 @@
# ChatStreamCompletionCreateParamsIDChainOfThought
## Values
| Name | Value |
| ------------------ | ------------------ |
| `CHAIN_OF_THOUGHT` | chain-of-thought |
@@ -1,8 +0,0 @@
# ChatStreamCompletionCreateParamsIDFileParser
## Values
| Name | Value |
| ------------- | ------------- |
| `FILE_PARSER` | file-parser |
@@ -1,8 +0,0 @@
# ChatStreamCompletionCreateParamsIDModeration
## Values
| Name | Value |
| ------------ | ------------ |
| `MODERATION` | moderation |
@@ -1,8 +0,0 @@
# ChatStreamCompletionCreateParamsIDWeb
## Values
| Name | Value |
| ----- | ----- |
| `WEB` | web |
@@ -1,85 +0,0 @@
# ChatStreamCompletionCreateParamsIgnoreEnum
## Values
| Name | Value |
| ------------------ | ------------------ |
| `ANY_SCALE` | AnyScale |
| `CENT_ML` | Cent-ML |
| `HUGGING_FACE` | HuggingFace |
| `HYPERBOLIC_2` | Hyperbolic 2 |
| `LEPTON` | Lepton |
| `LYNN_2` | Lynn 2 |
| `LYNN` | Lynn |
| `MANCER` | Mancer |
| `MODAL` | Modal |
| `OCTO_AI` | OctoAI |
| `RECURSAL` | Recursal |
| `REFLECTION` | Reflection |
| `REPLICATE` | Replicate |
| `SAMBA_NOVA_2` | SambaNova 2 |
| `SF_COMPUTE` | SF Compute |
| `TOGETHER_2` | Together 2 |
| `ONE_DOT_AI` | 01.AI |
| `AI21` | AI21 |
| `AION_LABS` | AionLabs |
| `ALIBABA` | Alibaba |
| `AMAZON_BEDROCK` | Amazon Bedrock |
| `ANTHROPIC` | Anthropic |
| `ATLAS_CLOUD` | AtlasCloud |
| `ATOMA` | Atoma |
| `AVIAN` | Avian |
| `AZURE` | Azure |
| `BASE_TEN` | BaseTen |
| `CEREBRAS` | Cerebras |
| `CHUTES` | Chutes |
| `CLOUDFLARE` | Cloudflare |
| `COHERE` | Cohere |
| `CROF_AI` | CrofAI |
| `CRUSOE` | Crusoe |
| `DEEP_INFRA` | DeepInfra |
| `DEEP_SEEK` | DeepSeek |
| `ENFER` | Enfer |
| `FEATHERLESS` | Featherless |
| `FIREWORKS` | Fireworks |
| `FRIENDLI` | Friendli |
| `GMI_CLOUD` | GMICloud |
| `GOOGLE` | Google |
| `GOOGLE_AI_STUDIO` | Google AI Studio |
| `GROQ` | Groq |
| `HYPERBOLIC` | Hyperbolic |
| `INCEPTION` | Inception |
| `INFERENCE_NET` | InferenceNet |
| `INFERMATIC` | Infermatic |
| `INFLECTION` | Inflection |
| `INO_CLOUD` | InoCloud |
| `KLUSTER` | Kluster |
| `LAMBDA` | Lambda |
| `LIQUID` | Liquid |
| `MANCER_2` | Mancer 2 |
| `META` | Meta |
| `MINIMAX` | Minimax |
| `MISTRAL` | Mistral |
| `MOONSHOT_AI` | Moonshot AI |
| `MORPH` | Morph |
| `N_COMPASS` | NCompass |
| `NEBIUS` | Nebius |
| `NEXT_BIT` | NextBit |
| `NINETEEN` | Nineteen |
| `NOVITA` | Novita |
| `OPEN_AI` | OpenAI |
| `OPEN_INFERENCE` | OpenInference |
| `PARASAIL` | Parasail |
| `PERPLEXITY` | Perplexity |
| `PHALA` | Phala |
| `SAMBA_NOVA` | SambaNova |
| `STEALTH` | Stealth |
| `SWITCHPOINT` | Switchpoint |
| `TARGON` | Targon |
| `TOGETHER` | Together |
| `UBICLOUD` | Ubicloud |
| `VENICE` | Venice |
| `WAND_B` | WandB |
| `X_AI` | xAI |
| `Z_AI` | Z.AI |
@@ -1,17 +0,0 @@
# ChatStreamCompletionCreateParamsIgnoreUnion
## Supported Types
### `models.ChatStreamCompletionCreateParamsIgnoreEnum`
```python
value: models.ChatStreamCompletionCreateParamsIgnoreEnum = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -1,23 +0,0 @@
# ChatStreamCompletionCreateParamsImage
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `str`
```python
value: str = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
@@ -1,11 +0,0 @@
# ChatStreamCompletionCreateParamsJSONSchema
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `name` | *str* | :heavy_check_mark: | Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars) |
| `description` | *Optional[str]* | :heavy_minus_sign: | Schema description for the model |
| `schema_` | [Optional[models.ResponseFormatJSONSchemaSchema]](../models/responseformatjsonschemaschema.md) | :heavy_minus_sign: | The schema for the response format, described as a JSON Schema object |
| `strict` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable strict schema adherence |
@@ -1,14 +0,0 @@
# ChatStreamCompletionCreateParamsMaxPrice
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[models.ChatStreamCompletionCreateParamsPrompt]](../models/chatstreamcompletioncreateparamsprompt.md) | :heavy_minus_sign: | N/A |
| `completion` | [Optional[models.ChatStreamCompletionCreateParamsCompletion]](../models/chatstreamcompletioncreateparamscompletion.md) | :heavy_minus_sign: | N/A |
| `image` | [Optional[models.ChatStreamCompletionCreateParamsImage]](../models/chatstreamcompletioncreateparamsimage.md) | :heavy_minus_sign: | N/A |
| `audio` | [Optional[models.ChatStreamCompletionCreateParamsAudio]](../models/chatstreamcompletioncreateparamsaudio.md) | :heavy_minus_sign: | N/A |
| `request` | [Optional[models.ChatStreamCompletionCreateParamsRequest]](../models/chatstreamcompletioncreateparamsrequest.md) | :heavy_minus_sign: | N/A |
@@ -1,85 +0,0 @@
# ChatStreamCompletionCreateParamsOnlyEnum
## Values
| Name | Value |
| ------------------ | ------------------ |
| `ANY_SCALE` | AnyScale |
| `CENT_ML` | Cent-ML |
| `HUGGING_FACE` | HuggingFace |
| `HYPERBOLIC_2` | Hyperbolic 2 |
| `LEPTON` | Lepton |
| `LYNN_2` | Lynn 2 |
| `LYNN` | Lynn |
| `MANCER` | Mancer |
| `MODAL` | Modal |
| `OCTO_AI` | OctoAI |
| `RECURSAL` | Recursal |
| `REFLECTION` | Reflection |
| `REPLICATE` | Replicate |
| `SAMBA_NOVA_2` | SambaNova 2 |
| `SF_COMPUTE` | SF Compute |
| `TOGETHER_2` | Together 2 |
| `ONE_DOT_AI` | 01.AI |
| `AI21` | AI21 |
| `AION_LABS` | AionLabs |
| `ALIBABA` | Alibaba |
| `AMAZON_BEDROCK` | Amazon Bedrock |
| `ANTHROPIC` | Anthropic |
| `ATLAS_CLOUD` | AtlasCloud |
| `ATOMA` | Atoma |
| `AVIAN` | Avian |
| `AZURE` | Azure |
| `BASE_TEN` | BaseTen |
| `CEREBRAS` | Cerebras |
| `CHUTES` | Chutes |
| `CLOUDFLARE` | Cloudflare |
| `COHERE` | Cohere |
| `CROF_AI` | CrofAI |
| `CRUSOE` | Crusoe |
| `DEEP_INFRA` | DeepInfra |
| `DEEP_SEEK` | DeepSeek |
| `ENFER` | Enfer |
| `FEATHERLESS` | Featherless |
| `FIREWORKS` | Fireworks |
| `FRIENDLI` | Friendli |
| `GMI_CLOUD` | GMICloud |
| `GOOGLE` | Google |
| `GOOGLE_AI_STUDIO` | Google AI Studio |
| `GROQ` | Groq |
| `HYPERBOLIC` | Hyperbolic |
| `INCEPTION` | Inception |
| `INFERENCE_NET` | InferenceNet |
| `INFERMATIC` | Infermatic |
| `INFLECTION` | Inflection |
| `INO_CLOUD` | InoCloud |
| `KLUSTER` | Kluster |
| `LAMBDA` | Lambda |
| `LIQUID` | Liquid |
| `MANCER_2` | Mancer 2 |
| `META` | Meta |
| `MINIMAX` | Minimax |
| `MISTRAL` | Mistral |
| `MOONSHOT_AI` | Moonshot AI |
| `MORPH` | Morph |
| `N_COMPASS` | NCompass |
| `NEBIUS` | Nebius |
| `NEXT_BIT` | NextBit |
| `NINETEEN` | Nineteen |
| `NOVITA` | Novita |
| `OPEN_AI` | OpenAI |
| `OPEN_INFERENCE` | OpenInference |
| `PARASAIL` | Parasail |
| `PERPLEXITY` | Perplexity |
| `PHALA` | Phala |
| `SAMBA_NOVA` | SambaNova |
| `STEALTH` | Stealth |
| `SWITCHPOINT` | Switchpoint |
| `TARGON` | Targon |
| `TOGETHER` | Together |
| `UBICLOUD` | Ubicloud |
| `VENICE` | Venice |
| `WAND_B` | WandB |
| `X_AI` | xAI |
| `Z_AI` | Z.AI |
@@ -1,17 +0,0 @@
# ChatStreamCompletionCreateParamsOnlyUnion
## Supported Types
### `models.ChatStreamCompletionCreateParamsOnlyEnum`
```python
value: models.ChatStreamCompletionCreateParamsOnlyEnum = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -1,85 +0,0 @@
# ChatStreamCompletionCreateParamsOrderEnum
## Values
| Name | Value |
| ------------------ | ------------------ |
| `ANY_SCALE` | AnyScale |
| `CENT_ML` | Cent-ML |
| `HUGGING_FACE` | HuggingFace |
| `HYPERBOLIC_2` | Hyperbolic 2 |
| `LEPTON` | Lepton |
| `LYNN_2` | Lynn 2 |
| `LYNN` | Lynn |
| `MANCER` | Mancer |
| `MODAL` | Modal |
| `OCTO_AI` | OctoAI |
| `RECURSAL` | Recursal |
| `REFLECTION` | Reflection |
| `REPLICATE` | Replicate |
| `SAMBA_NOVA_2` | SambaNova 2 |
| `SF_COMPUTE` | SF Compute |
| `TOGETHER_2` | Together 2 |
| `ONE_DOT_AI` | 01.AI |
| `AI21` | AI21 |
| `AION_LABS` | AionLabs |
| `ALIBABA` | Alibaba |
| `AMAZON_BEDROCK` | Amazon Bedrock |
| `ANTHROPIC` | Anthropic |
| `ATLAS_CLOUD` | AtlasCloud |
| `ATOMA` | Atoma |
| `AVIAN` | Avian |
| `AZURE` | Azure |
| `BASE_TEN` | BaseTen |
| `CEREBRAS` | Cerebras |
| `CHUTES` | Chutes |
| `CLOUDFLARE` | Cloudflare |
| `COHERE` | Cohere |
| `CROF_AI` | CrofAI |
| `CRUSOE` | Crusoe |
| `DEEP_INFRA` | DeepInfra |
| `DEEP_SEEK` | DeepSeek |
| `ENFER` | Enfer |
| `FEATHERLESS` | Featherless |
| `FIREWORKS` | Fireworks |
| `FRIENDLI` | Friendli |
| `GMI_CLOUD` | GMICloud |
| `GOOGLE` | Google |
| `GOOGLE_AI_STUDIO` | Google AI Studio |
| `GROQ` | Groq |
| `HYPERBOLIC` | Hyperbolic |
| `INCEPTION` | Inception |
| `INFERENCE_NET` | InferenceNet |
| `INFERMATIC` | Infermatic |
| `INFLECTION` | Inflection |
| `INO_CLOUD` | InoCloud |
| `KLUSTER` | Kluster |
| `LAMBDA` | Lambda |
| `LIQUID` | Liquid |
| `MANCER_2` | Mancer 2 |
| `META` | Meta |
| `MINIMAX` | Minimax |
| `MISTRAL` | Mistral |
| `MOONSHOT_AI` | Moonshot AI |
| `MORPH` | Morph |
| `N_COMPASS` | NCompass |
| `NEBIUS` | Nebius |
| `NEXT_BIT` | NextBit |
| `NINETEEN` | Nineteen |
| `NOVITA` | Novita |
| `OPEN_AI` | OpenAI |
| `OPEN_INFERENCE` | OpenInference |
| `PARASAIL` | Parasail |
| `PERPLEXITY` | Perplexity |
| `PHALA` | Phala |
| `SAMBA_NOVA` | SambaNova |
| `STEALTH` | Stealth |
| `SWITCHPOINT` | Switchpoint |
| `TARGON` | Targon |
| `TOGETHER` | Together |
| `UBICLOUD` | Ubicloud |
| `VENICE` | Venice |
| `WAND_B` | WandB |
| `X_AI` | xAI |
| `Z_AI` | Z.AI |
@@ -1,17 +0,0 @@
# ChatStreamCompletionCreateParamsOrderUnion
## Supported Types
### `models.ChatStreamCompletionCreateParamsOrderEnum`
```python
value: models.ChatStreamCompletionCreateParamsOrderEnum = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -1,8 +0,0 @@
# ChatStreamCompletionCreateParamsPdf
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `engine` | [Optional[models.ChatStreamCompletionCreateParamsPdfEngine]](../models/chatstreamcompletioncreateparamspdfengine.md) | :heavy_minus_sign: | N/A |
@@ -1,10 +0,0 @@
# ChatStreamCompletionCreateParamsPdfEngine
## Values
| Name | Value |
| ------------- | ------------- |
| `MISTRAL_OCR` | mistral-ocr |
| `PDF_TEXT` | pdf-text |
| `NATIVE` | native |
@@ -1,8 +0,0 @@
# ChatStreamCompletionCreateParamsPluginChainOfThought
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| `id` | [models.ChatStreamCompletionCreateParamsIDChainOfThought](../models/chatstreamcompletioncreateparamsidchainofthought.md) | :heavy_check_mark: | N/A |
@@ -1,10 +0,0 @@
# ChatStreamCompletionCreateParamsPluginFileParser
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `id` | [models.ChatStreamCompletionCreateParamsIDFileParser](../models/chatstreamcompletioncreateparamsidfileparser.md) | :heavy_check_mark: | N/A |
| `max_files` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `pdf` | [Optional[models.ChatStreamCompletionCreateParamsPdf]](../models/chatstreamcompletioncreateparamspdf.md) | :heavy_minus_sign: | N/A |
@@ -1,8 +0,0 @@
# ChatStreamCompletionCreateParamsPluginModeration
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `id` | [models.ChatStreamCompletionCreateParamsIDModeration](../models/chatstreamcompletioncreateparamsidmoderation.md) | :heavy_check_mark: | N/A |
@@ -1,29 +0,0 @@
# ChatStreamCompletionCreateParamsPluginUnion
## Supported Types
### `models.ChatStreamCompletionCreateParamsPluginModeration`
```python
value: models.ChatStreamCompletionCreateParamsPluginModeration = /* values here */
```
### `models.ChatStreamCompletionCreateParamsPluginWeb`
```python
value: models.ChatStreamCompletionCreateParamsPluginWeb = /* values here */
```
### `models.ChatStreamCompletionCreateParamsPluginChainOfThought`
```python
value: models.ChatStreamCompletionCreateParamsPluginChainOfThought = /* values here */
```
### `models.ChatStreamCompletionCreateParamsPluginFileParser`
```python
value: models.ChatStreamCompletionCreateParamsPluginFileParser = /* values here */
```
@@ -1,11 +0,0 @@
# ChatStreamCompletionCreateParamsPluginWeb
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `id` | [models.ChatStreamCompletionCreateParamsIDWeb](../models/chatstreamcompletioncreateparamsidweb.md) | :heavy_check_mark: | N/A |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `engine` | [Optional[models.ChatStreamCompletionCreateParamsEngine]](../models/chatstreamcompletioncreateparamsengine.md) | :heavy_minus_sign: | N/A |
@@ -1,23 +0,0 @@
# ChatStreamCompletionCreateParamsPrompt
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `str`
```python
value: str = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
@@ -1,18 +0,0 @@
# ChatStreamCompletionCreateParamsProvider
When multiple model providers are available, optionally indicate your routing preference.
## 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[models.ChatStreamCompletionCreateParamsDataCollection]](../models/chatstreamcompletioncreateparamsdatacollection.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/>- deny: use only providers which do not collect user data.<br/> |
| `order` | List[[models.ChatStreamCompletionCreateParamsOrderUnion](../models/chatstreamcompletioncreateparamsorderunion.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[[models.ChatStreamCompletionCreateParamsOnlyUnion](../models/chatstreamcompletioncreateparamsonlyunion.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[[models.ChatStreamCompletionCreateParamsIgnoreUnion](../models/chatstreamcompletioncreateparamsignoreunion.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[[models.ChatStreamCompletionCreateParamsQuantization](../models/chatstreamcompletioncreateparamsquantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. |
| `sort` | [OptionalNullable[models.ChatStreamCompletionCreateParamsSort]](../models/chatstreamcompletioncreateparamssort.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[models.ChatStreamCompletionCreateParamsMaxPrice]](../models/chatstreamcompletioncreateparamsmaxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. |
@@ -1,16 +0,0 @@
# ChatStreamCompletionCreateParamsQuantization
## Values
| Name | Value |
| --------- | --------- |
| `INT4` | int4 |
| `INT8` | int8 |
| `FP4` | fp4 |
| `FP6` | fp6 |
| `FP8` | fp8 |
| `FP16` | fp16 |
| `BF16` | bf16 |
| `FP32` | fp32 |
| `UNKNOWN` | unknown |
@@ -1,13 +0,0 @@
# ChatStreamCompletionCreateParamsReasoning
Reasoning configuration
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Enables reasoning with default settings. Only work for some models. |
| `effort` | [OptionalNullable[models.ChatStreamCompletionCreateParamsEffort]](../models/chatstreamcompletioncreateparamseffort.md) | :heavy_minus_sign: | OpenAI-style reasoning effort setting |
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | non-OpenAI-style reasoning effort setting |
| `exclude` | *Optional[bool]* | :heavy_minus_sign: | N/A |
@@ -1,13 +0,0 @@
# ChatStreamCompletionCreateParamsReasoningEffort
Reasoning effort
## Values
| Name | Value |
| --------- | --------- |
| `HIGH` | high |
| `MEDIUM` | medium |
| `LOW` | low |
| `MINIMAL` | minimal |
@@ -1,23 +0,0 @@
# ChatStreamCompletionCreateParamsRequest
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `str`
```python
value: str = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
@@ -1,11 +0,0 @@
# ChatStreamCompletionCreateParamsResponseFormatGrammar
Custom grammar response format
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `type` | [models.ChatStreamCompletionCreateParamsTypeGrammar](../models/chatstreamcompletioncreateparamstypegrammar.md) | :heavy_check_mark: | N/A |
| `grammar` | *str* | :heavy_check_mark: | Custom grammar for text generation |
@@ -1,10 +0,0 @@
# ChatStreamCompletionCreateParamsResponseFormatJSONObject
JSON object response format
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `type` | [models.ChatStreamCompletionCreateParamsTypeJSONObject](../models/chatstreamcompletioncreateparamstypejsonobject.md) | :heavy_check_mark: | N/A |
@@ -1,11 +0,0 @@
# ChatStreamCompletionCreateParamsResponseFormatJSONSchema
JSON Schema response format for structured outputs
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `type` | [models.ChatStreamCompletionCreateParamsTypeJSONSchema](../models/chatstreamcompletioncreateparamstypejsonschema.md) | :heavy_check_mark: | N/A |
| `json_schema` | [models.ChatStreamCompletionCreateParamsJSONSchema](../models/chatstreamcompletioncreateparamsjsonschema.md) | :heavy_check_mark: | N/A |
@@ -1,10 +0,0 @@
# ChatStreamCompletionCreateParamsResponseFormatPython
Python code response format
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| `type` | [models.ChatStreamCompletionCreateParamsTypePython](../models/chatstreamcompletioncreateparamstypepython.md) | :heavy_check_mark: | N/A |
@@ -1,10 +0,0 @@
# ChatStreamCompletionCreateParamsResponseFormatText
Default text response format
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `type` | [models.ChatStreamCompletionCreateParamsTypeText](../models/chatstreamcompletioncreateparamstypetext.md) | :heavy_check_mark: | N/A |
@@ -1,37 +0,0 @@
# ChatStreamCompletionCreateParamsResponseFormatUnion
Response format configuration
## Supported Types
### `models.ChatStreamCompletionCreateParamsResponseFormatText`
```python
value: models.ChatStreamCompletionCreateParamsResponseFormatText = /* values here */
```
### `models.ChatStreamCompletionCreateParamsResponseFormatJSONObject`
```python
value: models.ChatStreamCompletionCreateParamsResponseFormatJSONObject = /* values here */
```
### `models.ChatStreamCompletionCreateParamsResponseFormatJSONSchema`
```python
value: models.ChatStreamCompletionCreateParamsResponseFormatJSONSchema = /* values here */
```
### `models.ChatStreamCompletionCreateParamsResponseFormatGrammar`
```python
value: models.ChatStreamCompletionCreateParamsResponseFormatGrammar = /* values here */
```
### `models.ChatStreamCompletionCreateParamsResponseFormatPython`
```python
value: models.ChatStreamCompletionCreateParamsResponseFormatPython = /* values here */
```
@@ -1,12 +0,0 @@
# ChatStreamCompletionCreateParamsSort
The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
## Values
| Name | Value |
| ------------ | ------------ |
| `PRICE` | price |
| `THROUGHPUT` | throughput |
| `LATENCY` | latency |
@@ -1,25 +0,0 @@
# ChatStreamCompletionCreateParamsStop
Stop sequences (up to 4)
## Supported Types
### `str`
```python
value: str = /* values here */
```
### `List[str]`
```python
value: List[str] = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
@@ -1,10 +0,0 @@
# ChatStreamCompletionCreateParamsStreamOptions
Streaming configuration options
## Fields
| Field | Type | Required | Description |
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
| `include_usage` | *Optional[bool]* | :heavy_minus_sign: | Include usage information in streaming response |
@@ -1,8 +0,0 @@
# ChatStreamCompletionCreateParamsTypeGrammar
## Values
| Name | Value |
| --------- | --------- |
| `GRAMMAR` | grammar |
@@ -1,8 +0,0 @@
# ChatStreamCompletionCreateParamsTypeJSONObject
## Values
| Name | Value |
| ------------- | ------------- |
| `JSON_OBJECT` | json_object |
@@ -1,8 +0,0 @@
# ChatStreamCompletionCreateParamsTypeJSONSchema
## Values
| Name | Value |
| ------------- | ------------- |
| `JSON_SCHEMA` | json_schema |
@@ -1,8 +0,0 @@
# ChatStreamCompletionCreateParamsTypePython
## Values
| Name | Value |
| -------- | -------- |
| `PYTHON` | python |
@@ -1,8 +0,0 @@
# ChatStreamCompletionCreateParamsTypeText
## Values
| Name | Value |
| ------ | ------ |
| `TEXT` | text |
@@ -1,4 +1,4 @@
# ChatCompletionCreateParamsImage
# Completion
## Supported Types
@@ -0,0 +1,17 @@
# CreateChatCompletionResponse
## Supported Types
### `models.ChatCompletion`
```python
value: models.ChatCompletion = /* values here */
```
### `Union[eventstreaming.EventStream[models.ChatCompletionChunk], eventstreaming.EventStreamAsync[models.ChatCompletionChunk]]`
```python
value: Union[eventstreaming.EventStream[models.ChatCompletionChunk], eventstreaming.EventStreamAsync[models.ChatCompletionChunk]] = /* values here */
```
@@ -1,4 +1,4 @@
# ChatCompletionCreateParamsDataCollection
# DataCollection
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
@@ -1,4 +1,4 @@
# ChatCompletionCreateParamsEffort
# Effort
OpenAI-style reasoning effort setting
@@ -1,4 +1,4 @@
# ChatCompletionCreateParamsEngine
# Engine
## Values
@@ -1,4 +1,4 @@
# ChatCompletionCreateParamsIDChainOfThought
# IDChainOfThought
## Values
@@ -1,4 +1,4 @@
# ChatCompletionCreateParamsIDFileParser
# IDFileParser
## Values
@@ -1,4 +1,4 @@
# ChatCompletionCreateParamsIDModeration
# IDModeration
## Values
@@ -1,4 +1,4 @@
# ChatCompletionCreateParamsIDWeb
# IDWeb
## Values
+17
View File
@@ -0,0 +1,17 @@
# Ignore
## Supported Types
### `models.IgnoreEnum`
```python
value: models.IgnoreEnum = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -1,4 +1,4 @@
# ChatCompletionCreateParamsOnlyEnum
# IgnoreEnum
## Values
@@ -1,4 +1,4 @@
# ChatCompletionCreateParamsPrompt
# Image
## Supported Types
@@ -1,4 +1,4 @@
# ChatCompletionCreateParamsJSONSchema
# JSONSchema
## Fields
+14
View File
@@ -0,0 +1,14 @@
# MaxPrice
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ |
| `prompt` | [Optional[models.Prompt]](../models/prompt.md) | :heavy_minus_sign: | N/A |
| `completion` | [Optional[models.Completion]](../models/completion.md) | :heavy_minus_sign: | N/A |
| `image` | [Optional[models.Image]](../models/image.md) | :heavy_minus_sign: | N/A |
| `audio` | [Optional[models.Audio]](../models/audio.md) | :heavy_minus_sign: | N/A |
| `request` | [Optional[models.Request]](../models/request.md) | :heavy_minus_sign: | N/A |
+17
View File
@@ -0,0 +1,17 @@
# Only
## Supported Types
### `models.OnlyEnum`
```python
value: models.OnlyEnum = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -1,4 +1,4 @@
# ChatCompletionCreateParamsOrderEnum
# OnlyEnum
## Values
+17
View File
@@ -0,0 +1,17 @@
# Order
## Supported Types
### `models.OrderEnum`
```python
value: models.OrderEnum = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -1,4 +1,4 @@
# ChatCompletionCreateParamsIgnoreEnum
# OrderEnum
## Values
+8
View File
@@ -0,0 +1,8 @@
# Pdf
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- |
| `engine` | [Optional[models.PdfEngine]](../models/pdfengine.md) | :heavy_minus_sign: | N/A |
@@ -1,4 +1,4 @@
# ChatCompletionCreateParamsPdfEngine
# PdfEngine
## Values
+29
View File
@@ -0,0 +1,29 @@
# Plugin
## Supported Types
### `models.PluginModeration`
```python
value: models.PluginModeration = /* values here */
```
### `models.PluginWeb`
```python
value: models.PluginWeb = /* values here */
```
### `models.PluginChainOfThought`
```python
value: models.PluginChainOfThought = /* values here */
```
### `models.PluginFileParser`
```python
value: models.PluginFileParser = /* values here */
```
+8
View File
@@ -0,0 +1,8 @@
# PluginChainOfThought
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
| `id` | [models.IDChainOfThought](../models/idchainofthought.md) | :heavy_check_mark: | N/A |
+10
View File
@@ -0,0 +1,10 @@
# PluginFileParser
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ |
| `id` | [models.IDFileParser](../models/idfileparser.md) | :heavy_check_mark: | N/A |
| `max_files` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `pdf` | [Optional[models.Pdf]](../models/pdf.md) | :heavy_minus_sign: | N/A |

Some files were not shown because too many files have changed in this diff Show More