mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-08-06 13:20:23 +08:00
Commits included in this export:
- e1074ff86fccf5e48406b7595298873106d3cc5a - 123bbdaf841d299162a82ee2573adfbb70a45b8f - ac457b8a8dad98fdf5ddcae8dd4711361cea3084 - ea825199f4c59dd68fec01cf8d18a582963c9f25 - 4d48e4f6bb936e785787314a965298da6b78fea0 - 718729a573ee98893a4408d5a52ab4686661fe54 - b867adcde6b64f3f2a11c4626254b39098e4b0b4 - 21912c097b4066d109766c6b4492826595cd57c5 - bc1ed85adc976a4634ca8a41b82e4fc2c39a864f - d145c89c941937a312ed1357590d2bfda9a3603d - 12f05b5dee397ead47cfcd545a7a2e3c7ff57524 - dd28f75a19a015809797c7abf3f8758f7c37262e - c96e569781e07ab44172d9c69940ec17bafd81f4 - c9d5a90e3c2b5077a2bdd49773f1a46d1a5a79c7 - 58b08f87116ceab9076de2fdc0a4c74c919b44c4 GitOrigin-RevId: e1074ff86fccf5e48406b7595298873106d3cc5a
This commit is contained in:
+144
-313
@@ -2,7 +2,7 @@ openapi: 3.1.0
|
||||
info:
|
||||
title: OpenRouter API
|
||||
version: 1.0.0
|
||||
description: OpenAI-compatible Chat Completions and Completions API with additional OpenRouter features
|
||||
description: OpenAI-compatible API with additional OpenRouter features
|
||||
contact:
|
||||
name: OpenRouter Support
|
||||
url: https://openrouter.ai/docs
|
||||
@@ -3542,6 +3542,7 @@ components:
|
||||
- AI21
|
||||
- AionLabs
|
||||
- Alibaba
|
||||
- Ambient
|
||||
- Amazon Bedrock
|
||||
- Amazon Nova
|
||||
- Anthropic
|
||||
@@ -8110,6 +8111,7 @@ components:
|
||||
- AI21
|
||||
- AionLabs
|
||||
- Alibaba
|
||||
- Ambient
|
||||
- Amazon Bedrock
|
||||
- Amazon Nova
|
||||
- Anthropic
|
||||
@@ -9341,263 +9343,6 @@ components:
|
||||
required:
|
||||
- data
|
||||
additionalProperties: false
|
||||
CompletionFinishReason:
|
||||
anyOf:
|
||||
- type: string
|
||||
enum:
|
||||
- stop
|
||||
- length
|
||||
- content_filter
|
||||
- type: 'null'
|
||||
CompletionLogprobs:
|
||||
type: object
|
||||
properties:
|
||||
tokens:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
token_logprobs:
|
||||
type: array
|
||||
items:
|
||||
type: number
|
||||
top_logprobs:
|
||||
anyOf:
|
||||
- type: array
|
||||
items:
|
||||
type: object
|
||||
propertyNames:
|
||||
type: string
|
||||
additionalProperties:
|
||||
type: number
|
||||
- type: 'null'
|
||||
text_offset:
|
||||
type: array
|
||||
items:
|
||||
type: number
|
||||
required:
|
||||
- tokens
|
||||
- token_logprobs
|
||||
- top_logprobs
|
||||
- text_offset
|
||||
CompletionUsage:
|
||||
type: object
|
||||
properties:
|
||||
prompt_tokens:
|
||||
type: number
|
||||
completion_tokens:
|
||||
type: number
|
||||
total_tokens:
|
||||
type: number
|
||||
required:
|
||||
- prompt_tokens
|
||||
- completion_tokens
|
||||
- total_tokens
|
||||
CompletionCreateParams:
|
||||
type: object
|
||||
properties:
|
||||
model:
|
||||
$ref: '#/components/schemas/ModelName'
|
||||
models:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/ModelName'
|
||||
prompt:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: array
|
||||
items:
|
||||
type: string
|
||||
- type: array
|
||||
items:
|
||||
type: number
|
||||
- type: array
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
type: number
|
||||
best_of:
|
||||
anyOf:
|
||||
- type: integer
|
||||
minimum: 1
|
||||
maximum: 20
|
||||
- type: 'null'
|
||||
echo:
|
||||
anyOf:
|
||||
- type: boolean
|
||||
- type: 'null'
|
||||
frequency_penalty:
|
||||
anyOf:
|
||||
- type: number
|
||||
minimum: -2
|
||||
maximum: 2
|
||||
- type: 'null'
|
||||
logit_bias:
|
||||
anyOf:
|
||||
- type: object
|
||||
propertyNames:
|
||||
type: string
|
||||
additionalProperties:
|
||||
type: number
|
||||
- type: 'null'
|
||||
logprobs:
|
||||
anyOf:
|
||||
- type: integer
|
||||
minimum: 0
|
||||
maximum: 5
|
||||
- type: 'null'
|
||||
max_tokens:
|
||||
anyOf:
|
||||
- type: integer
|
||||
minimum: 1
|
||||
maximum: 9007199254740991
|
||||
- type: 'null'
|
||||
'n':
|
||||
anyOf:
|
||||
- type: integer
|
||||
minimum: 1
|
||||
maximum: 128
|
||||
- type: 'null'
|
||||
presence_penalty:
|
||||
anyOf:
|
||||
- type: number
|
||||
minimum: -2
|
||||
maximum: 2
|
||||
- type: 'null'
|
||||
seed:
|
||||
anyOf:
|
||||
- type: integer
|
||||
minimum: -9007199254740991
|
||||
maximum: 9007199254740991
|
||||
- type: 'null'
|
||||
stop:
|
||||
anyOf:
|
||||
- anyOf:
|
||||
- type: string
|
||||
- type: array
|
||||
items:
|
||||
type: string
|
||||
- type: 'null'
|
||||
stream:
|
||||
default: false
|
||||
type: boolean
|
||||
stream_options:
|
||||
anyOf:
|
||||
- type: object
|
||||
properties:
|
||||
include_usage:
|
||||
anyOf:
|
||||
- type: boolean
|
||||
- type: 'null'
|
||||
- type: 'null'
|
||||
suffix:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
temperature:
|
||||
anyOf:
|
||||
- type: number
|
||||
minimum: 0
|
||||
maximum: 2
|
||||
- type: 'null'
|
||||
top_p:
|
||||
anyOf:
|
||||
- type: number
|
||||
minimum: 0
|
||||
maximum: 1
|
||||
- type: 'null'
|
||||
user:
|
||||
type: string
|
||||
metadata:
|
||||
anyOf:
|
||||
- type: object
|
||||
propertyNames:
|
||||
type: string
|
||||
additionalProperties:
|
||||
type: string
|
||||
- type: 'null'
|
||||
response_format:
|
||||
anyOf:
|
||||
- oneOf:
|
||||
- type: object
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
const: text
|
||||
required:
|
||||
- type
|
||||
- type: object
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
const: json_object
|
||||
required:
|
||||
- type
|
||||
- $ref: '#/components/schemas/ResponseFormatJSONSchema'
|
||||
- $ref: '#/components/schemas/ResponseFormatTextGrammar'
|
||||
- type: object
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
const: python
|
||||
required:
|
||||
- type
|
||||
type: object
|
||||
- type: 'null'
|
||||
required:
|
||||
- prompt
|
||||
CompletionChoice:
|
||||
type: object
|
||||
properties:
|
||||
text:
|
||||
type: string
|
||||
index:
|
||||
type: number
|
||||
logprobs:
|
||||
anyOf:
|
||||
- $ref: '#/components/schemas/CompletionLogprobs'
|
||||
- type: 'null'
|
||||
finish_reason:
|
||||
$ref: '#/components/schemas/CompletionFinishReason'
|
||||
native_finish_reason:
|
||||
type: string
|
||||
reasoning:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
required:
|
||||
- text
|
||||
- index
|
||||
- logprobs
|
||||
- finish_reason
|
||||
CompletionResponse:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
object:
|
||||
type: string
|
||||
const: text_completion
|
||||
created:
|
||||
type: number
|
||||
model:
|
||||
type: string
|
||||
provider:
|
||||
type: string
|
||||
system_fingerprint:
|
||||
type: string
|
||||
choices:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/CompletionChoice'
|
||||
usage:
|
||||
$ref: '#/components/schemas/CompletionUsage'
|
||||
required:
|
||||
- id
|
||||
- object
|
||||
- created
|
||||
- model
|
||||
- choices
|
||||
additionalProperties: false
|
||||
parameters: {}
|
||||
securitySchemes:
|
||||
apiKey:
|
||||
@@ -9724,7 +9469,7 @@ paths:
|
||||
x-speakeasy-name-override: create
|
||||
x-speakeasy-stream-request-field: stream
|
||||
tags:
|
||||
- anthropic.messages
|
||||
- Anthropic Messages
|
||||
summary: Create a message
|
||||
description: >-
|
||||
Creates a message using the Anthropic Messages API format. Supports text, images, PDFs, tools, and extended
|
||||
@@ -10612,6 +10357,130 @@ paths:
|
||||
nullable: true
|
||||
description: Router used for the request (e.g., openrouter/auto)
|
||||
example: openrouter/auto
|
||||
provider_responses:
|
||||
type: array
|
||||
nullable: true
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
endpoint_id:
|
||||
type: string
|
||||
model_permaslug:
|
||||
type: string
|
||||
provider_name:
|
||||
type: string
|
||||
enum:
|
||||
- AnyScale
|
||||
- Atoma
|
||||
- Cent-ML
|
||||
- CrofAI
|
||||
- Enfer
|
||||
- GoPomelo
|
||||
- HuggingFace
|
||||
- Hyperbolic 2
|
||||
- InoCloud
|
||||
- Kluster
|
||||
- Lambda
|
||||
- Lepton
|
||||
- Lynn 2
|
||||
- Lynn
|
||||
- Mancer
|
||||
- Meta
|
||||
- Modal
|
||||
- Nineteen
|
||||
- OctoAI
|
||||
- Recursal
|
||||
- Reflection
|
||||
- Replicate
|
||||
- SambaNova 2
|
||||
- SF Compute
|
||||
- Targon
|
||||
- Together 2
|
||||
- Ubicloud
|
||||
- 01.AI
|
||||
- AI21
|
||||
- AionLabs
|
||||
- Alibaba
|
||||
- Ambient
|
||||
- Amazon Bedrock
|
||||
- Amazon Nova
|
||||
- Anthropic
|
||||
- Arcee AI
|
||||
- AtlasCloud
|
||||
- Avian
|
||||
- Azure
|
||||
- BaseTen
|
||||
- BytePlus
|
||||
- Black Forest Labs
|
||||
- Cerebras
|
||||
- Chutes
|
||||
- Cirrascale
|
||||
- Clarifai
|
||||
- Cloudflare
|
||||
- Cohere
|
||||
- Crusoe
|
||||
- DeepInfra
|
||||
- DeepSeek
|
||||
- Featherless
|
||||
- Fireworks
|
||||
- Friendli
|
||||
- GMICloud
|
||||
- Google
|
||||
- Google AI Studio
|
||||
- Groq
|
||||
- Hyperbolic
|
||||
- Inception
|
||||
- Inceptron
|
||||
- InferenceNet
|
||||
- Infermatic
|
||||
- Inflection
|
||||
- Liquid
|
||||
- Mara
|
||||
- Mancer 2
|
||||
- Minimax
|
||||
- ModelRun
|
||||
- Mistral
|
||||
- Modular
|
||||
- Moonshot AI
|
||||
- Morph
|
||||
- NCompass
|
||||
- Nebius
|
||||
- NextBit
|
||||
- Novita
|
||||
- Nvidia
|
||||
- OpenAI
|
||||
- OpenInference
|
||||
- Parasail
|
||||
- Perplexity
|
||||
- Phala
|
||||
- Relace
|
||||
- SambaNova
|
||||
- Seed
|
||||
- SiliconFlow
|
||||
- Sourceful
|
||||
- Stealth
|
||||
- StreamLake
|
||||
- Switchpoint
|
||||
- Together
|
||||
- Upstage
|
||||
- Venice
|
||||
- WandB
|
||||
- Xiaomi
|
||||
- xAI
|
||||
- Z.AI
|
||||
- FakeProvider
|
||||
status:
|
||||
type: number
|
||||
nullable: true
|
||||
latency:
|
||||
type: number
|
||||
is_byok:
|
||||
type: boolean
|
||||
required:
|
||||
- status
|
||||
description: List of provider responses for this generation, including fallback attempts
|
||||
required:
|
||||
- id
|
||||
- upstream_id
|
||||
@@ -10646,6 +10515,7 @@ paths:
|
||||
- external_user
|
||||
- api_type
|
||||
- router
|
||||
- provider_responses
|
||||
description: Generation data
|
||||
required:
|
||||
- data
|
||||
@@ -10790,7 +10660,13 @@ paths:
|
||||
tags:
|
||||
- Models
|
||||
x-speakeasy-name-override: listForUser
|
||||
summary: List models filtered by user provider preferences
|
||||
description: >-
|
||||
List models filtered by user provider preferences, [privacy
|
||||
settings](https://openrouter.ai/docs/guides/privacy/logging), and
|
||||
[guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through
|
||||
`eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region
|
||||
routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing).
|
||||
summary: List models filtered by user provider preferences, privacy settings, and guardrails
|
||||
security:
|
||||
- bearer: []
|
||||
responses:
|
||||
@@ -10806,6 +10682,12 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UnauthorizedResponse'
|
||||
'404':
|
||||
description: Not Found - No eligible endpoints found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/NotFoundResponse'
|
||||
'500':
|
||||
description: Internal Server Error
|
||||
content:
|
||||
@@ -13812,55 +13694,6 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ChatError'
|
||||
/completions:
|
||||
post:
|
||||
summary: Create a completion
|
||||
x-speakeasy-group: completions
|
||||
x-speakeasy-name-override: generate
|
||||
x-speakeasy-stream-request-field: stream
|
||||
description: Creates a completion for the provided prompt and parameters. Supports both streaming and non-streaming modes.
|
||||
tags:
|
||||
- Completions
|
||||
requestBody:
|
||||
required: true
|
||||
description: Completion request parameters
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CompletionCreateParams'
|
||||
responses:
|
||||
'200':
|
||||
description: Successful completion response
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CompletionResponse'
|
||||
description: Completion response
|
||||
'400':
|
||||
description: Bad request - invalid parameters
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ChatError'
|
||||
'401':
|
||||
description: Unauthorized - invalid API key
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ChatError'
|
||||
'429':
|
||||
description: Too many requests - rate limit exceeded
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ChatError'
|
||||
'500':
|
||||
description: Internal server error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ChatError'
|
||||
operationId: createCompletions
|
||||
servers:
|
||||
- url: https://openrouter.ai/api/v1
|
||||
description: Production server
|
||||
@@ -13875,10 +13708,10 @@ tags:
|
||||
description: API key management endpoints
|
||||
- name: Analytics
|
||||
description: Analytics and usage endpoints
|
||||
- name: Anthropic Messages
|
||||
description: Anthropic Messages endpoints
|
||||
- name: Chat
|
||||
description: Chat completion endpoints
|
||||
- name: Completions
|
||||
description: Text completion endpoints
|
||||
- name: Credits
|
||||
description: Credit management endpoints
|
||||
- name: Embeddings
|
||||
@@ -13895,8 +13728,6 @@ tags:
|
||||
description: OAuth authentication endpoints
|
||||
- name: Providers
|
||||
description: Provider information endpoints
|
||||
- name: anthropic.messages
|
||||
description: anthropic.messages endpoints
|
||||
- name: beta.responses
|
||||
description: beta.responses endpoints
|
||||
x-fern-base-path: /
|
||||
|
||||
Reference in New Issue
Block a user