API reference
Pricing & Energy
How API usage is paid for.
Free models#
Free models cost nothing per request. To use them you must hold at least 5,000 ENERGY, counting your wallet, your Energy Vault and your Liquidity Pool stake together. Holding is enough: nothing is spent.
Paid models#
Paid models are charged in Energy from your Energy Vault. 1 Energy = $0.001 (1 USDG = 1,000 Energy). The cost of a request is:
energy = ceil( (prompt_tokens × input_price + completion_tokens × output_price) / 1,000,000 × 1,000 )where the prices are the model's USD per 1M tokens from GET /v1/models.
Worked example
A model priced at $1 input / $5 output per 1M tokens, with 2,000 prompt tokens and 500 completion tokens: (2,000 × 1 + 500 × 5) / 1,000,000 = $0.0045 → 4.5 Energy → 5 Energy.
Reservations#
- Before a paid request, an estimate is reserved from your vault (prompt size +
max_tokens, or 1,024 tokens when you don't set it). Parallel requests can never spend more than you have. - When the answer is done, the reservation is replaced by the real cost from
usage. - Once an hour, the used Energy is charged on-chain from your vault and burned.
Not enough Energy#
If your vault can't cover the reservation, the API answers 402 with type insufficient_energy. Deposit more ENERGY in the dashboard, or use a free model.