mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-08-01 12:40:23 +08:00
## Python SDK Changes:
* `open_router.api_keys.list()`: * `request` **Changed** **Breaking** ⚠️ * `response.data.[]` **Changed** **Breaking** ⚠️ * `open_router.guardrails.get()`: `response.data` **Changed** **Breaking** ⚠️ * `open_router.o_auth.create_auth_code()`: `response.data.app_id` **Changed** **Breaking** ⚠️ * `open_router.guardrails.bulk_unassign_members()`: `response.unassigned_count` **Changed** **Breaking** ⚠️ * `open_router.guardrails.bulk_unassign_keys()`: `response.unassigned_count` **Changed** **Breaking** ⚠️ * `open_router.guardrails.bulk_assign_members()`: `response.assigned_count` **Changed** **Breaking** ⚠️ * `open_router.guardrails.list_guardrail_member_assignments()`: * `request` **Changed** **Breaking** ⚠️ * `response.total_count` **Changed** **Breaking** ⚠️ * `open_router.beta.responses.send()`: * `request` **Changed** **Breaking** ⚠️ * `response` **Changed** **Breaking** ⚠️ * `open_router.analytics.get_user_activity()`: * `request` **Changed** * `response.data.[]` **Changed** **Breaking** ⚠️ * `error.status[404]` **Added** * `open_router.chat.send()`: * `request` **Changed** **Breaking** ⚠️ * `response` **Changed** **Breaking** ⚠️ * `open_router.embeddings.generate()`: * `request.provider` **Changed** **Breaking** ⚠️ * `response` **Changed** **Breaking** ⚠️ * `open_router.embeddings.list_models()`: `response.data.[]` **Changed** **Breaking** ⚠️ * `open_router.generations.get_generation()`: `response.data` **Changed** **Breaking** ⚠️ * `open_router.models.count()`: `response.data.count` **Changed** **Breaking** ⚠️ * `open_router.models.list()`: `response.data.[]` **Changed** **Breaking** ⚠️ * `open_router.models.list_for_user()`: `response.data.[]` **Changed** **Breaking** ⚠️ * `open_router.endpoints.list_zdr_endpoints()`: `response.data.[]` **Changed** **Breaking** ⚠️ * `open_router.guardrails.bulk_assign_keys()`: `response.assigned_count` **Changed** **Breaking** ⚠️ * `open_router.guardrails.list_member_assignments()`: * `request` **Changed** **Breaking** ⚠️ * `response.total_count` **Changed** **Breaking** ⚠️ * `open_router.api_keys.create()`: * `request` **Changed** **Breaking** ⚠️ * `response.data` **Changed** **Breaking** ⚠️ * `open_router.api_keys.update()`: * `request.limit` **Changed** **Breaking** ⚠️ * `response.data` **Changed** **Breaking** ⚠️ * `open_router.api_keys.get()`: `response.data` **Changed** **Breaking** ⚠️ * `open_router.api_keys.get_current_key_metadata()`: `response.data` **Changed** **Breaking** ⚠️ * `open_router.guardrails.list()`: * `request` **Changed** **Breaking** ⚠️ * `response` **Changed** **Breaking** ⚠️ * `open_router.guardrails.create()`: * `request` **Changed** **Breaking** ⚠️ * `response.data` **Changed** **Breaking** ⚠️ * `open_router.endpoints.list()`: `response.data` **Changed** **Breaking** ⚠️ * `open_router.guardrails.update()`: * `request` **Changed** **Breaking** ⚠️ * `response.data` **Changed** **Breaking** ⚠️ * `open_router.guardrails.list_key_assignments()`: * `request` **Changed** **Breaking** ⚠️ * `response.total_count` **Changed** **Breaking** ⚠️ * `open_router.guardrails.list_guardrail_key_assignments()`: * `request` **Changed** **Breaking** ⚠️ * `response.total_count` **Changed** **Breaking** ⚠️ * `open_router.organization.list_members()`: **Added** * `open_router.rerank.rerank()`: **Added** * `open_router.credits.create_coinbase_charge()`: **Deleted** **Breaking** ⚠️ * `open_router.video_generation.list_videos_models()`: **Added** * `open_router.video_generation.get_video_content()`: **Added** * `open_router.video_generation.get_generation()`: **Added** * `open_router.video_generation.generate()`: **Added**
This commit is contained in:
@@ -6,57 +6,8 @@ Endpoint information
|
||||
|
||||
### Available Operations
|
||||
|
||||
* [list](#list) - List all endpoints for a model
|
||||
* [list_zdr_endpoints](#list_zdr_endpoints) - Preview the impact of ZDR on the available endpoints
|
||||
|
||||
## list
|
||||
|
||||
List all endpoints for a model
|
||||
|
||||
### Example Usage
|
||||
|
||||
<!-- UsageSnippet language="python" operationID="listEndpoints" method="get" path="/models/{author}/{slug}/endpoints" -->
|
||||
```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.endpoints.list(author="<value>", slug="<value>")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `author` | *str* | :heavy_check_mark: | N/A |
|
||||
| `slug` | *str* | :heavy_check_mark: | N/A |
|
||||
| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.<br/>This is used to track API usage per application.<br/> |
|
||||
| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.<br/> |
|
||||
| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.<br/> |
|
||||
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
|
||||
|
||||
### Response
|
||||
|
||||
**[operations.ListEndpointsResponse](../../operations/listendpointsresponse.md)**
|
||||
|
||||
### Errors
|
||||
|
||||
| Error Type | Status Code | Content Type |
|
||||
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
|
||||
| errors.NotFoundResponseError | 404 | application/json |
|
||||
| errors.InternalServerResponseError | 500 | application/json |
|
||||
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
|
||||
* [list](#list) - List all endpoints for a model
|
||||
|
||||
## list_zdr_endpoints
|
||||
|
||||
@@ -102,4 +53,53 @@ with OpenRouter(
|
||||
| Error Type | Status Code | Content Type |
|
||||
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
|
||||
| errors.InternalServerResponseError | 500 | application/json |
|
||||
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
|
||||
|
||||
## list
|
||||
|
||||
List all endpoints for a model
|
||||
|
||||
### Example Usage
|
||||
|
||||
<!-- UsageSnippet language="python" operationID="listEndpoints" method="get" path="/models/{author}/{slug}/endpoints" -->
|
||||
```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.endpoints.list(author="openai", slug="gpt-4")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Parameter | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `author` | *str* | :heavy_check_mark: | The author/organization of the model | openai |
|
||||
| `slug` | *str* | :heavy_check_mark: | The model slug | gpt-4 |
|
||||
| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.<br/>This is used to track API usage per application.<br/> | |
|
||||
| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.<br/> | |
|
||||
| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.<br/> | |
|
||||
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
|
||||
|
||||
### Response
|
||||
|
||||
**[operations.ListEndpointsResponse](../../operations/listendpointsresponse.md)**
|
||||
|
||||
### Errors
|
||||
|
||||
| Error Type | Status Code | Content Type |
|
||||
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
|
||||
| errors.NotFoundResponseError | 404 | application/json |
|
||||
| errors.InternalServerResponseError | 500 | application/json |
|
||||
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
|
||||
Reference in New Issue
Block a user