Compare commits

..
Author SHA1 Message Date
OpenRouter SDK Bot 3f7c8b9074 chore: update OpenAPI spec [sdk-bot] 2026-04-10 15:46:21 +00:00
Matt AppersonandGitHub 06bea2ae0f chore: set forwardCompatibleUnionsByDefault to tagged-only (#76) 2026-04-08 10:46:15 -04:00
Matt AppersonandGitHub 6b1b7e6a9d fix: add overlay to convert boolean query params to boolean type (#75) 2026-04-08 09:22:13 -04:00
Matt AppersonandGitHub dd8e6bdac2 fix: add generic overlay to remove redundant allOf inline enums (#73) 2026-04-03 18:37:50 -04:00
Matt Apperson e6b0242969 chore: clean up removed docs and update generated SDK files
Remove obsolete component documentation and update speakeasy-generated
files to match the latest OpenAPI spec regeneration.
2026-04-02 10:21:41 -04:00
OpenRouter SDK Bot 5ab44f08f0 feat: regenerate SDK with updated OpenAPI spec
Speakeasy regeneration with latest schema changes including
type renames and new server tool models.
2026-03-27 15:18:14 -04:00
robert-j-yandGitHub e72a84e82d chore: sync from monorepo (#61) 2026-02-23 17:02:29 -06:00
OpenRouter Team c734c52d9c Commits included in this export:
- 56d382078cfce7fa597d1da2bce531af2d060b47
  - 9ef6db7e04c9401536763a321b05d00311cef31a
  - bf855082e30820d466f0f86a6d6e87de2ecfb06f
  - 335b1cbe361214e48b945b987b4e164457aa817b
  - 648485fdc7f9d8ae86fd857eccedcc5e41fb2e69
  - 80c49474a15a2bd549a5f26efad3858aa45b7c7b
  - 70e8ac317f9c4472db3decd024d1819650df4182
  - 9f2a6659ab6dbf111a0c29e4366328c3d2048826
  - a3a28b1fc6ec7d2941232a4ebde8c5f470497876
  - 4b5dc9193480b7c5c9ddb882ccf3ee2128ca0d51
  - bb413e979a46ef67c2f266743f7ebd798af42afb
  - b60e92d5dcec83f31986164f51c010d1728b2b17
  - 45687f423707f5838461585c568a024a19eb2f06
  - 3103d3ca68b6e42ccdb6136588ec2b6edc8dcab0
  - fd9f991606027cd86116317c71f8eb7b4e2aa3eb
  - 0f312019161edd76c1e5923d142c788d22f096d5
  - 5dbab2094bc744db4a90b3097520d897e5d0d634
  - 4c47d1af1735db18a1c1a7f463e801c7f71ad4e5

GitOrigin-RevId: 56d382078cfce7fa597d1da2bce531af2d060b47
2026-02-23 21:34:42 +00:00
Shashank GoyalandGitHub b2098ff28e chore: sync from monorepo (#49) 2026-02-05 20:45:13 -05:00
OpenRouter Team 1cad51abb6 Commits included in this export:
- 6ddaaa6989d725bbe966e45f7aed0c1bd72f9153
  - 4779741b6ba710b1299612b82e8544516bd9dd6a
  - 22083fcc8f58884d8212d6f3314b231c4ddd21cd
  - a925a620f97196d509e073a163caac053bd82316
  - 5c05d8829784601ffd151acef1a6978c266f913d
  - 6f4fff535fbf4274255c255ae23620b8e00e614f
  - ef358e96cb01e469b77d44683603a602b0813116
  - e6299b4ebfe5c2eed6c598771f0fd99f84555401
  - 24d3f0ee1c2aa19a62f7902836034080b9246813
  - 68922847c2969b773887310eb7aa9a814e199c5a
  - 729ee2338c39df22461526153e7f4ba868fd498e
  - e1074ff86fccf5e48406b7595298873106d3cc5a
  - 123bbdaf841d299162a82ee2573adfbb70a45b8f
  - ac457b8a8dad98fdf5ddcae8dd4711361cea3084
  - ea825199f4c59dd68fec01cf8d18a582963c9f25
  - 4d48e4f6bb936e785787314a965298da6b78fea0
  - 718729a573ee98893a4408d5a52ab4686661fe54
  - b867adcde6b64f3f2a11c4626254b39098e4b0b4
  - 21912c097b4066d109766c6b4492826595cd57c5
  - bc1ed85adc976a4634ca8a41b82e4fc2c39a864f
  - d145c89c941937a312ed1357590d2bfda9a3603d
  - 12f05b5dee397ead47cfcd545a7a2e3c7ff57524
  - dd28f75a19a015809797c7abf3f8758f7c37262e
  - c96e569781e07ab44172d9c69940ec17bafd81f4
  - c9d5a90e3c2b5077a2bdd49773f1a46d1a5a79c7
  - 58b08f87116ceab9076de2fdc0a4c74c919b44c4

GitOrigin-RevId: 6ddaaa6989d725bbe966e45f7aed0c1bd72f9153
2026-02-05 23:15:21 +00:00
robert-j-yandGitHub 0c791b04d1 chore: sync from monorepo (#36) 2026-01-21 17:28:27 -08:00
OpenRouter Team 5f2c0ee2ea Project import generated by Copybara.
GitOrigin-RevId: 2592bdc8b4b7c695a3d689390aedc9a42914acc8
2026-01-22 01:26:28 +00:00
robert-j-yandGitHub 5832c0495b chore: regenerate SDK with version 0.1.2 (#34) 2026-01-21 13:47:48 -08:00
Robert Yeakel f5dfc30997 chore: regenerate SDK with version 0.1.2 2026-01-21 13:45:46 -08:00
Shashank GoyalandGitHub a56ffbf5f3 Update speakeasy gen.yaml (#33) 2026-01-21 16:17:11 -05:00
Shashank Goyal cc2b002c5c Update speakeasy gen.yaml 2026-01-21 16:16:16 -05:00
Shashank Goyal 9774c726fd Bring project back to correct version number 2026-01-21 16:03:44 -05:00
Matt AppersonandGitHub 3a40848aab fix: update OpenAPI spec with router field (#32) 2026-01-13 20:40:08 -05:00
Matt AppersonandGitHub f190e3f950 feat: fix types and add reasoning_details to chat responses (#27) 2025-12-16 16:16:22 -05:00
Matt AppersonandGitHub d433ce35e8 chore: regenerate Python SDK with updated OpenAPI spec (#26) 2025-12-12 15:17:08 -05:00
Matt Apperson 61e5216764 chore: regenerate Python SDK with updated OpenAPI spec
Updates include:
- Updated OpenAPI spec with new component schemas
- Restructured component documentation with nested parameter types
- Added new components for plugin and provider configurations
- Updated chat generation params and response request structures
- Version bump and dependency updates
2025-12-12 15:13:12 -05:00
Matt AppersonandGitHub 67ef52b03e chore: Python SDK updates and regeneration (#24) 2025-12-04 13:09:00 -05:00
Matt Apperson d4474da1b8 more updates 2025-12-04 13:07:08 -05:00
Matt Apperson aed8199b2b updates 2025-12-04 13:07:01 -05:00
Matt AppersonandGitHub 06b2ccc54a chore: regenerate Python SDK v0.1.1 with new overlays (#23) 2025-12-04 10:48:48 -05:00
Matt Apperson 6cd0d2a76d latest updates 2025-12-04 10:46:19 -05:00
Matt AppersonandGitHub a1dae775cb chore: regenerate Python SDK v0.0.17 (#18) 2025-11-18 13:59:14 -05:00
Matt Apperson 10a76ba502 chore: regenerate SDK to v0.0.19 with speakeasy 2025-11-18 13:58:48 -05:00
Matt Apperson f4ffd51f40 chore: regenerate Python SDK v0.0.17
Update Python SDK with Speakeasy regeneration:
- Bump version from 0.0.16 to 0.0.17
- Refactor OpenAPI schema definitions:
  - Inline BigNumberUnion type into usage sites
  - Reorganize ProviderName enum location
  - Simplify provider order/only/ignore array types
  - Add plugins schema definitions
- Update gen.lock with new configChecksum
2025-11-18 13:56:41 -05:00
Matt AppersonandGitHub 20c63f6f13 feat: add monorepo sync notification workflow (#17) 2025-11-15 16:16:37 -05:00
Matt Apperson 0f9cb9787a feat: add monorepo sync notification workflow
Automatically notifies openrouter-web monorepo when changes are pushed to main.
This triggers the subtree sync workflow to create a PR with updates.

Requires MONOREPO_SYNC_TOKEN secret to be configured.
2025-11-15 15:53:15 -05:00
Matt AppersonandGitHub 6c5dfcfb2b chore: 🐝 Update SDK - Generate 0.0.16 (#16) 2025-11-15 13:50:49 -05:00
speakeasy-github[bot]andspeakeasy-bot afbf99e8bf empty commit to trigger [run-tests] workflow 2025-11-15 18:17:41 +00:00
speakeasybot 6895d9d45b ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.658.1 2025-11-15 18:17:32 +00:00
Matt Apperson e824ca8a57 remove banner 2025-11-13 14:35:17 -05:00
Matt AppersonandGitHub e70f43e916 Add Apache License 2.0
Added the Apache License 2.0 to the project.
2025-11-13 14:34:40 -05:00
Matt Apperson 94ba44c933 fixes 2025-11-13 14:21:27 -05:00
Matt Apperson d13e797ad1 fix 2025-11-13 14:14:19 -05:00
Matt Apperson 3629471122 names 2025-11-13 14:09:48 -05:00
Matt Apperson c702382b4b lint fix 2025-11-13 14:02:45 -05:00
Matt Apperson 599fd1454c bump 2025-11-13 13:52:26 -05:00
Matt Apperson a0b2566851 fix permissions 2025-11-13 13:45:14 -05:00
1014 changed files with 75656 additions and 25247 deletions
+3 -1
View File
@@ -1,7 +1,9 @@
{
"permissions": {
"allow": [
"Bash(python3:*)"
"Bash(python3:*)",
"Bash(git push:*)",
"Bash(gh pr create:*)"
],
"deny": [],
"ask": []
+1
View File
@@ -0,0 +1 @@
pylintrc
+46
View File
@@ -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
View File
@@ -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
View File
File diff suppressed because it is too large Load Diff
+18 -7
View File
@@ -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.4
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
+10
View File
@@ -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
View File
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
View File
@@ -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
+12 -6
View File
@@ -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
+201
View File
@@ -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
View File
@@ -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.
+6 -2
View File
@@ -1,5 +1,3 @@
![hero illustration](./assets/banner.png)
# 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
View File
@@ -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 - .
+8 -110
View File
@@ -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:
+14
View File
@@ -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 | |
+13
View File
@@ -0,0 +1,13 @@
# By
The provider sorting strategy (price, throughput, latency)
## Values
| Name | Value |
| ------------ | ------------ |
| `PRICE` | price |
| `THROUGHPUT` | throughput |
| `LATENCY` | latency |
| `EXACTO` | exacto |
+10
View File
@@ -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 |
+11
View File
@@ -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 | |
+10
View File
@@ -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 |
@@ -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 | |
+10
View File
@@ -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 */
```
@@ -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 */
```
@@ -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 |
+13
View File
@@ -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. |
+17
View File
@@ -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 |
+11
View File
@@ -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 |
+19
View File
@@ -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 */
```
+10
View File
@@ -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) |
+13
View File
@@ -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) |
+25
View File
@@ -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 */
```
+25
View File
@@ -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 */
```
+21
View File
@@ -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 | |
@@ -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 |
+83
View File
@@ -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 |
@@ -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 |
+13
View File
@@ -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