Usage & Credits

Query your remaining credits, spend, and usage history directly from the API with your key.

Get usage and credits

GET/v1/usage

Returns the current credit balance and lifetime usage for whatever your key is scoped to. Authenticate with a regular Bearer API key:

curl https://api.aetherapi.dev/v1/usage \
  -H "Authorization: Bearer sk-aetherapi-..."

Response with an account key

For a Default Project (personal) key, account reflects your personal account balance:

{
  "account": {
    "user_id": "usr_...",
    "username": "alice",
    "email": "[email protected]",
    "credits": 187500,
    "used_credits": 12500,
    "used_tokens": 8412000,
    "api_calls": 312,
    "money_saved": 4.2,
    "created": "2026-01-15T09:00:00.000Z",
    "last_usage_timestamp": "2026-08-21T18:42:11.000Z"
  },
  "api_key": {
    "key": "sk-a...a1b2c3",
    "id": "key_...",
    "name": "my-app",
    "enabled": true,
    "used_credits": 4200,
    "used_tokens": 2100000,
    "api_calls": 98,
    "last_used": "2026-08-21T18:42:11.000Z"
  },
  "totals": {
    "total_credits_used": 12500
  },
  "timestamp_utc": "2026-08-22T10:00:00.000Z"
}

Response with a project key

For a shared project key, account reports the project wallet instead of any individual member's balance — the same shared credits every request bills against:

{
  "account": {
    "project_id": "prj_...",
    "project_name": "team",
    "wallet_mode": "project",
    "credits": 125000,
    "used_credits": 5000,
    "used_tokens": 31000000,
    "api_calls": 1420,
    "money_saved": 12.6,
    "created": "2026-06-01T12:00:00.000Z",
    "updated": "2026-08-21T18:42:11.000Z"
  },
  "api_key": { "...": "summary of the key used, as above" },
  "totals": {
    "total_credits_used": 5000
  },
  "timestamp_utc": "2026-08-22T10:00:00.000Z"
}

Wallet scoping

The response always mirrors the wallet your key actually draws from: the account for personal keys, the shared project wallet for project keys. Member-level balances are never exposed through this endpoint.

Get usage history

GET/v1/history

Same authentication, returns daily activity and weekly aggregates (tokens, credits, calls, per-model breakdown) for the caller only. With a project key it is scoped to that specific key's usage inside the project:

{
  "user_id": "usr_...",
  "weekly_stats": {
    "2026-W33": {
      "week_start": "2026-08-10",
      "tokens": 1840000,
      "credits": 9200,
      "calls": 74
    }
  },
  "daily_activity": {
    "2026-08-21": {
      "tokens": 240000,
      "credits": 1200,
      "calls": 9,
      "model_usage": { "...": "per-model token and credit totals" },
      "call_details": [ { "...": "one entry per request" } ]
    }
  },
  "timestamp_utc": "2026-08-22T10:00:00.000Z"
}

Errors

Both endpoints return 401 missing_authorization without a valid Bearer key. See Errors for the full error format.