TypeScript SDKAPI reference
models
List the models available to your account.
client.models.list(options?: { signal?: AbortSignal }): Promise<ModelList>Returns every model your API key can call. The list is account-scoped — if a feature is gated, models you don't have access to will not appear.
Example
const { data } = await client.models.list();
for (const m of data) {
console.log(m.id, m.owned_by);
}Types
interface Model {
id: string;
object: "model";
created?: number; // unix seconds, if upstream provides it
owned_by?: string;
}
interface ModelList {
object: "list";
data: Model[];
}Model.id is what you pass as params.model to chat.completions.create and the other resources. Treat ids as opaque strings — Bastion does not promise stability across versions for non-OSS upstreams.
Caching
The SDK does not cache. If you call models.list() on a hot path, wrap it yourself or call it once at process start.
Errors
| When | Class |
|---|---|
| Invalid key | AuthenticationError |
| Network failure | APIConnectionError |
| Upstream issue | UpstreamError |