ONE credits:usage
← Receivers

credits:usage

credits family

mcp

Read what YOUR workspace's credits went on: one window (24h, 7d, 30d, 90d, mtd, all), grouped by one key (model, provider, actor, thread, reason, hour, day, month). Transfers, expiry and test-mode burns are not use. costUsd is the provider-reported credit_burns.cost_usd, named in costColumn, and unpricedBurns counts the rows that have none. total is the exact number of groups, truncated says the page is cut, sum is the whole window, asOf is when it was read (text/billing.md promise 6)

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
member
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:usage \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "groupBy": <model | provider | actor | …> }}'

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.

  • window 24h | 7d | 30d | … optional How far back, in UTC: 24h, 7d, 30d, 90d, mtd (this calendar month) or all. Default 30d.
  • groupBy model | provider | actor | … required The one key to group by. Time keys (hour, day, month) answer newest first; the others answer biggest spend first.
  • limit number optional Most groups to return, 1 to 200. Default 50. A cut page says truncated:true and still carries the exact total.

Response

What comes back from the call.

  • ok boolean
  • window string
  • groupBy string
  • since number Unix seconds the window starts at; 0 = all time.
  • rows object[]
  • total number Exact number of groups in the whole window, not the page.
  • truncated boolean true when more groups exist than rows carries.
  • sum object The whole window across every group, not the visible rows.
  • costColumn string The column costUsd was read from: credit_burns.cost_usd.
  • asOf string ISO time the read ran.
  • error string unauthorized | invalid_request | ledger_unavailable | usage_unavailable

Traffic

Every call to credits:usage, 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:usage, 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 1
  • one.ie/web/src/components/finance/map/stations.ts:215
API route 1
  • one.ie/web/src/lib/receiver-index.generated.ts:141
CLI 2
  • packages/cli/src/credits.ts:56
  • packages/cli/src/lib/money-receivers.ts:41
→

Answered by

credits:usage one.ie/web/src/lib/resolvers/credits.ts:28 Dispatched through POST /api/ask/credits:usage, after the envelope validates the payload.
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "window": {
      "description": "How far back, in UTC: 24h, 7d, 30d, 90d, mtd (this calendar month) or all. Default 30d.",
      "type": "string",
      "enum": [
        "24h",
        "7d",
        "30d",
        "90d",
        "mtd",
        "all"
      ]
    },
    "groupBy": {
      "type": "string",
      "enum": [
        "model",
        "provider",
        "actor",
        "thread",
        "reason",
        "hour",
        "day",
        "month"
      ],
      "description": "The one key to group by. Time keys (hour, day, month) answer newest first; the others answer biggest spend first."
    },
    "limit": {
      "description": "Most groups to return, 1 to 200. Default 50. A cut page says truncated:true and still carries the exact total.",
      "type": "integer",
      "minimum": 1,
      "maximum": 200
    }
  },
  "required": [
    "groupBy"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "window": {
      "type": "string"
    },
    "groupBy": {
      "type": "string"
    },
    "since": {
      "description": "Unix seconds the window starts at; 0 = all time.",
      "type": "number"
    },
    "rows": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "The group: a model id, provider, actor, thread, reason, or a UTC bucket (2026-11-28T10:00Z, 2026-11-28, 2026-11)."
          },
          "burns": {
            "type": "number"
          },
          "credits": {
            "type": "number",
            "description": "Credits charged, SUM(amount_credits)."
          },
          "costCredits": {
            "type": "number",
            "description": "Upstream cost in credits before margins, SUM(cost_credits). Not dollars."
          },
          "costUsd": {
            "type": "number",
            "description": "Provider-reported dollars, SUM(credit_burns.cost_usd) over the rows that carry it."
          },
          "unpricedBurns": {
            "type": "number",
            "description": "Burns in this group with no cost_usd; costUsd understates by these."
          },
          "tokensIn": {
            "type": "number"
          },
          "tokensOut": {
            "type": "number"
          }
        },
        "required": [
          "key",
          "burns",
          "credits",
          "costCredits",
          "costUsd",
          "unpricedBurns",
          "tokensIn",
          "tokensOut"
        ]
      }
    },
    "total": {
      "description": "Exact number of groups in the whole window, not the page.",
      "type": "number"
    },
    "truncated": {
      "description": "true when more groups exist than rows carries.",
      "type": "boolean"
    },
    "sum": {
      "description": "The whole window across every group, not the visible rows.",
      "type": "object",
      "properties": {
        "burns": {
          "type": "number"
        },
        "credits": {
          "type": "number"
        },
        "costCredits": {
          "type": "number"
        },
        "costUsd": {
          "type": "number"
        },
        "unpricedBurns": {
          "type": "number"
        }
      },
      "required": [
        "burns",
        "credits",
        "costCredits",
        "costUsd",
        "unpricedBurns"
      ]
    },
    "costColumn": {
      "description": "The column costUsd was read from: credit_burns.cost_usd.",
      "type": "string"
    },
    "asOf": {
      "description": "ISO time the read ran.",
      "type": "string"
    },
    "error": {
      "description": "unauthorized | invalid_request | ledger_unavailable | usage_unavailable",
      "type": "string"
    }
  },
  "required": [
    "ok"
  ]
}