Skip to content

Credits

Returns your company's credit balance, its total usage to date, and the amounts reserved for requests in flight and available for new ones, in USD.

Markdown
On this page
GET/v1/credits

The credit balance lives at company level, and every project in the company spends from it. Whichever project's key you call this endpoint with, it returns the company's balance and total usage. Amounts are USD decimals.

Example

Request
curl https://api.getlykia.com/v1/credits \
  -H "Authorization: Bearer $LYKIA_API_KEY"
Response200
{
  "data": {
    "balance": 99.996675,
    "total_usage": 0.003325,
    "reserved": 0.16414,
    "available": 99.832535,
    "billing_mode": "prepaid"
  }
}

Response

dataobject
balancenumber

The company's credit balance. The cost of a request is deducted when it finishes. Usage does not take the balance below zero (see How the balance goes down); a refund or payment dispute for credits that were already spent, or BYOK fees, can.

total_usagenumber

Everything the company has spent from credits so far: the cost of requests paid with credits plus BYOK fees that have been deducted.

reservednumber

The amount set aside for requests in flight. Each request reserves the most it can cost before it is sent, and the reservation is released when it finishes. See Reservations.

availablenumber

balance minus reserved: what new requests can use. A paid request whose prompt and a minimal completion this amount cannot cover gets 402.

billing_modestring

How the company pays for usage. prepaid: requests are paid from this credit balance.

Topping up, the platform fee and what a request costs: Credits and billing.