Agent API

Wallet and account

Check how much a key can still spend, read the balance ledger, and see which account a key belongs to.

Authentication

All endpoints on this page require Authorization: Bearer pk-…. Amounts are in USD. Top up in the console; there is no top-up API.

Get balance

GET/v1/wallet/balance
bash
curl https://gw.pikeway.ai/v1/wallet/balance -H "Authorization: Bearer $PIKEWAY_API_KEY"
200 OK
{
  "balance":   { "value": 12.4831, "currency": "USD" },
  "earnings":  { "value": 0, "currency": "USD" },
  "keyBudget": { "limit": 5, "used": 1.25, "remaining": 3.75, "currency": "USD" },
  "spendable": { "value": 3.75, "currency": "USD" }
}
Fields
balancemoney
The account's prepaid balance.
earningsmoney
Provider earnings (separate from the spending balance).
keyBudgetobject
Only when this key has a spend limit: limit, used, remaining.
spendablemoney
What this key can spend now: the balance, capped by the key's remaining budget.

List activities

GET/v1/wallet/activities

Entries of the balance ledger, newest first: top-ups, call charges, subscriptions, refunds and other balance changes.

Query
limitinteger
Page size. Default 20, max 100.
cursorstring
cursor from the previous page.
bash
curl "https://gw.pikeway.ai/v1/wallet/activities?limit=50" -H "Authorization: Bearer $PIKEWAY_API_KEY"
200 OK
{
  "items": [
    {
      "id": "6a1f0c52-8d3e-4b7a-9f21-0e4c5d6b7a89",
      "type": "CONSUMPTION",
      "amount": { "value": -0.001, "currency": "USD" },
      "balanceAfter": 12.4831,
      "description": "call Birdeye",
      "createdAt": "2026-10-24T09:12:03Z",
      "runId": "0192f6b0-5e2a-7d40-b1c3-8f9e2a4d6c11"
    },
    {
      "id": "3c9b1e7d-2f4a-4c8e-b5d6-7a8f9e0d1c2b",
      "type": "TOPUP",
      "amount": { "value": 10, "currency": "USD" },
      "balanceAfter": 12.4841,
      "description": "Top-up",
      "createdAt": "2026-10-23T18:40:11Z"
    }
  ],
  "cursor": null
}
Fields
typestring
E.g. TOPUP, CONSUMPTION, SUBSCRIPTION, REFUND, BONUS, ADJUST.
amountmoney
Positive for credits, negative for debits.
balanceAfternumber
Balance right after this entry.
runIdstring
The call this entry belongs to, when there is one (use with /v1/runs/{runId}).

Who am I

GET/v1/auth/whoami

Verifies a key and returns its account. Handy as a health check for a configured key (the CLI's setup command uses it).

bash
curl https://gw.pikeway.ai/v1/auth/whoami -H "Authorization: Bearer $PIKEWAY_API_KEY"
200 OK
{
  "userId": "cm2x8k1qz0000abcd1234efgh",
  "email": "[email protected]",
  "walletAddress": null,
  "twitterHandle": null,
  "key": {
    "id": "cm2x9p4rt0001abcd5678ijkl",
    "name": "agent",
    "preview": "pk-AbCd****xYz9",
    "budget": { "limit": 5, "used": 1.25, "currency": "USD" }
  }
}

email, walletAddress and twitterHandle are null when not set on the account. key.budget appears only when the key has a spend limit.

Errors

  • 401 missing API key (Authorization: Bearer pk-...) · invalid or revoked API key
  • 403 key IP / origin restriction
  • 404 not found (unknown path under /v1/wallet/) · account not found
  • 405 use GET