ONE credits:cap
← Receivers

credits:cap

credits family

Funder only, a person's own hand: set the monthly cap and the alert line on a recipient you fund — your client workspace or an agent you own. The spend path warns you (warn funder to spender) when the recipient crosses the alert line, default 80, and refuses with budget_exhausted at the cap. Setting it again lowers or raises it in place and keeps what was used; a cap of 0 is the revoke door's, never this one (text/billing.md promise 7)

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
manage_clients
The class of authority the caller must already hold, decided from the attested context with no round trip.
Cost
free
What one call costs, so you can budget before acting.
Reversible
yes
The effect can be undone by a later call.
Idempotent
yes
Safe to retry as-is.

Send it with your agent

One click hands your coding agent a prompt that registers the substrate, reads this contract, and makes the call. Launch opens the app; the others copy the prompt.

Claude Code
Codex
Cursor
Gemini CLI
Claude Desktop
ChatGPT
curl -X POST https://one.ie/api/ask/credits:cap \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "to": "acme-client", "monthlyCredits": 50000, "alertPct": 80 }}'

The key is never in a link. npx -y @oneie/cli login writes it to ~/.config/oneie/key on your machine.

Request

Validated before dispatch — an invalid payload is refused with the fix, never half-applied.

  • to string required The recipient to cap: a client workspace slug you are the parent of, or an agent id you own. Never yourself.
  • recipientType client | agent | group | staff optional client (default) or agent. group and staff are refused: their membership is not verifiable from D1.
  • monthlyCredits number required The monthly ceiling in credits, at least 1. Spend past it is refused budget_exhausted.
  • alertPct number optional Percent of the cap at which you are warned, 1 to 99. Omitted: keep the row's current line, else 80.

Response

What comes back from the call.

  • ok boolean
  • funder string The attested caller's workspace — the row's giver.
  • to string
  • monthlyCredits number
  • alertPct number The alert line now in force, percent.
  • periodUsed number Credits already used this period; a cap set below this refuses at the next spend.
  • created boolean true when no budget row existed and this call made it.
  • error string unauthorized | human_hand_required | key_required | invalid_request | self_cap | forbidden | unsupported_recipient | zeroed_on_chain | cap_unavailable | ledger_unavailable

Traffic

Every call to credits:cap, counted where it is dispatched — over HTTP or in-process alike. Aggregate only — no actor, no payload, no workspace.

Counting…

Wiring

Every place in the open source that names credits:cap, and the file that answers it. Read from the tree at build time — a receiver is reached by NAME through one door, so there is no import edge to follow and a grep is the honest shape of the question. Structure, not volume — the count is in Traffic above.

Called from

UI 2
  • one.ie/web/src/components/finance/map/stations.ts:215
  • one.ie/web/src/pages/u/[slug]/finance/index.astro:146
API route 4
  • one.ie/web/src/lib/auth-plugins/fingerprint-ask.ts:252
  • one.ie/web/src/lib/finance/sheet.ts:13
  • one.ie/web/src/lib/receiver-index.generated.ts:138
  • one.ie/web/src/lib/resolvers/credits.ts:88
CLI 2
  • packages/cli/src/credits.ts:71
  • packages/cli/src/lib/money-receivers.ts:30
→

Answered by

credits:cap one.ie/web/src/lib/resolvers/credits.ts:66 Dispatched through POST /api/ask/credits:cap, after the envelope validates the payload.
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "to": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "The recipient to cap: a client workspace slug you are the parent of, or an agent id you own. Never yourself."
    },
    "recipientType": {
      "description": "client (default) or agent. group and staff are refused: their membership is not verifiable from D1.",
      "type": "string",
      "enum": [
        "client",
        "agent",
        "group",
        "staff"
      ]
    },
    "monthlyCredits": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1000000000,
      "description": "The monthly ceiling in credits, at least 1. Spend past it is refused budget_exhausted."
    },
    "alertPct": {
      "description": "Percent of the cap at which you are warned, 1 to 99. Omitted: keep the row's current line, else 80.",
      "type": "integer",
      "minimum": 1,
      "maximum": 99
    }
  },
  "required": [
    "to",
    "monthlyCredits"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "funder": {
      "description": "The attested caller's workspace — the row's giver.",
      "type": "string"
    },
    "to": {
      "type": "string"
    },
    "monthlyCredits": {
      "type": "number"
    },
    "alertPct": {
      "description": "The alert line now in force, percent.",
      "type": "number"
    },
    "periodUsed": {
      "description": "Credits already used this period; a cap set below this refuses at the next spend.",
      "type": "number"
    },
    "created": {
      "description": "true when no budget row existed and this call made it.",
      "type": "boolean"
    },
    "error": {
      "description": "unauthorized | human_hand_required | key_required | invalid_request | self_cap | forbidden | unsupported_recipient | zeroed_on_chain | cap_unavailable | ledger_unavailable",
      "type": "string"
    }
  },
  "required": [
    "ok"
  ]
}