space.ai.limits()

Read a project’s plan limits, its own monthly limit, and what it has used this month and this minute.

Reads the project’s plan limits, its own monthly limit, the AI units it has used this month, and the requests and tokens counted this minute.

function limits(options?: CallOptions): Promise<Limits>

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 the project’s limits:

{
  "plan": {
    "code": "free",
    "name": "Free",
    "unitsPerMonth": 100000,
    "requestsPerMinute": 20,
    "tokensPerMinute": 40000
  },
  "own": {
    "unitsPerMonth": 50000,
    "updatedBy": "01m3c081d2wj4g63qcr53pa1yh",
    "updatedAt": "2026-09-29T10:15:00Z"
  },
  "month": { "start": "2026-09-01", "used": 4200, "reserved": 120 },
  "minute": { "start": "2026-09-29T10:15:00Z", "requests": 3, "tokens": 12500 }
}
plan.codestring

The plan’s code, such as free.

plan.namestring

The plan’s name, such as Free.

plan.unitsPerMonthnumber

The most AI units the plan allows in a month. In every plan limit, 0 means no limit.

plan.requestsPerMinutenumber

The most calls the project can send in a minute.

plan.tokensPerMinutenumber

The most tokens the project’s calls can ask for in a minute: each call’s input, and its maxTokens of output.

ownobject or null

The project’s own limit, or null if it never had one. The lower of it and the plan’s applies. own.unitsPerMonth is null when it was removed, and 0 stops AI for the project. own.updatedBy and own.updatedAt say who set it and when.

month.startstring

The first day of this month, in UTC, such as 2026-09-01.

month.usednumber

The AI units calls used this month.

month.reservednumber

Units set aside for calls in progress. See How a call is checked.

minute.startstring

When this minute started, as an ISO 8601 string.

minute.requestsnumber

The calls counted so far in this minute.

minute.tokensnumber

The tokens those calls asked for: their input, and their maxTokens of output.

The project’s own limit is set in the console. See Set a monthly limit of your own.

Errors

CodeWhen
forbiddenThe key may not view usage and limits 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

limits.ts
import { space } from "digitospace"

const limits = await space.ai.limits()

console.log(`${limits.month.used} of ${limits.plan.unitsPerMonth} AI units used this month`)
console.log(`${limits.minute.requests} of ${limits.plan.requestsPerMinute} requests this minute`)

if (limits.own?.unitsPerMonth != null) {
  console.log(`Own limit: ${limits.own.unitsPerMonth} AI units a month`)
}

Last updated