mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-31 12:30:30 +08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f812f831d | ||
|
|
95cb1260c7 |
@@ -1,9 +1,7 @@
|
|||||||
{
|
{
|
||||||
"permissions": {
|
"permissions": {
|
||||||
"allow": [
|
"allow": [
|
||||||
"Bash(python3:*)",
|
"Bash(python3:*)"
|
||||||
"Bash(git push:*)",
|
|
||||||
"Bash(gh pr create:*)"
|
|
||||||
],
|
],
|
||||||
"deny": [],
|
"deny": [],
|
||||||
"ask": []
|
"ask": []
|
||||||
|
|||||||
@@ -1,225 +0,0 @@
|
|||||||
name: Auto-merge Speakeasy PR
|
|
||||||
|
|
||||||
# Called as a follow-up job after Speakeasy Generate (mode: pr). Merges the
|
|
||||||
# regen PR opened/updated in the same workflow run so sdk_publish.yaml can run.
|
|
||||||
# Prefer branch_name from Generate logs; fall back to run_started_at heuristics.
|
|
||||||
# Uses GH_DOCS_SYNC GitHub App token (not a PAT) so merges trigger downstream push.
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
run_started_at:
|
|
||||||
description: ISO timestamp when the parent Generate workflow run started
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
branch_name:
|
|
||||||
description: Speakeasy regen branch from the parent Generate run (optional)
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: ""
|
|
||||||
secrets:
|
|
||||||
GH_DOCS_SYNC_APP_ID:
|
|
||||||
required: true
|
|
||||||
GH_DOCS_SYNC_APP_PRIVATE_KEY:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: auto-merge-speakeasy
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
auto-merge:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Generate GitHub App token
|
|
||||||
id: app-token
|
|
||||||
# actions/create-github-app-token@v3.2.0 (immutable SHA)
|
|
||||||
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1
|
|
||||||
with:
|
|
||||||
app-id: ${{ secrets.GH_DOCS_SYNC_APP_ID }}
|
|
||||||
private-key: ${{ secrets.GH_DOCS_SYNC_APP_PRIVATE_KEY }}
|
|
||||||
|
|
||||||
- name: Resolve Speakeasy regen PR
|
|
||||||
id: pr
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
REPO="${{ github.repository }}"
|
|
||||||
RUN_STARTED="${{ inputs.run_started_at }}"
|
|
||||||
BRANCH="${{ inputs.branch_name }}"
|
|
||||||
|
|
||||||
PR_JSON=$(gh pr list \
|
|
||||||
--repo "$REPO" \
|
|
||||||
--state open \
|
|
||||||
--search "head:speakeasy-sdk-regen-" \
|
|
||||||
--limit 500 \
|
|
||||||
--json number,updatedAt,title,labels,author,headRefName)
|
|
||||||
|
|
||||||
PR_NUM=""
|
|
||||||
if [ -n "$BRANCH" ]; then
|
|
||||||
CANDIDATE=$(echo "$PR_JSON" | jq -r --arg branch "$BRANCH" \
|
|
||||||
'[.[] | select(.headRefName == $branch)] | .[0] // empty')
|
|
||||||
if [ -n "$CANDIDATE" ] && echo "$CANDIDATE" | jq -e '
|
|
||||||
(.headRefName | startswith("speakeasy-sdk-regen-"))
|
|
||||||
and (.title | contains("🐝 Update SDK"))
|
|
||||||
and ([.labels[].name] | any(. == "patch" or . == "minor" or . == "major"))
|
|
||||||
and (.author.is_bot == true)
|
|
||||||
' > /dev/null; then
|
|
||||||
PR_NUM=$(echo "$CANDIDATE" | jq -r '.number')
|
|
||||||
echo "Resolved Speakeasy regen PR #$PR_NUM from branch $BRANCH"
|
|
||||||
else
|
|
||||||
echo "::warning::branch_name=$BRANCH did not match a valid open regen PR — falling back to run_started_at"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$PR_NUM" ]; then
|
|
||||||
PR_NUM=$(echo "$PR_JSON" | jq -r --arg started "$RUN_STARTED" '
|
|
||||||
[.[]
|
|
||||||
| select(.headRefName | startswith("speakeasy-sdk-regen-"))
|
|
||||||
| select(.title | contains("🐝 Update SDK"))
|
|
||||||
| select([.labels[].name] | any(. == "patch" or . == "minor" or . == "major"))
|
|
||||||
| select(.author.is_bot == true)
|
|
||||||
| select(.updatedAt >= $started)
|
|
||||||
] | sort_by(.updatedAt) | last | .number // empty')
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$PR_NUM" ]; then
|
|
||||||
echo "No Speakeasy regen PR for this Generate run — skipping auto-merge"
|
|
||||||
echo "::notice title=auto-merge-skipped::No qualifying Speakeasy regen PR to merge"
|
|
||||||
{
|
|
||||||
echo "## Auto-merge skipped"
|
|
||||||
echo "No qualifying \`speakeasy-sdk-regen-*\` PR was found."
|
|
||||||
echo "- branch_name input: \`${BRANCH:-<empty>}\`"
|
|
||||||
echo "- run_started_at: \`$RUN_STARTED\`"
|
|
||||||
} >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
echo "pr_num=" >> "$GITHUB_OUTPUT"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "pr_num=$PR_NUM" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "$PR_JSON" > /tmp/speakeasy_pr_json.json
|
|
||||||
|
|
||||||
- name: Close superseded Speakeasy PRs
|
|
||||||
if: steps.pr.outputs.pr_num != ''
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
CURRENT_PR="${{ steps.pr.outputs.pr_num }}"
|
|
||||||
PR_JSON=$(cat /tmp/speakeasy_pr_json.json)
|
|
||||||
|
|
||||||
PRIOR_JSON=$(echo "$PR_JSON" | jq -r --arg current_pr "$CURRENT_PR" \
|
|
||||||
'[.[].number | select(tostring != $current_pr)] | .[]')
|
|
||||||
|
|
||||||
if [ -z "$PRIOR_JSON" ]; then
|
|
||||||
echo "No superseded Speakeasy PRs to close"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
mapfile -t PRIOR <<< "$PRIOR_JSON"
|
|
||||||
|
|
||||||
echo "Closing ${#PRIOR[@]} superseded Speakeasy PR(s)"
|
|
||||||
for N in "${PRIOR[@]}"; do
|
|
||||||
gh pr close "$N" --repo "${{ github.repository }}" --delete-branch \
|
|
||||||
--comment "Superseded by newer Speakeasy SDK generation PR #${CURRENT_PR}" \
|
|
||||||
|| echo "::warning::Failed to close PR #$N (continuing)"
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Auto-merge Speakeasy PR
|
|
||||||
if: steps.pr.outputs.pr_num != ''
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
PR_NUM="${{ steps.pr.outputs.pr_num }}"
|
|
||||||
REPO="${{ github.repository }}"
|
|
||||||
|
|
||||||
wait_for_checks() {
|
|
||||||
local pr=$1
|
|
||||||
local timeout=600
|
|
||||||
local interval=15
|
|
||||||
local elapsed=0
|
|
||||||
|
|
||||||
echo "Waiting for PR #$pr checks (timeout ${timeout}s)..."
|
|
||||||
while [ "$elapsed" -lt "$timeout" ]; do
|
|
||||||
TOTAL=$(gh pr view "$pr" --repo "$REPO" --json statusCheckRollup --jq \
|
|
||||||
'.statusCheckRollup | length')
|
|
||||||
PENDING=$(gh pr view "$pr" --repo "$REPO" --json statusCheckRollup --jq \
|
|
||||||
'[.statusCheckRollup[]? | select(.status != "COMPLETED")] | length')
|
|
||||||
FAILED=$(gh pr view "$pr" --repo "$REPO" --json statusCheckRollup --jq \
|
|
||||||
'[.statusCheckRollup[]? | select(.status == "COMPLETED") | select(.conclusion != "SUCCESS" and .conclusion != "SKIPPED" and .conclusion != "NEUTRAL")] | length')
|
|
||||||
|
|
||||||
if [ "$TOTAL" -eq 0 ]; then
|
|
||||||
# GITHUB_TOKEN-authored regen PRs get no pull_request checks at all,
|
|
||||||
# so TOTAL stays 0 forever. Wait a short grace window in case checks
|
|
||||||
# are merely slow to register, then proceed rather than time out.
|
|
||||||
if [ "$elapsed" -ge 60 ]; then
|
|
||||||
echo "No checks registered after ${elapsed}s — proceeding (checkless PR)"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
echo "Checks not yet registered — waiting ${interval}s..."
|
|
||||||
sleep "$interval"
|
|
||||||
elapsed=$((elapsed + interval))
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$PENDING" -eq 0 ]; then
|
|
||||||
if [ "$FAILED" -gt 0 ]; then
|
|
||||||
echo "::error::PR #$pr has failing checks — refusing direct merge"
|
|
||||||
gh pr checks "$pr" --repo "$REPO" || true
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "All checks completed"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Checks pending ($PENDING) — waiting ${interval}s..."
|
|
||||||
sleep "$interval"
|
|
||||||
elapsed=$((elapsed + interval))
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "::error::Timed out waiting for PR #$pr checks"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
STATE=$(gh pr view "$PR_NUM" --repo "$REPO" --json state --jq .state)
|
|
||||||
if [ "$STATE" != "OPEN" ]; then
|
|
||||||
echo "PR #$PR_NUM is $STATE — skipping merge"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
MERGE_METHOD=""
|
|
||||||
# Prefer GitHub auto-merge when required checks exist; otherwise
|
|
||||||
# squash-merge directly after checks pass (sdk-release-prs.yaml pattern).
|
|
||||||
AUTO_MERGE_NOOP_PATTERN='is in clean status|protected branch rules|Branch does not have required protected branch rules'
|
|
||||||
if gh pr merge "$PR_NUM" --repo "$REPO" --squash --auto --delete-branch 2> /tmp/gh-merge.err; then
|
|
||||||
MERGE_METHOD="auto-merge queued"
|
|
||||||
echo "Auto-merge enabled for Speakeasy PR #$PR_NUM"
|
|
||||||
elif grep -qiE "$AUTO_MERGE_NOOP_PATTERN" /tmp/gh-merge.err; then
|
|
||||||
echo "Auto-merge not applicable — waiting for checks, then merging PR #$PR_NUM directly"
|
|
||||||
cat /tmp/gh-merge.err >&2
|
|
||||||
wait_for_checks "$PR_NUM"
|
|
||||||
gh pr merge "$PR_NUM" --repo "$REPO" --squash --delete-branch
|
|
||||||
MERGE_METHOD="direct squash (checks passed)"
|
|
||||||
else
|
|
||||||
echo "::error::Failed to enable auto-merge on Speakeasy PR #$PR_NUM"
|
|
||||||
cat /tmp/gh-merge.err >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "::notice title=auto-merge-pr::Merged Speakeasy PR #$PR_NUM ($MERGE_METHOD)"
|
|
||||||
{
|
|
||||||
echo "## Auto-merge complete"
|
|
||||||
echo "- PR: #$PR_NUM"
|
|
||||||
echo "- Method: $MERGE_METHOD"
|
|
||||||
echo "- Token: GH_DOCS_SYNC GitHub App"
|
|
||||||
} >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
name: PR Validation
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
paths-ignore:
|
|
||||||
- .speakeasy/in.openapi.yaml
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: pr-validation-${{ github.event.pull_request.number }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
validate:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
|
|
||||||
- name: Install uv
|
|
||||||
uses: astral-sh/setup-uv@v5
|
|
||||||
with:
|
|
||||||
enable-cache: true
|
|
||||||
|
|
||||||
- name: Build SDK
|
|
||||||
run: uv build
|
|
||||||
|
|
||||||
- name: Type check (mypy)
|
|
||||||
run: uv run --group dev mypy src
|
|
||||||
|
|
||||||
- name: Type check (pyright)
|
|
||||||
run: uv run --group dev pyright src
|
|
||||||
|
|
||||||
- name: Lint (pylint)
|
|
||||||
run: uv run --group dev pylint src --rcfile pylintrc
|
|
||||||
@@ -21,11 +21,6 @@ permissions:
|
|||||||
types:
|
types:
|
||||||
- labeled
|
- labeled
|
||||||
- unlabeled
|
- unlabeled
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: speakeasy-generate
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
generate:
|
generate:
|
||||||
uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
|
uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
|
||||||
@@ -37,67 +32,3 @@ jobs:
|
|||||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
pypi_token: ${{ secrets.PYPI_TOKEN }}
|
pypi_token: ${{ secrets.PYPI_TOKEN }}
|
||||||
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
|
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
|
||||||
|
|
||||||
resolve-branch:
|
|
||||||
needs: generate
|
|
||||||
if: ${{ !cancelled() && needs.generate.result == 'success' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
branch_name: ${{ steps.branch.outputs.branch_name }}
|
|
||||||
run_started_at: ${{ steps.branch.outputs.run_started_at }}
|
|
||||||
steps:
|
|
||||||
- name: Extract branch from Generate logs
|
|
||||||
id: branch
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
REPO="${{ github.repository }}"
|
|
||||||
RUN_ID="${{ github.run_id }}"
|
|
||||||
|
|
||||||
RUN_STARTED="${{ github.run_started_at }}"
|
|
||||||
if [ -z "$RUN_STARTED" ]; then
|
|
||||||
RUN_STARTED=$(gh run view "$RUN_ID" --repo "$REPO" --json startedAt --jq '.startedAt')
|
|
||||||
echo "Resolved run_started_at from API: $RUN_STARTED"
|
|
||||||
fi
|
|
||||||
echo "run_started_at=$RUN_STARTED" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
# Full-run logs are unavailable while the workflow is in progress;
|
|
||||||
# fetch logs from the completed generate job instead.
|
|
||||||
JOB_ID=$(gh run view "$RUN_ID" --repo "$REPO" --json jobs --jq \
|
|
||||||
'[.jobs[] | select(.name == "generate / Generate Target")] | .[0].databaseId // empty')
|
|
||||||
|
|
||||||
BRANCH=""
|
|
||||||
if [ -z "$JOB_ID" ]; then
|
|
||||||
echo "::warning::Could not find generate job id — auto-merge will use run_started_at fallback"
|
|
||||||
else
|
|
||||||
MAX_ATTEMPTS=12
|
|
||||||
INTERVAL=10
|
|
||||||
for attempt in $(seq 1 "$MAX_ATTEMPTS"); do
|
|
||||||
BRANCH=$(gh run view "$RUN_ID" --repo "$REPO" --job "$JOB_ID" --log 2>/dev/null \
|
|
||||||
| grep -oE 'branch_name=speakeasy-sdk-regen-[0-9]+' | tail -1 | cut -d= -f2 || true)
|
|
||||||
if [ -n "$BRANCH" ]; then
|
|
||||||
echo "Extracted branch_name=$BRANCH (attempt $attempt)"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if [ "$attempt" -lt "$MAX_ATTEMPTS" ]; then
|
|
||||||
echo "Job logs not ready — waiting ${INTERVAL}s (attempt $attempt/$MAX_ATTEMPTS)..."
|
|
||||||
sleep "$INTERVAL"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ -z "$BRANCH" ]; then
|
|
||||||
echo "::warning::Could not extract branch_name from Generate logs after ${MAX_ATTEMPTS} attempts — auto-merge will use run_started_at fallback"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
echo "branch_name=$BRANCH" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
auto-merge:
|
|
||||||
needs: [generate, resolve-branch]
|
|
||||||
if: ${{ !cancelled() && needs.generate.result == 'success' }}
|
|
||||||
uses: ./.github/workflows/auto-merge-speakeasy-pr.yaml
|
|
||||||
with:
|
|
||||||
run_started_at: ${{ needs.resolve-branch.outputs.run_started_at }}
|
|
||||||
branch_name: ${{ needs.resolve-branch.outputs.branch_name }}
|
|
||||||
secrets:
|
|
||||||
GH_DOCS_SYNC_APP_ID: ${{ secrets.GH_DOCS_SYNC_APP_ID }}
|
|
||||||
GH_DOCS_SYNC_APP_PRIVATE_KEY: ${{ secrets.GH_DOCS_SYNC_APP_PRIVATE_KEY }}
|
|
||||||
|
|||||||
@@ -1,104 +0,0 @@
|
|||||||
name: Generate (spec change merged)
|
|
||||||
permissions:
|
|
||||||
checks: write
|
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
statuses: write
|
|
||||||
id-token: write
|
|
||||||
"on":
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
force:
|
|
||||||
description: Force generation of SDKs
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
set_version:
|
|
||||||
description: optionally set a specific SDK version
|
|
||||||
type: string
|
|
||||||
pull_request:
|
|
||||||
types: [closed]
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- .speakeasy/in.openapi.yaml
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: speakeasy-generate-spec-change
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
generate:
|
|
||||||
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
|
|
||||||
uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
|
|
||||||
with:
|
|
||||||
force: ${{ github.event.inputs.force }}
|
|
||||||
mode: pr
|
|
||||||
set_version: ${{ github.event.inputs.set_version }}
|
|
||||||
secrets:
|
|
||||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
pypi_token: ${{ secrets.PYPI_TOKEN }}
|
|
||||||
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
|
|
||||||
|
|
||||||
resolve-branch:
|
|
||||||
needs: generate
|
|
||||||
if: ${{ !cancelled() && needs.generate.result == 'success' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
branch_name: ${{ steps.branch.outputs.branch_name }}
|
|
||||||
run_started_at: ${{ steps.branch.outputs.run_started_at }}
|
|
||||||
steps:
|
|
||||||
- name: Extract branch from Generate logs
|
|
||||||
id: branch
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
REPO="${{ github.repository }}"
|
|
||||||
RUN_ID="${{ github.run_id }}"
|
|
||||||
|
|
||||||
RUN_STARTED="${{ github.run_started_at }}"
|
|
||||||
if [ -z "$RUN_STARTED" ]; then
|
|
||||||
RUN_STARTED=$(gh run view "$RUN_ID" --repo "$REPO" --json startedAt --jq '.startedAt')
|
|
||||||
echo "Resolved run_started_at from API: $RUN_STARTED"
|
|
||||||
fi
|
|
||||||
echo "run_started_at=$RUN_STARTED" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
# Full-run logs are unavailable while the workflow is in progress;
|
|
||||||
# fetch logs from the completed generate job instead.
|
|
||||||
JOB_ID=$(gh run view "$RUN_ID" --repo "$REPO" --json jobs --jq \
|
|
||||||
'[.jobs[] | select(.name == "generate / Generate Target")] | .[0].databaseId // empty')
|
|
||||||
|
|
||||||
BRANCH=""
|
|
||||||
if [ -z "$JOB_ID" ]; then
|
|
||||||
echo "::warning::Could not find generate job id — auto-merge will use run_started_at fallback"
|
|
||||||
else
|
|
||||||
MAX_ATTEMPTS=12
|
|
||||||
INTERVAL=10
|
|
||||||
for attempt in $(seq 1 "$MAX_ATTEMPTS"); do
|
|
||||||
BRANCH=$(gh run view "$RUN_ID" --repo "$REPO" --job "$JOB_ID" --log 2>/dev/null \
|
|
||||||
| grep -oE 'branch_name=speakeasy-sdk-regen-[0-9]+' | tail -1 | cut -d= -f2 || true)
|
|
||||||
if [ -n "$BRANCH" ]; then
|
|
||||||
echo "Extracted branch_name=$BRANCH (attempt $attempt)"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if [ "$attempt" -lt "$MAX_ATTEMPTS" ]; then
|
|
||||||
echo "Job logs not ready — waiting ${INTERVAL}s (attempt $attempt/$MAX_ATTEMPTS)..."
|
|
||||||
sleep "$INTERVAL"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ -z "$BRANCH" ]; then
|
|
||||||
echo "::warning::Could not extract branch_name from Generate logs after ${MAX_ATTEMPTS} attempts — auto-merge will use run_started_at fallback"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
echo "branch_name=$BRANCH" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
auto-merge:
|
|
||||||
needs: [generate, resolve-branch]
|
|
||||||
if: ${{ !cancelled() && needs.generate.result == 'success' }}
|
|
||||||
uses: ./.github/workflows/auto-merge-speakeasy-pr.yaml
|
|
||||||
with:
|
|
||||||
run_started_at: ${{ needs.resolve-branch.outputs.run_started_at }}
|
|
||||||
branch_name: ${{ needs.resolve-branch.outputs.branch_name }}
|
|
||||||
secrets:
|
|
||||||
GH_DOCS_SYNC_APP_ID: ${{ secrets.GH_DOCS_SYNC_APP_ID }}
|
|
||||||
GH_DOCS_SYNC_APP_PRIVATE_KEY: ${{ secrets.GH_DOCS_SYNC_APP_PRIVATE_KEY }}
|
|
||||||
+2
-14
@@ -1,25 +1,13 @@
|
|||||||
|
.venv/
|
||||||
venv/
|
venv/
|
||||||
src/*.egg-info/
|
src/*.egg-info/
|
||||||
**/__pycache__/
|
**/__pycache__/
|
||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
.python-version
|
.python-version
|
||||||
|
.DS_Store
|
||||||
pyrightconfig.json
|
pyrightconfig.json
|
||||||
**/.speakeasy/temp/
|
**/.speakeasy/temp/
|
||||||
**/.speakeasy/logs/
|
**/.speakeasy/logs/
|
||||||
.speakeasy/reports
|
.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
|
||||||
.env.local
|
.env.local
|
||||||
.env.*.local
|
|
||||||
.DS_Store
|
|
||||||
.venv/
|
|
||||||
|
|||||||
+818
-10269
File diff suppressed because it is too large
Load Diff
+5
-13
@@ -6,7 +6,7 @@ generation:
|
|||||||
sdkClassName: OpenRouter
|
sdkClassName: OpenRouter
|
||||||
maintainOpenAPIOrder: true
|
maintainOpenAPIOrder: true
|
||||||
usageSnippets:
|
usageSnippets:
|
||||||
optionalPropertyRendering: never
|
optionalPropertyRendering: withExample
|
||||||
sdkInitStyle: constructor
|
sdkInitStyle: constructor
|
||||||
useClassNamesForArrayFields: true
|
useClassNamesForArrayFields: true
|
||||||
fixes:
|
fixes:
|
||||||
@@ -24,15 +24,13 @@ generation:
|
|||||||
sdkHooksConfigAccess: true
|
sdkHooksConfigAccess: true
|
||||||
schemas:
|
schemas:
|
||||||
allOfMergeStrategy: shallowMerge
|
allOfMergeStrategy: shallowMerge
|
||||||
requestBodyFieldName: ""
|
requestBodyFieldName: body
|
||||||
persistentEdits: {}
|
|
||||||
tests:
|
tests:
|
||||||
generateTests: false
|
generateTests: false
|
||||||
generateNewTests: true
|
generateNewTests: true
|
||||||
skipResponseBodyAssertions: false
|
skipResponseBodyAssertions: false
|
||||||
preApplyUnionDiscriminators: true
|
|
||||||
python:
|
python:
|
||||||
version: 0.10.8
|
version: 0.1.0
|
||||||
additionalDependencies:
|
additionalDependencies:
|
||||||
dev: {}
|
dev: {}
|
||||||
main: {}
|
main: {}
|
||||||
@@ -40,14 +38,11 @@ python:
|
|||||||
- id
|
- id
|
||||||
- object
|
- object
|
||||||
- input
|
- input
|
||||||
- models
|
|
||||||
- hash
|
|
||||||
asyncMode: both
|
asyncMode: both
|
||||||
authors:
|
authors:
|
||||||
- OpenRouter
|
- OpenRouter
|
||||||
baseErrorName: OpenRouterError
|
baseErrorName: OpenRouterError
|
||||||
clientServerStatusCodesAsErrors: true
|
clientServerStatusCodesAsErrors: true
|
||||||
constFieldCasing: upper
|
|
||||||
defaultErrorName: OpenRouterDefaultError
|
defaultErrorName: OpenRouterDefaultError
|
||||||
description: Official Python Client SDK for OpenRouter.
|
description: Official Python Client SDK for OpenRouter.
|
||||||
enableCustomCodeRegions: false
|
enableCustomCodeRegions: false
|
||||||
@@ -59,16 +54,14 @@ python:
|
|||||||
flattenGlobalSecurity: true
|
flattenGlobalSecurity: true
|
||||||
flattenRequests: true
|
flattenRequests: true
|
||||||
flatteningOrder: parameters-first
|
flatteningOrder: parameters-first
|
||||||
forwardCompatibleUnionsByDefault: tagged-only
|
|
||||||
imports:
|
imports:
|
||||||
option: openapi
|
option: openapi
|
||||||
paths:
|
paths:
|
||||||
callbacks: callbacks
|
callbacks: ""
|
||||||
errors: errors
|
errors: errors
|
||||||
operations: operations
|
operations: operations
|
||||||
shared: components
|
shared: components
|
||||||
webhooks: webhooks
|
webhooks: ""
|
||||||
inferSSEOverload: true
|
|
||||||
inferUnionDiscriminators: true
|
inferUnionDiscriminators: true
|
||||||
inputModelSuffix: input
|
inputModelSuffix: input
|
||||||
legacyPyright: false
|
legacyPyright: false
|
||||||
@@ -80,7 +73,6 @@ python:
|
|||||||
outputModelSuffix: output
|
outputModelSuffix: output
|
||||||
packageManager: uv
|
packageManager: uv
|
||||||
packageName: openrouter
|
packageName: openrouter
|
||||||
preApplyUnionDiscriminators: false
|
|
||||||
pytestFilterWarnings: []
|
pytestFilterWarnings: []
|
||||||
pytestTimeout: 0
|
pytestTimeout: 0
|
||||||
responseFormat: flat
|
responseFormat: flat
|
||||||
|
|||||||
+7443
-33286
File diff suppressed because it is too large
Load Diff
@@ -1,10 +0,0 @@
|
|||||||
lintVersion: 1.0.0
|
|
||||||
defaultRuleset: openrouter
|
|
||||||
rulesets:
|
|
||||||
openrouter:
|
|
||||||
rulesets:
|
|
||||||
- speakeasy-recommended
|
|
||||||
- speakeasy-generation
|
|
||||||
rules:
|
|
||||||
oas3-missing-example:
|
|
||||||
severity: "off"
|
|
||||||
+8270
-33992
File diff suppressed because it is too large
Load Diff
@@ -1,52 +0,0 @@
|
|||||||
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"
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
overlay: 1.0.0
|
|
||||||
x-speakeasy-jsonpath: rfc9535
|
|
||||||
info:
|
|
||||||
title: Fix nullable pagination params
|
|
||||||
version: 0.0.0
|
|
||||||
actions:
|
|
||||||
- target: $..parameters[?@.name == "offset" && @.in == "query"].schema
|
|
||||||
description: Remove nullable from offset query params to fix mypy errors in pagination helpers
|
|
||||||
update:
|
|
||||||
nullable: false
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
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
|
|
||||||
+14
-24
@@ -1,48 +1,38 @@
|
|||||||
speakeasyVersion: 1.680.0
|
speakeasyVersion: 1.668.0
|
||||||
sources:
|
sources:
|
||||||
OpenRouter API:
|
-OAS:
|
||||||
sourceNamespace: open-router-chat-completions-api
|
sourceNamespace: open-router-chat-completions-api
|
||||||
sourceRevisionDigest: sha256:ed6981b24a0f8df827afac0f83d7dae4d8f7df331ae6e72664e03800cb7a0244
|
sourceRevisionDigest: sha256:697f956356ab0195b9a9b9a5106e4ac979caa551709b3614c723df972c661829
|
||||||
sourceBlobDigest: sha256:5961e537bd3160eb3f541232a5e7cb43704fed5e9ce76b342c08f6c52d4fefe9
|
sourceBlobDigest: sha256:a286a09ceced7f78a685731aef81d1498b89a6a46f3794219dc93fa2d822853b
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
- speakeasy-sdk-regen-1782660460
|
- speakeasy-sdk-regen-1763684529
|
||||||
- 1.0.0
|
|
||||||
targets:
|
targets:
|
||||||
open-router:
|
open-router:
|
||||||
source: OpenRouter API
|
source: -OAS
|
||||||
sourceNamespace: open-router-chat-completions-api
|
sourceNamespace: open-router-chat-completions-api
|
||||||
sourceRevisionDigest: sha256:ed6981b24a0f8df827afac0f83d7dae4d8f7df331ae6e72664e03800cb7a0244
|
sourceRevisionDigest: sha256:697f956356ab0195b9a9b9a5106e4ac979caa551709b3614c723df972c661829
|
||||||
sourceBlobDigest: sha256:5961e537bd3160eb3f541232a5e7cb43704fed5e9ce76b342c08f6c52d4fefe9
|
sourceBlobDigest: sha256:a286a09ceced7f78a685731aef81d1498b89a6a46f3794219dc93fa2d822853b
|
||||||
codeSamplesNamespace: open-router-python-code-samples
|
|
||||||
codeSamplesRevisionDigest: sha256:d3f20480ea1c0bcb8d872ae696b7a8b2c16d1469ee95b6df12b03b7004ce1c9c
|
|
||||||
workflow:
|
workflow:
|
||||||
workflowVersion: 1.0.0
|
workflowVersion: 1.0.0
|
||||||
speakeasyVersion: 1.680.0
|
speakeasyVersion: latest
|
||||||
sources:
|
sources:
|
||||||
OpenRouter API:
|
-OAS:
|
||||||
inputs:
|
inputs:
|
||||||
- location: .speakeasy/in.openapi.yaml
|
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main
|
||||||
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
|
|
||||||
- location: .speakeasy/overlays/fix-nullable-pagination.overlay.yaml
|
|
||||||
output: .speakeasy/out.openapi.yaml
|
output: .speakeasy/out.openapi.yaml
|
||||||
registry:
|
registry:
|
||||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
|
location: registry.speakeasyapi.dev/openrouter/sdk/-oas
|
||||||
targets:
|
targets:
|
||||||
open-router:
|
open-router:
|
||||||
target: python
|
target: python
|
||||||
source: OpenRouter API
|
source: -OAS
|
||||||
publish:
|
publish:
|
||||||
pypi:
|
pypi:
|
||||||
token: $pypi_token
|
token: $pypi_token
|
||||||
codeSamples:
|
codeSamples:
|
||||||
registry:
|
registry:
|
||||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-python-code-samples
|
location: registry.speakeasyapi.dev/openrouter/sdk/-oas-python-code-samples
|
||||||
labelOverride:
|
labelOverride:
|
||||||
fixedValue: Python (SDK)
|
fixedValue: Python (SDK)
|
||||||
blocking: false
|
blocking: false
|
||||||
|
|||||||
@@ -1,29 +1,22 @@
|
|||||||
workflowVersion: 1.0.0
|
workflowVersion: 1.0.0
|
||||||
speakeasyVersion: 1.680.0
|
speakeasyVersion: latest
|
||||||
sources:
|
sources:
|
||||||
OpenRouter API:
|
-OAS:
|
||||||
inputs:
|
inputs:
|
||||||
- location: .speakeasy/in.openapi.yaml
|
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main
|
||||||
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
|
|
||||||
- location: .speakeasy/overlays/fix-nullable-pagination.overlay.yaml
|
|
||||||
output: .speakeasy/out.openapi.yaml
|
output: .speakeasy/out.openapi.yaml
|
||||||
registry:
|
registry:
|
||||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
|
location: registry.speakeasyapi.dev/openrouter/sdk/-oas
|
||||||
targets:
|
targets:
|
||||||
open-router:
|
open-router:
|
||||||
target: python
|
target: python
|
||||||
source: OpenRouter API
|
source: -OAS
|
||||||
publish:
|
publish:
|
||||||
pypi:
|
pypi:
|
||||||
token: $pypi_token
|
token: $pypi_token
|
||||||
codeSamples:
|
codeSamples:
|
||||||
registry:
|
registry:
|
||||||
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-python-code-samples
|
location: registry.speakeasyapi.dev/openrouter/sdk/-oas-python-code-samples
|
||||||
labelOverride:
|
labelOverride:
|
||||||
fixedValue: Python (SDK)
|
fixedValue: Python (SDK)
|
||||||
blocking: false
|
blocking: false
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# OpenRouter Python SDK
|
# OpenRouter Python SDK
|
||||||
|
|
||||||
The OpenRouter Python SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.
|
The OpenRouter Python SDK is a type-safe toolkit for building AI applications with access to 300+ language models through a unified API.
|
||||||
|
|
||||||
## Why use the OpenRouter SDK?
|
## Why use the OpenRouter SDK?
|
||||||
|
|
||||||
|
|||||||
+9
-72
@@ -1,6 +1,6 @@
|
|||||||
# OpenRouter SDK
|
# 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 400+ models across providers in an easy and type-safe way.
|
The [OpenRouter SDK](https://openrouter.ai/docs/sdks/python) is a Python toolkit designed to help you build AI-powered features and solutions. Giving you easy access to 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).
|
To learn more about how to use the OpenRouter SDK, check out our [API Reference](https://openrouter.ai/docs/sdks/python/reference) and [Documentation](https://openrouter.ai/docs/sdks/python).
|
||||||
|
|
||||||
@@ -169,69 +169,6 @@ asyncio.run(main())
|
|||||||
|
|
||||||
<!-- No Custom HTTP Client [http-client] -->
|
<!-- No Custom HTTP Client [http-client] -->
|
||||||
|
|
||||||
<!-- Start Pagination [pagination] -->
|
|
||||||
## Pagination
|
|
||||||
|
|
||||||
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
|
|
||||||
returned response object will have a `Next` method that can be called to pull down the next group of results. If the
|
|
||||||
return value of `Next` is `None`, then there are no more pages to be fetched.
|
|
||||||
|
|
||||||
Here's an example of one such pagination call:
|
|
||||||
```python
|
|
||||||
from openrouter import OpenRouter
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
with OpenRouter(
|
|
||||||
http_referer="<value>",
|
|
||||||
x_open_router_title="<value>",
|
|
||||||
x_open_router_categories="<value>",
|
|
||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
|
||||||
) as open_router:
|
|
||||||
|
|
||||||
res = open_router.byok.list()
|
|
||||||
|
|
||||||
while res is not None:
|
|
||||||
# Handle items
|
|
||||||
|
|
||||||
res = res.next()
|
|
||||||
|
|
||||||
```
|
|
||||||
<!-- End Pagination [pagination] -->
|
|
||||||
|
|
||||||
<!-- Start File uploads [file-upload] -->
|
|
||||||
## File uploads
|
|
||||||
|
|
||||||
Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
|
|
||||||
|
|
||||||
> [!TIP]
|
|
||||||
>
|
|
||||||
> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.
|
|
||||||
>
|
|
||||||
|
|
||||||
```python
|
|
||||||
from openrouter import OpenRouter
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
with OpenRouter(
|
|
||||||
http_referer="<value>",
|
|
||||||
x_open_router_title="<value>",
|
|
||||||
x_open_router_categories="<value>",
|
|
||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
|
||||||
) as open_router:
|
|
||||||
|
|
||||||
res = open_router.files.upload(file={
|
|
||||||
"file_name": "example.file",
|
|
||||||
"content": open("example.file", "rb"),
|
|
||||||
})
|
|
||||||
|
|
||||||
# Handle response
|
|
||||||
print(res)
|
|
||||||
|
|
||||||
```
|
|
||||||
<!-- End File uploads [file-upload] -->
|
|
||||||
|
|
||||||
<!-- Start Resource Management [resource-management] -->
|
<!-- Start Resource Management [resource-management] -->
|
||||||
## Resource Management
|
## Resource Management
|
||||||
|
|
||||||
@@ -245,9 +182,6 @@ import os
|
|||||||
def main():
|
def main():
|
||||||
|
|
||||||
with OpenRouter(
|
with OpenRouter(
|
||||||
http_referer="<value>",
|
|
||||||
x_open_router_title="<value>",
|
|
||||||
x_open_router_categories="<value>",
|
|
||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
) as open_router:
|
) as open_router:
|
||||||
# Rest of application here...
|
# Rest of application here...
|
||||||
@@ -257,9 +191,6 @@ def main():
|
|||||||
async def amain():
|
async def amain():
|
||||||
|
|
||||||
async with OpenRouter(
|
async with OpenRouter(
|
||||||
http_referer="<value>",
|
|
||||||
x_open_router_title="<value>",
|
|
||||||
x_open_router_categories="<value>",
|
|
||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
) as open_router:
|
) as open_router:
|
||||||
# Rest of application here...
|
# Rest of application here...
|
||||||
@@ -309,4 +240,10 @@ To run the test suite, you'll need to set up your environment with an OpenRouter
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
pytest
|
pytest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Maturity
|
||||||
|
|
||||||
|
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
|
||||||
|
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
|
||||||
|
looking for the latest version.
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# OpenRouter SDK
|
# 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 400+ models across providers in an easy and type-safe way.
|
The [OpenRouter SDK](https://openrouter.ai/docs/sdks/python) is a Python toolkit designed to help you build AI-powered features and solutions. Giving you easy access to 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).
|
To learn more about how to use the OpenRouter SDK, check out our [API Reference](https://openrouter.ai/docs/sdks/python/reference) and [Documentation](https://openrouter.ai/docs/sdks/python).
|
||||||
|
|
||||||
@@ -169,69 +169,6 @@ asyncio.run(main())
|
|||||||
|
|
||||||
<!-- No Custom HTTP Client [http-client] -->
|
<!-- No Custom HTTP Client [http-client] -->
|
||||||
|
|
||||||
<!-- Start Pagination [pagination] -->
|
|
||||||
## Pagination
|
|
||||||
|
|
||||||
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
|
|
||||||
returned response object will have a `Next` method that can be called to pull down the next group of results. If the
|
|
||||||
return value of `Next` is `None`, then there are no more pages to be fetched.
|
|
||||||
|
|
||||||
Here's an example of one such pagination call:
|
|
||||||
```python
|
|
||||||
from openrouter import OpenRouter
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
with OpenRouter(
|
|
||||||
http_referer="<value>",
|
|
||||||
x_open_router_title="<value>",
|
|
||||||
x_open_router_categories="<value>",
|
|
||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
|
||||||
) as open_router:
|
|
||||||
|
|
||||||
res = open_router.byok.list()
|
|
||||||
|
|
||||||
while res is not None:
|
|
||||||
# Handle items
|
|
||||||
|
|
||||||
res = res.next()
|
|
||||||
|
|
||||||
```
|
|
||||||
<!-- End Pagination [pagination] -->
|
|
||||||
|
|
||||||
<!-- Start File uploads [file-upload] -->
|
|
||||||
## File uploads
|
|
||||||
|
|
||||||
Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
|
|
||||||
|
|
||||||
> [!TIP]
|
|
||||||
>
|
|
||||||
> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.
|
|
||||||
>
|
|
||||||
|
|
||||||
```python
|
|
||||||
from openrouter import OpenRouter
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
with OpenRouter(
|
|
||||||
http_referer="<value>",
|
|
||||||
x_open_router_title="<value>",
|
|
||||||
x_open_router_categories="<value>",
|
|
||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
|
||||||
) as open_router:
|
|
||||||
|
|
||||||
res = open_router.files.upload(file={
|
|
||||||
"file_name": "example.file",
|
|
||||||
"content": open("example.file", "rb"),
|
|
||||||
})
|
|
||||||
|
|
||||||
# Handle response
|
|
||||||
print(res)
|
|
||||||
|
|
||||||
```
|
|
||||||
<!-- End File uploads [file-upload] -->
|
|
||||||
|
|
||||||
<!-- Start Resource Management [resource-management] -->
|
<!-- Start Resource Management [resource-management] -->
|
||||||
## Resource Management
|
## Resource Management
|
||||||
|
|
||||||
@@ -245,9 +182,6 @@ import os
|
|||||||
def main():
|
def main():
|
||||||
|
|
||||||
with OpenRouter(
|
with OpenRouter(
|
||||||
http_referer="<value>",
|
|
||||||
x_open_router_title="<value>",
|
|
||||||
x_open_router_categories="<value>",
|
|
||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
) as open_router:
|
) as open_router:
|
||||||
# Rest of application here...
|
# Rest of application here...
|
||||||
@@ -257,9 +191,6 @@ def main():
|
|||||||
async def amain():
|
async def amain():
|
||||||
|
|
||||||
async with OpenRouter(
|
async with OpenRouter(
|
||||||
http_referer="<value>",
|
|
||||||
x_open_router_title="<value>",
|
|
||||||
x_open_router_categories="<value>",
|
|
||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
) as open_router:
|
) as open_router:
|
||||||
# Rest of application here...
|
# Rest of application here...
|
||||||
@@ -309,4 +240,10 @@ To run the test suite, you'll need to set up your environment with an OpenRouter
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
pytest
|
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.
|
||||||
+4
-94
@@ -10,102 +10,12 @@ Based on:
|
|||||||
### Releases
|
### Releases
|
||||||
- [PyPI v0.0.16] https://pypi.org/project/openrouter/0.0.16 - .
|
- [PyPI v0.0.16] https://pypi.org/project/openrouter/0.0.16 - .
|
||||||
|
|
||||||
## 2026-06-11 00:55:55
|
## 2025-12-04 00:22:56
|
||||||
### Changes
|
### Changes
|
||||||
Based on:
|
Based on:
|
||||||
- OpenAPI Doc
|
- OpenAPI Doc
|
||||||
- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy
|
- Speakeasy CLI 1.668.0 (2.770.0) https://github.com/speakeasy-api/speakeasy
|
||||||
### Generated
|
### Generated
|
||||||
- [python v0.9.2] .
|
- [python v0.1.0] .
|
||||||
### Releases
|
### Releases
|
||||||
- [PyPI v0.9.2] https://pypi.org/project/openrouter/0.9.2 - .
|
- [PyPI v0.1.0] https://pypi.org/project/openrouter/0.1.0 - .
|
||||||
|
|
||||||
## 2026-06-17 00:59:07
|
|
||||||
### Changes
|
|
||||||
Based on:
|
|
||||||
- OpenAPI Doc
|
|
||||||
- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy
|
|
||||||
### Generated
|
|
||||||
- [python v0.10.0] .
|
|
||||||
### Releases
|
|
||||||
- [PyPI v0.10.0] https://pypi.org/project/openrouter/0.10.0 - .
|
|
||||||
|
|
||||||
## 2026-06-25 21:56:51
|
|
||||||
### Changes
|
|
||||||
Based on:
|
|
||||||
- OpenAPI Doc
|
|
||||||
- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy
|
|
||||||
### Generated
|
|
||||||
- [python v0.10.1] .
|
|
||||||
### Releases
|
|
||||||
- [PyPI v0.10.1] https://pypi.org/project/openrouter/0.10.1 - .
|
|
||||||
|
|
||||||
## 2026-06-25 22:28:38
|
|
||||||
### Changes
|
|
||||||
Based on:
|
|
||||||
- OpenAPI Doc
|
|
||||||
- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy
|
|
||||||
### Generated
|
|
||||||
- [python v0.10.2] .
|
|
||||||
### Releases
|
|
||||||
- [PyPI v0.10.2] https://pypi.org/project/openrouter/0.10.2 - .
|
|
||||||
|
|
||||||
## 2026-06-26 00:15:50
|
|
||||||
### Changes
|
|
||||||
Based on:
|
|
||||||
- OpenAPI Doc
|
|
||||||
- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy
|
|
||||||
### Generated
|
|
||||||
- [python v0.10.3] .
|
|
||||||
### Releases
|
|
||||||
- [PyPI v0.10.3] https://pypi.org/project/openrouter/0.10.3 - .
|
|
||||||
|
|
||||||
## 2026-06-26 12:06:01
|
|
||||||
### Changes
|
|
||||||
Based on:
|
|
||||||
- OpenAPI Doc
|
|
||||||
- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy
|
|
||||||
### Generated
|
|
||||||
- [python v0.10.4] .
|
|
||||||
### Releases
|
|
||||||
- [PyPI v0.10.4] https://pypi.org/project/openrouter/0.10.4 - .
|
|
||||||
|
|
||||||
## 2026-06-26 14:36:56
|
|
||||||
### Changes
|
|
||||||
Based on:
|
|
||||||
- OpenAPI Doc
|
|
||||||
- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy
|
|
||||||
### Generated
|
|
||||||
- [python v0.10.5] .
|
|
||||||
### Releases
|
|
||||||
- [PyPI v0.10.5] https://pypi.org/project/openrouter/0.10.5 - .
|
|
||||||
|
|
||||||
## 2026-06-26 18:19:11
|
|
||||||
### Changes
|
|
||||||
Based on:
|
|
||||||
- OpenAPI Doc
|
|
||||||
- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy
|
|
||||||
### Generated
|
|
||||||
- [python v0.10.6] .
|
|
||||||
### Releases
|
|
||||||
- [PyPI v0.10.6] https://pypi.org/project/openrouter/0.10.6 - .
|
|
||||||
|
|
||||||
## 2026-06-26 23:43:40
|
|
||||||
### Changes
|
|
||||||
Based on:
|
|
||||||
- OpenAPI Doc
|
|
||||||
- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy
|
|
||||||
### Generated
|
|
||||||
- [python v0.10.7] .
|
|
||||||
### Releases
|
|
||||||
- [PyPI v0.10.7] https://pypi.org/project/openrouter/0.10.7 - .
|
|
||||||
|
|
||||||
## 2026-06-28 15:27:21
|
|
||||||
### Changes
|
|
||||||
Based on:
|
|
||||||
- OpenAPI Doc
|
|
||||||
- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy
|
|
||||||
### Generated
|
|
||||||
- [python v0.10.8] .
|
|
||||||
### Releases
|
|
||||||
- [PyPI v0.10.8] https://pypi.org/project/openrouter/0.10.8 - .
|
|
||||||
@@ -6,16 +6,69 @@ import os
|
|||||||
|
|
||||||
|
|
||||||
with OpenRouter(
|
with OpenRouter(
|
||||||
http_referer="<value>",
|
|
||||||
x_open_router_title="<value>",
|
|
||||||
x_open_router_categories="<value>",
|
|
||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
) as open_router:
|
) as open_router:
|
||||||
|
|
||||||
res = open_router.analytics.get_user_activity()
|
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": "allow",
|
||||||
|
"zdr": True,
|
||||||
|
"enforce_distillable_text": True,
|
||||||
|
"order": [
|
||||||
|
"OpenAI",
|
||||||
|
],
|
||||||
|
"only": [
|
||||||
|
"OpenAI",
|
||||||
|
],
|
||||||
|
"ignore": [
|
||||||
|
"OpenAI",
|
||||||
|
],
|
||||||
|
"quantizations": None,
|
||||||
|
"sort": "price",
|
||||||
|
})
|
||||||
|
|
||||||
# Handle response
|
with res as event_stream:
|
||||||
print(res)
|
for event in event_stream:
|
||||||
|
# handle event
|
||||||
|
print(event, flush=True)
|
||||||
```
|
```
|
||||||
|
|
||||||
</br>
|
</br>
|
||||||
@@ -31,16 +84,69 @@ import os
|
|||||||
async def main():
|
async def main():
|
||||||
|
|
||||||
async with OpenRouter(
|
async with OpenRouter(
|
||||||
http_referer="<value>",
|
|
||||||
x_open_router_title="<value>",
|
|
||||||
x_open_router_categories="<value>",
|
|
||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
) as open_router:
|
) as open_router:
|
||||||
|
|
||||||
res = await open_router.analytics.get_user_activity_async()
|
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": "allow",
|
||||||
|
"zdr": True,
|
||||||
|
"enforce_distillable_text": True,
|
||||||
|
"order": [
|
||||||
|
"OpenAI",
|
||||||
|
],
|
||||||
|
"only": [
|
||||||
|
"OpenAI",
|
||||||
|
],
|
||||||
|
"ignore": [
|
||||||
|
"OpenAI",
|
||||||
|
],
|
||||||
|
"quantizations": None,
|
||||||
|
"sort": "price",
|
||||||
|
})
|
||||||
|
|
||||||
# Handle response
|
async with res as event_stream:
|
||||||
print(res)
|
async for event in event_stream:
|
||||||
|
# handle event
|
||||||
|
print(event, flush=True)
|
||||||
|
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -5,14 +5,14 @@
|
|||||||
|
|
||||||
| Field | Type | Required | Description | Example |
|
| Field | Type | Required | Description | Example |
|
||||||
| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- |
|
| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- |
|
||||||
| `byok_usage_inference` | *float* | :heavy_check_mark: | BYOK inference cost in USD (external credits spent) | 0.012 |
|
|
||||||
| `completion_tokens` | *int* | :heavy_check_mark: | Total completion tokens generated | 125 |
|
|
||||||
| `date_` | *str* | :heavy_check_mark: | Date of the activity (YYYY-MM-DD format) | 2025-08-24 |
|
| `date_` | *str* | :heavy_check_mark: | Date of the activity (YYYY-MM-DD format) | 2025-08-24 |
|
||||||
| `endpoint_id` | *str* | :heavy_check_mark: | Unique identifier for the endpoint | 550e8400-e29b-41d4-a716-446655440000 |
|
|
||||||
| `model` | *str* | :heavy_check_mark: | Model slug (e.g., "openai/gpt-4.1") | openai/gpt-4.1 |
|
| `model` | *str* | :heavy_check_mark: | Model slug (e.g., "openai/gpt-4.1") | openai/gpt-4.1 |
|
||||||
| `model_permaslug` | *str* | :heavy_check_mark: | Model permaslug (e.g., "openai/gpt-4.1-2025-04-14") | openai/gpt-4.1-2025-04-14 |
|
| `model_permaslug` | *str* | :heavy_check_mark: | Model permaslug (e.g., "openai/gpt-4.1-2025-04-14") | openai/gpt-4.1-2025-04-14 |
|
||||||
| `prompt_tokens` | *int* | :heavy_check_mark: | Total prompt tokens used | 50 |
|
| `endpoint_id` | *str* | :heavy_check_mark: | Unique identifier for the endpoint | 550e8400-e29b-41d4-a716-446655440000 |
|
||||||
| `provider_name` | *str* | :heavy_check_mark: | Name of the provider serving this endpoint | OpenAI |
|
| `provider_name` | *str* | :heavy_check_mark: | Name of the provider serving this endpoint | OpenAI |
|
||||||
| `reasoning_tokens` | *int* | :heavy_check_mark: | Total reasoning tokens used | 25 |
|
| `usage` | *float* | :heavy_check_mark: | Total cost in USD (OpenRouter credits spent) | 0.015 |
|
||||||
| `requests` | *int* | :heavy_check_mark: | Number of requests made | 5 |
|
| `byok_usage_inference` | *float* | :heavy_check_mark: | BYOK inference cost in USD (external credits spent) | 0.012 |
|
||||||
| `usage` | *float* | :heavy_check_mark: | Total cost in USD (OpenRouter credits spent) | 0.015 |
|
| `requests` | *float* | :heavy_check_mark: | Number of requests made | 5 |
|
||||||
|
| `prompt_tokens` | *float* | :heavy_check_mark: | Total prompt tokens used | 50 |
|
||||||
|
| `completion_tokens` | *float* | :heavy_check_mark: | Total completion tokens generated | 125 |
|
||||||
|
| `reasoning_tokens` | *float* | :heavy_check_mark: | Total reasoning tokens used | 25 |
|
||||||
@@ -7,8 +7,8 @@ Model architecture information
|
|||||||
|
|
||||||
| Field | Type | Required | Description | Example |
|
| Field | Type | Required | Description | Example |
|
||||||
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
||||||
| `input_modalities` | List[[components.InputModality](../components/inputmodality.md)] | :heavy_check_mark: | Supported input modalities | |
|
| `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 | chatml |
|
| `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 |
|
| `modality` | *Nullable[str]* | :heavy_check_mark: | Primary modality of the model | text |
|
||||||
| `output_modalities` | List[[components.OutputModality](../components/outputmodality.md)] | :heavy_check_mark: | Supported output modalities | |
|
| `input_modalities` | List[[components.InputModality](../components/inputmodality.md)] | :heavy_check_mark: | Supported input modalities | |
|
||||||
| `tokenizer` | [Nullable[components.Tokenizer]](../components/tokenizer.md) | :heavy_check_mark: | N/A | GPT |
|
| `output_modalities` | List[[components.OutputModality](../components/outputmodality.md)] | :heavy_check_mark: | Supported output modalities | |
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# AssistantMessage
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
|
||||||
|
| `role` | *Literal["assistant"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `content` | [OptionalNullable[components.AssistantMessageContent]](../components/assistantmessagecontent.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `tool_calls` | List[[components.ChatMessageToolCall](../components/chatmessagetoolcall.md)] | :heavy_minus_sign: | N/A |
|
||||||
|
| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# AssistantMessageContent
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `str`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: str = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `List[components.ChatMessageContentItem]`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: List[components.ChatMessageContentItem] = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
# By
|
|
||||||
|
|
||||||
The provider sorting strategy (price, throughput, latency)
|
|
||||||
|
|
||||||
|
|
||||||
## Values
|
|
||||||
|
|
||||||
| Name | Value |
|
|
||||||
| ------------ | ------------ |
|
|
||||||
| `PRICE` | price |
|
|
||||||
| `THROUGHPUT` | throughput |
|
|
||||||
| `LATENCY` | latency |
|
|
||||||
| `EXACTO` | exacto |
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# ChainID
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| --------------------------------------------- | --------------------------------------------- |
|
||||||
|
| `ONE` | 1 |
|
||||||
|
| `ONE_HUNDRED_AND_THIRTY_SEVEN` | 137 |
|
||||||
|
| `EIGHT_THOUSAND_FOUR_HUNDRED_AND_FIFTY_THREE` | 8453 |
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# ChatCompletionFinishReason
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ---------------- | ---------------- |
|
||||||
|
| `TOOL_CALLS` | tool_calls |
|
||||||
|
| `STOP` | stop |
|
||||||
|
| `LENGTH` | length |
|
||||||
|
| `CONTENT_FILTER` | content_filter |
|
||||||
|
| `ERROR` | error |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# ChatErrorError
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
|
||||||
|
| `code` | [Nullable[components.Code]](../components/code.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `message` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `param` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `type` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# ChatGenerationParams
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
|
||||||
|
| `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | N/A |
|
||||||
|
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||||
|
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
|
||||||
|
| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
|
||||||
|
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `reasoning` | [Optional[components.Reasoning]](../components/reasoning.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `response_format` | [Optional[components.ChatGenerationParamsResponseFormatUnion]](../components/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `stop` | [OptionalNullable[components.ChatGenerationParamsStop]](../components/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
|
||||||
|
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `debug` | [Optional[components.Debug]](../components/debug.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# ChatGenerationParamsResponseFormatJSONObject
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------ | ------------------------ | ------------------------ | ------------------------ |
|
||||||
|
| `type` | *Literal["json_object"]* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# ChatGenerationParamsResponseFormatPython
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------- | ------------------- | ------------------- | ------------------- |
|
||||||
|
| `type` | *Literal["python"]* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# ChatGenerationParamsResponseFormatText
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
|
| `type` | *Literal["text"]* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# ChatGenerationParamsResponseFormatUnion
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `components.ChatGenerationParamsResponseFormatText`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ChatGenerationParamsResponseFormatText = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.ChatGenerationParamsResponseFormatJSONObject`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ChatGenerationParamsResponseFormatJSONObject = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.ResponseFormatJSONSchema`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ResponseFormatJSONSchema = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.ResponseFormatTextGrammar`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ResponseFormatTextGrammar = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.ChatGenerationParamsResponseFormatPython`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ChatGenerationParamsResponseFormatPython = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
# Stop
|
# ChatGenerationParamsStop
|
||||||
|
|
||||||
Stop sequences (up to 4)
|
|
||||||
|
|
||||||
|
|
||||||
## Supported Types
|
## Supported Types
|
||||||
@@ -17,9 +15,3 @@ value: str = /* values here */
|
|||||||
value: List[str] = /* values here */
|
value: List[str] = /* values here */
|
||||||
```
|
```
|
||||||
|
|
||||||
### `Any`
|
|
||||||
|
|
||||||
```python
|
|
||||||
value: Any = /* values here */
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# ChatGenerationTokenUsage
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
|
||||||
|
| `completion_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `prompt_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `total_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `completion_tokens_details` | [OptionalNullable[components.CompletionTokensDetails]](../components/completiontokensdetails.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `prompt_tokens_details` | [OptionalNullable[components.PromptTokensDetails]](../components/prompttokensdetails.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# ChatMessageContentItem
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `components.ChatMessageContentItemText`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ChatMessageContentItemText = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.ChatMessageContentItemImage`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ChatMessageContentItemImage = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.ChatMessageContentItemAudio`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ChatMessageContentItemAudio = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.ChatMessageContentItemVideo`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ChatMessageContentItemVideo = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.ChatMessageContentItemVideo`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ChatMessageContentItemVideo = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatMessageContentItemAudio
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
|
||||||
|
| `type` | *Literal["input_audio"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `input_audio` | [components.ChatMessageContentItemAudioInputAudio](../components/chatmessagecontentitemaudioinputaudio.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatMessageContentItemAudioInputAudio
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
|
| `data` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `format_` | *str* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatMessageContentItemCacheControl
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ |
|
||||||
|
| `type` | *Literal["ephemeral"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `ttl` | [Optional[components.TTL]](../components/ttl.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatMessageContentItemImage
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ |
|
||||||
|
| `type` | *Literal["image_url"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `image_url` | [components.ImageURL](../components/imageurl.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# ChatMessageContentItemImageDetail
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ------ | ------ |
|
||||||
|
| `AUTO` | auto |
|
||||||
|
| `LOW` | low |
|
||||||
|
| `HIGH` | high |
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# ChatMessageContentItemText
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| `type` | *Literal["text"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `text` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `cache_control` | [Optional[components.ChatMessageContentItemCacheControl]](../components/chatmessagecontentitemcachecontrol.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# ChatMessageContentItemVideo
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `components.ChatMessageContentItemVideoInputVideo`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ChatMessageContentItemVideoInputVideo = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.ChatMessageContentItemVideoVideoURL`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ChatMessageContentItemVideoVideoURL = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatMessageContentItemVideoInputVideo
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
|
||||||
|
| `type` | *Literal["input_video"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `video_url` | [components.VideoURL1](../components/videourl1.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatMessageContentItemVideoVideoURL
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
|
||||||
|
| `type` | *Literal["video_url"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `video_url` | [components.VideoURL2](../components/videourl2.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# ChatMessageTokenLogprob
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- |
|
||||||
|
| `token` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `logprob` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `bytes_` | List[*float*] | :heavy_check_mark: | N/A |
|
||||||
|
| `top_logprobs` | List[[components.TopLogprob](../components/toplogprob.md)] | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatMessageTokenLogprobs
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
|
||||||
|
| `content` | List[[components.ChatMessageTokenLogprob](../components/chatmessagetokenlogprob.md)] | :heavy_check_mark: | N/A |
|
||||||
|
| `refusal` | List[[components.ChatMessageTokenLogprob](../components/chatmessagetokenlogprob.md)] | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# ChatMessageToolCall
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
||||||
|
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `type` | *Literal["function"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `function` | [components.ChatMessageToolCallFunction](../components/chatmessagetoolcallfunction.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatMessageToolCallFunction
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
|
| `name` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `arguments` | *str* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# ChatResponse
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
|
||||||
|
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `choices` | List[[components.ChatResponseChoice](../components/chatresponsechoice.md)] | :heavy_check_mark: | N/A |
|
||||||
|
| `created` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `object` | *Literal["chat.completion"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `system_fingerprint` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `usage` | [Optional[components.ChatGenerationTokenUsage]](../components/chatgenerationtokenusage.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# ChatResponseChoice
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
||||||
|
| `finish_reason` | [Nullable[components.ChatCompletionFinishReason]](../components/chatcompletionfinishreason.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `message` | [components.AssistantMessage](../components/assistantmessage.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `logprobs` | [OptionalNullable[components.ChatMessageTokenLogprobs]](../components/chatmessagetokenlogprobs.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# ChatStreamingChoice
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
||||||
|
| `delta` | [components.ChatStreamingMessageChunk](../components/chatstreamingmessagechunk.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `finish_reason` | [Nullable[components.ChatCompletionFinishReason]](../components/chatcompletionfinishreason.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `logprobs` | [OptionalNullable[components.ChatMessageTokenLogprobs]](../components/chatmessagetokenlogprobs.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# ChatStreamingMessageChunk
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
||||||
|
| `role` | [Optional[components.ChatStreamingMessageChunkRole]](../components/chatstreamingmessagechunkrole.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `content` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `tool_calls` | List[[components.ChatStreamingMessageToolCall](../components/chatstreamingmessagetoolcall.md)] | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# ChatStreamingMessageChunkRole
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ----------- | ----------- |
|
||||||
|
| `ASSISTANT` | assistant |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# ChatStreamingMessageToolCall
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
|
||||||
|
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `type` | *Optional[Literal["function"]]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `function` | [Optional[components.ChatStreamingMessageToolCallFunction]](../components/chatstreamingmessagetoolcallfunction.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatStreamingMessageToolCallFunction
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
|
| `name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `arguments` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# ChatStreamingResponseChunk
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
||||||
|
| `data` | [components.ChatStreamingResponseChunkData](../components/chatstreamingresponsechunkdata.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# ChatStreamingResponseChunkData
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
||||||
|
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `choices` | List[[components.ChatStreamingChoice](../components/chatstreamingchoice.md)] | :heavy_check_mark: | N/A |
|
||||||
|
| `created` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `object` | *Literal["chat.completion.chunk"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `system_fingerprint` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `error` | [Optional[components.ChatStreamingResponseChunkError]](../components/chatstreamingresponsechunkerror.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `usage` | [Optional[components.ChatGenerationTokenUsage]](../components/chatgenerationtokenusage.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatStreamingResponseChunkError
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
|
| `message` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `code` | *float* | :heavy_check_mark: | N/A |
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
# ChatStreamOptions
|
# ChatStreamOptions
|
||||||
|
|
||||||
Streaming configuration options
|
|
||||||
|
|
||||||
|
|
||||||
## Fields
|
## Fields
|
||||||
|
|
||||||
| Field | Type | Required | Description | Example |
|
| Field | Type | Required | Description |
|
||||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
| ~~`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 |
|
| `include_usage` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||||
+13
-21
@@ -1,25 +1,17 @@
|
|||||||
# Code
|
# Code
|
||||||
|
|
||||||
|
|
||||||
## Values
|
## Supported Types
|
||||||
|
|
||||||
|
### `str`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: str = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `float`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: float = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
| Name | Value |
|
|
||||||
| -------------------------------- | -------------------------------- |
|
|
||||||
| `SERVER_ERROR` | server_error |
|
|
||||||
| `RATE_LIMIT_EXCEEDED` | rate_limit_exceeded |
|
|
||||||
| `INVALID_PROMPT` | invalid_prompt |
|
|
||||||
| `VECTOR_STORE_TIMEOUT` | vector_store_timeout |
|
|
||||||
| `INVALID_IMAGE` | invalid_image |
|
|
||||||
| `INVALID_IMAGE_FORMAT` | invalid_image_format |
|
|
||||||
| `INVALID_BASE64_IMAGE` | invalid_base64_image |
|
|
||||||
| `INVALID_IMAGE_URL` | invalid_image_url |
|
|
||||||
| `IMAGE_TOO_LARGE` | image_too_large |
|
|
||||||
| `IMAGE_TOO_SMALL` | image_too_small |
|
|
||||||
| `IMAGE_PARSE_ERROR` | image_parse_error |
|
|
||||||
| `IMAGE_CONTENT_POLICY_VIOLATION` | image_content_policy_violation |
|
|
||||||
| `INVALID_IMAGE_MODE` | invalid_image_mode |
|
|
||||||
| `IMAGE_FILE_TOO_LARGE` | image_file_too_large |
|
|
||||||
| `UNSUPPORTED_IMAGE_MEDIA_TYPE` | unsupported_image_media_type |
|
|
||||||
| `EMPTY_IMAGE_FILE` | empty_image_file |
|
|
||||||
| `FAILED_TO_DOWNLOAD_IMAGE` | failed_to_download_image |
|
|
||||||
| `IMAGE_FILE_NOT_FOUND` | image_file_not_found |
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# CodeEnum
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| -------------------------------- | -------------------------------- |
|
||||||
|
| `SERVER_ERROR` | server_error |
|
||||||
|
| `RATE_LIMIT_EXCEEDED` | rate_limit_exceeded |
|
||||||
|
| `INVALID_PROMPT` | invalid_prompt |
|
||||||
|
| `VECTOR_STORE_TIMEOUT` | vector_store_timeout |
|
||||||
|
| `INVALID_IMAGE` | invalid_image |
|
||||||
|
| `INVALID_IMAGE_FORMAT` | invalid_image_format |
|
||||||
|
| `INVALID_BASE64_IMAGE` | invalid_base64_image |
|
||||||
|
| `INVALID_IMAGE_URL` | invalid_image_url |
|
||||||
|
| `IMAGE_TOO_LARGE` | image_too_large |
|
||||||
|
| `IMAGE_TOO_SMALL` | image_too_small |
|
||||||
|
| `IMAGE_PARSE_ERROR` | image_parse_error |
|
||||||
|
| `IMAGE_CONTENT_POLICY_VIOLATION` | image_content_policy_violation |
|
||||||
|
| `INVALID_IMAGE_MODE` | invalid_image_mode |
|
||||||
|
| `IMAGE_FILE_TOO_LARGE` | image_file_too_large |
|
||||||
|
| `UNSUPPORTED_IMAGE_MEDIA_TYPE` | unsupported_image_media_type |
|
||||||
|
| `EMPTY_IMAGE_FILE` | empty_image_file |
|
||||||
|
| `FAILED_TO_DOWNLOAD_IMAGE` | failed_to_download_image |
|
||||||
|
| `IMAGE_FILE_NOT_FOUND` | image_file_not_found |
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# CompletionChoice
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
||||||
|
| `text` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `logprobs` | [Nullable[components.CompletionLogprobs]](../components/completionlogprobs.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `finish_reason` | [Nullable[components.CompletionFinishReason]](../components/completionfinishreason.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `native_finish_reason` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# CompletionCreateParams
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
|
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||||
|
| `prompt` | [components.Prompt](../components/prompt.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `best_of` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `echo` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A |
|
||||||
|
| `logprobs` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `n` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `stop` | [OptionalNullable[components.CompletionCreateParamsStop]](../components/completioncreateparamsstop.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `stream_options` | [OptionalNullable[components.StreamOptions]](../components/streamoptions.md) | :heavy_minus_sign: | N/A |
|
||||||
|
| `suffix` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A |
|
||||||
|
| `response_format` | [OptionalNullable[components.CompletionCreateParamsResponseFormatUnion]](../components/completioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# CompletionCreateParamsResponseFormatJSONObject
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------ | ------------------------ | ------------------------ | ------------------------ |
|
||||||
|
| `type` | *Literal["json_object"]* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# CompletionCreateParamsResponseFormatPython
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------- | ------------------- | ------------------- | ------------------- |
|
||||||
|
| `type` | *Literal["python"]* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# CompletionCreateParamsResponseFormatText
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
|
| `type` | *Literal["text"]* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# CompletionCreateParamsResponseFormatUnion
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `components.CompletionCreateParamsResponseFormatText`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.CompletionCreateParamsResponseFormatText = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.CompletionCreateParamsResponseFormatJSONObject`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.CompletionCreateParamsResponseFormatJSONObject = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.ResponseFormatJSONSchema`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ResponseFormatJSONSchema = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.ResponseFormatTextGrammar`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ResponseFormatTextGrammar = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.CompletionCreateParamsResponseFormatPython`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.CompletionCreateParamsResponseFormatPython = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# CompletionCreateParamsStop
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `str`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: str = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `List[str]`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: List[str] = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# CompletionFinishReason
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ---------------- | ---------------- |
|
||||||
|
| `STOP` | stop |
|
||||||
|
| `LENGTH` | length |
|
||||||
|
| `CONTENT_FILTER` | content_filter |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# CompletionLogprobs
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------ | ------------------------ | ------------------------ | ------------------------ |
|
||||||
|
| `tokens` | List[*str*] | :heavy_check_mark: | N/A |
|
||||||
|
| `token_logprobs` | List[*float*] | :heavy_check_mark: | N/A |
|
||||||
|
| `top_logprobs` | List[Dict[str, *float*]] | :heavy_check_mark: | N/A |
|
||||||
|
| `text_offset` | List[*float*] | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# CompletionResponse
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
|
||||||
|
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `object` | *Literal["text_completion"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `created` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `provider` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `system_fingerprint` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `choices` | List[[components.CompletionChoice](../components/completionchoice.md)] | :heavy_check_mark: | N/A |
|
||||||
|
| `usage` | [Optional[components.CompletionUsage]](../components/completionusage.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# CompletionTokensDetails
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- |
|
||||||
|
| `reasoning_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `audio_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `accepted_prediction_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `rejected_prediction_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# CompletionUsage
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------- | ------------------- | ------------------- | ------------------- |
|
||||||
|
| `prompt_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `completion_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `total_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
# CostDetails
|
# CostDetails
|
||||||
|
|
||||||
Breakdown of upstream inference costs
|
|
||||||
|
|
||||||
|
|
||||||
## Fields
|
## Fields
|
||||||
|
|
||||||
| Field | Type | Required | Description |
|
| Field | Type | Required | Description |
|
||||||
| ------------------------------------- | ------------------------------------- | ------------------------------------- | ------------------------------------- |
|
| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- |
|
||||||
| `upstream_inference_completions_cost` | *float* | :heavy_check_mark: | N/A |
|
| `upstream_inference_cost` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
| `upstream_inference_cost` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
| `upstream_inference_input_cost` | *float* | :heavy_check_mark: | N/A |
|
||||||
| `upstream_inference_prompt_cost` | *float* | :heavy_check_mark: | N/A |
|
| `upstream_inference_output_cost` | *float* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# CreateChargeRequest
|
||||||
|
|
||||||
|
Create a Coinbase charge for crypto payment
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- |
|
||||||
|
| `amount` | *float* | :heavy_check_mark: | N/A |
|
||||||
|
| `sender` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `chain_id` | [components.ChainID](../components/chainid.md) | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# Debug
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| -------------------- | -------------------- | -------------------- | -------------------- |
|
||||||
|
| `echo_upstream_body` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -7,9 +7,6 @@ Default parameters for this model
|
|||||||
|
|
||||||
| Field | Type | Required | Description |
|
| Field | Type | Required | Description |
|
||||||
| ------------------------- | ------------------------- | ------------------------- | ------------------------- |
|
| ------------------------- | ------------------------- | ------------------------- | ------------------------- |
|
||||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
|
||||||
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
|
||||||
| `repetition_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
|
||||||
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
| `top_k` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# Effort
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| --------- | --------- |
|
||||||
|
| `NONE` | none |
|
||||||
|
| `MINIMAL` | minimal |
|
||||||
|
| `LOW` | low |
|
||||||
|
| `MEDIUM` | medium |
|
||||||
|
| `HIGH` | high |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# Engine
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| -------- | -------- |
|
||||||
|
| `NATIVE` | native |
|
||||||
|
| `EXA` | exa |
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
| Field | Type | Required | Description |
|
| Field | Type | Required | Description |
|
||||||
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
|
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
|
||||||
|
| `type` | [components.FileCitationType](../components/filecitationtype.md) | :heavy_check_mark: | N/A |
|
||||||
| `file_id` | *str* | :heavy_check_mark: | N/A |
|
| `file_id` | *str* | :heavy_check_mark: | N/A |
|
||||||
| `filename` | *str* | :heavy_check_mark: | N/A |
|
| `filename` | *str* | :heavy_check_mark: | N/A |
|
||||||
| `index` | *int* | :heavy_check_mark: | N/A |
|
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||||
| `type` | [components.FileCitationType](../components/filecitationtype.md) | :heavy_check_mark: | N/A |
|
|
||||||
@@ -5,6 +5,6 @@
|
|||||||
|
|
||||||
| Field | Type | Required | Description |
|
| Field | Type | Required | Description |
|
||||||
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
|
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
|
||||||
|
| `type` | [components.FilePathType](../components/filepathtype.md) | :heavy_check_mark: | N/A |
|
||||||
| `file_id` | *str* | :heavy_check_mark: | N/A |
|
| `file_id` | *str* | :heavy_check_mark: | N/A |
|
||||||
| `index` | *int* | :heavy_check_mark: | N/A |
|
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||||
| `type` | [components.FilePathType](../components/filepathtype.md) | :heavy_check_mark: | N/A |
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# IDFileParser
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ------------- | ------------- |
|
||||||
|
| `FILE_PARSER` | file-parser |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# IDModeration
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ------------ | ------------ |
|
||||||
|
| `MODERATION` | moderation |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# IDResponseHealing
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ------------------ | ------------------ |
|
||||||
|
| `RESPONSE_HEALING` | response-healing |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# IDWeb
|
||||||
|
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
| ----- | ----- |
|
||||||
|
| `WEB` | web |
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Ignore
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `components.ProviderName`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ProviderName = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `str`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: str = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# ImageURL
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
|
||||||
|
| `url` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `detail` | [Optional[components.ChatMessageContentItemImageDetail]](../components/chatmessagecontentitemimagedetail.md) | :heavy_minus_sign: | N/A |
|
||||||
@@ -5,4 +5,4 @@
|
|||||||
|
|
||||||
| Field | Type | Required | Description |
|
| Field | Type | Required | Description |
|
||||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
| `cached_tokens` | *int* | :heavy_check_mark: | N/A |
|
| `cached_tokens` | *float* | :heavy_check_mark: | N/A |
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# JSONSchemaConfig
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------ | ------------------------ | ------------------------ | ------------------------ |
|
||||||
|
| `name` | *str* | :heavy_check_mark: | N/A |
|
||||||
|
| `description` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
|
| `schema_` | Dict[str, *Any*] | :heavy_minus_sign: | N/A |
|
||||||
|
| `strict` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -7,9 +7,9 @@ List of available endpoints for a model
|
|||||||
|
|
||||||
| Field | Type | Required | Description | Example |
|
| Field | Type | Required | Description | Example |
|
||||||
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `architecture` | [components.Architecture](../components/architecture.md) | :heavy_check_mark: | N/A | {<br/>"input_modalities": [<br/>"text"<br/>],<br/>"instruct_type": "chatml",<br/>"modality": "text-\u003etext",<br/>"output_modalities": [<br/>"text"<br/>],<br/>"tokenizer": "GPT"<br/>} |
|
|
||||||
| `created` | *int* | :heavy_check_mark: | Unix timestamp of when the model was created | 1692901234 |
|
|
||||||
| `description` | *str* | :heavy_check_mark: | Description of the model | GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. |
|
|
||||||
| `endpoints` | List[[components.PublicEndpoint](../components/publicendpoint.md)] | :heavy_check_mark: | List of available endpoints for this model | |
|
|
||||||
| `id` | *str* | :heavy_check_mark: | Unique identifier for the model | openai/gpt-4 |
|
| `id` | *str* | :heavy_check_mark: | Unique identifier for the model | openai/gpt-4 |
|
||||||
| `name` | *str* | :heavy_check_mark: | Display name of the model | GPT-4 |
|
| `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` | [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,14 @@
|
|||||||
|
# MaxPrice
|
||||||
|
|
||||||
|
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- |
|
||||||
|
| `prompt` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||||
|
| `completion` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||||
|
| `image` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||||
|
| `audio` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||||
|
| `request` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number |
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# Message
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `components.SystemMessage`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.SystemMessage = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.UserMessage`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.UserMessage = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.MessageDeveloper`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.MessageDeveloper = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.AssistantMessage`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.AssistantMessage = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `components.ToolResponseMessage`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: components.ToolResponseMessage = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# MessageContent
|
||||||
|
|
||||||
|
|
||||||
|
## Supported Types
|
||||||
|
|
||||||
|
### `str`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: str = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
|
### `List[components.ChatMessageContentItemText]`
|
||||||
|
|
||||||
|
```python
|
||||||
|
value: List[components.ChatMessageContentItemText] = /* values here */
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# MessageDeveloper
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||||
|
| `role` | *Literal["developer"]* | :heavy_check_mark: | N/A |
|
||||||
|
| `content` | [components.MessageContent](../components/messagecontent.md) | :heavy_check_mark: | N/A |
|
||||||
|
| `name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
# Modality
|
|
||||||
|
|
||||||
|
|
||||||
## Values
|
|
||||||
|
|
||||||
| Name | Value |
|
|
||||||
| ------- | ------- |
|
|
||||||
| `TEXT` | text |
|
|
||||||
| `IMAGE` | image |
|
|
||||||
| `AUDIO` | audio |
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user