add open enums, server selection, update description

This commit is contained in:
Sheldon Vaughn
2025-09-18 07:54:13 -05:00
parent 540701c0a3
commit 5d06b0a7b4
16 changed files with 128 additions and 61 deletions
+10 -3
View File
@@ -401,9 +401,15 @@ with OpenRouter(
<!-- Start Server Selection [server] -->
## Server Selection
### Server Variables
### Select Server by Name
The default server `https://{provider_url}/api/v1` contains variables and is set to `https://openrouter.ai/api/v1` by default. To override default values, the following parameters are available when initializing the SDK client instance:
You can override the default server globally by passing a server name to the `server: str` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:
| Name | Server | Variables | Description |
| ------------ | ------------------------------- | -------------- | ----------------- |
| `production` | `https://{provider_url}/api/v1` | `provider_url` | Production server |
If the selected server has variables, you may override its default values through the additional parameters made available in the SDK constructor:
| Variable | Parameter | Default | Description |
| -------------- | ------------------- | ----------------- | ----------- |
@@ -417,6 +423,7 @@ import os
with OpenRouter(
server="production",
provider_url="https://ruddy-guacamole.info/"
api_key=os.getenv("OPENROUTER_API_KEY", ""),
) as open_router:
@@ -437,7 +444,7 @@ with OpenRouter(
### Override Server URL Per-Client
The default server can be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
```python
from openrouter import OpenRouter
import os