{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pomerado-ai/json-schema/pomerado-ai-spend-controls-schema.json",
  "title": "SpendControls",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pomerado-ai-openapi.json#/components/schemas/SpendControls",
  "type": "object",
  "required": [
    "daily_cap"
  ],
  "properties": {
    "daily_cap": {
      "type": "object",
      "required": [
        "on",
        "basis",
        "calls",
        "effective_calls",
        "changed_by",
        "changed_at"
      ],
      "properties": {
        "on": {
          "type": "boolean"
        },
        "basis": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "calls",
                "overage_cents"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "What the cap was set in: calls, or overage_cents (overage dollars). Null until first set"
        },
        "calls": {
          "anyOf": [
            {
              "type": "integer",
              "description": "a non-negative number",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ],
          "description": "The calls a UTC day it was set to; null unless basis is calls"
        },
        "overage_cents": {
          "anyOf": [
            {
              "type": "integer",
              "description": "a non-negative number",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ],
          "description": "Owners and Admins only. The overage dollars a UTC day it was set to, in US cents; null unless basis is overage_cents. They stay the same dollars when the price or the included calls change"
        },
        "effective_calls": {
          "anyOf": [
            {
              "type": "integer",
              "description": "a non-negative number",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ],
          "description": "Tool calls today, the UTC day, the cap stands at; only runs count, never builds. While the cap is on, new runs past it are refused with quota_exceeded (details.limit_source team_cap) until the UTC day resets; runs already started finish. A cap in dollars comes to today's included calls plus its dollars over today's overage price, rounded down, so it follows the terms each day. Null until first set, and for a cap in dollars while the team has no billing terms or free overage, when it refuses no runs"
        },
        "changed_by": {
          "anyOf": [
            {
              "$ref": "#/$defs/SpendControlPerson"
            },
            {
              "type": "null"
            }
          ],
          "description": "Who changed it last; null until first set"
        },
        "changed_at": {
          "anyOf": [
            {
              "type": "string",
              "description": "ISO 8601 UTC"
            },
            {
              "type": "null"
            }
          ],
          "description": "When it was last changed; null until first set"
        }
      },
      "additionalProperties": false,
      "description": "Kept while off"
    },
    "overage_budget": {
      "type": "object",
      "required": [
        "on",
        "cents",
        "changed_by",
        "changed_at"
      ],
      "properties": {
        "on": {
          "type": "boolean"
        },
        "cents": {
          "anyOf": [
            {
              "type": "integer",
              "description": "a non-negative number",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ],
          "description": "Expected overage each billing period, in US cents, which budget alerts measure against. It never stops runs. Null until first set"
        },
        "changed_by": {
          "anyOf": [
            {
              "$ref": "#/$defs/SpendControlPerson"
            },
            {
              "type": "null"
            }
          ],
          "description": "Who changed it last; null until first set"
        },
        "changed_at": {
          "anyOf": [
            {
              "type": "string",
              "description": "ISO 8601 UTC"
            },
            {
              "type": "null"
            }
          ],
          "description": "When it was last changed; null until first set"
        }
      },
      "additionalProperties": false,
      "description": "Owners and Admins only. Kept while off"
    },
    "today": {
      "type": "object",
      "required": [
        "refused_runs",
        "first_refused_at"
      ],
      "properties": {
        "refused_runs": {
          "type": "integer",
          "description": "New runs refused today, the UTC day, for being over the day's tool call limit: the cap while on, or a limit Pomerado set, whichever is lower. Each request counts once, however often it was retried with its idempotency key",
          "minimum": 0
        },
        "first_refused_at": {
          "anyOf": [
            {
              "type": "string",
              "description": "ISO 8601 UTC"
            },
            {
              "type": "null"
            }
          ],
          "description": "When the first of them was refused; null when none was"
        },
        "limit_source": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "team_cap",
                "pomerado"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Which limit holds today: team_cap, the team's own cap, lower than any limit Pomerado set; pomerado, a limit Pomerado set, lower than the cap or equal to it, or with the cap off; null when neither limits the day. Absent while it can't be read"
        }
      },
      "additionalProperties": false,
      "description": "Absent while they can't be counted"
    }
  },
  "additionalProperties": false,
  "$defs": {
    "SpendControlPerson": {
      "type": "object",
      "required": [
        "member_id",
        "name",
        "email"
      ],
      "properties": {
        "member_id": {
          "type": "string",
          "description": "The member's user ID"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false,
      "description": "A member. name and email are null once your team no longer knows them, and to an API key without team:manage for anyone but its own member"
    }
  }
}