mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-29 11:23:49 +08:00
Initial commit: OpenRouter Python SDK
Auto-generated Python SDK for OpenRouter API, providing comprehensive client library with: - Chat completions and streaming support - Embeddings API - Model and provider information - API key management - Analytics and usage tracking - OAuth authentication flows - Full type hints and error handling
This commit is contained in:
@@ -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
|
||||||
|
```
|
||||||
@@ -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"
|
||||||
|
}
|
||||||
@@ -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
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# This allows generated code to be indexed correctly
|
||||||
|
*.py linguist-generated=false
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
.venv/
|
||||||
|
venv/
|
||||||
|
src/*.egg-info/
|
||||||
|
**/__pycache__/
|
||||||
|
.pytest_cache/
|
||||||
|
.python-version
|
||||||
|
.DS_Store
|
||||||
|
pyrightconfig.json
|
||||||
|
**/.speakeasy/temp/
|
||||||
|
**/.speakeasy/logs/
|
||||||
|
.speakeasy/reports
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
+1096
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,77 @@
|
|||||||
|
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
|
||||||
|
hoistGlobalSecurity: true
|
||||||
|
inferSSEOverload: true
|
||||||
|
sdkHooksConfigAccess: true
|
||||||
|
schemas:
|
||||||
|
allOfMergeStrategy: shallowMerge
|
||||||
|
requestBodyFieldName: body
|
||||||
|
tests:
|
||||||
|
generateTests: false
|
||||||
|
generateNewTests: true
|
||||||
|
skipResponseBodyAssertions: false
|
||||||
|
python:
|
||||||
|
version: 0.0.1
|
||||||
|
additionalDependencies:
|
||||||
|
dev: {}
|
||||||
|
main: {}
|
||||||
|
allowedRedefinedBuiltins:
|
||||||
|
- id
|
||||||
|
- object
|
||||||
|
- input
|
||||||
|
asyncMode: both
|
||||||
|
authors:
|
||||||
|
- Speakeasy
|
||||||
|
baseErrorName: OpenRouterError
|
||||||
|
clientServerStatusCodesAsErrors: true
|
||||||
|
defaultErrorName: OpenRouterDefaultError
|
||||||
|
description: Python Client SDK Generated by Speakeasy.
|
||||||
|
enableCustomCodeRegions: false
|
||||||
|
enumFormat: union
|
||||||
|
envVarPrefix: OPENROUTER
|
||||||
|
fixFlags:
|
||||||
|
asyncPaginationSep2025: true
|
||||||
|
responseRequiredSep2024: true
|
||||||
|
flattenGlobalSecurity: true
|
||||||
|
flattenRequests: true
|
||||||
|
flatteningOrder: parameters-first
|
||||||
|
imports:
|
||||||
|
option: openapi
|
||||||
|
paths:
|
||||||
|
callbacks: ""
|
||||||
|
errors: errors
|
||||||
|
operations: ""
|
||||||
|
shared: ""
|
||||||
|
webhooks: ""
|
||||||
|
inputModelSuffix: input
|
||||||
|
legacyPyright: false
|
||||||
|
maxMethodParams: 999
|
||||||
|
methodArguments: infer-optional-args
|
||||||
|
moduleName: ""
|
||||||
|
outputModelSuffix: output
|
||||||
|
packageManager: uv
|
||||||
|
packageName: openrouter
|
||||||
|
pytestFilterWarnings: []
|
||||||
|
pytestTimeout: 0
|
||||||
|
responseFormat: flat
|
||||||
|
sseFlatResponse: false
|
||||||
|
templateVersion: v2
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
|||||||
|
speakeasyVersion: 1.656.2
|
||||||
|
sources:
|
||||||
|
-OAS:
|
||||||
|
sourceNamespace: open-router-chat-completions-api
|
||||||
|
sourceRevisionDigest: sha256:08647b466c00989914e3a2436175152270f771f0a57d055f5bab14cc2d4be89e
|
||||||
|
sourceBlobDigest: sha256:53027ec57392d9617cc001ece83c2fe1aa6e5dbfd52d170381c34c33c6042c23
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
targets:
|
||||||
|
open-router:
|
||||||
|
source: -OAS
|
||||||
|
sourceNamespace: open-router-chat-completions-api
|
||||||
|
sourceRevisionDigest: sha256:08647b466c00989914e3a2436175152270f771f0a57d055f5bab14cc2d4be89e
|
||||||
|
sourceBlobDigest: sha256:53027ec57392d9617cc001ece83c2fe1aa6e5dbfd52d170381c34c33c6042c23
|
||||||
|
workflow:
|
||||||
|
workflowVersion: 1.0.0
|
||||||
|
speakeasyVersion: latest
|
||||||
|
sources:
|
||||||
|
-OAS:
|
||||||
|
inputs:
|
||||||
|
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main
|
||||||
|
output: .speakeasy/out.openapi.yaml
|
||||||
|
registry:
|
||||||
|
location: registry.speakeasyapi.dev/openrouter/sdk/-oas
|
||||||
|
targets:
|
||||||
|
open-router:
|
||||||
|
target: python
|
||||||
|
source: -OAS
|
||||||
|
codeSamples:
|
||||||
|
registry:
|
||||||
|
location: registry.speakeasyapi.dev/openrouter/sdk/-oas-python-code-samples
|
||||||
|
labelOverride:
|
||||||
|
fixedValue: Python (SDK)
|
||||||
|
blocking: false
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
workflowVersion: 1.0.0
|
||||||
|
speakeasyVersion: latest
|
||||||
|
sources:
|
||||||
|
-OAS:
|
||||||
|
inputs:
|
||||||
|
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main
|
||||||
|
output: .speakeasy/out.openapi.yaml
|
||||||
|
registry:
|
||||||
|
location: registry.speakeasyapi.dev/openrouter/sdk/-oas
|
||||||
|
targets:
|
||||||
|
open-router:
|
||||||
|
target: python
|
||||||
|
source: -OAS
|
||||||
|
codeSamples:
|
||||||
|
registry:
|
||||||
|
location: registry.speakeasyapi.dev/openrouter/sdk/-oas-python-code-samples
|
||||||
|
labelOverride:
|
||||||
|
fixedValue: Python (SDK)
|
||||||
|
blocking: false
|
||||||
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"python.testing.pytestArgs": ["tests", "-vv"],
|
||||||
|
"python.testing.unittestEnabled": false,
|
||||||
|
"python.testing.pytestEnabled": true,
|
||||||
|
"pylint.args": ["--rcfile=pylintrc"]
|
||||||
|
}
|
||||||
@@ -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
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
<!-- Start SDK Example Usage [usage] -->
|
||||||
|
```python
|
||||||
|
# Synchronous Example
|
||||||
|
from openrouter import OpenRouter
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
with OpenRouter(
|
||||||
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
|
) as open_router:
|
||||||
|
|
||||||
|
res = open_router.beta.responses.send(input=[
|
||||||
|
{
|
||||||
|
"type": "message",
|
||||||
|
"role": "user",
|
||||||
|
"content": "Hello, how are you?",
|
||||||
|
},
|
||||||
|
], metadata={
|
||||||
|
"user_id": "123",
|
||||||
|
"session_id": "abc-def-ghi",
|
||||||
|
}, tools=[
|
||||||
|
{
|
||||||
|
"type": "function",
|
||||||
|
"name": "get_current_weather",
|
||||||
|
"description": "Get the current weather in a given location",
|
||||||
|
"parameters": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"location": {
|
||||||
|
"type": "string",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
], model="anthropic/claude-4.5-sonnet-20250929", text={
|
||||||
|
"format_": {
|
||||||
|
"type": "text",
|
||||||
|
},
|
||||||
|
"verbosity": "medium",
|
||||||
|
}, reasoning={
|
||||||
|
"summary": "auto",
|
||||||
|
"enabled": True,
|
||||||
|
}, temperature=0.7, top_p=0.9, prompt={
|
||||||
|
"id": "<id>",
|
||||||
|
"variables": {
|
||||||
|
"key": {
|
||||||
|
"type": "input_text",
|
||||||
|
"text": "Hello, how can I help you?",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, service_tier="auto", truncation="auto", stream=False, provider={
|
||||||
|
"data_collection": "deny",
|
||||||
|
"zdr": True,
|
||||||
|
"enforce_distillable_text": True,
|
||||||
|
"order": [
|
||||||
|
"OpenAI",
|
||||||
|
],
|
||||||
|
"only": [
|
||||||
|
"OpenAI",
|
||||||
|
],
|
||||||
|
"ignore": [
|
||||||
|
"OpenAI",
|
||||||
|
],
|
||||||
|
"quantizations": None,
|
||||||
|
"sort": "price",
|
||||||
|
})
|
||||||
|
|
||||||
|
with res as event_stream:
|
||||||
|
for event in event_stream:
|
||||||
|
# handle event
|
||||||
|
print(event, flush=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
</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
|
||||||
|
import os
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
|
||||||
|
async with OpenRouter(
|
||||||
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
|
) as open_router:
|
||||||
|
|
||||||
|
res = await open_router.beta.responses.send_async(input=[
|
||||||
|
{
|
||||||
|
"type": "message",
|
||||||
|
"role": "user",
|
||||||
|
"content": "Hello, how are you?",
|
||||||
|
},
|
||||||
|
], metadata={
|
||||||
|
"user_id": "123",
|
||||||
|
"session_id": "abc-def-ghi",
|
||||||
|
}, tools=[
|
||||||
|
{
|
||||||
|
"type": "function",
|
||||||
|
"name": "get_current_weather",
|
||||||
|
"description": "Get the current weather in a given location",
|
||||||
|
"parameters": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"location": {
|
||||||
|
"type": "string",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
], model="anthropic/claude-4.5-sonnet-20250929", text={
|
||||||
|
"format_": {
|
||||||
|
"type": "text",
|
||||||
|
},
|
||||||
|
"verbosity": "medium",
|
||||||
|
}, reasoning={
|
||||||
|
"summary": "auto",
|
||||||
|
"enabled": True,
|
||||||
|
}, temperature=0.7, top_p=0.9, prompt={
|
||||||
|
"id": "<id>",
|
||||||
|
"variables": {
|
||||||
|
"key": {
|
||||||
|
"type": "input_text",
|
||||||
|
"text": "Hello, how can I help you?",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, service_tier="auto", truncation="auto", stream=False, provider={
|
||||||
|
"data_collection": "deny",
|
||||||
|
"zdr": True,
|
||||||
|
"enforce_distillable_text": True,
|
||||||
|
"order": [
|
||||||
|
"OpenAI",
|
||||||
|
],
|
||||||
|
"only": [
|
||||||
|
"OpenAI",
|
||||||
|
],
|
||||||
|
"ignore": [
|
||||||
|
"OpenAI",
|
||||||
|
],
|
||||||
|
"quantizations": None,
|
||||||
|
"sort": "price",
|
||||||
|
})
|
||||||
|
|
||||||
|
async with res as event_stream:
|
||||||
|
async for event in event_stream:
|
||||||
|
# handle event
|
||||||
|
print(event, flush=True)
|
||||||
|
|
||||||
|
asyncio.run(main())
|
||||||
|
```
|
||||||
|
<!-- End SDK Example Usage [usage] -->
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# BadGatewayResponseError
|
||||||
|
|
||||||
|
Bad Gateway - Provider/upstream API failure
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
||||||
|
| `error` | [models.BadGatewayResponseErrorData](../models/badgatewayresponseerrordata.md) | :heavy_check_mark: | Error data for BadGatewayResponse | {<br/>"code": 502,<br/>"message": "Provider returned error"<br/>} |
|
||||||
|
| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# BadRequestResponseError
|
||||||
|
|
||||||
|
Bad Request - Invalid request parameters or malformed input
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
||||||
|
| `error` | [models.BadRequestResponseErrorData](../models/badrequestresponseerrordata.md) | :heavy_check_mark: | Error data for BadRequestResponse | {<br/>"code": 400,<br/>"message": "Invalid request parameters"<br/>} |
|
||||||
|
| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# ChatError
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- |
|
||||||
|
| `error` | [models.ChatErrorError](../models/chaterrorerror.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# EdgeNetworkTimeoutResponseError
|
||||||
|
|
||||||
|
Infrastructure Timeout - Provider request timed out at edge network
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
||||||
|
| `error` | [models.EdgeNetworkTimeoutResponseErrorData](../models/edgenetworktimeoutresponseerrordata.md) | :heavy_check_mark: | Error data for EdgeNetworkTimeoutResponse | {<br/>"code": 524,<br/>"message": "Request timed out. Please try again later."<br/>} |
|
||||||
|
| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# ForbiddenResponseError
|
||||||
|
|
||||||
|
Forbidden - Authentication successful but insufficient permissions
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
|
||||||
|
| `error` | [models.ForbiddenResponseErrorData](../models/forbiddenresponseerrordata.md) | :heavy_check_mark: | Error data for ForbiddenResponse | {<br/>"code": 403,<br/>"message": "Only provisioning keys can perform this operation"<br/>} |
|
||||||
|
| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# InternalServerResponseError
|
||||||
|
|
||||||
|
Internal Server Error - Unexpected server error
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
||||||
|
| `error` | [models.InternalServerResponseErrorData](../models/internalserverresponseerrordata.md) | :heavy_check_mark: | Error data for InternalServerResponse | {<br/>"code": 500,<br/>"message": "Internal Server Error"<br/>} |
|
||||||
|
| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# NotFoundResponseError
|
||||||
|
|
||||||
|
Not Found - Resource does not exist
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
||||||
|
| `error` | [models.NotFoundResponseErrorData](../models/notfoundresponseerrordata.md) | :heavy_check_mark: | Error data for NotFoundResponse | {<br/>"code": 404,<br/>"message": "Resource not found"<br/>} |
|
||||||
|
| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# PayloadTooLargeResponseError
|
||||||
|
|
||||||
|
Payload Too Large - Request payload exceeds size limits
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
||||||
|
| `error` | [models.PayloadTooLargeResponseErrorData](../models/payloadtoolargeresponseerrordata.md) | :heavy_check_mark: | Error data for PayloadTooLargeResponse | {<br/>"code": 413,<br/>"message": "Request payload too large"<br/>} |
|
||||||
|
| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# PaymentRequiredResponseError
|
||||||
|
|
||||||
|
Payment Required - Insufficient credits or quota to complete request
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
|
||||||
|
| `error` | [models.PaymentRequiredResponseErrorData](../models/paymentrequiredresponseerrordata.md) | :heavy_check_mark: | Error data for PaymentRequiredResponse | {<br/>"code": 402,<br/>"message": "Insufficient credits. Add more using https://openrouter.ai/credits"<br/>} |
|
||||||
|
| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# ProviderOverloadedResponseError
|
||||||
|
|
||||||
|
Provider Overloaded - Provider is temporarily overloaded
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
||||||
|
| `error` | [models.ProviderOverloadedResponseErrorData](../models/provideroverloadedresponseerrordata.md) | :heavy_check_mark: | Error data for ProviderOverloadedResponse | {<br/>"code": 529,<br/>"message": "Provider returned error"<br/>} |
|
||||||
|
| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# RequestTimeoutResponseError
|
||||||
|
|
||||||
|
Request Timeout - Operation exceeded time limit
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
||||||
|
| `error` | [models.RequestTimeoutResponseErrorData](../models/requesttimeoutresponseerrordata.md) | :heavy_check_mark: | Error data for RequestTimeoutResponse | {<br/>"code": 408,<br/>"message": "Operation timed out. Please try again later."<br/>} |
|
||||||
|
| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# ServiceUnavailableResponseError
|
||||||
|
|
||||||
|
Service Unavailable - Service temporarily unavailable
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
||||||
|
| `error` | [models.ServiceUnavailableResponseErrorData](../models/serviceunavailableresponseerrordata.md) | :heavy_check_mark: | Error data for ServiceUnavailableResponse | {<br/>"code": 503,<br/>"message": "Service temporarily unavailable"<br/>} |
|
||||||
|
| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# TooManyRequestsResponseError
|
||||||
|
|
||||||
|
Too Many Requests - Rate limit exceeded
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
||||||
|
| `error` | [models.TooManyRequestsResponseErrorData](../models/toomanyrequestsresponseerrordata.md) | :heavy_check_mark: | Error data for TooManyRequestsResponse | {<br/>"code": 429,<br/>"message": "Rate limit exceeded"<br/>} |
|
||||||
|
| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# UnauthorizedResponseError
|
||||||
|
|
||||||
|
Unauthorized - Authentication required or invalid credentials
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
||||||
|
| `error` | [models.UnauthorizedResponseErrorData](../models/unauthorizedresponseerrordata.md) | :heavy_check_mark: | Error data for UnauthorizedResponse | {<br/>"code": 401,<br/>"message": "Missing Authentication header"<br/>} |
|
||||||
|
| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# UnprocessableEntityResponseError
|
||||||
|
|
||||||
|
Unprocessable Entity - Semantic validation failure
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
|
||||||
|
| `error` | [models.UnprocessableEntityResponseErrorData](../models/unprocessableentityresponseerrordata.md) | :heavy_check_mark: | Error data for UnprocessableEntityResponse | {<br/>"code": 422,<br/>"message": "Invalid argument"<br/>} |
|
||||||
|
| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# ActivityItem
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- |
|
||||||
|
| `date_` | *str* | :heavy_check_mark: | Date of the activity (YYYY-MM-DD format) | 2025-08-24 |
|
||||||
|
| `model` | *str* | :heavy_check_mark: | Model slug (e.g., "openai/gpt-4.1") | openai/gpt-4.1 |
|
||||||
|
| `model_permaslug` | *str* | :heavy_check_mark: | Model permaslug (e.g., "openai/gpt-4.1-2025-04-14") | openai/gpt-4.1-2025-04-14 |
|
||||||
|
| `endpoint_id` | *str* | :heavy_check_mark: | Unique identifier for the endpoint | 550e8400-e29b-41d4-a716-446655440000 |
|
||||||
|
| `provider_name` | *str* | :heavy_check_mark: | Name of the provider serving this endpoint | OpenAI |
|
||||||
|
| `usage` | *float* | :heavy_check_mark: | Total cost in USD (OpenRouter credits spent) | 0.015 |
|
||||||
|
| `byok_usage_inference` | *float* | :heavy_check_mark: | BYOK inference cost in USD (external credits spent) | 0.012 |
|
||||||
|
| `requests` | *float* | :heavy_check_mark: | Number of requests made | 5 |
|
||||||
|
| `prompt_tokens` | *float* | :heavy_check_mark: | Total prompt tokens used | 50 |
|
||||||
|
| `completion_tokens` | *float* | :heavy_check_mark: | Total completion tokens generated | 125 |
|
||||||
|
| `reasoning_tokens` | *float* | :heavy_check_mark: | Total reasoning tokens used | 25 |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# APIType
|
||||||
|
|
||||||
|
Type of API used for the generation
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ------------- | ------------- |
|
||||||
|
| `COMPLETIONS` | completions |
|
||||||
|
| `EMBEDDINGS` | embeddings |
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# Architecture
|
||||||
|
|
||||||
|
Model architecture information
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- |
|
||||||
|
| `tokenizer` | [Nullable[models.Tokenizer]](../models/tokenizer.md) | :heavy_check_mark: | N/A | GPT |
|
||||||
|
| `instruct_type` | [Nullable[models.InstructType]](../models/instructtype.md) | :heavy_check_mark: | Instruction format type | |
|
||||||
|
| `modality` | *Nullable[str]* | :heavy_check_mark: | Primary modality of the model | text |
|
||||||
|
| `input_modalities` | List[[models.InputModality](../models/inputmodality.md)] | :heavy_check_mark: | Supported input modalities | |
|
||||||
|
| `output_modalities` | List[[models.OutputModality](../models/outputmodality.md)] | :heavy_check_mark: | Supported output modalities | |
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# AssistantMessage
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
||||||
|
| `role` | *Literal["assistant"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `content` | [OptionalNullable[models.AssistantMessageContent]](../models/assistantmessagecontent.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `tool_calls` | List[[models.ChatMessageToolCall](../models/chatmessagetoolcall.md)] | :heavy_minus_sign: | N/A |
|
||||||
|
| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# AssistantMessageContent
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `str`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: str = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `List[models.ChatMessageContentItem]`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: List[models.ChatMessageContentItem] = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# BadGatewayResponseErrorData
|
||||||
|
|
||||||
|
Error data for BadGatewayResponse
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------- | -------------------------- | -------------------------- | -------------------------- |
|
||||||
|
| `code` | *int* | :heavy_check_mark: | N/A |
|
||||||
|
| `message` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `metadata` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# BadRequestResponseErrorData
|
||||||
|
|
||||||
|
Error data for BadRequestResponse
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------- | -------------------------- | -------------------------- | -------------------------- |
|
||||||
|
| `code` | *int* | :heavy_check_mark: | N/A |
|
||||||
|
| `message` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `metadata` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# CallData
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------- | -------------------- | -------------------- | -------------------- |
|
||||||
|
| `deadline` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `fee_amount` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `operator` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `prefix` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `recipient` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `recipient_amount` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `recipient_currency` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `refund_destination` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `signature` | *str* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# ChainID
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| --------------------------------------------- | --------------------------------------------- |
|
||||||
|
| `ONE` | 1 |
|
||||||
|
| `ONE_HUNDRED_AND_THIRTY_SEVEN` | 137 |
|
||||||
|
| `EIGHT_THOUSAND_FOUR_HUNDRED_AND_FIFTY_THREE` | 8453 |
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# ChatCompletionFinishReason
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ---------------- | ---------------- |
|
||||||
|
| `TOOL_CALLS` | tool_calls |
|
||||||
|
| `STOP` | stop |
|
||||||
|
| `LENGTH` | length |
|
||||||
|
| `CONTENT_FILTER` | content_filter |
|
||||||
|
| `ERROR` | error |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# ChatErrorError
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ |
|
||||||
|
| `code` | [Nullable[models.Code]](../models/code.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `message` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `param` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `type` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# ChatGenerationParams
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| `messages` | List[[models.Message](../models/message.md)] | :heavy_check_mark: | N/A |
|
||||||
|
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||||
|
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
|
||||||
|
| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
|
||||||
|
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `reasoning` | [Optional[models.Reasoning]](../models/reasoning.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `response_format` | [Optional[models.ChatGenerationParamsResponseFormatUnion]](../models/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `stop` | [OptionalNullable[models.ChatGenerationParamsStop]](../models/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `stream_options` | [OptionalNullable[models.ChatStreamOptions]](../models/chatstreamoptions.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `tools` | List[[models.ToolDefinitionJSON](../models/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
|
||||||
|
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# ChatGenerationParamsResponseFormatJSONObject
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------ | ------------------------ | ------------------------ | ------------------------ |
|
||||||
|
| `type` | *Literal["json_object"]* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# ChatGenerationParamsResponseFormatPython
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------- | ------------------- | ------------------- | ------------------- |
|
||||||
|
| `type` | *Literal["python"]* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# ChatGenerationParamsResponseFormatText
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
|
| `type` | *Literal["text"]* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# ChatGenerationParamsResponseFormatUnion
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `models.ChatGenerationParamsResponseFormatText`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.ChatGenerationParamsResponseFormatText = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `models.ChatGenerationParamsResponseFormatJSONObject`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.ChatGenerationParamsResponseFormatJSONObject = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `models.ResponseFormatJSONSchema`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.ResponseFormatJSONSchema = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `models.ResponseFormatTextGrammar`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.ResponseFormatTextGrammar = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `models.ChatGenerationParamsResponseFormatPython`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.ChatGenerationParamsResponseFormatPython = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# ChatGenerationParamsStop
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `str`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: str = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `List[str]`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: List[str] = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# ChatGenerationTokenUsage
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
||||||
|
| `completion_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `prompt_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `total_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `completion_tokens_details` | [OptionalNullable[models.CompletionTokensDetails]](../models/completiontokensdetails.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `prompt_tokens_details` | [OptionalNullable[models.PromptTokensDetails]](../models/prompttokensdetails.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# ChatMessageContentItem
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `models.ChatMessageContentItemText`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.ChatMessageContentItemText = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `models.ChatMessageContentItemImage`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.ChatMessageContentItemImage = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `models.ChatMessageContentItemAudio`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.ChatMessageContentItemAudio = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `models.ChatMessageContentItemVideo`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.ChatMessageContentItemVideo = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatMessageContentItemAudio
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
||||||
|
| `type` | *Literal["input_audio"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `input_audio` | [models.ChatMessageContentItemAudioInputAudio](../models/chatmessagecontentitemaudioinputaudio.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# ChatMessageContentItemAudioFormat
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ------- | ------- |
|
||||||
|
| `WAV` | wav |
|
||||||
|
| `MP3` | mp3 |
|
||||||
|
| `FLAC` | flac |
|
||||||
|
| `M4A` | m4a |
|
||||||
|
| `OGG` | ogg |
|
||||||
|
| `PCM16` | pcm16 |
|
||||||
|
| `PCM24` | pcm24 |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatMessageContentItemAudioInputAudio
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
|
||||||
|
| `data` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `format_` | [models.ChatMessageContentItemAudioFormat](../models/chatmessagecontentitemaudioformat.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatMessageContentItemImage
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
|
||||||
|
| `type` | *Literal["image_url"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `image_url` | [models.ImageURL](../models/imageurl.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# ChatMessageContentItemImageDetail
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ------ | ------ |
|
||||||
|
| `AUTO` | auto |
|
||||||
|
| `LOW` | low |
|
||||||
|
| `HIGH` | high |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatMessageContentItemText
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
|
| `type` | *Literal["text"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `text` | *str* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatMessageContentItemVideo
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
|
||||||
|
| `type` | *Literal["input_video"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `video_url` | [models.VideoURL](../models/videourl.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# ChatMessageTokenLogprob
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
|
||||||
|
| `token` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `logprob` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `bytes_` | List[*float*] | :heavy_check_mark: | N/A |
|
||||||
|
| `top_logprobs` | List[[models.TopLogprob](../models/toplogprob.md)] | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatMessageTokenLogprobs
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
||||||
|
| `content` | List[[models.ChatMessageTokenLogprob](../models/chatmessagetokenlogprob.md)] | :heavy_check_mark: | N/A |
|
||||||
|
| `refusal` | List[[models.ChatMessageTokenLogprob](../models/chatmessagetokenlogprob.md)] | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# ChatMessageToolCall
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
||||||
|
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `type` | *Literal["function"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `function` | [models.ChatMessageToolCallFunction](../models/chatmessagetoolcallfunction.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatMessageToolCallFunction
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
|
| `name` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `arguments` | *str* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# ChatResponse
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
||||||
|
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `choices` | List[[models.ChatResponseChoice](../models/chatresponsechoice.md)] | :heavy_check_mark: | N/A |
|
||||||
|
| `created` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `object` | *Literal["chat.completion"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `system_fingerprint` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `usage` | [Optional[models.ChatGenerationTokenUsage]](../models/chatgenerationtokenusage.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# ChatResponseChoice
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
|
||||||
|
| `finish_reason` | [Nullable[models.ChatCompletionFinishReason]](../models/chatcompletionfinishreason.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `message` | [models.AssistantMessage](../models/assistantmessage.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `logprobs` | [OptionalNullable[models.ChatMessageTokenLogprobs]](../models/chatmessagetokenlogprobs.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# ChatStreamingChoice
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
|
||||||
|
| `delta` | [models.ChatStreamingMessageChunk](../models/chatstreamingmessagechunk.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `finish_reason` | [Nullable[models.ChatCompletionFinishReason]](../models/chatcompletionfinishreason.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `logprobs` | [OptionalNullable[models.ChatMessageTokenLogprobs]](../models/chatmessagetokenlogprobs.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# ChatStreamingMessageChunk
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
||||||
|
| `role` | [Optional[models.ChatStreamingMessageChunkRole]](../models/chatstreamingmessagechunkrole.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `content` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `tool_calls` | List[[models.ChatStreamingMessageToolCall](../models/chatstreamingmessagetoolcall.md)] | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# ChatStreamingMessageChunkRole
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ----------- | ----------- |
|
||||||
|
| `ASSISTANT` | assistant |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# ChatStreamingMessageToolCall
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
|
||||||
|
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `type` | *Optional[Literal["function"]]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `function` | [Optional[models.ChatStreamingMessageToolCallFunction]](../models/chatstreamingmessagetoolcallfunction.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatStreamingMessageToolCallFunction
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
|
| `name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `arguments` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# ChatStreamingResponseChunk
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
|
||||||
|
| `data` | [models.ChatStreamingResponseChunkData](../models/chatstreamingresponsechunkdata.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# ChatStreamingResponseChunkData
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
|
||||||
|
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `choices` | List[[models.ChatStreamingChoice](../models/chatstreamingchoice.md)] | :heavy_check_mark: | N/A |
|
||||||
|
| `created` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `object` | *Literal["chat.completion.chunk"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `system_fingerprint` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `error` | [Optional[models.ChatStreamingResponseChunkError]](../models/chatstreamingresponsechunkerror.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `usage` | [Optional[models.ChatGenerationTokenUsage]](../models/chatgenerationtokenusage.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatStreamingResponseChunkError
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
|
| `message` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `code` | *float* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# ChatStreamOptions
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
|
| `include_usage` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Code
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `str`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: str = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `float`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: float = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# CodeEnum
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| -------------------------------- | -------------------------------- |
|
||||||
|
| `SERVER_ERROR` | server_error |
|
||||||
|
| `RATE_LIMIT_EXCEEDED` | rate_limit_exceeded |
|
||||||
|
| `INVALID_PROMPT` | invalid_prompt |
|
||||||
|
| `VECTOR_STORE_TIMEOUT` | vector_store_timeout |
|
||||||
|
| `INVALID_IMAGE` | invalid_image |
|
||||||
|
| `INVALID_IMAGE_FORMAT` | invalid_image_format |
|
||||||
|
| `INVALID_BASE64_IMAGE` | invalid_base64_image |
|
||||||
|
| `INVALID_IMAGE_URL` | invalid_image_url |
|
||||||
|
| `IMAGE_TOO_LARGE` | image_too_large |
|
||||||
|
| `IMAGE_TOO_SMALL` | image_too_small |
|
||||||
|
| `IMAGE_PARSE_ERROR` | image_parse_error |
|
||||||
|
| `IMAGE_CONTENT_POLICY_VIOLATION` | image_content_policy_violation |
|
||||||
|
| `INVALID_IMAGE_MODE` | invalid_image_mode |
|
||||||
|
| `IMAGE_FILE_TOO_LARGE` | image_file_too_large |
|
||||||
|
| `UNSUPPORTED_IMAGE_MEDIA_TYPE` | unsupported_image_media_type |
|
||||||
|
| `EMPTY_IMAGE_FILE` | empty_image_file |
|
||||||
|
| `FAILED_TO_DOWNLOAD_IMAGE` | failed_to_download_image |
|
||||||
|
| `IMAGE_FILE_NOT_FOUND` | image_file_not_found |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# CompletionChoice
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
||||||
|
| `text` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `logprobs` | [Nullable[models.CompletionLogprobs]](../models/completionlogprobs.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `finish_reason` | [Nullable[models.CompletionFinishReason]](../models/completionfinishreason.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# CompletionCreateParams
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||||
|
| `prompt` | [models.Prompt](../models/prompt.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `best_of` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `echo` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
|
||||||
|
| `logprobs` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `n` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `stop` | [OptionalNullable[models.CompletionCreateParamsStop]](../models/completioncreateparamsstop.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `stream_options` | [OptionalNullable[models.StreamOptions]](../models/streamoptions.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `suffix` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
|
||||||
|
| `response_format` | [OptionalNullable[models.CompletionCreateParamsResponseFormatUnion]](../models/completioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# CompletionCreateParamsResponseFormatJSONObject
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------ | ------------------------ | ------------------------ | ------------------------ |
|
||||||
|
| `type` | *Literal["json_object"]* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# CompletionCreateParamsResponseFormatPython
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------- | ------------------- | ------------------- | ------------------- |
|
||||||
|
| `type` | *Literal["python"]* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# CompletionCreateParamsResponseFormatText
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
|
| `type` | *Literal["text"]* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# CompletionCreateParamsResponseFormatUnion
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `models.CompletionCreateParamsResponseFormatText`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.CompletionCreateParamsResponseFormatText = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `models.CompletionCreateParamsResponseFormatJSONObject`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.CompletionCreateParamsResponseFormatJSONObject = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `models.ResponseFormatJSONSchema`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.ResponseFormatJSONSchema = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `models.ResponseFormatTextGrammar`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.ResponseFormatTextGrammar = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `models.CompletionCreateParamsResponseFormatPython`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.CompletionCreateParamsResponseFormatPython = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# CompletionCreateParamsStop
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `str`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: str = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `List[str]`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: List[str] = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# CompletionFinishReason
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ---------------- | ---------------- |
|
||||||
|
| `STOP` | stop |
|
||||||
|
| `LENGTH` | length |
|
||||||
|
| `CONTENT_FILTER` | content_filter |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# CompletionLogprobs
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------ | ------------------------ | ------------------------ | ------------------------ |
|
||||||
|
| `tokens` | List[*str*] | :heavy_check_mark: | N/A |
|
||||||
|
| `token_logprobs` | List[*float*] | :heavy_check_mark: | N/A |
|
||||||
|
| `top_logprobs` | List[Dict[str, *float*]] | :heavy_check_mark: | N/A |
|
||||||
|
| `text_offset` | List[*float*] | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# CompletionResponse
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
|
||||||
|
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `object` | *Literal["text_completion"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `created` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `system_fingerprint` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `choices` | List[[models.CompletionChoice](../models/completionchoice.md)] | :heavy_check_mark: | N/A |
|
||||||
|
| `usage` | [Optional[models.CompletionUsage]](../models/completionusage.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# CompletionTokensDetails
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- |
|
||||||
|
| `reasoning_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `audio_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `accepted_prediction_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `rejected_prediction_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# CompletionUsage
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------- | ------------------- | ------------------- | ------------------- |
|
||||||
|
| `prompt_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `completion_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `total_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# CostDetails
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- |
|
||||||
|
| `upstream_inference_cost` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `upstream_inference_input_cost` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `upstream_inference_output_cost` | *float* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# CreateAuthKeysCodeCodeChallengeMethod
|
||||||
|
|
||||||
|
The method used to generate the code challenge
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ------- | ------- |
|
||||||
|
| `S256` | S256 |
|
||||||
|
| `PLAIN` | plain |
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# CreateAuthKeysCodeData
|
||||||
|
|
||||||
|
Auth code data
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
|
||||||
|
| `id` | *str* | :heavy_check_mark: | The authorization code ID to use in the exchange request | auth_code_xyz789 |
|
||||||
|
| `app_id` | *float* | :heavy_check_mark: | The application ID associated with this auth code | 12345 |
|
||||||
|
| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the auth code was created | 2025-08-24T10:30:00Z |
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# CreateAuthKeysCodeRequest
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. | https://myapp.com/auth/callback |
|
||||||
|
| `code_challenge` | *Optional[str]* | :heavy_minus_sign: | PKCE code challenge for enhanced security | E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM |
|
||||||
|
| `code_challenge_method` | [Optional[models.CreateAuthKeysCodeCodeChallengeMethod]](../models/createauthkeyscodecodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 |
|
||||||
|
| `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 |
|
||||||
|
| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | |
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# CreateAuthKeysCodeResponse
|
||||||
|
|
||||||
|
Successfully created authorization code
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
||||||
|
| `data` | [models.CreateAuthKeysCodeData](../models/createauthkeyscodedata.md) | :heavy_check_mark: | Auth code data | {<br/>"id": "auth_code_xyz789",<br/>"app_id": 12345,<br/>"created_at": "2025-08-24T10:30:00Z"<br/>} |
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# CreateChargeRequest
|
||||||
|
|
||||||
|
Create a Coinbase charge for crypto payment
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------------------- | -------------------------------------- | -------------------------------------- | -------------------------------------- |
|
||||||
|
| `amount` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `sender` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `chain_id` | [models.ChainID](../models/chainid.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# CreateCoinbaseChargeData
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
|
||||||
|
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `created_at` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `expires_at` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `web3_data` | [models.Web3Data](../models/web3data.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# CreateCoinbaseChargeResponse
|
||||||
|
|
||||||
|
Returns the calldata to fulfill the transaction
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
|
||||||
|
| `data` | [models.CreateCoinbaseChargeData](../models/createcoinbasechargedata.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# CreateCoinbaseChargeSecurity
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
|
| `bearer` | *str* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# CreateEmbeddingsData
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ |
|
||||||
|
| `object` | [models.ObjectEmbedding](../models/objectembedding.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `embedding` | [models.Embedding](../models/embedding.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# CreateEmbeddingsDataCollection
|
||||||
|
|
||||||
|
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,17 @@
|
|||||||
|
# CreateEmbeddingsIgnore
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `models.ProviderName`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.ProviderName = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `str`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: str = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# CreateEmbeddingsMaxPrice
|
||||||
|
|
||||||
|
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- |
|
||||||
|
| `prompt` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||||
|
| `completion` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||||
|
| `image` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||||
|
| `audio` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||||
|
| `request` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# CreateEmbeddingsObject
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ------ | ------ |
|
||||||
|
| `LIST` | list |
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# CreateEmbeddingsOnly
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `models.ProviderName`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.ProviderName = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `str`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: str = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# CreateEmbeddingsOrder
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `models.ProviderName`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: models.ProviderName = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `str`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: str = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user