MLXDocs
Compute API · Pilot

Credit and billing

Markdown
Pilot · not generally available yet

API credit is USDC you set aside on the ledger for your requests. Usage is counted as requests finish and charged once a day in one public transaction, which also pays the Macs.

API credit

API credit is USDC from your MLX Wallet, held in the protocol account api.mlx for your requests. It shows on your account as apiCredit.

  • Add it with the user transaction api_fund {amount}: at least 1 USDC, and at most 1,000 USDC of credit per wallet in the pilot. The console signs it for you.
  • Take it back with api_refund {amount}. You can take back credit that isn't paying for requests since the last bill or for requests running now; the console shows how much that is.
  • api.mlx takes no transfers: a transfer to it fails, so USDC can't land there by mistake.

Your available credit is your credit, less what you've used since the last bill and the most your running requests could cost. A request is refused (402) when its most possible cost is more than that.

Prices

$0.02 per million tokens, the prompt's and the completion's alike: $0.00002 per thousand. Usage is counted in billionths of a dollar as each request finishes and charged in whole millionths (USDC's base unit), rounded down.

The daily bill

After 00:10 UTC each day the sequencer sends one system transaction, compute_bill. Every figure in it is a running total since the pilot started, so only what's new moves and sending the same bill twice moves nothing:

FieldWhat the ledger does
charges[] {account, billed}Takes billed − apiBilled from that wallet's API credit (never more than the credit holds) and records apiBilled = billed.
pays[] {account, earned}Pays earned − apiEarned in USDC from what was charged to that wallet (a Mac's owner), never locked. A pay the day's charges can't cover yet stays due for the next bill.
feeMoves fee less what was already sent to treasury.mlx.

api.mlx always holds exactly the wallets' API credit plus what was charged and not yet paid out. The explorer shows each bill and each wallet's line in it.

GEThttps://mlx.app/api/account/api.mlx

Who gets what

For each request, 90% of its price is split equally between the wallets of the Macs whose answer was returned (two, when it was checked), and 10% is the network's fee, sent to the treasury. The whitepaper's split is 85% to the worker, 5% to the verifier and 10% to the protocol. In the pilot both Macs do the whole job, so the worker's and the verifier's shares are split equally between them.