Models API (TypeScript)
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
TypeScript
import { TheRouter.ai } from "@therouter/sdk";
const client = new TheRouter.ai({ apiKey: process.env.THEROUTER_API_KEY! });
const models = await client.models.list({ provider: "openai" });
const one = await client.models.retrieve("anthropic/claude-sonnet-4.5");
console.log(models.data.length, 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.