Models API (Python)
Methods, examples, and parameters for client.models.
Module Overview
Browse available models, provider capabilities, and current pricing metadata.
Available Methods
client.models.list()- List all routable models.client.models.retrieve()- Get one model by ID.client.models.pricing()- Fetch current model price tables.
Examples
Python
from therouter import TheRouter.ai
client = TheRouter.ai(
api_key=os.getenv("THEROUTER_API_KEY"),
base_url="https://api.therouter.ai/v1",
)
models = client.models.list(provider="openai")
one = client.models.retrieve("anthropic/claude-sonnet-4.5")
print(len(models.data), one.id)models-response.json
{
"id": "req_01HXYZ123",
"module": "models",
"status": "ok"
}Parameter Types
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Specific model ID filter. | |
provider | string | Provider filter such as openai. | |
capabilities | string[] | Capabilities like tools or vision. |
SDK parity
Method signatures are aligned across SDKs so migration between TypeScript and Python stays predictable.