space.ai.models()

List the models the project can call.

Lists the models the project can call, with what each one reads, how much it can take and write, whether it can call tools and reasons, and the AI units it uses.

function models(options?: CallOptions): Promise<ModelInfo[]>

Parameters

options.signalAbortSignal

Cancels the call.

options.timeoutMsnumber

How long the call may take, in milliseconds. The timeoutMs set in createSpace when you leave it out, 30,000 by default.

Returns

A promise of a list of models.

The call is sent again, up to retries times, when it fails in a way that may pass, such as a network failure or 503.

Errors

CodeWhen
unauthenticatedThe API key is missing or not one we accept
forbiddenThe key may not call models in the project

Every call can also fail with the codes shared by all of space, such as missing_project or network_error. See SpaceError.

Example

models.ts
import { space } from "digitospace"

const models = await space.ai.models()

for (const model of models.filter((m) => m.tools)) {
  console.log(model.name, model.contextWindow, model.processedIn)
}

Last updated