We use cookies. Cookies and browser storage keep you signed in and remember your preferences. With your permission we also measure how the site is used. You can any time. See our cookie policy.

Balance & key info

Endpoints

Balance & key info

Read your USD balance, key limits and usage with GET /credits and GET /key, and check what is left before a request fails.

Read your account's USD balance, total spend and the calling key's rate limit. Two paths return the same body: /credits and /key, a shorter alias.

GET https://api14.com/api/v1/credits
GET https://api14.com/api/v1/key

All amounts are US dollars.

Request

No parameters. Authenticate with your API key:

curl https://api14.com/api/v1/credits \
  -H "Authorization: Bearer sk-api14-..."

Response

{
  "data": {
    "total_credits": 145.0,
    "total_usage": 102.82,
    "balance_usd": 42.18,
    "key_id": "ckey_01JABCDEF",
    "rate_limit": { "requests": 120, "interval": "1m" }
  }
}
FieldDescription
total_creditsTotal USD ever added to the account: top-ups, subscription included usage, bonuses and promo codes.
total_usageTotal USD spent on requests.
balance_usdCurrent spendable balance in USD.
key_idThe id of the API key used for this request.
rate_limit.requestsThe key's own requests-per-minute limit, or null if the key uses your plan's limit.
rate_limit.intervalAlways 1m.

total_credits - total_usage can differ slightly from balance_usd because of refunds and manual adjustments; balance_usd is authoritative.

Example: stop before running out

import os, requests

r = requests.get(
    "https://api14.com/api/v1/credits",
    headers={"Authorization": f"Bearer {os.environ['API14_API_KEY']}"},
)
balance = r.json()["data"]["balance_usd"]
if balance < 1:
    raise SystemExit(f"Balance low: ${balance:.2f}. Add funds at /dashboard/billing")
curl -s https://api14.com/api/v1/key \
  -H "Authorization: Bearer $API14_API_KEY" | jq '.data.balance_usd'

When the balance hits $0

Paid requests return 402 insufficient_balance until you add funds, unless auto top-up is enabled in Billing. Reading /credits, /key and /models keeps working. See Pricing & billing.

Errors

StatusCodeWhen
401invalid_api_keyMissing or invalid key.

See Errors.