B2BB2B LLM

Wallet lookup

Read the company wallet and selected Usage Limit with company finance permission.

GET /v1/balance returns the company billing owner's wallet and a selected key/group Usage Limit when the active API credential has permission to view company finance. A company wallet is not a collection of per-key child balances. Project usage access alone does not grant wallet visibility.

Request

curl https://api.b2b-llm.com/v1/balance -H "Authorization: Bearer $B2B_API_KEY"

Response

{
  "object": "balance",
  "currency": "USD",
  "balance": "125.75",
  "key": {
    "limit": "500.0000000000",
    "usage": "480.0000000000",
    "remaining": "20.0000000000",
    "limit_source": "group"
  }
}

The existing object, currency and balance fields retain their contract. balance is the company wallet in USD as a decimal string; insignificant trailing zeros may be omitted. New amount values under key, other than null, are decimal strings with ten fractional digits. Keep exact strings in financial code rather than binary floating-point values.

Selecting the counter

For each positive configured key or group limit, calculate max(0, limit - usage). The smaller remainder wins; an exact tie selects the key. The returned limit, usage and remaining all belong to that source, named by key.limit_source as "key" or "group".

In the example, the group has 500 limit and 480 aggregate usage. If the individual key has a remainder above 20, the group is selected. Group usage includes other keys in that group; it must not be interpreted as this key's own usage. An exhausted or overspent counter reports "0.0000000000" and remains the restrictive counter instead of falling back to the wallet. Actual usage is not reduced to the limit.

If only one positive limit is configured, that counter is returned. With neither configured, key.limit, key.remaining and key.limit_source are null, while key.usage contains the actual key usage:

{
  "key": {
    "limit": null,
    "usage": "3.5000000000",
    "remaining": null,
    "limit_source": null
  }
}

null is distinct from zero and does not grant unlimited company credit. Key and group usage are independently resettable counters, not lifetime spending. A reset can change which source is selected on the next lookup.

Quota is separate from the wallet

The wallet does not cap key.remaining. The endpoint compares stored Usage Limit remainders without converting them to wallet charges. Usage valuation can follow user or official pricing with a configured multiplier, so quota amounts are not a second cash balance. Account, key/group, model and rate checks still apply to future requests.

Values reflect recorded accounting. Unfinished requests and completed requests awaiting settlement may not yet be included. This lookup does not reserve money or promise a hard concurrent-spend ceiling. A zero wallet or an exhausted quota does not prevent an otherwise authorized balance lookup.

Permissions

The current key, expiry, account, organization, domain and IP checks remain in force. Frozen and revoked keys cannot read this endpoint. Organization owner/admin and authorized company billing permissions are distinct from developer/viewer project roles. Employees without company balance visibility receive HTTP 403 balance_not_permitted; the response does not disclose the new key object either. Shared project selection in Playground does not promote the employee to the credential creator's wallet permission.

Owner automation can alternatively use the separately authenticated Partner balance endpoint.