first commit

This commit is contained in:
Sheldon Vaughn
2025-08-22 10:31:13 -05:00
commit ab530a160e
284 changed files with 18581 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
> **Remember to shutdown a GitHub Codespace when it is not in use!**
# Dev Containers Quick Start
The default location for usage snippets is the `samples` directory.
## Running a Usage Sample
A sample usage example has been provided in a `root.py` file. As you work with the SDK, it's expected that you will modify these samples to fit your needs. To execute this particular snippet, use the command below.
```
python root.py
```
## Generating Additional Usage Samples
The speakeasy CLI allows you to generate more usage snippets. Here's how:
- To generate a sample for a specific operation by providing an operation ID, use:
```
speakeasy generate usage -s .speakeasy/out.openapi.yaml -l python -i {INPUT_OPERATION_ID} -o ./samples
```
- To generate samples for an entire namespace (like a tag or group name), use:
```
speakeasy generate usage -s .speakeasy/out.openapi.yaml -l python -n {INPUT_TAG_NAME} -o ./samples
```
+40
View File
@@ -0,0 +1,40 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/images/tree/main/src/python
{
"name": "Python",
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/astral-sh/devcontainer-features/uv:latest": {}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "sudo chmod +x ./.devcontainer/setup.sh && ./.devcontainer/setup.sh",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"github.vscode-pull-request-github"
],
"settings": {
"files.eol": "\n",
"editor.formatOnSave": true,
"python.formatting.provider": "black",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.flake8Enabled": true,
"python.linting.banditEnabled": true,
"python.testing.pytestEnabled": true
}
},
"codespaces": {
"openFiles": [
".devcontainer/README.md"
]
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
# Install the speakeasy CLI
curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | sh
# Setup samples directory
rmdir samples || true
mkdir samples
uv sync --dev
# Generate starter usage sample with speakeasy
speakeasy generate usage -s .speakeasy/out.openapi.yaml -l python -o samples/root.py
+2
View File
@@ -0,0 +1,2 @@
# This allows generated code to be indexed correctly
*.py linguist-generated=false
+11
View File
@@ -0,0 +1,11 @@
.venv/
venv/
src/*.egg-info/
**/__pycache__/
.pytest_cache/
.python-version
.DS_Store
pyrightconfig.json
**/.speakeasy/temp/
**/.speakeasy/logs/
.speakeasy/reports
File diff suppressed because it is too large Load Diff
+90
View File
@@ -0,0 +1,90 @@
overlay: 1.0.0
x-speakeasy-jsonpath: rfc9535
info:
title: Overlay chat-completions-openapi.yaml => openapi.yaml
version: 0.0.0
actions:
- target: $["components"]["schemas"]["ChatCompletion"]["properties"]["system_fingerprint"]
update:
type: string
nullable: true
description: System fingerprint
- target: $["components"]["schemas"]["ChatCompletionChunk"]["properties"]["system_fingerprint"]
update:
type: string
nullable: true
- target: $["components"]["schemas"]
update:
ChatStreamCompletionCreateParams:
allOf:
- $ref: "#/components/schemas/ChatCompletionCreateParams"
- type: object
properties:
stream:
type: boolean
enum:
- true
default: true
description: Enable streaming response
- target: $["paths"]["/chat/completions"]["post"]["responses"]["200"]["content"]["application/json"]["schema"]
update:
$ref: '#/components/schemas/ChatCompletion'
- target: $["paths"]["/chat/completions"]["post"]["responses"]["200"]["content"]["application/json"]["schema"]
update:
description: Non-streaming response when stream=false
- target: $["paths"]["/chat/completions"]["post"]["responses"]["200"]["content"]["application/json"]["schema"]["oneOf"]
remove: true
- target: $["paths"]["/chat/completions"]["post"]["responses"]["200"]["content"]["text/event-stream"]
remove: true
- target: $["paths"]
update:
/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'
'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'
@@ -0,0 +1,28 @@
overlay: 1.0.0
x-speakeasy-jsonpath: rfc9535
info:
title: Speakeasy Modifications
version: 0.0.2
x-speakeasy-metadata:
after: ""
before: ""
type: speakeasy-modifications
actions:
- target: $["paths"]["/chat/completions"]["post"]
update:
x-speakeasy-name-override: complete
x-speakeasy-metadata:
after: sdk.chat.complete()
before: sdk.Chat.createChatCompletion()
created_at: 1755805257797
reviewed_at: 1755805262583
type: method-name
- target: $["paths"]["/chat/completions#stream"]["post"]
update:
x-speakeasy-name-override: completeStream
x-speakeasy-metadata:
after: sdk.chat.completeStream()
before: sdk.Chat.streamChatCompletion()
created_at: 1755805257798
reviewed_at: 1755805262583
type: method-name
+320
View File
@@ -0,0 +1,320 @@
lockVersion: 2.0.0
id: 232c6d4f-b0fd-4172-8f1b-e2421566e9b4
management:
docChecksum: 003bbbc167e4db8bd3f147793a6648e1
docVersion: 1.0.0
speakeasyVersion: 1.606.2
generationVersion: 2.687.1
releaseVersion: 0.1.2
configChecksum: b19ff6e8c7d11c27501834040fadf2a5
features:
python:
additionalDependencies: 1.0.0
constsAndDefaults: 1.0.5
core: 5.19.9
defaultEnabledRetries: 0.2.0
devContainers: 3.0.0
enumUnions: 0.1.0
envVarSecurityUsage: 0.3.2
flatRequests: 1.0.1
globalSecurity: 3.0.3
globalSecurityCallbacks: 1.0.0
globalSecurityFlattening: 1.0.0
globalServerURLs: 3.1.1
methodArguments: 1.0.2
nameOverrides: 3.0.1
nullables: 1.0.1
responseFormat: 1.0.1
retries: 3.0.2
sdkHooks: 1.1.0
serverEvents: 1.0.7
serverEventsSentinels: 0.1.0
unions: 3.0.4
generatedFiles:
- .devcontainer/README.md
- .devcontainer/devcontainer.json
- .devcontainer/setup.sh
- .gitattributes
- .vscode/settings.json
- USAGE.md
- docs/errors/chatcompletionerror.md
- docs/models/annotationdetail.md
- docs/models/chatcompletion.md
- docs/models/chatcompletionassistantmessageparam.md
- docs/models/chatcompletionassistantmessageparamcontent.md
- docs/models/chatcompletionassistantmessageparamrole.md
- docs/models/chatcompletionchoice.md
- docs/models/chatcompletionchoicefinishreason.md
- docs/models/chatcompletionchunk.md
- docs/models/chatcompletionchunkchoice.md
- docs/models/chatcompletionchunkchoicedelta.md
- docs/models/chatcompletionchunkchoicedeltarole.md
- docs/models/chatcompletionchunkchoicedeltatoolcall.md
- docs/models/chatcompletionchunkchoicedeltatoolcallfunction.md
- docs/models/chatcompletionchunkchoicedeltatoolcalltype.md
- docs/models/chatcompletionchunkchoicefinishreason.md
- docs/models/chatcompletionchunkobject.md
- docs/models/chatcompletioncontentpart.md
- docs/models/chatcompletioncontentpartaudio.md
- docs/models/chatcompletioncontentpartaudioformat.md
- docs/models/chatcompletioncontentpartaudiotype.md
- docs/models/chatcompletioncontentpartimage.md
- docs/models/chatcompletioncontentpartimageimageurl.md
- docs/models/chatcompletioncontentpartimagetype.md
- 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
- docs/models/chatcompletionmessagerole.md
- docs/models/chatcompletionmessagetoolcall.md
- docs/models/chatcompletionmessagetoolcallfunction.md
- docs/models/chatcompletionmessagetoolcalltype.md
- docs/models/chatcompletionnamedtoolchoice.md
- docs/models/chatcompletionnamedtoolchoicefunction.md
- docs/models/chatcompletionnamedtoolchoicetype.md
- docs/models/chatcompletionobject.md
- docs/models/chatcompletionsystemmessageparam.md
- docs/models/chatcompletionsystemmessageparamcontent.md
- docs/models/chatcompletionsystemmessageparamrole.md
- docs/models/chatcompletiontokenlogprob.md
- docs/models/chatcompletiontokenlogprobs.md
- docs/models/chatcompletiontool.md
- docs/models/chatcompletiontoolchoiceoption.md
- docs/models/chatcompletiontoolchoiceoptionauto.md
- docs/models/chatcompletiontoolchoiceoptionnone.md
- docs/models/chatcompletiontoolchoiceoptionrequired.md
- docs/models/chatcompletiontoolfunction.md
- docs/models/chatcompletiontoolmessageparam.md
- docs/models/chatcompletiontoolmessageparamcontent.md
- docs/models/chatcompletiontoolmessageparamrole.md
- docs/models/chatcompletiontooltype.md
- 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/completiontokensdetails.md
- docs/models/completionusage.md
- docs/models/contentimageurl.md
- docs/models/contenttext.md
- docs/models/contenttypeimageurl.md
- docs/models/contenttypetext.md
- docs/models/detail.md
- docs/models/error.md
- docs/models/file.md
- docs/models/fileannotationdetail.md
- docs/models/fileannotationdetailcontentunion.md
- docs/models/fileannotationdetailimageurl.md
- docs/models/inputaudio.md
- docs/models/parameters.md
- docs/models/prompttokensdetails.md
- docs/models/reasoningdetail.md
- docs/models/reasoningdetailencrypted.md
- docs/models/reasoningdetailencryptedformat.md
- docs/models/reasoningdetailencryptedtype.md
- docs/models/reasoningdetailsummary.md
- docs/models/reasoningdetailsummaryformat.md
- docs/models/reasoningdetailsummarytype.md
- docs/models/reasoningdetailtext.md
- docs/models/reasoningdetailtextformat.md
- docs/models/reasoningdetailtexttype.md
- docs/models/responseformatjsonschemaschema.md
- docs/models/security.md
- docs/models/streamchatcompletionresponsebody.md
- docs/models/toplogprob.md
- docs/models/typefile.md
- docs/models/urlcitation.md
- docs/models/urlcitationannotationdetail.md
- docs/models/urlcitationannotationdetailtype.md
- docs/models/utils/retryconfig.md
- docs/sdks/chat/README.md
- docs/sdks/openrouter/README.md
- py.typed
- pylintrc
- pyproject.toml
- scripts/publish.sh
- src/openrouter/__init__.py
- src/openrouter/_hooks/__init__.py
- src/openrouter/_hooks/sdkhooks.py
- src/openrouter/_hooks/types.py
- src/openrouter/_version.py
- src/openrouter/basesdk.py
- src/openrouter/chat.py
- src/openrouter/errors/__init__.py
- src/openrouter/errors/chatcompletionerror.py
- src/openrouter/errors/no_response_error.py
- src/openrouter/errors/openrouterdefaulterror.py
- src/openrouter/errors/openroutererror.py
- src/openrouter/errors/responsevalidationerror.py
- src/openrouter/httpclient.py
- src/openrouter/models/__init__.py
- src/openrouter/models/annotationdetail.py
- src/openrouter/models/chatcompletion.py
- src/openrouter/models/chatcompletionassistantmessageparam.py
- src/openrouter/models/chatcompletionchoice.py
- src/openrouter/models/chatcompletionchunk.py
- src/openrouter/models/chatcompletionchunkchoice.py
- src/openrouter/models/chatcompletionchunkchoicedelta.py
- src/openrouter/models/chatcompletionchunkchoicedeltatoolcall.py
- src/openrouter/models/chatcompletioncontentpart.py
- src/openrouter/models/chatcompletioncontentpartaudio.py
- src/openrouter/models/chatcompletioncontentpartimage.py
- src/openrouter/models/chatcompletioncontentparttext.py
- src/openrouter/models/chatcompletioncreateparams.py
- src/openrouter/models/chatcompletionerror.py
- src/openrouter/models/chatcompletionmessage.py
- src/openrouter/models/chatcompletionmessageparam.py
- src/openrouter/models/chatcompletionmessagetoolcall.py
- src/openrouter/models/chatcompletionnamedtoolchoice.py
- src/openrouter/models/chatcompletionsystemmessageparam.py
- src/openrouter/models/chatcompletiontokenlogprob.py
- src/openrouter/models/chatcompletiontokenlogprobs.py
- src/openrouter/models/chatcompletiontool.py
- 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/fileannotationdetail.py
- src/openrouter/models/reasoningdetail.py
- src/openrouter/models/reasoningdetailencrypted.py
- src/openrouter/models/reasoningdetailsummary.py
- 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
- src/openrouter/sdkconfiguration.py
- src/openrouter/types/__init__.py
- src/openrouter/types/basemodel.py
- src/openrouter/utils/__init__.py
- src/openrouter/utils/annotations.py
- src/openrouter/utils/datetimes.py
- src/openrouter/utils/enums.py
- src/openrouter/utils/eventstreaming.py
- src/openrouter/utils/forms.py
- src/openrouter/utils/headers.py
- src/openrouter/utils/logger.py
- src/openrouter/utils/metadata.py
- src/openrouter/utils/queryparams.py
- src/openrouter/utils/requestbodies.py
- src/openrouter/utils/retries.py
- src/openrouter/utils/security.py
- src/openrouter/utils/serializers.py
- src/openrouter/utils/unmarshal_json_response.py
- src/openrouter/utils/url.py
- src/openrouter/utils/values.py
examples:
createChatCompletion:
speakeasy-default-create-chat-completion:
requestBody:
application/json: {"messages": [{"role": "user", "content": "Hello, how are you?"}], "stream": false, "temperature": 1, "top_p": 1}
responses:
"200":
application/json: {"id": "<id>", "choices": [], "created": 6977.95, "model": "El Camino", "object": "chat.completion"}
"400":
application/json: {"error": {"code": "<value>", "message": "<value>", "param": "<value>", "type": "<value>"}}
"500":
application/json: {"error": {"code": "<value>", "message": "<value>", "param": "<value>", "type": "<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": "<value>", "message": "<value>", "param": "<value>", "type": "<value>"}}
"500":
application/json: {"error": {"code": "<value>", "message": "<value>", "param": "<value>", "type": "<value>"}}
examplesVersion: 1.0.2
+64
View File
@@ -0,0 +1,64 @@
configVersion: 2.0.0
generation:
devContainers:
enabled: true
schemaPath: .speakeasy/out.openapi.yaml
sdkClassName: OpenRouter
maintainOpenAPIOrder: true
usageSnippets:
optionalPropertyRendering: withExample
sdkInitStyle: constructor
useClassNamesForArrayFields: true
fixes:
nameResolutionDec2023: true
nameResolutionFeb2025: true
parameterOrderingFeb2024: true
requestResponseComponentNamesFeb2024: true
securityFeb2025: true
sharedErrorComponentsApr2025: true
auth:
oAuth2ClientCredentialsEnabled: true
oAuth2PasswordEnabled: true
sdkHooksConfigAccess: true
tests:
generateTests: false
generateNewTests: true
skipResponseBodyAssertions: false
python:
version: 0.1.2
additionalDependencies:
dev: {}
main: {}
authors:
- Speakeasy
baseErrorName: OpenRouterError
clientServerStatusCodesAsErrors: true
defaultErrorName: OpenRouterDefaultError
description: Python Client SDK Generated by Speakeasy.
enableCustomCodeRegions: false
enumFormat: enum
envVarPrefix: OPENROUTER
fixFlags:
responseRequiredSep2024: true
flattenGlobalSecurity: true
flattenRequests: true
flatteningOrder: parameters-first
imports:
option: openapi
paths:
callbacks: ""
errors: errors
operations: ""
shared: ""
webhooks: ""
inputModelSuffix: input
maxMethodParams: 999
methodArguments: infer-optional-args
moduleName: ""
outputModelSuffix: output
packageManager: uv
packageName: openrouter
pytestFilterWarnings: []
pytestTimeout: 0
responseFormat: flat
templateVersion: v2
File diff suppressed because it is too large Load Diff
+40
View File
@@ -0,0 +1,40 @@
speakeasyVersion: 1.606.2
sources:
OpenRouter Chat Completions API:
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:30b19a8759608792fb4d27f6bf28d5982d7e2a8cf5b3faf34ba3507a62f9f106
sourceBlobDigest: sha256:454f1b880a0882a70f78eacccb2c33e3d9d19134a0738b0e21487984a7bf2e63
tags:
- latest
- 1.0.0
targets:
open-router:
source: OpenRouter Chat Completions API
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:30b19a8759608792fb4d27f6bf28d5982d7e2a8cf5b3faf34ba3507a62f9f106
sourceBlobDigest: sha256:454f1b880a0882a70f78eacccb2c33e3d9d19134a0738b0e21487984a7bf2e63
codeSamplesNamespace: open-router-chat-completions-api-python-code-samples
codeSamplesRevisionDigest: sha256:3a91ac3dc92c4f41025bfbe2ab316844707268e93ea1947cd4fe8996f01620b5
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
OpenRouter Chat Completions API:
inputs:
- location: .speakeasy/OAS_files/chat-completions-openapi.yaml
overlays:
- location: .speakeasy/OAS_files/overlay.yaml
- location: .speakeasy/OAS_files/speakeasy-modifications-overlay.yaml
output: .speakeasy/out.openapi.yaml
registry:
location: registry.speakeasyapi.dev/sheldon-vaughn-test/sandbox/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
labelOverride:
fixedValue: Python (SDK)
blocking: false
+22
View File
@@ -0,0 +1,22 @@
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
OpenRouter Chat Completions API:
inputs:
- location: .speakeasy/OAS_files/chat-completions-openapi.yaml
overlays:
- location: .speakeasy/OAS_files/overlay.yaml
- location: .speakeasy/OAS_files/speakeasy-modifications-overlay.yaml
output: .speakeasy/out.openapi.yaml
registry:
location: registry.speakeasyapi.dev/sheldon-vaughn-test/sandbox/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
labelOverride:
fixedValue: Python (SDK)
blocking: false
+6
View File
@@ -0,0 +1,6 @@
{
"python.testing.pytestArgs": ["tests", "-vv"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"pylint.args": ["--rcfile=pylintrc"]
}
+26
View File
@@ -0,0 +1,26 @@
# Contributing to This Repository
Thank you for your interest in contributing to this repository. Please note that this repository contains generated code. As such, we do not accept direct changes or pull requests. Instead, we encourage you to follow the guidelines below to report issues and suggest improvements.
## How to Report Issues
If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. When reporting an issue, please provide as much detail as possible to help us reproduce the problem. This includes:
- A clear and descriptive title
- Steps to reproduce the issue
- Expected and actual behavior
- Any relevant logs, screenshots, or error messages
- Information about your environment (e.g., operating system, software versions)
- For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed
## Issue Triage and Upstream Fixes
We will review and triage issues as quickly as possible. Our goal is to address bugs and incorporate improvements in the upstream source code. Fixes will be included in the next generation of the generated code.
## Contact
If you have any questions or need further assistance, please feel free to reach out by opening an issue.
Thank you for your understanding and cooperation!
The Maintainers
+598
View File
@@ -0,0 +1,598 @@
# open-router
Developer-friendly & type-safe Python SDK specifically catered to leverage *open-router* API.
<div align="left">
<a href="https://www.speakeasy.com/?utm_source=open-router&utm_campaign=python"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
<a href="https://opensource.org/licenses/MIT">
<img src="https://img.shields.io/badge/License-MIT-blue.svg" style="width: 100px; height: 28px;" />
</a>
</div>
<br /><br />
> [!IMPORTANT]
> This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your [workspace](https://app.speakeasy.com/org/sheldon-vaughn-test/sandbox). Delete this section before > publishing to a package manager.
<!-- Start Summary [summary] -->
## Summary
OpenRouter Chat Completions API: OpenAI-compatible Chat Completions API with additional OpenRouter features
For more information about the API: [OpenRouter Documentation](https://openrouter.ai/docs)
<!-- End Summary [summary] -->
<!-- Start Table of Contents [toc] -->
## Table of Contents
<!-- $toc-max-depth=2 -->
* [open-router](#open-router)
* [SDK Installation](#sdk-installation)
* [IDE Support](#ide-support)
* [SDK Example Usage](#sdk-example-usage)
* [Authentication](#authentication)
* [Available Resources and Operations](#available-resources-and-operations)
* [Server-sent event streaming](#server-sent-event-streaming)
* [Retries](#retries)
* [Error Handling](#error-handling)
* [Server Selection](#server-selection)
* [Custom HTTP Client](#custom-http-client)
* [Resource Management](#resource-management)
* [Debugging](#debugging)
* [Development](#development)
* [Maturity](#maturity)
* [Contributions](#contributions)
<!-- End Table of Contents [toc] -->
<!-- Start SDK Installation [installation] -->
## SDK Installation
> [!TIP]
> To finish publishing your SDK to PyPI you must [run your first generation action](https://www.speakeasy.com/docs/github-setup#step-by-step-guide).
> [!NOTE]
> **Python version upgrade policy**
>
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
The SDK can be installed with *uv*, *pip*, or *poetry* package managers.
### uv
*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+<UNSET>.git
```
### PIP
*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+<UNSET>.git
```
### Poetry
*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+<UNSET>.git
```
### Shell and script usage with `uv`
You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so:
```shell
uvx --from openrouter python
```
It's also possible to write a standalone Python script without needing to set up a whole project like so:
```python
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.9"
# dependencies = [
# "openrouter",
# ]
# ///
from openrouter import OpenRouter
sdk = OpenRouter(
# SDK arguments
)
# Rest of script here...
```
Once that is saved to a file, you can run it with `uv run script.py` where
`script.py` can be replaced with the actual file name.
<!-- End SDK Installation [installation] -->
<!-- Start IDE Support [idesupport] -->
## IDE Support
### PyCharm
Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.
- [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
<!-- End IDE Support [idesupport] -->
<!-- Start SDK Example Usage [usage] -->
## SDK Example Usage
### Example
```python
# Synchronous Example
from openrouter import OpenRouter, models
import os
with OpenRouter(
bearer_auth=os.getenv("OPENROUTER_BEARER_AUTH", ""),
) as open_router:
res = open_router.chat.complete(messages=[
{
"role": models.ChatCompletionUserMessageParamRole.USER,
"content": "Hello, how are you?",
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
```
</br>
The same SDK client can also be used to make asynchronous requests by importing asyncio.
```python
# Asynchronous Example
import asyncio
from openrouter import OpenRouter, models
import os
async def main():
async with OpenRouter(
bearer_auth=os.getenv("OPENROUTER_BEARER_AUTH", ""),
) as open_router:
res = await open_router.chat.complete_async(messages=[
{
"role": models.ChatCompletionUserMessageParamRole.USER,
"content": "Hello, how are you?",
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
asyncio.run(main())
```
<!-- End SDK Example Usage [usage] -->
<!-- Start Authentication [security] -->
## Authentication
### Per-Client Security Schemes
This SDK supports the following security scheme globally:
| Name | Type | Scheme | Environment Variable |
| ------------- | ---- | ----------- | ------------------------ |
| `bearer_auth` | http | HTTP Bearer | `OPENROUTER_BEARER_AUTH` |
To authenticate with the API the `bearer_auth` parameter must be set when initializing the SDK client instance. For example:
```python
from openrouter import OpenRouter, models
import os
with OpenRouter(
bearer_auth=os.getenv("OPENROUTER_BEARER_AUTH", ""),
) as open_router:
res = open_router.chat.complete(messages=[
{
"role": models.ChatCompletionUserMessageParamRole.USER,
"content": "Hello, how are you?",
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
```
<!-- End Authentication [security] -->
<!-- Start Available Resources and Operations [operations] -->
## Available Resources and Operations
<details open>
<summary>Available methods</summary>
### [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>
<!-- End Available Resources and Operations [operations] -->
<!-- Start Server-sent event streaming [eventstream] -->
## Server-sent event streaming
[Server-sent events][mdn-sse] are used to stream content from certain
operations. These operations will expose the stream as [Generator][generator] that
can be consumed using a simple `for` loop. The loop will
terminate when the server no longer has any events to send and closes the
underlying connection.
The stream is also a [Context Manager][context-manager] and can be used with the `with` statement and will close the
underlying connection when the context is exited.
```python
from openrouter import OpenRouter, models
import os
with OpenRouter(
bearer_auth=os.getenv("OPENROUTER_BEARER_AUTH", ""),
) as open_router:
res = open_router.chat.complete_stream(messages=[
{
"role": models.ChatCompletionUserMessageParamRole.USER,
"content": "Hello, how are you?",
},
], stream=True, temperature=1, top_p=1)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
```
[mdn-sse]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
[generator]: https://book.pythontips.com/en/latest/generators.html
[context-manager]: https://book.pythontips.com/en/latest/context_managers.html
<!-- End Server-sent event streaming [eventstream] -->
<!-- Start Retries [retries] -->
## Retries
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
```python
from openrouter import OpenRouter, models
from openrouter.utils import BackoffStrategy, RetryConfig
import os
with OpenRouter(
bearer_auth=os.getenv("OPENROUTER_BEARER_AUTH", ""),
) as open_router:
res = open_router.chat.complete(messages=[
{
"role": models.ChatCompletionUserMessageParamRole.USER,
"content": "Hello, how are you?",
},
], stream=False, temperature=1, top_p=1,
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
# Handle response
print(res)
```
If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:
```python
from openrouter import OpenRouter, models
from openrouter.utils import BackoffStrategy, RetryConfig
import os
with OpenRouter(
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
bearer_auth=os.getenv("OPENROUTER_BEARER_AUTH", ""),
) as open_router:
res = open_router.chat.complete(messages=[
{
"role": models.ChatCompletionUserMessageParamRole.USER,
"content": "Hello, how are you?",
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
```
<!-- End Retries [retries] -->
<!-- Start Error Handling [errors] -->
## Error Handling
[`OpenRouterError`](./src/openrouter/errors/openroutererror.py) is the base class for all HTTP error responses. It has the following properties:
| Property | Type | Description |
| ------------------ | ---------------- | --------------------------------------------------------------------------------------- |
| `err.message` | `str` | Error message |
| `err.status_code` | `int` | HTTP response status code eg `404` |
| `err.headers` | `httpx.Headers` | HTTP response headers |
| `err.body` | `str` | HTTP body. Can be empty string if no body is returned. |
| `err.raw_response` | `httpx.Response` | Raw HTTP response |
| `err.data` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
### Example
```python
from openrouter import OpenRouter, errors, models
import os
with OpenRouter(
bearer_auth=os.getenv("OPENROUTER_BEARER_AUTH", ""),
) as open_router:
res = None
try:
res = open_router.chat.complete(messages=[
{
"role": models.ChatCompletionUserMessageParamRole.USER,
"content": "Hello, how are you?",
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
except errors.OpenRouterError as e:
# The base class for HTTP error responses
print(e.message)
print(e.status_code)
print(e.body)
print(e.headers)
print(e.raw_response)
# Depending on the method different errors may be thrown
if isinstance(e, errors.ChatCompletionError):
print(e.data.error) # models.Error
```
### Error Classes
**Primary errors:**
* [`OpenRouterError`](./src/openrouter/errors/openroutererror.py): The base class for HTTP error responses.
* [`ChatCompletionError`](./src/openrouter/errors/chatcompletionerror.py): Chat completion error response.
<details><summary>Less common errors (5)</summary>
<br />
**Network errors:**
* [`httpx.RequestError`](https://www.python-httpx.org/exceptions/#httpx.RequestError): Base class for request errors.
* [`httpx.ConnectError`](https://www.python-httpx.org/exceptions/#httpx.ConnectError): HTTP client was unable to make a request to a server.
* [`httpx.TimeoutException`](https://www.python-httpx.org/exceptions/#httpx.TimeoutException): HTTP request timed out.
**Inherit from [`OpenRouterError`](./src/openrouter/errors/openroutererror.py)**:
* [`ResponseValidationError`](./src/openrouter/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
</details>
<!-- End Error Handling [errors] -->
<!-- Start Server Selection [server] -->
## Server Selection
### Server Variables
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:
| Variable | Parameter | Default | Description |
| -------------- | ------------------- | ----------------- | ----------- |
| `provider_url` | `provider_url: str` | `"openrouter.ai"` | |
#### Example
```python
from openrouter import OpenRouter, models
import os
with OpenRouter(
provider_url="https://ruddy-guacamole.info/"
bearer_auth=os.getenv("OPENROUTER_BEARER_AUTH", ""),
) as open_router:
res = open_router.chat.complete(messages=[
{
"role": models.ChatCompletionUserMessageParamRole.USER,
"content": "Hello, how are you?",
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
```
### 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:
```python
from openrouter import OpenRouter, models
import os
with OpenRouter(
server_url="https://openrouter.ai/api/v1",
bearer_auth=os.getenv("OPENROUTER_BEARER_AUTH", ""),
) as open_router:
res = open_router.chat.complete(messages=[
{
"role": models.ChatCompletionUserMessageParamRole.USER,
"content": "Hello, how are you?",
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
```
<!-- End Server Selection [server] -->
<!-- Start Custom HTTP Client [http-client] -->
## Custom HTTP Client
The Python SDK makes API calls using the [httpx](https://www.python-httpx.org/) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance.
Depending on whether you are using the sync or async version of the SDK, you can pass an instance of `HttpClient` or `AsyncHttpClient` respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls.
This allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of `httpx.Client` or `httpx.AsyncClient` directly.
For example, you could specify a header for every request that this sdk makes as follows:
```python
from openrouter import OpenRouter
import httpx
http_client = httpx.Client(headers={"x-custom-header": "someValue"})
s = OpenRouter(client=http_client)
```
or you could wrap the client with your own custom logic:
```python
from openrouter import OpenRouter
from openrouter.httpclient import AsyncHttpClient
import httpx
class CustomClient(AsyncHttpClient):
client: AsyncHttpClient
def __init__(self, client: AsyncHttpClient):
self.client = client
async def send(
self,
request: httpx.Request,
*,
stream: bool = False,
auth: Union[
httpx._types.AuthTypes, httpx._client.UseClientDefault, None
] = httpx.USE_CLIENT_DEFAULT,
follow_redirects: Union[
bool, httpx._client.UseClientDefault
] = httpx.USE_CLIENT_DEFAULT,
) -> httpx.Response:
request.headers["Client-Level-Header"] = "added by client"
return await self.client.send(
request, stream=stream, auth=auth, follow_redirects=follow_redirects
)
def build_request(
self,
method: str,
url: httpx._types.URLTypes,
*,
content: Optional[httpx._types.RequestContent] = None,
data: Optional[httpx._types.RequestData] = None,
files: Optional[httpx._types.RequestFiles] = None,
json: Optional[Any] = None,
params: Optional[httpx._types.QueryParamTypes] = None,
headers: Optional[httpx._types.HeaderTypes] = None,
cookies: Optional[httpx._types.CookieTypes] = None,
timeout: Union[
httpx._types.TimeoutTypes, httpx._client.UseClientDefault
] = httpx.USE_CLIENT_DEFAULT,
extensions: Optional[httpx._types.RequestExtensions] = None,
) -> httpx.Request:
return self.client.build_request(
method,
url,
content=content,
data=data,
files=files,
json=json,
params=params,
headers=headers,
cookies=cookies,
timeout=timeout,
extensions=extensions,
)
s = OpenRouter(async_client=CustomClient(httpx.AsyncClient()))
```
<!-- End Custom HTTP Client [http-client] -->
<!-- Start Resource Management [resource-management] -->
## Resource Management
The `OpenRouter` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
```python
from openrouter import OpenRouter
import os
def main():
with OpenRouter(
bearer_auth=os.getenv("OPENROUTER_BEARER_AUTH", ""),
) as open_router:
# Rest of application here...
# Or when using async:
async def amain():
async with OpenRouter(
bearer_auth=os.getenv("OPENROUTER_BEARER_AUTH", ""),
) as open_router:
# Rest of application here...
```
<!-- End Resource Management [resource-management] -->
<!-- Start Debugging [debug] -->
## Debugging
You can setup your SDK to emit debug logs for SDK requests and responses.
You can pass your own logger class directly into your SDK.
```python
from openrouter import OpenRouter
import logging
logging.basicConfig(level=logging.DEBUG)
s = OpenRouter(debug_logger=logging.getLogger("openrouter"))
```
You can also enable a default debug logger by setting an environment variable `OPENROUTER_DEBUG` to true.
<!-- End Debugging [debug] -->
<!-- Placeholder for Future Speakeasy SDK Sections -->
# Development
## Maturity
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
looking for the latest version.
## Contributions
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=open-router&utm_campaign=python)
+50
View File
@@ -0,0 +1,50 @@
<!-- Start SDK Example Usage [usage] -->
```python
# Synchronous Example
from openrouter import OpenRouter, models
import os
with OpenRouter(
bearer_auth=os.getenv("OPENROUTER_BEARER_AUTH", ""),
) as open_router:
res = open_router.chat.complete(messages=[
{
"role": models.ChatCompletionUserMessageParamRole.USER,
"content": "Hello, how are you?",
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
```
</br>
The same SDK client can also be used to make asynchronous requests by importing asyncio.
```python
# Asynchronous Example
import asyncio
from openrouter import OpenRouter, models
import os
async def main():
async with OpenRouter(
bearer_auth=os.getenv("OPENROUTER_BEARER_AUTH", ""),
) as open_router:
res = await open_router.chat.complete_async(messages=[
{
"role": models.ChatCompletionUserMessageParamRole.USER,
"content": "Hello, how are you?",
},
], stream=False, temperature=1, top_p=1)
# Handle response
print(res)
asyncio.run(main())
```
<!-- End SDK Example Usage [usage] -->
+10
View File
@@ -0,0 +1,10 @@
# ChatCompletionError
Chat completion error response
## Fields
| Field | Type | Required | Description |
| ---------------------------------- | ---------------------------------- | ---------------------------------- | ---------------------------------- |
| `error` | [models.Error](../models/error.md) | :heavy_check_mark: | Error object structure |
+19
View File
@@ -0,0 +1,19 @@
# AnnotationDetail
Annotation information
## Supported Types
### `models.FileAnnotationDetail`
```python
value: models.FileAnnotationDetail = /* values here */
```
### `models.URLCitationAnnotationDetail`
```python
value: models.URLCitationAnnotationDetail = /* values here */
```
+16
View File
@@ -0,0 +1,16 @@
# ChatCompletion
Chat completion response
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| `id` | *str* | :heavy_check_mark: | Unique completion identifier |
| `choices` | List[[models.ChatCompletionChoice](../models/chatcompletionchoice.md)] | :heavy_check_mark: | List of completion choices |
| `created` | *float* | :heavy_check_mark: | Unix timestamp of creation |
| `model` | *str* | :heavy_check_mark: | Model used for completion |
| `object` | [models.ChatCompletionObject](../models/chatcompletionobject.md) | :heavy_check_mark: | N/A |
| `system_fingerprint` | *OptionalNullable[str]* | :heavy_minus_sign: | System fingerprint |
| `usage` | [Optional[models.CompletionUsage]](../models/completionusage.md) | :heavy_minus_sign: | Token usage statistics |
@@ -0,0 +1,14 @@
# ChatCompletionAssistantMessageParam
Assistant message with tool calls and audio support
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
| `role` | [models.ChatCompletionAssistantMessageParamRole](../models/chatcompletionassistantmessageparamrole.md) | :heavy_check_mark: | N/A |
| `content` | [OptionalNullable[models.ChatCompletionAssistantMessageParamContent]](../models/chatcompletionassistantmessageparamcontent.md) | :heavy_minus_sign: | Assistant message content |
| `name` | *Optional[str]* | :heavy_minus_sign: | Optional name for the assistant |
| `tool_calls` | List[[models.ChatCompletionMessageToolCall](../models/chatcompletionmessagetoolcall.md)] | :heavy_minus_sign: | Tool calls made by the assistant |
| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | Refusal message if content was refused |
@@ -0,0 +1,25 @@
# ChatCompletionAssistantMessageParamContent
Assistant message content
## Supported Types
### `str`
```python
value: str = /* values here */
```
### `List[models.ChatCompletionContentPart]`
```python
value: List[models.ChatCompletionContentPart] = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
@@ -0,0 +1,8 @@
# ChatCompletionAssistantMessageParamRole
## Values
| Name | Value |
| ----------- | ----------- |
| `ASSISTANT` | assistant |
+13
View File
@@ -0,0 +1,13 @@
# ChatCompletionChoice
Chat completion choice
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `finish_reason` | [Nullable[models.ChatCompletionChoiceFinishReason]](../models/chatcompletionchoicefinishreason.md) | :heavy_check_mark: | Reason the completion finished |
| `index` | *float* | :heavy_check_mark: | Choice index |
| `message` | [models.ChatCompletionMessage](../models/chatcompletionmessage.md) | :heavy_check_mark: | Assistant message in completion response |
| `logprobs` | [OptionalNullable[models.ChatCompletionTokenLogprobs]](../models/chatcompletiontokenlogprobs.md) | :heavy_minus_sign: | Log probabilities for the completion |
@@ -0,0 +1,14 @@
# ChatCompletionChoiceFinishReason
Reason the completion finished
## Values
| Name | Value |
| ---------------- | ---------------- |
| `TOOL_CALLS` | tool_calls |
| `STOP` | stop |
| `LENGTH` | length |
| `CONTENT_FILTER` | content_filter |
| `ERROR` | error |
+16
View File
@@ -0,0 +1,16 @@
# ChatCompletionChunk
Streaming chat completion chunk
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| `id` | *str* | :heavy_check_mark: | N/A |
| `choices` | List[[models.ChatCompletionChunkChoice](../models/chatcompletionchunkchoice.md)] | :heavy_check_mark: | N/A |
| `created` | *float* | :heavy_check_mark: | N/A |
| `model` | *str* | :heavy_check_mark: | N/A |
| `object` | [models.ChatCompletionChunkObject](../models/chatcompletionchunkobject.md) | :heavy_check_mark: | N/A |
| `system_fingerprint` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `usage` | [Optional[models.CompletionUsage]](../models/completionusage.md) | :heavy_minus_sign: | Token usage statistics |
+13
View File
@@ -0,0 +1,13 @@
# ChatCompletionChunkChoice
Streaming completion choice chunk
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| `delta` | [models.ChatCompletionChunkChoiceDelta](../models/chatcompletionchunkchoicedelta.md) | :heavy_check_mark: | Delta changes in streaming response |
| `finish_reason` | [Nullable[models.ChatCompletionChunkChoiceFinishReason]](../models/chatcompletionchunkchoicefinishreason.md) | :heavy_check_mark: | N/A |
| `index` | *float* | :heavy_check_mark: | N/A |
| `logprobs` | [OptionalNullable[models.ChatCompletionTokenLogprobs]](../models/chatcompletiontokenlogprobs.md) | :heavy_minus_sign: | Log probabilities for the completion |
@@ -0,0 +1,16 @@
# ChatCompletionChunkChoiceDelta
Delta changes in streaming response
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `role` | [Optional[models.ChatCompletionChunkChoiceDeltaRole]](../models/chatcompletionchunkchoicedeltarole.md) | :heavy_minus_sign: | The role of the message author |
| `content` | *OptionalNullable[str]* | :heavy_minus_sign: | Message content delta |
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | Reasoning content delta |
| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | Refusal message delta |
| `tool_calls` | List[[models.ChatCompletionChunkChoiceDeltaToolCall](../models/chatcompletionchunkchoicedeltatoolcall.md)] | :heavy_minus_sign: | Tool calls delta |
| `reasoning_details` | List[[models.ReasoningDetail](../models/reasoningdetail.md)] | :heavy_minus_sign: | Reasoning details delta to send reasoning details back to upstream |
| `annotations` | List[[models.AnnotationDetail](../models/annotationdetail.md)] | :heavy_minus_sign: | Annotations delta to send annotations back to upstream |
@@ -0,0 +1,10 @@
# ChatCompletionChunkChoiceDeltaRole
The role of the message author
## Values
| Name | Value |
| ----------- | ----------- |
| `ASSISTANT` | assistant |
@@ -0,0 +1,13 @@
# ChatCompletionChunkChoiceDeltaToolCall
Tool call delta for streaming responses
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
| `index` | *float* | :heavy_check_mark: | Tool call index in the array |
| `id` | *Optional[str]* | :heavy_minus_sign: | Tool call identifier |
| `type` | [Optional[models.ChatCompletionChunkChoiceDeltaToolCallType]](../models/chatcompletionchunkchoicedeltatoolcalltype.md) | :heavy_minus_sign: | Tool call type |
| `function` | [Optional[models.ChatCompletionChunkChoiceDeltaToolCallFunction]](../models/chatcompletionchunkchoicedeltatoolcallfunction.md) | :heavy_minus_sign: | Function call details |
@@ -0,0 +1,11 @@
# ChatCompletionChunkChoiceDeltaToolCallFunction
Function call details
## Fields
| Field | Type | Required | Description |
| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- |
| `name` | *Optional[str]* | :heavy_minus_sign: | Function name |
| `arguments` | *Optional[str]* | :heavy_minus_sign: | Function arguments as JSON string |
@@ -0,0 +1,10 @@
# ChatCompletionChunkChoiceDeltaToolCallType
Tool call type
## Values
| Name | Value |
| ---------- | ---------- |
| `FUNCTION` | function |
@@ -0,0 +1,12 @@
# ChatCompletionChunkChoiceFinishReason
## Values
| Name | Value |
| ---------------- | ---------------- |
| `TOOL_CALLS` | tool_calls |
| `STOP` | stop |
| `LENGTH` | length |
| `CONTENT_FILTER` | content_filter |
| `ERROR` | error |
+8
View File
@@ -0,0 +1,8 @@
# ChatCompletionChunkObject
## Values
| Name | Value |
| ----------------------- | ----------------------- |
| `CHAT_COMPLETION_CHUNK` | chat.completion.chunk |
+25
View File
@@ -0,0 +1,25 @@
# ChatCompletionContentPart
Content part for chat completion messages
## Supported Types
### `models.ChatCompletionContentPartText`
```python
value: models.ChatCompletionContentPartText = /* values here */
```
### `models.ChatCompletionContentPartImage`
```python
value: models.ChatCompletionContentPartImage = /* values here */
```
### `models.ChatCompletionContentPartAudio`
```python
value: models.ChatCompletionContentPartAudio = /* values here */
```
@@ -0,0 +1,11 @@
# ChatCompletionContentPartAudio
Audio input content part
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| `type` | [models.ChatCompletionContentPartAudioType](../models/chatcompletioncontentpartaudiotype.md) | :heavy_check_mark: | N/A |
| `input_audio` | [models.InputAudio](../models/inputaudio.md) | :heavy_check_mark: | N/A |
@@ -0,0 +1,16 @@
# ChatCompletionContentPartAudioFormat
Audio format
## Values
| Name | Value |
| ------- | ------- |
| `WAV` | wav |
| `MP3` | mp3 |
| `FLAC` | flac |
| `M4A` | m4a |
| `OGG` | ogg |
| `PCM16` | pcm16 |
| `PCM24` | pcm24 |
@@ -0,0 +1,8 @@
# ChatCompletionContentPartAudioType
## Values
| Name | Value |
| ------------- | ------------- |
| `INPUT_AUDIO` | input_audio |
@@ -0,0 +1,11 @@
# ChatCompletionContentPartImage
Image content part for vision models
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `type` | [models.ChatCompletionContentPartImageType](../models/chatcompletioncontentpartimagetype.md) | :heavy_check_mark: | N/A |
| `image_url` | [models.ChatCompletionContentPartImageImageURL](../models/chatcompletioncontentpartimageimageurl.md) | :heavy_check_mark: | N/A |
@@ -0,0 +1,9 @@
# ChatCompletionContentPartImageImageURL
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- |
| `url` | *str* | :heavy_check_mark: | URL of the image (data: URLs supported) |
| `detail` | [Optional[models.Detail]](../models/detail.md) | :heavy_minus_sign: | Image detail level for vision models |
@@ -0,0 +1,8 @@
# ChatCompletionContentPartImageType
## Values
| Name | Value |
| ----------- | ----------- |
| `IMAGE_URL` | image_url |
@@ -0,0 +1,11 @@
# ChatCompletionContentPartText
Text content part
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
| `type` | [models.ChatCompletionContentPartTextType](../models/chatcompletioncontentparttexttype.md) | :heavy_check_mark: | N/A |
| `text` | *str* | :heavy_check_mark: | N/A |
@@ -0,0 +1,8 @@
# ChatCompletionContentPartTextType
## Values
| Name | Value |
| ------ | ------ |
| `TEXT` | text |
+34
View File
@@ -0,0 +1,34 @@
# ChatCompletionCreateParams
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 | |
| `models_llm` | 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. | |
@@ -0,0 +1,23 @@
# ChatCompletionCreateParamsAudio
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `str`
```python
value: str = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
@@ -0,0 +1,23 @@
# ChatCompletionCreateParamsCompletion
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `str`
```python
value: str = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
@@ -0,0 +1,14 @@
# ChatCompletionCreateParamsDataCollection
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 |
@@ -0,0 +1,13 @@
# ChatCompletionCreateParamsEffort
OpenAI-style reasoning effort setting
## Values
| Name | Value |
| --------- | --------- |
| `HIGH` | high |
| `MEDIUM` | medium |
| `LOW` | low |
| `MINIMAL` | minimal |
@@ -0,0 +1,9 @@
# ChatCompletionCreateParamsEngine
## Values
| Name | Value |
| -------- | -------- |
| `NATIVE` | native |
| `EXA` | exa |
@@ -0,0 +1,8 @@
# ChatCompletionCreateParamsIDChainOfThought
## Values
| Name | Value |
| ------------------ | ------------------ |
| `CHAIN_OF_THOUGHT` | chain-of-thought |
@@ -0,0 +1,8 @@
# ChatCompletionCreateParamsIDFileParser
## Values
| Name | Value |
| ------------- | ------------- |
| `FILE_PARSER` | file-parser |
@@ -0,0 +1,8 @@
# ChatCompletionCreateParamsIDModeration
## Values
| Name | Value |
| ------------ | ------------ |
| `MODERATION` | moderation |
@@ -0,0 +1,8 @@
# ChatCompletionCreateParamsIDWeb
## Values
| Name | Value |
| ----- | ----- |
| `WEB` | web |
@@ -0,0 +1,85 @@
# ChatCompletionCreateParamsIgnoreEnum
## 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 |
@@ -0,0 +1,17 @@
# ChatCompletionCreateParamsIgnoreUnion
## Supported Types
### `models.ChatCompletionCreateParamsIgnoreEnum`
```python
value: models.ChatCompletionCreateParamsIgnoreEnum = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -0,0 +1,23 @@
# ChatCompletionCreateParamsImage
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `str`
```python
value: str = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
@@ -0,0 +1,11 @@
# ChatCompletionCreateParamsJSONSchema
## 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 |
@@ -0,0 +1,14 @@
# 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 |
@@ -0,0 +1,85 @@
# ChatCompletionCreateParamsOnlyEnum
## 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 |
@@ -0,0 +1,17 @@
# ChatCompletionCreateParamsOnlyUnion
## Supported Types
### `models.ChatCompletionCreateParamsOnlyEnum`
```python
value: models.ChatCompletionCreateParamsOnlyEnum = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -0,0 +1,85 @@
# ChatCompletionCreateParamsOrderEnum
## 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 |
@@ -0,0 +1,17 @@
# ChatCompletionCreateParamsOrderUnion
## Supported Types
### `models.ChatCompletionCreateParamsOrderEnum`
```python
value: models.ChatCompletionCreateParamsOrderEnum = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -0,0 +1,8 @@
# ChatCompletionCreateParamsPdf
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `engine` | [Optional[models.ChatCompletionCreateParamsPdfEngine]](../models/chatcompletioncreateparamspdfengine.md) | :heavy_minus_sign: | N/A |
@@ -0,0 +1,10 @@
# ChatCompletionCreateParamsPdfEngine
## Values
| Name | Value |
| ------------- | ------------- |
| `MISTRAL_OCR` | mistral-ocr |
| `PDF_TEXT` | pdf-text |
| `NATIVE` | native |
@@ -0,0 +1,8 @@
# ChatCompletionCreateParamsPluginChainOfThought
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| `id` | [models.ChatCompletionCreateParamsIDChainOfThought](../models/chatcompletioncreateparamsidchainofthought.md) | :heavy_check_mark: | N/A |
@@ -0,0 +1,10 @@
# 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 |
@@ -0,0 +1,8 @@
# ChatCompletionCreateParamsPluginModeration
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `id` | [models.ChatCompletionCreateParamsIDModeration](../models/chatcompletioncreateparamsidmoderation.md) | :heavy_check_mark: | N/A |
@@ -0,0 +1,29 @@
# 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 */
```
@@ -0,0 +1,11 @@
# 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 |
@@ -0,0 +1,23 @@
# ChatCompletionCreateParamsPrompt
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `str`
```python
value: str = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
@@ -0,0 +1,18 @@
# ChatCompletionCreateParamsProvider
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.ChatCompletionCreateParamsDataCollection]](../models/chatcompletioncreateparamsdatacollection.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.ChatCompletionCreateParamsOrderUnion](../models/chatcompletioncreateparamsorderunion.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.ChatCompletionCreateParamsOnlyUnion](../models/chatcompletioncreateparamsonlyunion.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.ChatCompletionCreateParamsIgnoreUnion](../models/chatcompletioncreateparamsignoreunion.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.ChatCompletionCreateParamsQuantization](../models/chatcompletioncreateparamsquantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. |
| `sort` | [OptionalNullable[models.ChatCompletionCreateParamsSort]](../models/chatcompletioncreateparamssort.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.ChatCompletionCreateParamsMaxPrice]](../models/chatcompletioncreateparamsmaxprice.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. |
@@ -0,0 +1,16 @@
# ChatCompletionCreateParamsQuantization
## Values
| Name | Value |
| --------- | --------- |
| `INT4` | int4 |
| `INT8` | int8 |
| `FP4` | fp4 |
| `FP6` | fp6 |
| `FP8` | fp8 |
| `FP16` | fp16 |
| `BF16` | bf16 |
| `FP32` | fp32 |
| `UNKNOWN` | unknown |
@@ -0,0 +1,13 @@
# 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 |
@@ -0,0 +1,13 @@
# ChatCompletionCreateParamsReasoningEffort
Reasoning effort
## Values
| Name | Value |
| --------- | --------- |
| `HIGH` | high |
| `MEDIUM` | medium |
| `LOW` | low |
| `MINIMAL` | minimal |
@@ -0,0 +1,23 @@
# ChatCompletionCreateParamsRequest
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `str`
```python
value: str = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
@@ -0,0 +1,11 @@
# 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 |
@@ -0,0 +1,10 @@
# ChatCompletionCreateParamsResponseFormatJSONObject
JSON object response format
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `type` | [models.ChatCompletionCreateParamsTypeJSONObject](../models/chatcompletioncreateparamstypejsonobject.md) | :heavy_check_mark: | N/A |
@@ -0,0 +1,11 @@
# 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 |
@@ -0,0 +1,10 @@
# ChatCompletionCreateParamsResponseFormatPython
Python code response format
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
| `type` | [models.ChatCompletionCreateParamsTypePython](../models/chatcompletioncreateparamstypepython.md) | :heavy_check_mark: | N/A |
@@ -0,0 +1,10 @@
# ChatCompletionCreateParamsResponseFormatText
Default text response format
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| `type` | [models.ChatCompletionCreateParamsTypeText](../models/chatcompletioncreateparamstypetext.md) | :heavy_check_mark: | N/A |
@@ -0,0 +1,37 @@
# 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 */
```
@@ -0,0 +1,12 @@
# ChatCompletionCreateParamsSort
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 |
@@ -0,0 +1,25 @@
# ChatCompletionCreateParamsStop
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 */
```
@@ -0,0 +1,10 @@
# ChatCompletionCreateParamsStreamOptions
Streaming configuration options
## Fields
| Field | Type | Required | Description |
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
| `include_usage` | *Optional[bool]* | :heavy_minus_sign: | Include usage information in streaming response |
@@ -0,0 +1,8 @@
# ChatCompletionCreateParamsTypeGrammar
## Values
| Name | Value |
| --------- | --------- |
| `GRAMMAR` | grammar |
@@ -0,0 +1,8 @@
# ChatCompletionCreateParamsTypeJSONObject
## Values
| Name | Value |
| ------------- | ------------- |
| `JSON_OBJECT` | json_object |
@@ -0,0 +1,8 @@
# ChatCompletionCreateParamsTypeJSONSchema
## Values
| Name | Value |
| ------------- | ------------- |
| `JSON_SCHEMA` | json_schema |
@@ -0,0 +1,8 @@
# ChatCompletionCreateParamsTypePython
## Values
| Name | Value |
| -------- | -------- |
| `PYTHON` | python |
@@ -0,0 +1,8 @@
# ChatCompletionCreateParamsTypeText
## Values
| Name | Value |
| ------ | ------ |
| `TEXT` | text |
+16
View File
@@ -0,0 +1,16 @@
# ChatCompletionMessage
Assistant message in completion response
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `role` | [models.ChatCompletionMessageRole](../models/chatcompletionmessagerole.md) | :heavy_check_mark: | N/A |
| `content` | *Nullable[str]* | :heavy_check_mark: | Message content |
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | Reasoning output |
| `refusal` | *Nullable[str]* | :heavy_check_mark: | Refusal message if content was refused |
| `tool_calls` | List[[models.ChatCompletionMessageToolCall](../models/chatcompletionmessagetoolcall.md)] | :heavy_minus_sign: | Tool calls made by the assistant |
| `reasoning_details` | List[[models.ReasoningDetail](../models/reasoningdetail.md)] | :heavy_minus_sign: | Reasoning details delta to send reasoning details back to upstream |
| `annotations` | List[[models.AnnotationDetail](../models/annotationdetail.md)] | :heavy_minus_sign: | Annotations delta to send annotations back to upstream |
+31
View File
@@ -0,0 +1,31 @@
# ChatCompletionMessageParam
Chat completion message with role-based discrimination
## Supported Types
### `models.ChatCompletionSystemMessageParam`
```python
value: models.ChatCompletionSystemMessageParam = /* values here */
```
### `models.ChatCompletionUserMessageParam`
```python
value: models.ChatCompletionUserMessageParam = /* values here */
```
### `models.ChatCompletionAssistantMessageParam`
```python
value: models.ChatCompletionAssistantMessageParam = /* values here */
```
### `models.ChatCompletionToolMessageParam`
```python
value: models.ChatCompletionToolMessageParam = /* values here */
```
+8
View File
@@ -0,0 +1,8 @@
# ChatCompletionMessageRole
## Values
| Name | Value |
| ----------- | ----------- |
| `ASSISTANT` | assistant |
@@ -0,0 +1,12 @@
# ChatCompletionMessageToolCall
Tool call made by the assistant
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `id` | *str* | :heavy_check_mark: | Tool call identifier |
| `type` | [models.ChatCompletionMessageToolCallType](../models/chatcompletionmessagetoolcalltype.md) | :heavy_check_mark: | N/A |
| `function` | [models.ChatCompletionMessageToolCallFunction](../models/chatcompletionmessagetoolcallfunction.md) | :heavy_check_mark: | N/A |
@@ -0,0 +1,9 @@
# ChatCompletionMessageToolCallFunction
## Fields
| Field | Type | Required | Description |
| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- |
| `name` | *str* | :heavy_check_mark: | Function name to call |
| `arguments` | *str* | :heavy_check_mark: | Function arguments as JSON string |
@@ -0,0 +1,8 @@
# ChatCompletionMessageToolCallType
## Values
| Name | Value |
| ---------- | ---------- |
| `FUNCTION` | function |
@@ -0,0 +1,11 @@
# ChatCompletionNamedToolChoice
Named tool choice for specific function
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `type` | [models.ChatCompletionNamedToolChoiceType](../models/chatcompletionnamedtoolchoicetype.md) | :heavy_check_mark: | N/A |
| `function` | [models.ChatCompletionNamedToolChoiceFunction](../models/chatcompletionnamedtoolchoicefunction.md) | :heavy_check_mark: | N/A |
@@ -0,0 +1,8 @@
# ChatCompletionNamedToolChoiceFunction
## Fields
| Field | Type | Required | Description |
| --------------------- | --------------------- | --------------------- | --------------------- |
| `name` | *str* | :heavy_check_mark: | Function name to call |
@@ -0,0 +1,8 @@
# ChatCompletionNamedToolChoiceType
## Values
| Name | Value |
| ---------- | ---------- |
| `FUNCTION` | function |
+8
View File
@@ -0,0 +1,8 @@
# ChatCompletionObject
## Values
| Name | Value |
| ----------------- | ----------------- |
| `CHAT_COMPLETION` | chat.completion |
@@ -0,0 +1,12 @@
# ChatCompletionSystemMessageParam
System message for setting behavior
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ |
| `role` | [models.ChatCompletionSystemMessageParamRole](../models/chatcompletionsystemmessageparamrole.md) | :heavy_check_mark: | N/A |
| `content` | [models.ChatCompletionSystemMessageParamContent](../models/chatcompletionsystemmessageparamcontent.md) | :heavy_check_mark: | System message content |
| `name` | *Optional[str]* | :heavy_minus_sign: | Optional name for the system message |

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