← Receivers

credits:request

credits family

Out of budget? Ask your funder for more. Files a signed request for `amount` more credits a month on YOUR budget (the caller's actor budget if it has one, else its workspace's), tells the funder in their inbox, and returns the token the funder approves with credits:approve. A workspace with no funder is told to top up instead (text/billing.md § Agency custom plans)

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
no
Not safe to blind-retry — dedupe on the envelope idempotencyKey.

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:request \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "amount": <number> }}'

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.

  • amount number required Extra credits per month you are asking for. The funder may approve less: an approval never raises a budget past the funder's own plan grant.
  • reason string optional Why — shown to the funder beside the request.

Response

What comes back from the call.

  • ok boolean
  • funder string The workspace whose pool pays and who must approve.
  • amount number
  • token string The signed request. The FUNDER passes it to credits:approve; the requester cannot.
  • expiresAt number Unix seconds after which the token is refused.
  • error string unauthorized | invalid_request | no_funder (self-funded — top up at topupUrl) | request_unavailable
  • topupUrl string

Traffic

Every call to credits:request, 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:request, 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

API route 2
  • one.ie/web/src/lib/credits.ts:85
  • one.ie/web/src/lib/receiver-index.generated.ts:97
→

Answered by

credits:request one.ie/web/src/lib/resolvers/credits.ts:26 Dispatched through POST /api/ask/credits:request, after the envelope validates the payload.

credits family · 2 more

JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "amount": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 10000000,
      "description": "Extra credits per month you are asking for. The funder may approve less: an approval never raises a budget past the funder's own plan grant."
    },
    "reason": {
      "description": "Why — shown to the funder beside the request.",
      "type": "string",
      "maxLength": 500
    }
  },
  "required": [
    "amount"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "funder": {
      "description": "The workspace whose pool pays and who must approve.",
      "type": "string"
    },
    "amount": {
      "type": "number"
    },
    "token": {
      "description": "The signed request. The FUNDER passes it to credits:approve; the requester cannot.",
      "type": "string"
    },
    "expiresAt": {
      "description": "Unix seconds after which the token is refused.",
      "type": "number"
    },
    "error": {
      "description": "unauthorized | invalid_request | no_funder (self-funded — top up at topupUrl) | request_unavailable",
      "type": "string"
    },
    "topupUrl": {
      "type": "string"
    }
  },
  "required": [
    "ok"
  ]
}