mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-31 12:30:30 +08:00
fix: examples, enums and regenerate (#2)
This commit is contained in:
@@ -28,7 +28,7 @@ Chat completion request parameters
|
||||
| `tools` | List[[models.ChatCompletionTool](../models/chatcompletiontool.md)] | :heavy_minus_sign: | Available tools for function calling | |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | Unique user identifier | |
|
||||
| `models_llm` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | |
|
||||
| `fallback_models` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | |
|
||||
| `reasoning_effort` | [OptionalNullable[models.ChatCompletionCreateParamsReasoningEffort]](../models/chatcompletioncreateparamsreasoningeffort.md) | :heavy_minus_sign: | Reasoning effort | |
|
||||
| `provider` | [OptionalNullable[models.ChatCompletionCreateParamsProvider]](../models/chatcompletioncreateparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
| `plugins` | List[[models.ChatCompletionCreateParamsPluginUnion](../models/chatcompletioncreateparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||
@@ -28,7 +28,7 @@ Chat completion request parameters
|
||||
| `tools` | List[[models.ChatCompletionTool](../models/chatcompletiontool.md)] | :heavy_minus_sign: | Available tools for function calling | |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | Unique user identifier | |
|
||||
| `models_llm` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | |
|
||||
| `fallback_models` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | |
|
||||
| `reasoning_effort` | [OptionalNullable[models.ChatStreamCompletionCreateParamsReasoningEffort]](../models/chatstreamcompletioncreateparamsreasoningeffort.md) | :heavy_minus_sign: | Reasoning effort | |
|
||||
| `provider` | [OptionalNullable[models.ChatStreamCompletionCreateParamsProvider]](../models/chatstreamcompletioncreateparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
| `plugins` | List[[models.ChatStreamCompletionCreateParamsPluginUnion](../models/chatstreamcompletioncreateparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||
@@ -5,9 +5,9 @@ Error object structure
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `code` | *Nullable[str]* | :heavy_check_mark: | N/A |
|
||||
| `message` | *str* | :heavy_check_mark: | N/A |
|
||||
| `param` | *Nullable[str]* | :heavy_check_mark: | N/A |
|
||||
| `type` | *str* | :heavy_check_mark: | N/A |
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------- | ----------------------- | ----------------------- | ----------------------- |
|
||||
| `code` | *Nullable[float]* | :heavy_check_mark: | N/A |
|
||||
| `message` | *str* | :heavy_check_mark: | N/A |
|
||||
| `param` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `type` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
@@ -5,4 +5,4 @@
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `bearer_auth` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `api_key` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
@@ -18,17 +18,17 @@ Creates a model response for the given chat conversation. Supports both streamin
|
||||
|
||||
<!-- UsageSnippet language="python" operationID="createChatCompletion" method="post" path="/chat/completions" -->
|
||||
```python
|
||||
from openrouter import OpenRouter, models
|
||||
from openrouter import OpenRouter
|
||||
import os
|
||||
|
||||
|
||||
with OpenRouter(
|
||||
bearer_auth=os.getenv("OPENROUTER_BEARER_AUTH", ""),
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.chat.complete(messages=[
|
||||
{
|
||||
"role": models.ChatCompletionUserMessageParamRole.USER,
|
||||
"role": "user",
|
||||
"content": "Hello, how are you?",
|
||||
},
|
||||
], stream=False, temperature=1, top_p=1)
|
||||
@@ -63,7 +63,7 @@ with OpenRouter(
|
||||
| `tools` | List[[models.ChatCompletionTool](../../models/chatcompletiontool.md)] | :heavy_minus_sign: | Available tools for function calling | |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | Unique user identifier | |
|
||||
| `models_llm` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | |
|
||||
| `fallback_models` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | |
|
||||
| `reasoning_effort` | [OptionalNullable[models.ChatCompletionCreateParamsReasoningEffort]](../../models/chatcompletioncreateparamsreasoningeffort.md) | :heavy_minus_sign: | Reasoning effort | |
|
||||
| `provider` | [OptionalNullable[models.ChatCompletionCreateParamsProvider]](../../models/chatcompletioncreateparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
| `plugins` | List[[models.ChatCompletionCreateParamsPluginUnion](../../models/chatcompletioncreateparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||
@@ -89,17 +89,17 @@ Creates a model response for the given chat conversation. Supports both streamin
|
||||
|
||||
<!-- UsageSnippet language="python" operationID="streamChatCompletion" method="post" path="/chat/completions#stream" -->
|
||||
```python
|
||||
from openrouter import OpenRouter, models
|
||||
from openrouter import OpenRouter
|
||||
import os
|
||||
|
||||
|
||||
with OpenRouter(
|
||||
bearer_auth=os.getenv("OPENROUTER_BEARER_AUTH", ""),
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.chat.complete_stream(messages=[
|
||||
{
|
||||
"role": models.ChatCompletionUserMessageParamRole.USER,
|
||||
"role": "user",
|
||||
"content": "Hello, how are you?",
|
||||
},
|
||||
], stream=True, temperature=1, top_p=1)
|
||||
@@ -136,7 +136,7 @@ with OpenRouter(
|
||||
| `tools` | List[[models.ChatCompletionTool](../../models/chatcompletiontool.md)] | :heavy_minus_sign: | Available tools for function calling | |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | Unique user identifier | |
|
||||
| `models_llm` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | |
|
||||
| `fallback_models` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | |
|
||||
| `reasoning_effort` | [OptionalNullable[models.ChatStreamCompletionCreateParamsReasoningEffort]](../../models/chatstreamcompletioncreateparamsreasoningeffort.md) | :heavy_minus_sign: | Reasoning effort | |
|
||||
| `provider` | [OptionalNullable[models.ChatStreamCompletionCreateParamsProvider]](../../models/chatstreamcompletioncreateparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
| `plugins` | List[[models.ChatStreamCompletionCreateParamsPluginUnion](../../models/chatstreamcompletioncreateparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||
|
||||
Reference in New Issue
Block a user