---
title: "overlane budget check"
description: "Ask before spending: exits 6 and records a stop when the call would reach a budget"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.overlane.app/llms.txt
> Use this file to discover all available pages before exploring further.

# overlane budget check

{/* Generated by apps/docs/scripts/generate.mjs (CLI pages from the command registry in packages/cli). Do not edit; run `pnpm --filter @overlane/docs gen`. */}

Asks whether a call estimated at --usd may go ahead for this task, agent and project. The estimate is counted: spent plus the estimate at or over a limit refuses, and the answer names the tightest limit. A refusal exits 6, stores a record (see `budget stops`) and prints the next command. With --record an allowed estimate is counted as spent so the next check sees it. An agent token is always checked as itself.

## Usage

```sh
overlane budget check --usd AMOUNT [--task TASK] [--agent ID] [--kind KIND] [--meter METER] [--record] [--dry-run]
```

## Flags

| Flag | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `--usd` | string | yes |  | The call's estimated cost in dollars, for example 0.40 |
| `--task` | string | no |  | The task this call belongs to |
| `--agent` | string | no |  | The agent token, for a person checking for an agent |
| `--kind` | string | no |  | What the call is, for the record (inference, ci, review) |
| `--meter` | one of `reviews`, `ciMinutes`, `docsCalls`, `hostedInference` | no |  | Also check the plan allowance for this meter |
| `--record` | boolean | no |  | Count the estimate as spent when allowed |
| `--dry-run` | boolean | no |  | Print the requests and file changes this command would make, then stop. Needs no credentials. |

## Examples

```sh
overlane budget check --usd 0.40 --task task-12
overlane budget check --usd 0.05 --task task-12 --record --kind inference
```

## Behavior

- Effect: `write` (changes local or hosted state).
- Needs credentials: yes. Uses the network: yes.
- Supports `--dry-run`: yes. Accepts `--force`: no.
- Machine-readable description: `overlane schema budget check`.

## Result

With `--json` (the default when stdout is not a terminal) the command prints this JSON Schema's shape on stdout.

```json
{
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "tenantId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "tenant identifier"
        },
        "allowed": {
          "type": "boolean"
        },
        "exitCode": {
          "anyOf": [
            {
              "type": "number",
              "const": 0
            },
            {
              "type": "number",
              "const": 6
            }
          ]
        },
        "reason": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "budget",
                "billing_cap",
                "read_only",
                "plan_allowance"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "message": {
          "type": "string",
          "minLength": 1
        },
        "nextCommand": {
          "type": [
            "string",
            "null"
          ]
        },
        "estimateCents": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "binding": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "scope": {
                  "type": "string",
                  "enum": [
                    "task",
                    "agent",
                    "project",
                    "team"
                  ]
                },
                "scopeId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "budget",
                    "billing_cap"
                  ]
                },
                "limitCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "spentCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "roomCents": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "scope",
                "scopeId",
                "source",
                "limitCents",
                "spentCents",
                "roomCents"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "checked": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "scope": {
                "type": "string",
                "enum": [
                  "task",
                  "agent",
                  "project",
                  "team"
                ]
              },
              "scopeId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "source": {
                "type": "string",
                "enum": [
                  "budget",
                  "billing_cap"
                ]
              },
              "limitCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "spentCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "roomCents": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "scope",
              "scopeId",
              "source",
              "limitCents",
              "spentCents",
              "roomCents"
            ],
            "additionalProperties": false
          }
        },
        "stopId": {
          "type": [
            "string",
            "null"
          ]
        },
        "replay": {
          "type": "boolean"
        },
        "recorded": {
          "type": "boolean"
        }
      },
      "required": [
        "tenantId",
        "allowed",
        "exitCode",
        "reason",
        "message",
        "nextCommand",
        "estimateCents",
        "binding",
        "checked",
        "stopId",
        "replay",
        "recorded"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "dryRun": {
          "type": "boolean",
          "const": true
        },
        "service": {
          "type": "string"
        },
        "requests": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "method": {
                "type": "string"
              },
              "path": {
                "type": "string"
              },
              "body": {},
              "note": {
                "type": "string"
              }
            },
            "required": [
              "method",
              "path"
            ],
            "additionalProperties": false
          }
        },
        "commands": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "writes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string"
              },
              "action": {
                "type": "string",
                "enum": [
                  "write",
                  "append",
                  "delete"
                ]
              },
              "description": {
                "type": "string"
              }
            },
            "required": [
              "path",
              "action",
              "description"
            ],
            "additionalProperties": false
          }
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "dryRun",
        "requests",
        "commands",
        "writes",
        "notes"
      ],
      "additionalProperties": false
    }
  ]
}
```

See [exit codes](/cli/#exit-codes) for the status the process returns.

Source: https://docs.overlane.app/cli/budget-check/index.mdx
