mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-31 12:30:30 +08:00
Compare commits
168
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ed54a1126 | ||
|
|
66b020ff43 | ||
|
|
7e29e408af | ||
|
|
30bc131b97 | ||
|
|
1b0118c365 | ||
|
|
cda73e5ebf | ||
|
|
b0eda78d3f | ||
|
|
bf682bdb62 | ||
|
|
b322622117 | ||
|
|
415450e785 | ||
|
|
1d488f0117 | ||
|
|
4e789208b4 | ||
|
|
cdd4dc7302 | ||
|
|
60708e1e8b | ||
|
|
5a324f99ae | ||
|
|
d5778dfafb | ||
|
|
68c251830c | ||
|
|
2aa2d73d2d | ||
|
|
58bd390fbd | ||
|
|
2707901239 | ||
|
|
a5ed2de8a8 | ||
|
|
21893dda58 | ||
|
|
758a2f3d49 | ||
|
|
0331f14f19 | ||
|
|
138b131a35 | ||
|
|
55c0d5c7fd | ||
|
|
e98a7a8260 | ||
|
|
7e7787cb23 | ||
|
|
c4b508f045 | ||
|
|
52e7853d21 | ||
|
|
d43061f722 | ||
|
|
7b10fd47d8 | ||
|
|
95f2c87bfa | ||
|
|
c756fc51e0 | ||
|
|
386db75669 | ||
|
|
e3dc2e6f4c | ||
|
|
70c8757fc0 | ||
|
|
b794150ed9 | ||
|
|
0f116c9792 | ||
|
|
0c735989c1 | ||
|
|
3b2f5b2316 | ||
|
|
3883438f02 | ||
|
|
1cd1e66e2d | ||
|
|
f29a61de7e | ||
|
|
1725abad89 | ||
|
|
8df520997d | ||
|
|
c4843278fd | ||
|
|
ccbd6d16f8 | ||
|
|
80646bd8a6 | ||
|
|
68fc6f0ee9 | ||
|
|
23ee599564 | ||
|
|
2203de96b4 | ||
|
|
b7d5098042 | ||
|
|
b9f588d84b | ||
|
|
5caa85a52c | ||
|
|
fc328cd45d | ||
|
|
234901509f | ||
|
|
771a5b1a52 | ||
|
|
93dd1b59fd | ||
|
|
698e7d6d7e | ||
|
|
fe4080dfda | ||
|
|
1090ab30b2 | ||
|
|
51a8873f33 | ||
|
|
a95178f8b3 | ||
|
|
63b73f57d4 | ||
|
|
6ceb25ca84 | ||
|
|
b5aca7806b | ||
|
|
4610ea4719 | ||
|
|
67bd50597a | ||
|
|
859e89d545 | ||
|
|
f94fcc1eb1 | ||
|
|
c361f61f5b | ||
|
|
f119275b26 | ||
|
|
460658428f | ||
|
|
5d441447a9 | ||
|
|
d549103228 | ||
|
|
3e77e61a5c | ||
|
|
e0dddac466 | ||
|
|
32c6c506cf | ||
|
|
59a8775ed7 | ||
|
|
e7a06917b2 | ||
|
|
d8c617dfd2 | ||
|
|
752156a9ad | ||
|
|
688c063276 | ||
|
|
da19555f7f | ||
|
|
0ecf2ef253 | ||
|
|
a7fd661299 | ||
|
|
c5e2532cc4 | ||
|
|
0aa6eabffd | ||
|
|
205749ae6b | ||
|
|
bf8a2c6adc | ||
|
|
9312cabf22 | ||
|
|
ec85ab283b | ||
|
|
4c5911ffee | ||
|
|
882f4a0811 | ||
|
|
90f661ff73 | ||
|
|
bb74b7fabc | ||
|
|
a7bb403311 | ||
|
|
522b03abf3 | ||
|
|
be479e24fd | ||
|
|
a4197ac1db | ||
|
|
f587c3ce45 | ||
|
|
a4ae8297ce | ||
|
|
4664c73492 | ||
|
|
e150991aa7 | ||
|
|
5f18dd0131 | ||
|
|
5441e86fee | ||
|
|
bb505b71e5 | ||
|
|
45c3ace681 | ||
|
|
d208cc6cf8 | ||
|
|
fb31150e8f | ||
|
|
e0e80c538a | ||
|
|
7db74e51d1 | ||
|
|
27c12d4d59 | ||
|
|
cd24443470 | ||
|
|
2fc0ea8084 | ||
|
|
330cff1158 | ||
|
|
8ac9dede84 | ||
|
|
c10bbfe084 | ||
|
|
3d1fdef97a | ||
|
|
067cdc027a | ||
|
|
5bad276c29 | ||
|
|
f3699017d5 | ||
|
|
b202e599ae | ||
|
|
be9056bcbe | ||
|
|
cb23cec150 | ||
|
|
312ffce1c5 | ||
|
|
c5e87b6ab2 | ||
|
|
a23c20f60b | ||
|
|
e6703a5038 | ||
|
|
9ce403745a | ||
|
|
175b135377 | ||
|
|
0503928934 | ||
|
|
6006c3a84f | ||
|
|
c2a933ff6b | ||
|
|
a34a1456a1 | ||
|
|
a40c0019c1 | ||
|
|
5881e47375 | ||
|
|
6989ad4f40 | ||
|
|
b2386114cd | ||
|
|
2bba049182 | ||
|
|
e8953c70bd | ||
|
|
29fdfcedc3 | ||
|
|
c0959955c1 | ||
|
|
a0a7edecfa | ||
|
|
4e84bb736b | ||
|
|
947e92e68d | ||
|
|
bdbd8becc2 | ||
|
|
6ef088e7c7 | ||
|
|
e4e5cc259a | ||
|
|
06bea2ae0f | ||
|
|
6b1b7e6a9d | ||
|
|
dd8e6bdac2 | ||
|
|
e6b0242969 | ||
|
|
5ab44f08f0 | ||
|
|
e72a84e82d | ||
|
|
c734c52d9c | ||
|
|
b2098ff28e | ||
|
|
1cad51abb6 | ||
|
|
0c791b04d1 | ||
|
|
5f2c0ee2ea | ||
|
|
5832c0495b | ||
|
|
f5dfc30997 | ||
|
|
a56ffbf5f3 | ||
|
|
cc2b002c5c | ||
|
|
9774c726fd | ||
|
|
3a40848aab | ||
|
|
f190e3f950 |
@@ -0,0 +1,86 @@
|
||||
name: Auto-merge Speakeasy PR
|
||||
|
||||
# Speakeasy mode:pr opens PRs (speakeasy-sdk-regen-*) and labels them
|
||||
# patch/minor/major. Merge automatically so sdk_publish.yaml can run.
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [labeled]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
concurrency:
|
||||
group: auto-merge-speakeasy
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
auto-merge:
|
||||
if: |
|
||||
github.event.sender.login == 'github-actions[bot]' &&
|
||||
github.event.pull_request.user.login == 'github-actions[bot]' &&
|
||||
startsWith(github.event.pull_request.head.ref, 'speakeasy-sdk-regen-') &&
|
||||
contains(github.event.pull_request.title, '🐝 Update SDK') &&
|
||||
contains(fromJSON('["patch", "minor", "major"]'), github.event.label.name)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Close superseded Speakeasy PRs
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
CURRENT_PR="${{ github.event.pull_request.number }}"
|
||||
|
||||
PRIOR_JSON=$(gh pr list \
|
||||
--repo "${{ github.repository }}" \
|
||||
--state open \
|
||||
--search "head:speakeasy-sdk-regen-" \
|
||||
--limit 500 \
|
||||
--json number \
|
||||
| jq -r --arg cur "$CURRENT_PR" \
|
||||
'[.[].number | select(tostring != $cur)] | .[]')
|
||||
|
||||
if [ -z "$PRIOR_JSON" ]; then
|
||||
echo "No superseded Speakeasy PRs to close"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mapfile -t PRIOR <<< "$PRIOR_JSON"
|
||||
|
||||
echo "Closing ${#PRIOR[@]} superseded Speakeasy PR(s)"
|
||||
for N in "${PRIOR[@]}"; do
|
||||
gh pr close "$N" --repo "${{ github.repository }}" --delete-branch \
|
||||
--comment "Superseded by newer Speakeasy SDK generation PR #${CURRENT_PR}" \
|
||||
|| echo "::warning::Failed to close PR #$N (continuing)"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
- name: Auto-merge Speakeasy PR
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
PR_NUM="${{ github.event.pull_request.number }}"
|
||||
REPO="${{ github.repository }}"
|
||||
|
||||
STATE=$(gh pr view "$PR_NUM" --repo "$REPO" --json state --jq .state)
|
||||
if [ "$STATE" != "OPEN" ]; then
|
||||
echo "PR #$PR_NUM is $STATE — skipping merge"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Prefer GitHub auto-merge when required checks exist; otherwise
|
||||
# squash-merge directly (same pattern as sdk-release-prs.yaml).
|
||||
AUTO_MERGE_NOOP_PATTERN='is in clean status|protected branch rules|Branch does not have required protected branch rules'
|
||||
if gh pr merge "$PR_NUM" --repo "$REPO" --squash --auto --delete-branch 2> /tmp/gh-merge.err; then
|
||||
echo "Auto-merge enabled for Speakeasy PR #$PR_NUM"
|
||||
elif grep -qiE "$AUTO_MERGE_NOOP_PATTERN" /tmp/gh-merge.err; then
|
||||
echo "Auto-merge not applicable — merging PR #$PR_NUM directly"
|
||||
cat /tmp/gh-merge.err >&2
|
||||
gh pr merge "$PR_NUM" --repo "$REPO" --squash --delete-branch
|
||||
else
|
||||
echo "::error::Failed to enable auto-merge on Speakeasy PR #$PR_NUM"
|
||||
cat /tmp/gh-merge.err >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,36 @@
|
||||
name: Generate (spec change merged)
|
||||
permissions:
|
||||
checks: write
|
||||
contents: write
|
||||
pull-requests: write
|
||||
statuses: write
|
||||
id-token: write
|
||||
"on":
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
force:
|
||||
description: Force generation of SDKs
|
||||
type: boolean
|
||||
default: false
|
||||
set_version:
|
||||
description: optionally set a specific SDK version
|
||||
type: string
|
||||
pull_request:
|
||||
types: [closed]
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- .speakeasy/in.openapi.yaml
|
||||
|
||||
jobs:
|
||||
generate:
|
||||
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
|
||||
uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
|
||||
with:
|
||||
force: ${{ github.event.inputs.force }}
|
||||
mode: pr
|
||||
set_version: ${{ github.event.inputs.set_version }}
|
||||
secrets:
|
||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
pypi_token: ${{ secrets.PYPI_TOKEN }}
|
||||
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
|
||||
+14
-2
@@ -1,13 +1,25 @@
|
||||
.venv/
|
||||
venv/
|
||||
src/*.egg-info/
|
||||
**/__pycache__/
|
||||
.pytest_cache/
|
||||
.python-version
|
||||
.DS_Store
|
||||
pyrightconfig.json
|
||||
**/.speakeasy/temp/
|
||||
**/.speakeasy/logs/
|
||||
.speakeasy/reports
|
||||
# Build artifacts
|
||||
/dist
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*.egg-info/
|
||||
*.egg
|
||||
# Speakeasy generation artifacts (generated in OSS repo, not here)
|
||||
.speakeasy/*.lock
|
||||
.speakeasy/*.openapi.yaml
|
||||
/docs
|
||||
# Environment
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
.DS_Store
|
||||
.venv/
|
||||
|
||||
+9758
-832
File diff suppressed because it is too large
Load Diff
+7
-1
@@ -25,13 +25,14 @@ generation:
|
||||
schemas:
|
||||
allOfMergeStrategy: shallowMerge
|
||||
requestBodyFieldName: ""
|
||||
persistentEdits: {}
|
||||
tests:
|
||||
generateTests: false
|
||||
generateNewTests: true
|
||||
skipResponseBodyAssertions: false
|
||||
preApplyUnionDiscriminators: true
|
||||
python:
|
||||
version: 0.0.22
|
||||
version: 0.10.1
|
||||
additionalDependencies:
|
||||
dev: {}
|
||||
main: {}
|
||||
@@ -39,11 +40,14 @@ python:
|
||||
- id
|
||||
- object
|
||||
- input
|
||||
- models
|
||||
- hash
|
||||
asyncMode: both
|
||||
authors:
|
||||
- OpenRouter
|
||||
baseErrorName: OpenRouterError
|
||||
clientServerStatusCodesAsErrors: true
|
||||
constFieldCasing: upper
|
||||
defaultErrorName: OpenRouterDefaultError
|
||||
description: Official Python Client SDK for OpenRouter.
|
||||
enableCustomCodeRegions: false
|
||||
@@ -55,6 +59,7 @@ python:
|
||||
flattenGlobalSecurity: true
|
||||
flattenRequests: true
|
||||
flatteningOrder: parameters-first
|
||||
forwardCompatibleUnionsByDefault: tagged-only
|
||||
imports:
|
||||
option: openapi
|
||||
paths:
|
||||
@@ -75,6 +80,7 @@ python:
|
||||
outputModelSuffix: output
|
||||
packageManager: uv
|
||||
packageName: openrouter
|
||||
preApplyUnionDiscriminators: false
|
||||
pytestFilterWarnings: []
|
||||
pytestTimeout: 0
|
||||
responseFormat: flat
|
||||
|
||||
+31873
-7970
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
lintVersion: 1.0.0
|
||||
defaultRuleset: openrouter
|
||||
rulesets:
|
||||
openrouter:
|
||||
rulesets:
|
||||
- speakeasy-recommended
|
||||
- speakeasy-generation
|
||||
rules:
|
||||
oas3-missing-example:
|
||||
severity: "off"
|
||||
+31881
-8015
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,18 @@
|
||||
overlay: 1.0.0
|
||||
x-speakeasy-jsonpath: rfc9535
|
||||
info:
|
||||
title: Add HTTP-Referer and X-Title as global parameters
|
||||
title: Add HTTP-Referer and X-OpenRouter-Title as global parameters
|
||||
version: 0.0.0
|
||||
actions:
|
||||
# Add global parameters for app identification
|
||||
- target: $
|
||||
description: Add x-speakeasy-globals for HTTP-Referer and X-Title headers
|
||||
description: Add x-speakeasy-globals for HTTP-Referer, X-OpenRouter-Title, and X-OpenRouter-Categories headers
|
||||
update:
|
||||
x-speakeasy-globals:
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/AppIdentifier"
|
||||
- $ref: "#/components/parameters/AppDisplayName"
|
||||
- $ref: "#/components/parameters/AppCategories"
|
||||
|
||||
# Add component parameters
|
||||
- target: $.components
|
||||
@@ -27,9 +28,25 @@ actions:
|
||||
The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
This is used to track API usage per application.
|
||||
AppDisplayName:
|
||||
name: X-Title
|
||||
name: X-OpenRouter-Title
|
||||
in: header
|
||||
schema:
|
||||
type: string
|
||||
description: |
|
||||
The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
||||
AppCategories:
|
||||
name: X-OpenRouter-Categories
|
||||
in: header
|
||||
schema:
|
||||
type: string
|
||||
description: |
|
||||
Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
||||
|
||||
# Add header parameters to all paths so Speakeasy matches them with globals
|
||||
- target: $.paths[*]
|
||||
description: Reference app identification headers on all paths so Speakeasy injects them via globals
|
||||
update:
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/AppIdentifier"
|
||||
- $ref: "#/components/parameters/AppDisplayName"
|
||||
- $ref: "#/components/parameters/AppCategories"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
overlay: 1.0.0
|
||||
x-speakeasy-jsonpath: rfc9535
|
||||
info:
|
||||
title: Simplify redundant allOf inline schemas
|
||||
version: 0.0.0
|
||||
actions:
|
||||
- target: "$..allOf[?@.enum && !@['$ref']]"
|
||||
description: >
|
||||
Remove inline enum definitions that duplicate a $ref enum in the same
|
||||
allOf. These are artifacts from zod-openapi .extend() serialization.
|
||||
remove: true
|
||||
@@ -0,0 +1,10 @@
|
||||
overlay: 1.0.0
|
||||
x-speakeasy-jsonpath: rfc9535
|
||||
info:
|
||||
title: Convert boolean query params from string to boolean
|
||||
version: 0.0.0
|
||||
actions:
|
||||
- target: $..parameters[?@.schema["x-openrouter-type"] == "boolean"].schema
|
||||
description: Convert x-openrouter-type boolean params from string to boolean
|
||||
update:
|
||||
type: boolean
|
||||
@@ -0,0 +1,10 @@
|
||||
overlay: 1.0.0
|
||||
x-speakeasy-jsonpath: rfc9535
|
||||
info:
|
||||
title: Fix nullable pagination params
|
||||
version: 0.0.0
|
||||
actions:
|
||||
- target: $..parameters[?@.name == "offset" && @.in == "query"].schema
|
||||
description: Remove nullable from offset query params to fix mypy errors in pagination helpers
|
||||
update:
|
||||
nullable: false
|
||||
+11
-13
@@ -1,29 +1,24 @@
|
||||
speakeasyVersion: 1.666.0
|
||||
speakeasyVersion: 1.680.0
|
||||
sources:
|
||||
-OAS:
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:f1b59b9b643de5e20d6e3299a8274783d8c0854615876f5d7f6f081814842695
|
||||
sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553
|
||||
tags:
|
||||
- latest
|
||||
OpenRouter API:
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:b128cdb6be96021e55feea5e2dcb6e7438de706138fcde4f871b14877885445b
|
||||
sourceBlobDigest: sha256:8b15f72eaabbd77f4642be28a2861fd1cfd5d8cfe96e72fb8a76832387c64fab
|
||||
sourceRevisionDigest: sha256:6ca77315c3cd31ab7e308e010b26b7c9eb366b11b78ea9c71179facc4daaf97b
|
||||
sourceBlobDigest: sha256:8bada810c7c5ddb302c51dbbbb36dd0c9a45c4ba1c5e44af1646f69fc2a38751
|
||||
tags:
|
||||
- latest
|
||||
- speakeasy-sdk-regen-1781818757
|
||||
- 1.0.0
|
||||
targets:
|
||||
open-router:
|
||||
source: OpenRouter API
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:b128cdb6be96021e55feea5e2dcb6e7438de706138fcde4f871b14877885445b
|
||||
sourceBlobDigest: sha256:8b15f72eaabbd77f4642be28a2861fd1cfd5d8cfe96e72fb8a76832387c64fab
|
||||
sourceRevisionDigest: sha256:6ca77315c3cd31ab7e308e010b26b7c9eb366b11b78ea9c71179facc4daaf97b
|
||||
sourceBlobDigest: sha256:8bada810c7c5ddb302c51dbbbb36dd0c9a45c4ba1c5e44af1646f69fc2a38751
|
||||
codeSamplesNamespace: open-router-python-code-samples
|
||||
codeSamplesRevisionDigest: sha256:92747cd4c744e6671784b73c124d89adc662799d11caf5e6573880f6bfb52405
|
||||
codeSamplesRevisionDigest: sha256:80ceff338c097e19bf3951fd00e8010fc7c102b916a684eeec33d507b7a3844f
|
||||
workflow:
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: 1.666.0
|
||||
speakeasyVersion: 1.680.0
|
||||
sources:
|
||||
OpenRouter API:
|
||||
inputs:
|
||||
@@ -32,6 +27,9 @@ workflow:
|
||||
- location: .speakeasy/overlays/open-enums.overlay.yaml
|
||||
- location: .speakeasy/overlays/remove-rss-responses.overlay.yaml
|
||||
- location: .speakeasy/overlays/add-headers.overlay.yaml
|
||||
- location: .speakeasy/overlays/allof-simplify.overlay.yaml
|
||||
- location: .speakeasy/overlays/boolean-query-params.overlay.yaml
|
||||
- location: .speakeasy/overlays/fix-nullable-pagination.overlay.yaml
|
||||
output: .speakeasy/out.openapi.yaml
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: 1.666.0
|
||||
speakeasyVersion: 1.680.0
|
||||
sources:
|
||||
OpenRouter API:
|
||||
inputs:
|
||||
@@ -8,6 +8,9 @@ sources:
|
||||
- location: .speakeasy/overlays/open-enums.overlay.yaml
|
||||
- location: .speakeasy/overlays/remove-rss-responses.overlay.yaml
|
||||
- location: .speakeasy/overlays/add-headers.overlay.yaml
|
||||
- location: .speakeasy/overlays/allof-simplify.overlay.yaml
|
||||
- location: .speakeasy/overlays/boolean-query-params.overlay.yaml
|
||||
- location: .speakeasy/overlays/fix-nullable-pagination.overlay.yaml
|
||||
output: .speakeasy/out.openapi.yaml
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# OpenRouter Python SDK
|
||||
|
||||
The OpenRouter Python SDK is a type-safe toolkit for building AI applications with access to 300+ language models through a unified API.
|
||||
The OpenRouter Python SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.
|
||||
|
||||
## Why use the OpenRouter SDK?
|
||||
|
||||
|
||||
+72
-9
@@ -1,6 +1,6 @@
|
||||
# OpenRouter SDK (Beta)
|
||||
# OpenRouter SDK
|
||||
|
||||
The [OpenRouter SDK](https://openrouter.ai/docs/sdks/python) is a Python toolkit designed to help you build AI-powered features and solutions. Giving you easy access to over 300 models across providers in an easy and type-safe way.
|
||||
The [OpenRouter SDK](https://openrouter.ai/docs/sdks/python) is a Python toolkit designed to help you build AI-powered features and solutions. Giving you easy access to 400+ models across providers in an easy and type-safe way.
|
||||
|
||||
To learn more about how to use the OpenRouter SDK, check out our [API Reference](https://openrouter.ai/docs/sdks/python/reference) and [Documentation](https://openrouter.ai/docs/sdks/python).
|
||||
|
||||
@@ -169,6 +169,69 @@ asyncio.run(main())
|
||||
|
||||
<!-- No Custom HTTP Client [http-client] -->
|
||||
|
||||
<!-- Start Pagination [pagination] -->
|
||||
## Pagination
|
||||
|
||||
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
|
||||
returned response object will have a `Next` method that can be called to pull down the next group of results. If the
|
||||
return value of `Next` is `None`, then there are no more pages to be fetched.
|
||||
|
||||
Here's an example of one such pagination call:
|
||||
```python
|
||||
from openrouter import OpenRouter
|
||||
import os
|
||||
|
||||
|
||||
with OpenRouter(
|
||||
http_referer="<value>",
|
||||
x_open_router_title="<value>",
|
||||
x_open_router_categories="<value>",
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.byok.list()
|
||||
|
||||
while res is not None:
|
||||
# Handle items
|
||||
|
||||
res = res.next()
|
||||
|
||||
```
|
||||
<!-- End Pagination [pagination] -->
|
||||
|
||||
<!-- Start File uploads [file-upload] -->
|
||||
## File uploads
|
||||
|
||||
Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
|
||||
|
||||
> [!TIP]
|
||||
>
|
||||
> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.
|
||||
>
|
||||
|
||||
```python
|
||||
from openrouter import OpenRouter
|
||||
import os
|
||||
|
||||
|
||||
with OpenRouter(
|
||||
http_referer="<value>",
|
||||
x_open_router_title="<value>",
|
||||
x_open_router_categories="<value>",
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.files.upload(file={
|
||||
"file_name": "example.file",
|
||||
"content": open("example.file", "rb"),
|
||||
})
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
```
|
||||
<!-- End File uploads [file-upload] -->
|
||||
|
||||
<!-- Start Resource Management [resource-management] -->
|
||||
## Resource Management
|
||||
|
||||
@@ -182,6 +245,9 @@ import os
|
||||
def main():
|
||||
|
||||
with OpenRouter(
|
||||
http_referer="<value>",
|
||||
x_open_router_title="<value>",
|
||||
x_open_router_categories="<value>",
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
# Rest of application here...
|
||||
@@ -191,6 +257,9 @@ def main():
|
||||
async def amain():
|
||||
|
||||
async with OpenRouter(
|
||||
http_referer="<value>",
|
||||
x_open_router_title="<value>",
|
||||
x_open_router_categories="<value>",
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
# Rest of application here...
|
||||
@@ -240,10 +309,4 @@ To run the test suite, you'll need to set up your environment with an OpenRouter
|
||||
|
||||
```bash
|
||||
pytest
|
||||
```
|
||||
|
||||
## 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.
|
||||
```
|
||||
@@ -1,6 +1,6 @@
|
||||
# OpenRouter SDK (Beta)
|
||||
# OpenRouter SDK
|
||||
|
||||
The [OpenRouter SDK](https://openrouter.ai/docs/sdks/python) is a Python toolkit designed to help you build AI-powered features and solutions. Giving you easy access to over 300 models across providers in an easy and type-safe way.
|
||||
The [OpenRouter SDK](https://openrouter.ai/docs/sdks/python) is a Python toolkit designed to help you build AI-powered features and solutions. Giving you easy access to 400+ models across providers in an easy and type-safe way.
|
||||
|
||||
To learn more about how to use the OpenRouter SDK, check out our [API Reference](https://openrouter.ai/docs/sdks/python/reference) and [Documentation](https://openrouter.ai/docs/sdks/python).
|
||||
|
||||
@@ -169,6 +169,69 @@ asyncio.run(main())
|
||||
|
||||
<!-- No Custom HTTP Client [http-client] -->
|
||||
|
||||
<!-- Start Pagination [pagination] -->
|
||||
## Pagination
|
||||
|
||||
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
|
||||
returned response object will have a `Next` method that can be called to pull down the next group of results. If the
|
||||
return value of `Next` is `None`, then there are no more pages to be fetched.
|
||||
|
||||
Here's an example of one such pagination call:
|
||||
```python
|
||||
from openrouter import OpenRouter
|
||||
import os
|
||||
|
||||
|
||||
with OpenRouter(
|
||||
http_referer="<value>",
|
||||
x_open_router_title="<value>",
|
||||
x_open_router_categories="<value>",
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.byok.list()
|
||||
|
||||
while res is not None:
|
||||
# Handle items
|
||||
|
||||
res = res.next()
|
||||
|
||||
```
|
||||
<!-- End Pagination [pagination] -->
|
||||
|
||||
<!-- Start File uploads [file-upload] -->
|
||||
## File uploads
|
||||
|
||||
Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
|
||||
|
||||
> [!TIP]
|
||||
>
|
||||
> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.
|
||||
>
|
||||
|
||||
```python
|
||||
from openrouter import OpenRouter
|
||||
import os
|
||||
|
||||
|
||||
with OpenRouter(
|
||||
http_referer="<value>",
|
||||
x_open_router_title="<value>",
|
||||
x_open_router_categories="<value>",
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.files.upload(file={
|
||||
"file_name": "example.file",
|
||||
"content": open("example.file", "rb"),
|
||||
})
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
```
|
||||
<!-- End File uploads [file-upload] -->
|
||||
|
||||
<!-- Start Resource Management [resource-management] -->
|
||||
## Resource Management
|
||||
|
||||
@@ -182,6 +245,9 @@ import os
|
||||
def main():
|
||||
|
||||
with OpenRouter(
|
||||
http_referer="<value>",
|
||||
x_open_router_title="<value>",
|
||||
x_open_router_categories="<value>",
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
# Rest of application here...
|
||||
@@ -191,6 +257,9 @@ def main():
|
||||
async def amain():
|
||||
|
||||
async with OpenRouter(
|
||||
http_referer="<value>",
|
||||
x_open_router_title="<value>",
|
||||
x_open_router_categories="<value>",
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
# Rest of application here...
|
||||
@@ -240,10 +309,4 @@ To run the test suite, you'll need to set up your environment with an OpenRouter
|
||||
|
||||
```bash
|
||||
pytest
|
||||
```
|
||||
|
||||
## 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.
|
||||
```
|
||||
+31
-1
@@ -8,4 +8,34 @@ Based on:
|
||||
### Generated
|
||||
- [python v0.0.16] .
|
||||
### Releases
|
||||
- [PyPI v0.0.16] https://pypi.org/project/openrouter/0.0.16 - .
|
||||
- [PyPI v0.0.16] https://pypi.org/project/openrouter/0.0.16 - .
|
||||
|
||||
## 2026-06-11 00:55:55
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.9.2] .
|
||||
### Releases
|
||||
- [PyPI v0.9.2] https://pypi.org/project/openrouter/0.9.2 - .
|
||||
|
||||
## 2026-06-17 00:59:07
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.10.0] .
|
||||
### Releases
|
||||
- [PyPI v0.10.0] https://pypi.org/project/openrouter/0.10.0 - .
|
||||
|
||||
## 2026-06-18 21:38:57
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.10.1] .
|
||||
### Releases
|
||||
- [PyPI v0.10.1] https://pypi.org/project/openrouter/0.10.1 - .
|
||||
@@ -6,15 +6,16 @@ import os
|
||||
|
||||
|
||||
with OpenRouter(
|
||||
http_referer="<value>",
|
||||
x_open_router_title="<value>",
|
||||
x_open_router_categories="<value>",
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.beta.responses.send(service_tier="auto", stream=False)
|
||||
res = open_router.analytics.get_user_activity()
|
||||
|
||||
with res as event_stream:
|
||||
for event in event_stream:
|
||||
# handle event
|
||||
print(event, flush=True)
|
||||
# Handle response
|
||||
print(res)
|
||||
```
|
||||
|
||||
</br>
|
||||
@@ -30,15 +31,16 @@ import os
|
||||
async def main():
|
||||
|
||||
async with OpenRouter(
|
||||
http_referer="<value>",
|
||||
x_open_router_title="<value>",
|
||||
x_open_router_categories="<value>",
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = await open_router.beta.responses.send_async(service_tier="auto", stream=False)
|
||||
res = await open_router.analytics.get_user_activity_async()
|
||||
|
||||
async with res as event_stream:
|
||||
async for event in event_stream:
|
||||
# handle event
|
||||
print(event, flush=True)
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
asyncio.run(main())
|
||||
```
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- |
|
||||
| `byok_usage_inference` | *float* | :heavy_check_mark: | BYOK inference cost in USD (external credits spent) | 0.012 |
|
||||
| `completion_tokens` | *int* | :heavy_check_mark: | Total completion tokens generated | 125 |
|
||||
| `date_` | *str* | :heavy_check_mark: | Date of the activity (YYYY-MM-DD format) | 2025-08-24 |
|
||||
| `endpoint_id` | *str* | :heavy_check_mark: | Unique identifier for the endpoint | 550e8400-e29b-41d4-a716-446655440000 |
|
||||
| `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 |
|
||||
| `prompt_tokens` | *int* | :heavy_check_mark: | Total prompt tokens used | 50 |
|
||||
| `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 |
|
||||
| `reasoning_tokens` | *int* | :heavy_check_mark: | Total reasoning tokens used | 25 |
|
||||
| `requests` | *int* | :heavy_check_mark: | Number of requests made | 5 |
|
||||
| `usage` | *float* | :heavy_check_mark: | Total cost in USD (OpenRouter credits spent) | 0.015 |
|
||||
@@ -7,8 +7,8 @@ Model architecture information
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
||||
| `tokenizer` | [Nullable[components.Tokenizer]](../components/tokenizer.md) | :heavy_check_mark: | N/A | GPT |
|
||||
| `instruct_type` | [Nullable[components.InstructType]](../components/instructtype.md) | :heavy_check_mark: | Instruction format type | |
|
||||
| `modality` | *Nullable[str]* | :heavy_check_mark: | Primary modality of the model | text |
|
||||
| `input_modalities` | List[[components.InputModality](../components/inputmodality.md)] | :heavy_check_mark: | Supported input modalities | |
|
||||
| `output_modalities` | List[[components.OutputModality](../components/outputmodality.md)] | :heavy_check_mark: | Supported output modalities | |
|
||||
| `instruct_type` | [Nullable[components.InstructType]](../components/instructtype.md) | :heavy_check_mark: | Instruction format type | chatml |
|
||||
| `modality` | *Nullable[str]* | :heavy_check_mark: | Primary modality of the model | text |
|
||||
| `output_modalities` | List[[components.OutputModality](../components/outputmodality.md)] | :heavy_check_mark: | Supported output modalities | |
|
||||
| `tokenizer` | [Nullable[components.Tokenizer]](../components/tokenizer.md) | :heavy_check_mark: | N/A | GPT |
|
||||
@@ -1,13 +0,0 @@
|
||||
# AssistantMessage
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
|
||||
| `role` | *Literal["assistant"]* | :heavy_check_mark: | N/A |
|
||||
| `content` | [OptionalNullable[components.AssistantMessageContent]](../components/assistantmessagecontent.md) | :heavy_minus_sign: | N/A |
|
||||
| `name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `tool_calls` | List[[components.ChatMessageToolCall](../components/chatmessagetoolcall.md)] | :heavy_minus_sign: | N/A |
|
||||
| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,17 +0,0 @@
|
||||
# AssistantMessageContent
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
### `List[components.ChatMessageContentItem]`
|
||||
|
||||
```python
|
||||
value: List[components.ChatMessageContentItem] = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# Sort
|
||||
# By
|
||||
|
||||
The provider sorting strategy (price, throughput, latency)
|
||||
|
||||
|
||||
## Values
|
||||
@@ -7,4 +9,5 @@
|
||||
| ------------ | ------------ |
|
||||
| `PRICE` | price |
|
||||
| `THROUGHPUT` | throughput |
|
||||
| `LATENCY` | latency |
|
||||
| `LATENCY` | latency |
|
||||
| `EXACTO` | exacto |
|
||||
@@ -1,10 +0,0 @@
|
||||
# ChainID
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| --------------------------------------------- | --------------------------------------------- |
|
||||
| `ONE` | 1 |
|
||||
| `ONE_HUNDRED_AND_THIRTY_SEVEN` | 137 |
|
||||
| `EIGHT_THOUSAND_FOUR_HUNDRED_AND_FIFTY_THREE` | 8453 |
|
||||
@@ -1,12 +0,0 @@
|
||||
# ChatCompletionFinishReason
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ---------------- | ---------------- |
|
||||
| `TOOL_CALLS` | tool_calls |
|
||||
| `STOP` | stop |
|
||||
| `LENGTH` | length |
|
||||
| `CONTENT_FILTER` | content_filter |
|
||||
| `ERROR` | error |
|
||||
@@ -1,11 +0,0 @@
|
||||
# ChatErrorError
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
|
||||
| `code` | [Nullable[components.Code]](../components/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 |
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatGenerationParamsDataCollection
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------- | ------- |
|
||||
| `DENY` | deny |
|
||||
| `ALLOW` | allow |
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatGenerationParamsEngine
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| -------- | -------- |
|
||||
| `NATIVE` | native |
|
||||
| `EXA` | exa |
|
||||
@@ -1,14 +0,0 @@
|
||||
# ChatGenerationParamsMaxPrice
|
||||
|
||||
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `prompt` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `completion` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `image` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `audio` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `request` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# ChatGenerationParamsPdf
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `engine` | [Optional[components.ChatGenerationParamsPdfEngine]](../components/chatgenerationparamspdfengine.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,10 +0,0 @@
|
||||
# ChatGenerationParamsPdfEngine
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------- | ------------- |
|
||||
| `MISTRAL_OCR` | mistral-ocr |
|
||||
| `PDF_TEXT` | pdf-text |
|
||||
| `NATIVE` | native |
|
||||
@@ -1,11 +0,0 @@
|
||||
# ChatGenerationParamsPluginFileParser
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
||||
| `id` | *Literal["file-parser"]* | :heavy_check_mark: | N/A |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `max_files` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
| `pdf` | [Optional[components.ChatGenerationParamsPdf]](../components/chatgenerationparamspdf.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# ChatGenerationParamsPluginModeration
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------- | ----------------------- | ----------------------- | ----------------------- |
|
||||
| `id` | *Literal["moderation"]* | :heavy_check_mark: | N/A |
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatGenerationParamsPluginResponseHealing
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------- | ----------------------------- | ----------------------------- | ----------------------------- |
|
||||
| `id` | *Literal["response-healing"]* | :heavy_check_mark: | N/A |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,29 +0,0 @@
|
||||
# ChatGenerationParamsPluginUnion
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.ChatGenerationParamsPluginModeration`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsPluginModeration = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsPluginWeb`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsPluginWeb = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsPluginFileParser`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsPluginFileParser = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsPluginResponseHealing`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsPluginResponseHealing = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# ChatGenerationParamsPluginWeb
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
||||
| `id` | *Literal["web"]* | :heavy_check_mark: | N/A |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `engine` | [Optional[components.ChatGenerationParamsEngine]](../components/chatgenerationparamsengine.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# ChatGenerationParamsResponseFormatJSONObject
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------ | ------------------------ | ------------------------ | ------------------------ |
|
||||
| `type` | *Literal["json_object"]* | :heavy_check_mark: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# ChatGenerationParamsResponseFormatPython
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------- | ------------------- | ------------------- | ------------------- |
|
||||
| `type` | *Literal["python"]* | :heavy_check_mark: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# ChatGenerationParamsResponseFormatText
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `type` | *Literal["text"]* | :heavy_check_mark: | N/A |
|
||||
@@ -1,35 +0,0 @@
|
||||
# ChatGenerationParamsResponseFormatUnion
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.ChatGenerationParamsResponseFormatText`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsResponseFormatText = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsResponseFormatJSONObject`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsResponseFormatJSONObject = /* values here */
|
||||
```
|
||||
|
||||
### `components.ResponseFormatJSONSchema`
|
||||
|
||||
```python
|
||||
value: components.ResponseFormatJSONSchema = /* values here */
|
||||
```
|
||||
|
||||
### `components.ResponseFormatTextGrammar`
|
||||
|
||||
```python
|
||||
value: components.ResponseFormatTextGrammar = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatGenerationParamsResponseFormatPython`
|
||||
|
||||
```python
|
||||
value: components.ChatGenerationParamsResponseFormatPython = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatGenerationParamsRoute
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ---------- | ---------- |
|
||||
| `FALLBACK` | fallback |
|
||||
| `SORT` | sort |
|
||||
@@ -1,12 +0,0 @@
|
||||
# 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[components.CompletionTokensDetails]](../components/completiontokensdetails.md) | :heavy_minus_sign: | N/A |
|
||||
| `prompt_tokens_details` | [OptionalNullable[components.PromptTokensDetails]](../components/prompttokensdetails.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,35 +0,0 @@
|
||||
# ChatMessageContentItem
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.ChatMessageContentItemText`
|
||||
|
||||
```python
|
||||
value: components.ChatMessageContentItemText = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatMessageContentItemImage`
|
||||
|
||||
```python
|
||||
value: components.ChatMessageContentItemImage = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatMessageContentItemAudio`
|
||||
|
||||
```python
|
||||
value: components.ChatMessageContentItemAudio = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatMessageContentItemVideo`
|
||||
|
||||
```python
|
||||
value: components.ChatMessageContentItemVideo = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatMessageContentItemVideo`
|
||||
|
||||
```python
|
||||
value: components.ChatMessageContentItemVideo = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatMessageContentItemAudio
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
|
||||
| `type` | *Literal["input_audio"]* | :heavy_check_mark: | N/A |
|
||||
| `input_audio` | [components.ChatMessageContentItemAudioInputAudio](../components/chatmessagecontentitemaudioinputaudio.md) | :heavy_check_mark: | N/A |
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatMessageContentItemAudioInputAudio
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `data` | *str* | :heavy_check_mark: | N/A |
|
||||
| `format_` | *str* | :heavy_check_mark: | N/A |
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatMessageContentItemCacheControl
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ |
|
||||
| `type` | *Literal["ephemeral"]* | :heavy_check_mark: | N/A |
|
||||
| `ttl` | [Optional[components.TTL]](../components/ttl.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatMessageContentItemImage
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ |
|
||||
| `type` | *Literal["image_url"]* | :heavy_check_mark: | N/A |
|
||||
| `image_url` | [components.ImageURL](../components/imageurl.md) | :heavy_check_mark: | N/A |
|
||||
@@ -1,10 +0,0 @@
|
||||
# ChatMessageContentItemImageDetail
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------ | ------ |
|
||||
| `AUTO` | auto |
|
||||
| `LOW` | low |
|
||||
| `HIGH` | high |
|
||||
@@ -1,10 +0,0 @@
|
||||
# ChatMessageContentItemText
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
||||
| `type` | *Literal["text"]* | :heavy_check_mark: | N/A |
|
||||
| `text` | *str* | :heavy_check_mark: | N/A |
|
||||
| `cache_control` | [Optional[components.ChatMessageContentItemCacheControl]](../components/chatmessagecontentitemcachecontrol.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,17 +0,0 @@
|
||||
# ChatMessageContentItemVideo
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.ChatMessageContentItemVideoInputVideo`
|
||||
|
||||
```python
|
||||
value: components.ChatMessageContentItemVideoInputVideo = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatMessageContentItemVideoVideoURL`
|
||||
|
||||
```python
|
||||
value: components.ChatMessageContentItemVideoVideoURL = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatMessageContentItemVideoInputVideo
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
|
||||
| `type` | *Literal["input_video"]* | :heavy_check_mark: | N/A |
|
||||
| `video_url` | [components.VideoURL1](../components/videourl1.md) | :heavy_check_mark: | N/A |
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatMessageContentItemVideoVideoURL
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
|
||||
| `type` | *Literal["video_url"]* | :heavy_check_mark: | N/A |
|
||||
| `video_url` | [components.VideoURL2](../components/videourl2.md) | :heavy_check_mark: | N/A |
|
||||
@@ -1,11 +0,0 @@
|
||||
# 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[[components.TopLogprob](../components/toplogprob.md)] | :heavy_check_mark: | N/A |
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatMessageTokenLogprobs
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
|
||||
| `content` | List[[components.ChatMessageTokenLogprob](../components/chatmessagetokenlogprob.md)] | :heavy_check_mark: | N/A |
|
||||
| `refusal` | List[[components.ChatMessageTokenLogprob](../components/chatmessagetokenlogprob.md)] | :heavy_check_mark: | N/A |
|
||||
@@ -1,10 +0,0 @@
|
||||
# ChatMessageToolCall
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
||||
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||
| `type` | *Literal["function"]* | :heavy_check_mark: | N/A |
|
||||
| `function` | [components.ChatMessageToolCallFunction](../components/chatmessagetoolcallfunction.md) | :heavy_check_mark: | N/A |
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatMessageToolCallFunction
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `name` | *str* | :heavy_check_mark: | N/A |
|
||||
| `arguments` | *str* | :heavy_check_mark: | N/A |
|
||||
@@ -1,14 +0,0 @@
|
||||
# ChatResponse
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
|
||||
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||
| `choices` | List[[components.ChatResponseChoice](../components/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[components.ChatGenerationTokenUsage]](../components/chatgenerationtokenusage.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,11 +0,0 @@
|
||||
# ChatResponseChoice
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
||||
| `finish_reason` | [Nullable[components.ChatCompletionFinishReason]](../components/chatcompletionfinishreason.md) | :heavy_check_mark: | N/A |
|
||||
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||
| `message` | [components.AssistantMessage](../components/assistantmessage.md) | :heavy_check_mark: | N/A |
|
||||
| `logprobs` | [OptionalNullable[components.ChatMessageTokenLogprobs]](../components/chatmessagetokenlogprobs.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,11 +0,0 @@
|
||||
# ChatStreamingChoice
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
||||
| `delta` | [components.ChatStreamingMessageChunk](../components/chatstreamingmessagechunk.md) | :heavy_check_mark: | N/A |
|
||||
| `finish_reason` | [Nullable[components.ChatCompletionFinishReason]](../components/chatcompletionfinishreason.md) | :heavy_check_mark: | N/A |
|
||||
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||
| `logprobs` | [OptionalNullable[components.ChatMessageTokenLogprobs]](../components/chatmessagetokenlogprobs.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,12 +0,0 @@
|
||||
# ChatStreamingMessageChunk
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `role` | [Optional[components.ChatStreamingMessageChunkRole]](../components/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[[components.ChatStreamingMessageToolCall](../components/chatstreamingmessagetoolcall.md)] | :heavy_minus_sign: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# ChatStreamingMessageChunkRole
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ----------- | ----------- |
|
||||
| `ASSISTANT` | assistant |
|
||||
@@ -1,11 +0,0 @@
|
||||
# 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[components.ChatStreamingMessageToolCallFunction]](../components/chatstreamingmessagetoolcallfunction.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatStreamingMessageToolCallFunction
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `arguments` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# ChatStreamingResponseChunk
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
||||
| `data` | [components.ChatStreamingResponseChunkData](../components/chatstreamingresponsechunkdata.md) | :heavy_check_mark: | N/A |
|
||||
@@ -1,15 +0,0 @@
|
||||
# ChatStreamingResponseChunkData
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
||||
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||
| `choices` | List[[components.ChatStreamingChoice](../components/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[components.ChatStreamingResponseChunkError]](../components/chatstreamingresponsechunkerror.md) | :heavy_minus_sign: | N/A |
|
||||
| `usage` | [Optional[components.ChatGenerationTokenUsage]](../components/chatgenerationtokenusage.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatStreamingResponseChunkError
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `message` | *str* | :heavy_check_mark: | N/A |
|
||||
| `code` | *float* | :heavy_check_mark: | N/A |
|
||||
@@ -1,8 +1,10 @@
|
||||
# ChatStreamOptions
|
||||
|
||||
Streaming configuration options
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `include_usage` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| ~~`include_usage`~~ | *Optional[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.<br/><br/>Deprecated: This field has no effect. Full usage details are always included. | true |
|
||||
+21
-13
@@ -1,17 +1,25 @@
|
||||
# Code
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
### `float`
|
||||
|
||||
```python
|
||||
value: float = /* values here */
|
||||
```
|
||||
## 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 |
|
||||
@@ -1,25 +0,0 @@
|
||||
# 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 |
|
||||
@@ -1,13 +0,0 @@
|
||||
# CompletionChoice
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
||||
| `text` | *str* | :heavy_check_mark: | N/A |
|
||||
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||
| `logprobs` | [Nullable[components.CompletionLogprobs]](../components/completionlogprobs.md) | :heavy_check_mark: | N/A |
|
||||
| `finish_reason` | [Nullable[components.CompletionFinishReason]](../components/completionfinishreason.md) | :heavy_check_mark: | N/A |
|
||||
| `native_finish_reason` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,28 +0,0 @@
|
||||
# CompletionCreateParams
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `prompt` | [components.Prompt](../components/prompt.md) | :heavy_check_mark: | N/A |
|
||||
| `best_of` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `echo` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
|
||||
| `logprobs` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `n` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `stop` | [OptionalNullable[components.CompletionCreateParamsStop]](../components/completioncreateparamsstop.md) | :heavy_minus_sign: | N/A |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `stream_options` | [OptionalNullable[components.StreamOptions]](../components/streamoptions.md) | :heavy_minus_sign: | N/A |
|
||||
| `suffix` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
|
||||
| `response_format` | [OptionalNullable[components.CompletionCreateParamsResponseFormatUnion]](../components/completioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# CompletionCreateParamsResponseFormatJSONObject
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------ | ------------------------ | ------------------------ | ------------------------ |
|
||||
| `type` | *Literal["json_object"]* | :heavy_check_mark: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# CompletionCreateParamsResponseFormatPython
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------- | ------------------- | ------------------- | ------------------- |
|
||||
| `type` | *Literal["python"]* | :heavy_check_mark: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# CompletionCreateParamsResponseFormatText
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `type` | *Literal["text"]* | :heavy_check_mark: | N/A |
|
||||
@@ -1,35 +0,0 @@
|
||||
# CompletionCreateParamsResponseFormatUnion
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.CompletionCreateParamsResponseFormatText`
|
||||
|
||||
```python
|
||||
value: components.CompletionCreateParamsResponseFormatText = /* values here */
|
||||
```
|
||||
|
||||
### `components.CompletionCreateParamsResponseFormatJSONObject`
|
||||
|
||||
```python
|
||||
value: components.CompletionCreateParamsResponseFormatJSONObject = /* values here */
|
||||
```
|
||||
|
||||
### `components.ResponseFormatJSONSchema`
|
||||
|
||||
```python
|
||||
value: components.ResponseFormatJSONSchema = /* values here */
|
||||
```
|
||||
|
||||
### `components.ResponseFormatTextGrammar`
|
||||
|
||||
```python
|
||||
value: components.ResponseFormatTextGrammar = /* values here */
|
||||
```
|
||||
|
||||
### `components.CompletionCreateParamsResponseFormatPython`
|
||||
|
||||
```python
|
||||
value: components.CompletionCreateParamsResponseFormatPython = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
# CompletionCreateParamsStop
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
### `List[str]`
|
||||
|
||||
```python
|
||||
value: List[str] = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# CompletionFinishReason
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ---------------- | ---------------- |
|
||||
| `STOP` | stop |
|
||||
| `LENGTH` | length |
|
||||
| `CONTENT_FILTER` | content_filter |
|
||||
@@ -1,11 +0,0 @@
|
||||
# CompletionLogprobs
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------ | ------------------------ | ------------------------ | ------------------------ |
|
||||
| `tokens` | List[*str*] | :heavy_check_mark: | N/A |
|
||||
| `token_logprobs` | List[*float*] | :heavy_check_mark: | N/A |
|
||||
| `top_logprobs` | List[Dict[str, *float*]] | :heavy_check_mark: | N/A |
|
||||
| `text_offset` | List[*float*] | :heavy_check_mark: | N/A |
|
||||
@@ -1,15 +0,0 @@
|
||||
# CompletionResponse
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
|
||||
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||
| `object` | *Literal["text_completion"]* | :heavy_check_mark: | N/A |
|
||||
| `created` | *float* | :heavy_check_mark: | N/A |
|
||||
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||
| `provider` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `system_fingerprint` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `choices` | List[[components.CompletionChoice](../components/completionchoice.md)] | :heavy_check_mark: | N/A |
|
||||
| `usage` | [Optional[components.CompletionUsage]](../components/completionusage.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,11 +1,13 @@
|
||||
# CompletionTokensDetails
|
||||
|
||||
Detailed completion token usage
|
||||
|
||||
|
||||
## 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 |
|
||||
| `accepted_prediction_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | Accepted prediction tokens |
|
||||
| `audio_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | Tokens used for audio output |
|
||||
| `reasoning_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | Tokens used for reasoning |
|
||||
| `rejected_prediction_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | Rejected prediction tokens |
|
||||
@@ -1,10 +0,0 @@
|
||||
# CompletionUsage
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------- | ------------------- | ------------------- | ------------------- |
|
||||
| `prompt_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||
| `completion_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||
| `total_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||
@@ -1,10 +1,12 @@
|
||||
# CostDetails
|
||||
|
||||
Breakdown of upstream inference costs
|
||||
|
||||
|
||||
## 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 |
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------- | ------------------------------------- | ------------------------------------- | ------------------------------------- |
|
||||
| `upstream_inference_completions_cost` | *float* | :heavy_check_mark: | N/A |
|
||||
| `upstream_inference_cost` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `upstream_inference_prompt_cost` | *float* | :heavy_check_mark: | N/A |
|
||||
@@ -1,12 +0,0 @@
|
||||
# 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` | [components.ChainID](../components/chainid.md) | :heavy_check_mark: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# Debug
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------- | -------------------- | -------------------- | -------------------- |
|
||||
| `echo_upstream_body` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
@@ -7,6 +7,9 @@ Default parameters for this model
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------- | ------------------------- | ------------------------- | ------------------------- |
|
||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `repetition_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `top_k` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,13 +0,0 @@
|
||||
# Effort
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| --------- | --------- |
|
||||
| `NONE` | none |
|
||||
| `MINIMAL` | minimal |
|
||||
| `LOW` | low |
|
||||
| `MEDIUM` | medium |
|
||||
| `HIGH` | high |
|
||||
| `XHIGH` | xhigh |
|
||||
@@ -0,0 +1,11 @@
|
||||
# Error
|
||||
|
||||
Error information
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------- | ------------------- | ------------------- | ------------------- | ------------------- |
|
||||
| `code` | *int* | :heavy_check_mark: | Error code | 429 |
|
||||
| `message` | *str* | :heavy_check_mark: | Error message | Rate limit exceeded |
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
|
||||
| `type` | [components.FileCitationType](../components/filecitationtype.md) | :heavy_check_mark: | N/A |
|
||||
| `file_id` | *str* | :heavy_check_mark: | N/A |
|
||||
| `filename` | *str* | :heavy_check_mark: | N/A |
|
||||
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||
| `index` | *int* | :heavy_check_mark: | N/A |
|
||||
| `type` | [components.FileCitationType](../components/filecitationtype.md) | :heavy_check_mark: | N/A |
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
|
||||
| `type` | [components.FilePathType](../components/filepathtype.md) | :heavy_check_mark: | N/A |
|
||||
| `file_id` | *str* | :heavy_check_mark: | N/A |
|
||||
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||
| `index` | *int* | :heavy_check_mark: | N/A |
|
||||
| `type` | [components.FilePathType](../components/filepathtype.md) | :heavy_check_mark: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# IDFileParser
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------- | ------------- |
|
||||
| `FILE_PARSER` | file-parser |
|
||||
@@ -1,8 +0,0 @@
|
||||
# IDModeration
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------ | ------------ |
|
||||
| `MODERATION` | moderation |
|
||||
@@ -1,8 +0,0 @@
|
||||
# IDResponseHealing
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------------ | ------------------ |
|
||||
| `RESPONSE_HEALING` | response-healing |
|
||||
@@ -1,8 +0,0 @@
|
||||
# IDWeb
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ----- | ----- |
|
||||
| `WEB` | web |
|
||||
@@ -1,17 +0,0 @@
|
||||
# Ignore
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.ProviderName`
|
||||
|
||||
```python
|
||||
value: components.ProviderName = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# ImageURL
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
|
||||
| `url` | *str* | :heavy_check_mark: | N/A |
|
||||
| `detail` | [Optional[components.ChatMessageContentItemImageDetail]](../components/chatmessagecontentitemimagedetail.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -5,4 +5,4 @@
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `cached_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||
| `cached_tokens` | *int* | :heavy_check_mark: | N/A |
|
||||
@@ -1,11 +0,0 @@
|
||||
# JSONSchemaConfig
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------ | ------------------------ | ------------------------ | ------------------------ |
|
||||
| `name` | *str* | :heavy_check_mark: | N/A |
|
||||
| `description` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `schema_` | Dict[str, *Any*] | :heavy_minus_sign: | N/A |
|
||||
| `strict` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
@@ -7,9 +7,9 @@ List of available endpoints for a model
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `id` | *str* | :heavy_check_mark: | Unique identifier for the model | openai/gpt-4 |
|
||||
| `name` | *str* | :heavy_check_mark: | Display name of the model | GPT-4 |
|
||||
| `created` | *float* | :heavy_check_mark: | Unix timestamp of when the model was created | 1692901234 |
|
||||
| `architecture` | [components.Architecture](../components/architecture.md) | :heavy_check_mark: | N/A | {<br/>"input_modalities": [<br/>"text"<br/>],<br/>"instruct_type": "chatml",<br/>"modality": "text-\u003etext",<br/>"output_modalities": [<br/>"text"<br/>],<br/>"tokenizer": "GPT"<br/>} |
|
||||
| `created` | *int* | :heavy_check_mark: | Unix timestamp of when the model was created | 1692901234 |
|
||||
| `description` | *str* | :heavy_check_mark: | Description of the model | GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. |
|
||||
| `architecture` | [components.Architecture](../components/architecture.md) | :heavy_check_mark: | N/A | {<br/>"tokenizer": "GPT",<br/>"instruct_type": "chatml",<br/>"modality": "text-\u003etext",<br/>"input_modalities": [<br/>"text"<br/>],<br/>"output_modalities": [<br/>"text"<br/>]<br/>} |
|
||||
| `endpoints` | List[[components.PublicEndpoint](../components/publicendpoint.md)] | :heavy_check_mark: | List of available endpoints for this model | |
|
||||
| `endpoints` | List[[components.PublicEndpoint](../components/publicendpoint.md)] | :heavy_check_mark: | List of available endpoints for this model | |
|
||||
| `id` | *str* | :heavy_check_mark: | Unique identifier for the model | openai/gpt-4 |
|
||||
| `name` | *str* | :heavy_check_mark: | Display name of the model | GPT-4 |
|
||||
@@ -1,35 +0,0 @@
|
||||
# Message
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.SystemMessage`
|
||||
|
||||
```python
|
||||
value: components.SystemMessage = /* values here */
|
||||
```
|
||||
|
||||
### `components.UserMessage`
|
||||
|
||||
```python
|
||||
value: components.UserMessage = /* values here */
|
||||
```
|
||||
|
||||
### `components.MessageDeveloper`
|
||||
|
||||
```python
|
||||
value: components.MessageDeveloper = /* values here */
|
||||
```
|
||||
|
||||
### `components.AssistantMessage`
|
||||
|
||||
```python
|
||||
value: components.AssistantMessage = /* values here */
|
||||
```
|
||||
|
||||
### `components.ToolResponseMessage`
|
||||
|
||||
```python
|
||||
value: components.ToolResponseMessage = /* 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