mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-31 12:30:30 +08:00
Compare commits
40
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21dd408dd4 | ||
|
|
06bea2ae0f | ||
|
|
6b1b7e6a9d | ||
|
|
dd8e6bdac2 | ||
|
|
e6b0242969 | ||
|
|
5ab44f08f0 | ||
|
|
e72a84e82d | ||
|
|
c734c52d9c | ||
|
|
b2098ff28e | ||
|
|
1cad51abb6 | ||
|
|
0c791b04d1 | ||
|
|
5f2c0ee2ea | ||
|
|
5832c0495b | ||
|
|
f5dfc30997 | ||
|
|
a56ffbf5f3 | ||
|
|
cc2b002c5c | ||
|
|
9774c726fd | ||
|
|
3a40848aab | ||
|
|
f190e3f950 | ||
|
|
d433ce35e8 | ||
|
|
61e5216764 | ||
|
|
67ef52b03e | ||
|
|
d4474da1b8 | ||
|
|
aed8199b2b | ||
|
|
06b2ccc54a | ||
|
|
6cd0d2a76d | ||
|
|
a1dae775cb | ||
|
|
10a76ba502 | ||
|
|
f4ffd51f40 | ||
|
|
20c63f6f13 | ||
|
|
0f9cb9787a | ||
|
|
6c5dfcfb2b | ||
|
|
afbf99e8bf | ||
|
|
6895d9d45b | ||
|
|
e824ca8a57 | ||
|
|
e70f43e916 | ||
|
|
94ba44c933 | ||
|
|
d13e797ad1 | ||
|
|
3629471122 | ||
|
|
c702382b4b |
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(python3:*)"
|
||||
"Bash(python3:*)",
|
||||
"Bash(git push:*)",
|
||||
"Bash(gh pr create:*)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
pylintrc
|
||||
@@ -0,0 +1,46 @@
|
||||
name: Notify Monorepo of Changes
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
notify-monorepo:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Send repository dispatch to monorepo
|
||||
run: |
|
||||
# Determine which event type to send based on repository name
|
||||
REPO_NAME="${GITHUB_REPOSITORY#*/}" # Gets 'python-sdk' from 'OpenRouterTeam/python-sdk'
|
||||
|
||||
case "$REPO_NAME" in
|
||||
"typescript-sdk")
|
||||
EVENT_TYPE="sync-typescript-sdk"
|
||||
;;
|
||||
"python-sdk")
|
||||
EVENT_TYPE="sync-python-sdk"
|
||||
;;
|
||||
"ai-sdk-provider")
|
||||
EVENT_TYPE="sync-ai-sdk-provider"
|
||||
;;
|
||||
"cli")
|
||||
EVENT_TYPE="sync-cli"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown repository: $REPO_NAME"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Sending repository_dispatch event: $EVENT_TYPE"
|
||||
|
||||
curl -L \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer ${{ secrets.MONOREPO_SYNC_TOKEN }}" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
https://api.github.com/repos/OpenRouterTeam/openrouter-web/dispatches \
|
||||
-d "{\"event_type\":\"$EVENT_TYPE\",\"client_payload\":{\"repository\":\"$GITHUB_REPOSITORY\",\"ref\":\"$GITHUB_REF\",\"sha\":\"$GITHUB_SHA\"}}"
|
||||
|
||||
echo "✅ Notification sent to monorepo"
|
||||
+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/
|
||||
|
||||
+4757
-807
File diff suppressed because it is too large
Load Diff
+18
-7
@@ -6,7 +6,7 @@ generation:
|
||||
sdkClassName: OpenRouter
|
||||
maintainOpenAPIOrder: true
|
||||
usageSnippets:
|
||||
optionalPropertyRendering: withExample
|
||||
optionalPropertyRendering: never
|
||||
sdkInitStyle: constructor
|
||||
useClassNamesForArrayFields: true
|
||||
fixes:
|
||||
@@ -24,13 +24,15 @@ generation:
|
||||
sdkHooksConfigAccess: true
|
||||
schemas:
|
||||
allOfMergeStrategy: shallowMerge
|
||||
requestBodyFieldName: body
|
||||
requestBodyFieldName: ""
|
||||
persistentEdits: {}
|
||||
tests:
|
||||
generateTests: false
|
||||
generateNewTests: true
|
||||
skipResponseBodyAssertions: false
|
||||
preApplyUnionDiscriminators: true
|
||||
python:
|
||||
version: 0.0.6
|
||||
version: 0.8.1
|
||||
additionalDependencies:
|
||||
dev: {}
|
||||
main: {}
|
||||
@@ -38,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
|
||||
@@ -54,22 +59,28 @@ python:
|
||||
flattenGlobalSecurity: true
|
||||
flattenRequests: true
|
||||
flatteningOrder: parameters-first
|
||||
forwardCompatibleUnionsByDefault: "tagged-only"
|
||||
imports:
|
||||
option: openapi
|
||||
paths:
|
||||
callbacks: ""
|
||||
callbacks: callbacks
|
||||
errors: errors
|
||||
operations: ""
|
||||
shared: ""
|
||||
webhooks: ""
|
||||
operations: operations
|
||||
shared: components
|
||||
webhooks: webhooks
|
||||
inferSSEOverload: true
|
||||
inferUnionDiscriminators: true
|
||||
inputModelSuffix: input
|
||||
legacyPyright: false
|
||||
license: Apache-2.0
|
||||
maxMethodParams: 999
|
||||
methodArguments: infer-optional-args
|
||||
moduleName: ""
|
||||
multipartArrayFormat: legacy
|
||||
outputModelSuffix: output
|
||||
packageManager: uv
|
||||
packageName: openrouter
|
||||
preApplyUnionDiscriminators: false
|
||||
pytestFilterWarnings: []
|
||||
pytestTimeout: 0
|
||||
responseFormat: flat
|
||||
|
||||
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"
|
||||
+19257
-8160
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,52 @@
|
||||
overlay: 1.0.0
|
||||
x-speakeasy-jsonpath: rfc9535
|
||||
info:
|
||||
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, 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
|
||||
description: Add parameters for app identification headers
|
||||
update:
|
||||
parameters:
|
||||
AppIdentifier:
|
||||
name: HTTP-Referer
|
||||
in: header
|
||||
schema:
|
||||
type: string
|
||||
description: |
|
||||
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-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: Add open enums
|
||||
version: 0.0.0
|
||||
actions:
|
||||
- target: $..[?length(@.enum) > 1]
|
||||
description: Automatically open all enums that have length > 1
|
||||
update:
|
||||
x-speakeasy-unknown-values: allow
|
||||
@@ -0,0 +1,15 @@
|
||||
overlay: 1.0.0
|
||||
x-speakeasy-jsonpath: rfc9535
|
||||
info:
|
||||
title: Remove RSS+XML response schemas and related parameters
|
||||
version: 0.0.0
|
||||
actions:
|
||||
- target: $..responses.*.content["application/rss+xml"]
|
||||
description: Remove application/rss+xml response schemas
|
||||
remove: true
|
||||
- target: $..parameters[?@.name == "use_rss"]
|
||||
description: Remove use_rss parameter
|
||||
remove: true
|
||||
- target: $..parameters[?@.name == "use_rss_chat_links"]
|
||||
description: Remove use_rss_chat_links parameter
|
||||
remove: true
|
||||
+20
-13
@@ -1,37 +1,44 @@
|
||||
speakeasyVersion: 1.656.2
|
||||
speakeasyVersion: 1.680.0
|
||||
sources:
|
||||
-OAS:
|
||||
OpenRouter API:
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:08647b466c00989914e3a2436175152270f771f0a57d055f5bab14cc2d4be89e
|
||||
sourceBlobDigest: sha256:53027ec57392d9617cc001ece83c2fe1aa6e5dbfd52d170381c34c33c6042c23
|
||||
sourceRevisionDigest: sha256:0795e89fdc7634204a5e1c93c441069d7bfb349fc1c7f43a53db24f0803c72fa
|
||||
sourceBlobDigest: sha256:bb920e0d3ed7fb2c204d06aa436d9ce9a3635727d3a6147a7a2798333458d12a
|
||||
tags:
|
||||
- latest
|
||||
- 1.0.0
|
||||
targets:
|
||||
open-router:
|
||||
source: -OAS
|
||||
source: OpenRouter API
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:08647b466c00989914e3a2436175152270f771f0a57d055f5bab14cc2d4be89e
|
||||
sourceBlobDigest: sha256:53027ec57392d9617cc001ece83c2fe1aa6e5dbfd52d170381c34c33c6042c23
|
||||
sourceRevisionDigest: sha256:0795e89fdc7634204a5e1c93c441069d7bfb349fc1c7f43a53db24f0803c72fa
|
||||
sourceBlobDigest: sha256:bb920e0d3ed7fb2c204d06aa436d9ce9a3635727d3a6147a7a2798333458d12a
|
||||
codeSamplesNamespace: open-router-python-code-samples
|
||||
codeSamplesRevisionDigest: sha256:c368e0601d6b667625dd99ffcd53e69e3dc98a4b518a45444add6457dde83b22
|
||||
workflow:
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: latest
|
||||
speakeasyVersion: 1.680.0
|
||||
sources:
|
||||
-OAS:
|
||||
OpenRouter API:
|
||||
inputs:
|
||||
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main
|
||||
- location: .speakeasy/in.openapi.yaml
|
||||
overlays:
|
||||
- location: .speakeasy/overlays/open-enums.overlay.yaml
|
||||
- location: .speakeasy/overlays/remove-rss-responses.overlay.yaml
|
||||
- location: .speakeasy/overlays/add-headers.overlay.yaml
|
||||
output: .speakeasy/out.openapi.yaml
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/-oas
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
|
||||
targets:
|
||||
open-router:
|
||||
target: python
|
||||
source: -OAS
|
||||
source: OpenRouter API
|
||||
publish:
|
||||
pypi:
|
||||
token: $pypi_token
|
||||
codeSamples:
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/-oas-python-code-samples
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-python-code-samples
|
||||
labelOverride:
|
||||
fixedValue: Python (SDK)
|
||||
blocking: false
|
||||
|
||||
@@ -1,22 +1,28 @@
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: latest
|
||||
speakeasyVersion: 1.680.0
|
||||
sources:
|
||||
-OAS:
|
||||
OpenRouter API:
|
||||
inputs:
|
||||
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main
|
||||
- location: .speakeasy/in.openapi.yaml
|
||||
overlays:
|
||||
- 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
|
||||
output: .speakeasy/out.openapi.yaml
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/-oas
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
|
||||
targets:
|
||||
open-router:
|
||||
target: python
|
||||
source: -OAS
|
||||
source: OpenRouter API
|
||||
publish:
|
||||
pypi:
|
||||
token: $pypi_token
|
||||
codeSamples:
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/-oas-python-code-samples
|
||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-python-code-samples
|
||||
labelOverride:
|
||||
fixedValue: Python (SDK)
|
||||
blocking: false
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
+255
@@ -0,0 +1,255 @@
|
||||
# OpenRouter SDK (Beta)
|
||||
|
||||
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.
|
||||
|
||||
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).
|
||||
|
||||
<!-- No Summary [summary] -->
|
||||
|
||||
<!-- No Table of Contents [toc] -->
|
||||
|
||||
<!-- Start SDK Installation [installation] -->
|
||||
## SDK Installation
|
||||
|
||||
> [!NOTE]
|
||||
> **Python version upgrade policy**
|
||||
>
|
||||
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
|
||||
|
||||
The SDK can be installed with *uv*, *pip*, or *poetry* package managers.
|
||||
|
||||
### uv
|
||||
|
||||
*uv* is a fast Python package installer and resolver, designed as a drop-in replacement for pip and pip-tools. It's recommended for its speed and modern Python tooling capabilities.
|
||||
|
||||
```bash
|
||||
uv add openrouter
|
||||
```
|
||||
|
||||
### PIP
|
||||
|
||||
*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
|
||||
|
||||
```bash
|
||||
pip install openrouter
|
||||
```
|
||||
|
||||
### Poetry
|
||||
|
||||
*Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies.
|
||||
|
||||
```bash
|
||||
poetry add openrouter
|
||||
```
|
||||
|
||||
### Shell and script usage with `uv`
|
||||
|
||||
You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so:
|
||||
|
||||
```shell
|
||||
uvx --from openrouter python
|
||||
```
|
||||
|
||||
It's also possible to write a standalone Python script without needing to set up a whole project like so:
|
||||
|
||||
```python
|
||||
#!/usr/bin/env -S uv run --script
|
||||
# /// script
|
||||
# requires-python = ">=3.9"
|
||||
# dependencies = [
|
||||
# "openrouter",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
from openrouter import OpenRouter
|
||||
|
||||
sdk = OpenRouter(
|
||||
# SDK arguments
|
||||
)
|
||||
|
||||
# Rest of script here...
|
||||
```
|
||||
|
||||
Once that is saved to a file, you can run it with `uv run script.py` where
|
||||
`script.py` can be replaced with the actual file name.
|
||||
<!-- End SDK Installation [installation] -->
|
||||
|
||||
<!-- Start Requirements [requirements] -->
|
||||
## Requirements
|
||||
|
||||
This SDK requires Python 3.9 or higher. For Python version support policy, see the SDK Installation section above.
|
||||
<!-- End Requirements [requirements] -->
|
||||
|
||||
<!-- Start IDE Support [idesupport] -->
|
||||
## IDE Support
|
||||
|
||||
### PyCharm
|
||||
|
||||
Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.
|
||||
|
||||
- [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
|
||||
<!-- End IDE Support [idesupport] -->
|
||||
|
||||
<!-- No SDK Example Usage [usage] -->
|
||||
## SDK 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.chat.send(messages=[
|
||||
{
|
||||
"role": "user",
|
||||
"content": "Hello, how are you?",
|
||||
},
|
||||
], model="anthropic/claude-4.5-sonnet", provider={
|
||||
"zdr": True,
|
||||
"sort": "price",
|
||||
}, stream=True)
|
||||
|
||||
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.chat.send_async(messages=[
|
||||
{
|
||||
"role": "user",
|
||||
"content": "Hello, how are you?",
|
||||
},
|
||||
], model="anthropic/claude-4.5-sonnet", provider={
|
||||
"zdr": True,
|
||||
"sort": "price",
|
||||
}, stream=True)
|
||||
|
||||
async for event in event_stream:
|
||||
# handle event
|
||||
print(event, flush=True)
|
||||
|
||||
asyncio.run(main())
|
||||
```
|
||||
|
||||
<!-- No Authentication [security] -->
|
||||
|
||||
<!-- No Available Resources and Operations [operations] -->
|
||||
|
||||
<!-- No Standalone functions [standalone-funcs] -->
|
||||
|
||||
<!-- No React hooks with TanStack Query [react-query] -->
|
||||
|
||||
<!-- No Server-sent event streaming [eventstream] -->
|
||||
|
||||
<!-- No Retries [retries] -->
|
||||
|
||||
<!-- No Error Handling [errors] -->
|
||||
|
||||
<!-- No Server Selection [server] -->
|
||||
|
||||
<!-- No Custom HTTP Client [http-client] -->
|
||||
|
||||
<!-- Start Resource Management [resource-management] -->
|
||||
## Resource Management
|
||||
|
||||
The `OpenRouter` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
|
||||
|
||||
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
||||
|
||||
```python
|
||||
from openrouter import OpenRouter
|
||||
import os
|
||||
def main():
|
||||
|
||||
with OpenRouter(
|
||||
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...
|
||||
|
||||
|
||||
# Or when using async:
|
||||
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...
|
||||
```
|
||||
<!-- End Resource Management [resource-management] -->
|
||||
|
||||
<!-- Start Debugging [debug] -->
|
||||
## Debugging
|
||||
|
||||
You can setup your SDK to emit debug logs for SDK requests and responses.
|
||||
|
||||
You can pass your own logger class directly into your SDK.
|
||||
```python
|
||||
from openrouter import OpenRouter
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
s = OpenRouter(debug_logger=logging.getLogger("openrouter"))
|
||||
```
|
||||
|
||||
You can also enable a default debug logger by setting an environment variable `OPENROUTER_DEBUG` to true.
|
||||
<!-- End Debugging [debug] -->
|
||||
|
||||
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
||||
|
||||
# Development
|
||||
|
||||
## Running Tests
|
||||
|
||||
To run the test suite, you'll need to set up your environment with an OpenRouter API key.
|
||||
|
||||
### Local Development
|
||||
|
||||
1. Copy the example environment file:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
2. Edit `.env` and add your OpenRouter API key:
|
||||
|
||||
```bash
|
||||
OPENROUTER_API_KEY=your_api_key_here
|
||||
```
|
||||
|
||||
3. Run the tests:
|
||||
|
||||
```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,5 +1,3 @@
|
||||

|
||||
|
||||
# OpenRouter SDK (Beta)
|
||||
|
||||
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.
|
||||
@@ -184,6 +182,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...
|
||||
@@ -193,6 +194,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...
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
## 2025-11-15 18:16:18
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.658.1 (2.755.6) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.0.16] .
|
||||
### Releases
|
||||
- [PyPI v0.0.16] https://pypi.org/project/openrouter/0.0.16 - .
|
||||
@@ -6,64 +6,13 @@ 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(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",
|
||||
})
|
||||
res = open_router.beta.responses.send(service_tier="auto", stream=False)
|
||||
|
||||
with res as event_stream:
|
||||
for event in event_stream:
|
||||
@@ -84,64 +33,13 @@ 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(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",
|
||||
})
|
||||
res = await open_router.beta.responses.send_async(service_tier="auto", stream=False)
|
||||
|
||||
async with res as event_stream:
|
||||
async for event in event_stream:
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# Architecture
|
||||
|
||||
Model architecture information
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| 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 | |
|
||||
@@ -0,0 +1,13 @@
|
||||
# By
|
||||
|
||||
The provider sorting strategy (price, throughput, latency)
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------ | ------------ |
|
||||
| `PRICE` | price |
|
||||
| `THROUGHPUT` | throughput |
|
||||
| `LATENCY` | latency |
|
||||
| `EXACTO` | exacto |
|
||||
@@ -0,0 +1,10 @@
|
||||
# ChatStreamOptions
|
||||
|
||||
Streaming configuration options
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| 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 |
|
||||
@@ -1,4 +1,4 @@
|
||||
# CodeEnum
|
||||
# Code
|
||||
|
||||
|
||||
## Values
|
||||
@@ -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 |
|
||||
| `reasoning_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Tokens used for reasoning |
|
||||
| `audio_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Tokens used for audio output |
|
||||
| `accepted_prediction_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Accepted prediction tokens |
|
||||
| `rejected_prediction_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Rejected prediction tokens |
|
||||
@@ -1,4 +1,4 @@
|
||||
# ModelsCountResponseData
|
||||
# Data
|
||||
|
||||
Model count data
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
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.
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
|
||||
|
||||
## Values
|
||||
@@ -9,4 +9,7 @@ Default parameters for this model
|
||||
| ------------------------- | ------------------------- | ------------------------- | ------------------------- |
|
||||
| `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 |
|
||||
| `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 |
|
||||
@@ -1,11 +1,15 @@
|
||||
# Effort
|
||||
|
||||
Constrains effort on reasoning for reasoning models
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| --------- | --------- |
|
||||
| `MINIMAL` | minimal |
|
||||
| `LOW` | low |
|
||||
| `XHIGH` | xhigh |
|
||||
| `HIGH` | high |
|
||||
| `MEDIUM` | medium |
|
||||
| `HIGH` | high |
|
||||
| `LOW` | low |
|
||||
| `MINIMAL` | minimal |
|
||||
| `NONE` | none |
|
||||
@@ -0,0 +1,11 @@
|
||||
# Error
|
||||
|
||||
Error information
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------- | ------------------- | ------------------- | ------------------- | ------------------- |
|
||||
| `message` | *str* | :heavy_check_mark: | Error message | Rate limit exceeded |
|
||||
| `code` | *float* | :heavy_check_mark: | Error code | 429 |
|
||||
@@ -1,10 +1,11 @@
|
||||
# SystemMessage
|
||||
# FileCitation
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
|
||||
| `role` | *Literal["system"]* | :heavy_check_mark: | N/A |
|
||||
| `content` | [models.SystemMessageContent](../models/systemmessagecontent.md) | :heavy_check_mark: | N/A |
|
||||
| `name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `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 |
|
||||
@@ -1,11 +1,10 @@
|
||||
# FileCitation
|
||||
# FilePath
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
|
||||
| `type` | [models.FileCitationType](../models/filecitationtype.md) | :heavy_check_mark: | N/A |
|
||||
| `type` | [components.FilePathType](../components/filepathtype.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 |
|
||||
@@ -11,5 +11,5 @@ List of available endpoints for a model
|
||||
| `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 |
|
||||
| `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` | [models.Architecture](../models/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[[models.PublicEndpoint](../models/publicendpoint.md)] | :heavy_check_mark: | List of available endpoints for this model | |
|
||||
| `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 | |
|
||||
@@ -0,0 +1,10 @@
|
||||
# Modality
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------- | ------- |
|
||||
| `TEXT` | text |
|
||||
| `IMAGE` | image |
|
||||
| `AUDIO` | audio |
|
||||
@@ -13,10 +13,12 @@ Information about an AI model available on OpenRouter
|
||||
| `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 |
|
||||
| `description` | *Optional[str]* | :heavy_minus_sign: | Description of the model | GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. |
|
||||
| `pricing` | [models.PublicPricing](../models/publicpricing.md) | :heavy_check_mark: | Pricing information for the model | {<br/>"prompt": "0.00003",<br/>"completion": "0.00006",<br/>"request": "0",<br/>"image": "0"<br/>} |
|
||||
| `pricing` | [components.PublicPricing](../components/publicpricing.md) | :heavy_check_mark: | Pricing information for the model | {<br/>"prompt": "0.00003",<br/>"completion": "0.00006",<br/>"request": "0",<br/>"image": "0"<br/>} |
|
||||
| `context_length` | *Nullable[float]* | :heavy_check_mark: | Maximum context length in tokens | 8192 |
|
||||
| `architecture` | [models.ModelArchitecture](../models/modelarchitecture.md) | :heavy_check_mark: | Model architecture information | {<br/>"tokenizer": "GPT",<br/>"instruct_type": "chatml",<br/>"modality": "text-\u003etext",<br/>"input_modalities": [<br/>"text"<br/>],<br/>"output_modalities": [<br/>"text"<br/>]<br/>} |
|
||||
| `top_provider` | [models.TopProviderInfo](../models/topproviderinfo.md) | :heavy_check_mark: | Information about the top provider for this model | {<br/>"context_length": 8192,<br/>"max_completion_tokens": 4096,<br/>"is_moderated": true<br/>} |
|
||||
| `per_request_limits` | [Nullable[models.PerRequestLimits]](../models/perrequestlimits.md) | :heavy_check_mark: | Per-request token limits | {<br/>"prompt_tokens": 1000,<br/>"completion_tokens": 1000<br/>} |
|
||||
| `supported_parameters` | List[[models.Parameter](../models/parameter.md)] | :heavy_check_mark: | List of supported parameters for this model | |
|
||||
| `default_parameters` | [Nullable[models.DefaultParameters]](../models/defaultparameters.md) | :heavy_check_mark: | Default parameters for this model | {<br/>"temperature": 0.7,<br/>"top_p": 0.9,<br/>"frequency_penalty": 0<br/>} |
|
||||
| `architecture` | [components.ModelArchitecture](../components/modelarchitecture.md) | :heavy_check_mark: | Model architecture information | {<br/>"tokenizer": "GPT",<br/>"instruct_type": "chatml",<br/>"modality": "text-\u003etext",<br/>"input_modalities": [<br/>"text"<br/>],<br/>"output_modalities": [<br/>"text"<br/>]<br/>} |
|
||||
| `top_provider` | [components.TopProviderInfo](../components/topproviderinfo.md) | :heavy_check_mark: | Information about the top provider for this model | {<br/>"context_length": 8192,<br/>"max_completion_tokens": 4096,<br/>"is_moderated": true<br/>} |
|
||||
| `per_request_limits` | [Nullable[components.PerRequestLimits]](../components/perrequestlimits.md) | :heavy_check_mark: | Per-request token limits | {<br/>"prompt_tokens": 1000,<br/>"completion_tokens": 1000<br/>} |
|
||||
| `supported_parameters` | List[[components.Parameter](../components/parameter.md)] | :heavy_check_mark: | List of supported parameters for this model | |
|
||||
| `default_parameters` | [Nullable[components.DefaultParameters]](../components/defaultparameters.md) | :heavy_check_mark: | Default parameters for this model | {<br/>"temperature": 0.7,<br/>"top_p": 0.9,<br/>"top_k": 0,<br/>"frequency_penalty": 0,<br/>"presence_penalty": 0,<br/>"repetition_penalty": 1<br/>} |
|
||||
| `knowledge_cutoff` | *OptionalNullable[str]* | :heavy_minus_sign: | The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown. | 2024-10-01 |
|
||||
| `expiration_date` | *OptionalNullable[str]* | :heavy_minus_sign: | The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration. | 2025-06-01 |
|
||||
+8
-6
@@ -1,12 +1,14 @@
|
||||
# OpenAIResponsesInputFunctionCallOutput
|
||||
# ModelArchitecture
|
||||
|
||||
Model architecture information
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
|
||||
| `type` | [models.OpenAIResponsesInputTypeFunctionCallOutput](../models/openairesponsesinputtypefunctioncalloutput.md) | :heavy_check_mark: | N/A | |
|
||||
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `call_id` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `output` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `status` | [OptionalNullable[models.ToolCallStatus]](../models/toolcallstatus.md) | :heavy_minus_sign: | N/A | completed |
|
||||
| `tokenizer` | [Optional[components.ModelGroup]](../components/modelgroup.md) | :heavy_minus_sign: | Tokenizer type used by the model | GPT |
|
||||
| `instruct_type` | [OptionalNullable[components.ModelArchitectureInstructType]](../components/modelarchitectureinstructtype.md) | :heavy_minus_sign: | Instruction format type | chatml |
|
||||
| `modality` | *Nullable[str]* | :heavy_check_mark: | Primary modality of the model | text->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 | |
|
||||
@@ -0,0 +1,10 @@
|
||||
# ModelsCountResponse
|
||||
|
||||
Model count data
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
|
||||
| `data` | [components.Data](../components/data.md) | :heavy_check_mark: | Model count data | {<br/>"count": 150<br/>} |
|
||||
@@ -1,8 +1,10 @@
|
||||
# PluginModeration
|
||||
# ModelsListResponse
|
||||
|
||||
List of available models
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ |
|
||||
| `id` | [models.IDModeration](../models/idmoderation.md) | :heavy_check_mark: | N/A |
|
||||
| `data` | List[[components.Model](../components/model.md)] | :heavy_check_mark: | List of available models |
|
||||
@@ -0,0 +1,23 @@
|
||||
# OpenAIResponsesAnnotation
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.FileCitation`
|
||||
|
||||
```python
|
||||
value: components.FileCitation = /* values here */
|
||||
```
|
||||
|
||||
### `components.URLCitation`
|
||||
|
||||
```python
|
||||
value: components.URLCitation = /* values here */
|
||||
```
|
||||
|
||||
### `components.FilePath`
|
||||
|
||||
```python
|
||||
value: components.FilePath = /* values here */
|
||||
```
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
# OpenAIResponsesToolChoiceFunction
|
||||
# OpenAIResponsesRefusalContent
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
||||
| `type` | [models.OpenAIResponsesToolChoiceTypeFunction](../models/openairesponsestoolchoicetypefunction.md) | :heavy_check_mark: | N/A |
|
||||
| `name` | *str* | :heavy_check_mark: | N/A |
|
||||
| `type` | [components.OpenAIResponsesRefusalContentType](../components/openairesponsesrefusalcontenttype.md) | :heavy_check_mark: | N/A |
|
||||
| `refusal` | *str* | :heavy_check_mark: | N/A |
|
||||
@@ -1,10 +1,8 @@
|
||||
# ModelsListResponse
|
||||
|
||||
List of available models
|
||||
# OpenAIResponsesToolChoice
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
|
||||
| `data` | List[[models.Model](../models/model.md)] | :heavy_check_mark: | List of available models |
|
||||
| `type` | [components.Type](../components/type.md) | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,9 @@
|
||||
# OpenAIResponsesToolChoiceFunction
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
|
||||
| `type` | [components.OpenAIResponsesToolChoiceTypeFunction](../components/openairesponsestoolchoicetypefunction.md) | :heavy_check_mark: | N/A |
|
||||
| `name` | *str* | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,35 @@
|
||||
# OpenAIResponsesToolChoiceUnion
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.OpenAIResponsesToolChoiceAuto`
|
||||
|
||||
```python
|
||||
value: components.OpenAIResponsesToolChoiceAuto = /* values here */
|
||||
```
|
||||
|
||||
### `components.OpenAIResponsesToolChoiceNone`
|
||||
|
||||
```python
|
||||
value: components.OpenAIResponsesToolChoiceNone = /* values here */
|
||||
```
|
||||
|
||||
### `components.OpenAIResponsesToolChoiceRequired`
|
||||
|
||||
```python
|
||||
value: components.OpenAIResponsesToolChoiceRequired = /* values here */
|
||||
```
|
||||
|
||||
### `components.OpenAIResponsesToolChoiceFunction`
|
||||
|
||||
```python
|
||||
value: components.OpenAIResponsesToolChoiceFunction = /* values here */
|
||||
```
|
||||
|
||||
### `components.OpenAIResponsesToolChoice`
|
||||
|
||||
```python
|
||||
value: components.OpenAIResponsesToolChoice = /* values here */
|
||||
```
|
||||
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
# ResponsesOutputItemFileSearchCall
|
||||
# OutputItemImageGenerationCall
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
||||
| `type` | [models.ResponsesOutputItemFileSearchCallType](../models/responsesoutputitemfilesearchcalltype.md) | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.OutputItemImageGenerationCallType](../components/outputitemimagegenerationcalltype.md) | :heavy_check_mark: | N/A | |
|
||||
| `id` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `queries` | List[*str*] | :heavy_check_mark: | N/A | |
|
||||
| `status` | [models.WebSearchStatus](../models/websearchstatus.md) | :heavy_check_mark: | N/A | completed |
|
||||
| `result` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `status` | [components.ImageGenerationStatus](../components/imagegenerationstatus.md) | :heavy_check_mark: | N/A | completed |
|
||||
@@ -0,0 +1,13 @@
|
||||
# OutputMessage
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||
| `role` | [components.OutputMessageRole](../components/outputmessagerole.md) | :heavy_check_mark: | N/A |
|
||||
| `type` | [components.OutputMessageType](../components/outputmessagetype.md) | :heavy_check_mark: | N/A |
|
||||
| `status` | [Optional[components.OutputMessageStatusUnion]](../components/outputmessagestatusunion.md) | :heavy_minus_sign: | N/A |
|
||||
| `content` | List[[components.OutputMessageContent](../components/outputmessagecontent.md)] | :heavy_check_mark: | N/A |
|
||||
| `phase` | [OptionalNullable[components.OutputMessagePhaseUnion]](../components/outputmessagephaseunion.md) | :heavy_minus_sign: | The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages. |
|
||||
@@ -0,0 +1,17 @@
|
||||
# OutputMessageContent
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.ResponseOutputText`
|
||||
|
||||
```python
|
||||
value: components.ResponseOutputText = /* values here */
|
||||
```
|
||||
|
||||
### `components.OpenAIResponsesRefusalContent`
|
||||
|
||||
```python
|
||||
value: components.OpenAIResponsesRefusalContent = /* values here */
|
||||
```
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# OutputMessageStatusUnion
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.OutputMessageStatusCompleted`
|
||||
|
||||
```python
|
||||
value: components.OutputMessageStatusCompleted = /* values here */
|
||||
```
|
||||
|
||||
### `components.OutputMessageStatusIncomplete`
|
||||
|
||||
```python
|
||||
value: components.OutputMessageStatusIncomplete = /* values here */
|
||||
```
|
||||
|
||||
### `components.OutputMessageStatusInProgress`
|
||||
|
||||
```python
|
||||
value: components.OutputMessageStatusInProgress = /* values here */
|
||||
```
|
||||
|
||||
@@ -7,4 +7,6 @@
|
||||
| ------------ | ------------ |
|
||||
| `TEXT` | text |
|
||||
| `IMAGE` | image |
|
||||
| `EMBEDDINGS` | embeddings |
|
||||
| `EMBEDDINGS` | embeddings |
|
||||
| `AUDIO` | audio |
|
||||
| `VIDEO` | video |
|
||||
@@ -26,5 +26,6 @@
|
||||
| `PARALLEL_TOOL_CALLS` | parallel_tool_calls |
|
||||
| `INCLUDE_REASONING` | include_reasoning |
|
||||
| `REASONING` | reasoning |
|
||||
| `REASONING_EFFORT` | reasoning_effort |
|
||||
| `WEB_SEARCH_OPTIONS` | web_search_options |
|
||||
| `VERBOSITY` | verbosity |
|
||||
@@ -0,0 +1,11 @@
|
||||
# Partition
|
||||
|
||||
Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model.
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------- | ------- |
|
||||
| `MODEL` | model |
|
||||
| `NONE` | none |
|
||||
@@ -0,0 +1,19 @@
|
||||
# PDFParserEngine
|
||||
|
||||
The engine to use for parsing PDF files. "pdf-text" is deprecated and automatically redirected to "cloudflare-ai".
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.PDFParserEngineEnum`
|
||||
|
||||
```python
|
||||
value: components.PDFParserEngineEnum = /* values here */
|
||||
```
|
||||
|
||||
### `components.PDFParserEnginePDFText`
|
||||
|
||||
```python
|
||||
value: components.PDFParserEnginePDFText = /* values here */
|
||||
```
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# PDFParserOptions
|
||||
|
||||
Options for PDF parsing.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
|
||||
| `engine` | [Optional[components.PDFParserEngine]](../components/pdfparserengine.md) | :heavy_minus_sign: | The engine to use for parsing PDF files. "pdf-text" is deprecated and automatically redirected to "cloudflare-ai". |
|
||||
@@ -0,0 +1,13 @@
|
||||
# PercentileLatencyCutoffs
|
||||
|
||||
Percentile-based latency cutoffs. All specified cutoffs must be met for an endpoint to be preferred.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------- | ----------------------------- | ----------------------------- | ----------------------------- |
|
||||
| `p50` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum p50 latency (seconds) |
|
||||
| `p75` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum p75 latency (seconds) |
|
||||
| `p90` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum p90 latency (seconds) |
|
||||
| `p99` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum p99 latency (seconds) |
|
||||
@@ -0,0 +1,13 @@
|
||||
# PercentileStats
|
||||
|
||||
Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------ | ------------------------ | ------------------------ | ------------------------ | ------------------------ |
|
||||
| `p50` | *float* | :heavy_check_mark: | Median (50th percentile) | 25.5 |
|
||||
| `p75` | *float* | :heavy_check_mark: | 75th percentile | 35.2 |
|
||||
| `p90` | *float* | :heavy_check_mark: | 90th percentile | 48.7 |
|
||||
| `p99` | *float* | :heavy_check_mark: | 99th percentile | 85.3 |
|
||||
@@ -0,0 +1,13 @@
|
||||
# PercentileThroughputCutoffs
|
||||
|
||||
Percentile-based throughput cutoffs. All specified cutoffs must be met for an endpoint to be preferred.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- |
|
||||
| `p50` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum p50 throughput (tokens/sec) |
|
||||
| `p75` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum p75 throughput (tokens/sec) |
|
||||
| `p90` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum p90 throughput (tokens/sec) |
|
||||
| `p99` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum p99 throughput (tokens/sec) |
|
||||
@@ -0,0 +1,25 @@
|
||||
# PreferredMaxLatency
|
||||
|
||||
Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `float`
|
||||
|
||||
```python
|
||||
value: float = /* values here */
|
||||
```
|
||||
|
||||
### `components.PercentileLatencyCutoffs`
|
||||
|
||||
```python
|
||||
value: components.PercentileLatencyCutoffs = /* values here */
|
||||
```
|
||||
|
||||
### `Any`
|
||||
|
||||
```python
|
||||
value: Any = /* values here */
|
||||
```
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# PreferredMinThroughput
|
||||
|
||||
Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `float`
|
||||
|
||||
```python
|
||||
value: float = /* values here */
|
||||
```
|
||||
|
||||
### `components.PercentileThroughputCutoffs`
|
||||
|
||||
```python
|
||||
value: components.PercentileThroughputCutoffs = /* values here */
|
||||
```
|
||||
|
||||
### `Any`
|
||||
|
||||
```python
|
||||
value: Any = /* values here */
|
||||
```
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# Pricing
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| -------------------- | -------------------- | -------------------- | -------------------- | -------------------- |
|
||||
| `prompt` | *str* | :heavy_check_mark: | N/A | 1000 |
|
||||
| `completion` | *str* | :heavy_check_mark: | N/A | 1000 |
|
||||
| `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `image_token` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `image_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `audio_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `web_search` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | |
|
||||
+7
-6
@@ -1,12 +1,13 @@
|
||||
# WebSearchPreviewToolUserLocation
|
||||
# PromptTokensDetails
|
||||
|
||||
Detailed prompt token usage
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
|
||||
| `type` | [models.WebSearchPreviewToolUserLocationType](../models/websearchpreviewtooluserlocationtype.md) | :heavy_check_mark: | N/A |
|
||||
| `city` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `country` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `region` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `timezone` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `cached_tokens` | *Optional[float]* | :heavy_minus_sign: | Cached prompt tokens |
|
||||
| `cache_write_tokens` | *Optional[float]* | :heavy_minus_sign: | Tokens written to cache. Only returned for models with explicit caching and cache write pricing. |
|
||||
| `audio_tokens` | *Optional[float]* | :heavy_minus_sign: | Audio input tokens |
|
||||
| `video_tokens` | *Optional[float]* | :heavy_minus_sign: | Video input tokens |
|
||||
@@ -0,0 +1,83 @@
|
||||
# ProviderName
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------------- | ------------------- |
|
||||
| `AKASH_ML` | AkashML |
|
||||
| `AI21` | AI21 |
|
||||
| `AION_LABS` | AionLabs |
|
||||
| `ALIBABA` | Alibaba |
|
||||
| `AMBIENT` | Ambient |
|
||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||
| `AMAZON_NOVA` | Amazon Nova |
|
||||
| `ANTHROPIC` | Anthropic |
|
||||
| `ARCEE_AI` | Arcee AI |
|
||||
| `ATLAS_CLOUD` | AtlasCloud |
|
||||
| `AVIAN` | Avian |
|
||||
| `AZURE` | Azure |
|
||||
| `BASE_TEN` | BaseTen |
|
||||
| `BYTE_PLUS` | BytePlus |
|
||||
| `BLACK_FOREST_LABS` | Black Forest Labs |
|
||||
| `CEREBRAS` | Cerebras |
|
||||
| `CHUTES` | Chutes |
|
||||
| `CIRRASCALE` | Cirrascale |
|
||||
| `CLARIFAI` | Clarifai |
|
||||
| `CLOUDFLARE` | Cloudflare |
|
||||
| `COHERE` | Cohere |
|
||||
| `CRUSOE` | Crusoe |
|
||||
| `DEEP_INFRA` | DeepInfra |
|
||||
| `DEEP_SEEK` | DeepSeek |
|
||||
| `FEATHERLESS` | Featherless |
|
||||
| `FIREWORKS` | Fireworks |
|
||||
| `FRIENDLI` | Friendli |
|
||||
| `GMI_CLOUD` | GMICloud |
|
||||
| `GOOGLE` | Google |
|
||||
| `GOOGLE_AI_STUDIO` | Google AI Studio |
|
||||
| `GROQ` | Groq |
|
||||
| `HYPERBOLIC` | Hyperbolic |
|
||||
| `INCEPTION` | Inception |
|
||||
| `INCEPTRON` | Inceptron |
|
||||
| `INFERENCE_NET` | InferenceNet |
|
||||
| `IONSTREAM` | Ionstream |
|
||||
| `INFERMATIC` | Infermatic |
|
||||
| `IO_NET` | Io Net |
|
||||
| `INFLECTION` | Inflection |
|
||||
| `LIQUID` | Liquid |
|
||||
| `MARA` | Mara |
|
||||
| `MANCER_2` | Mancer 2 |
|
||||
| `MINIMAX` | Minimax |
|
||||
| `MODEL_RUN` | ModelRun |
|
||||
| `MISTRAL` | Mistral |
|
||||
| `MODULAR` | Modular |
|
||||
| `MOONSHOT_AI` | Moonshot AI |
|
||||
| `MORPH` | Morph |
|
||||
| `N_COMPASS` | NCompass |
|
||||
| `NEBIUS` | Nebius |
|
||||
| `NEXT_BIT` | NextBit |
|
||||
| `NOVITA` | Novita |
|
||||
| `NVIDIA` | Nvidia |
|
||||
| `OPEN_AI` | OpenAI |
|
||||
| `OPEN_INFERENCE` | OpenInference |
|
||||
| `PARASAIL` | Parasail |
|
||||
| `PERPLEXITY` | Perplexity |
|
||||
| `PHALA` | Phala |
|
||||
| `REKA` | Reka |
|
||||
| `RELACE` | Relace |
|
||||
| `SAMBA_NOVA` | SambaNova |
|
||||
| `SEED` | Seed |
|
||||
| `SILICON_FLOW` | SiliconFlow |
|
||||
| `SOURCEFUL` | Sourceful |
|
||||
| `STEP_FUN` | StepFun |
|
||||
| `STEALTH` | Stealth |
|
||||
| `STREAM_LAKE` | StreamLake |
|
||||
| `SWITCHPOINT` | Switchpoint |
|
||||
| `TOGETHER` | Together |
|
||||
| `UPSTAGE` | Upstage |
|
||||
| `VENICE` | Venice |
|
||||
| `WAND_B` | WandB |
|
||||
| `XIAOMI` | Xiaomi |
|
||||
| `X_AI` | xAI |
|
||||
| `Z_AI` | Z.AI |
|
||||
| `FAKE_PROVIDER` | FakeProvider |
|
||||
+17
-7
@@ -1,12 +1,22 @@
|
||||
# OpenResponsesStreamEventResponseFailed
|
||||
# ProviderPreferences
|
||||
|
||||
Event emitted when a response has failed
|
||||
Provider routing preferences for the request.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `type` | [models.TypeResponseFailed](../models/typeresponsefailed.md) | :heavy_check_mark: | N/A | |
|
||||
| `response` | [models.OpenResponsesNonStreamingResponse](../models/openresponsesnonstreamingresponse.md) | :heavy_check_mark: | Complete non-streaming response from the Responses API | {<br/>"id": "resp-abc123",<br/>"object": "response",<br/>"created_at": 1704067200,<br/>"model": "gpt-4",<br/>"status": "completed",<br/>"output": [<br/>{<br/>"type": "message",<br/>"id": "msg-abc123",<br/>"status": "completed",<br/>"role": "assistant",<br/>"content": [<br/>{<br/>"type": "output_text",<br/>"text": "Hello! How can I help you today?",<br/>"annotations": []<br/>}<br/>]<br/>}<br/>],<br/>"usage": {<br/>"input_tokens": 10,<br/>"output_tokens": 25,<br/>"total_tokens": 35,<br/>"input_tokens_details": {<br/>"cached_tokens": 0<br/>},<br/>"output_tokens_details": {<br/>"reasoning_tokens": 0<br/>}<br/>},<br/>"tools": [],<br/>"tool_choice": "auto",<br/>"parallel_tool_calls": true,<br/>"error": null,<br/>"incomplete_details": null,<br/>"temperature": null,<br/>"top_p": null,<br/>"max_output_tokens": null,<br/>"metadata": null,<br/>"instructions": null<br/>} |
|
||||
| `sequence_number` | *float* | :heavy_check_mark: | N/A | |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests<br/>- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.<br/>- false: use only the primary/custom provider, and return the upstream error if it's unavailable.<br/> | |
|
||||
| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. | |
|
||||
| `data_collection` | [OptionalNullable[components.DataCollection]](../components/datacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.<br/>- allow: (default) allow providers which store user data non-transiently and may train on it<br/><br/>- deny: use only providers which do not collect user data. | allow |
|
||||
| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true |
|
||||
| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. | true |
|
||||
| `order` | List[[components.ProviderPreferencesOrder](../components/providerpreferencesorder.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | |
|
||||
| `only` | List[[components.ProviderPreferencesOnly](../components/providerpreferencesonly.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | |
|
||||
| `ignore` | List[[components.ProviderPreferencesIgnore](../components/providerpreferencesignore.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | |
|
||||
| `quantizations` | List[[components.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | |
|
||||
| `sort` | [OptionalNullable[components.ProviderPreferencesSortUnion]](../components/providerpreferencessortunion.md) | :heavy_minus_sign: | N/A | price |
|
||||
| `max_price` | [Optional[components.ProviderPreferencesMaxPrice]](../components/providerpreferencesmaxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | |
|
||||
| `preferred_min_throughput` | [OptionalNullable[components.PreferredMinThroughput]](../components/preferredminthroughput.md) | :heavy_minus_sign: | Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 100 |
|
||||
| `preferred_max_latency` | [OptionalNullable[components.PreferredMaxLatency]](../components/preferredmaxlatency.md) | :heavy_minus_sign: | Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 5 |
|
||||
@@ -0,0 +1,13 @@
|
||||
# ProviderPreferencesBy
|
||||
|
||||
The provider sorting strategy (price, throughput, latency)
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------ | ------------ |
|
||||
| `PRICE` | price |
|
||||
| `THROUGHPUT` | throughput |
|
||||
| `LATENCY` | latency |
|
||||
| `EXACTO` | exacto |
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user