Skip to content
Docs

Getting started

Credits and billing

Tools are paid for in credits. A workspace holds a prepaid balance, every call draws it down at a published unit price, and the console shows where each credit went.

Buckets#

A workspace holds three blocks of credits, consumed in this order:

BucketFilled byExpires
TrialStarter credit at sign-up, or a trial package an operator appliesAfter the package's trial period, or never
SubscriptionReloaded every cycle by a subscription packageAt the next reload (no rollover)
PrepaidReloads from the console (card, or invoice above the threshold) and auto-reloadNever

One credit has a fixed dollar value (LeanTools.Billing.CreditUsdValue, shown in the console and returned as creditUsdValue by the console APIs). Prices on the public site are that value times the credit rate.

Meters#

Each service exposes one or more meters; the workspace's package defines the credits per unit of every meter, falling back to the service default. A refused or failed call is never charged.

ServiceMeterUnitNotes
Web Searchrequestper queryAlso the native MCP tool web_search.search
LeanBrowserrequest, session_minuteper HTTP request, per active WebSocket minute
LeanModel textinput_tokens, output_tokens, audio_minuteper 1,000,000 tokens; per minute of audio transcribed or heardPriced per tier; a tier the package does not price is 403 tier_not_in_package. A chat request carrying audio parts adds an audio_minute line to its tokens
LeanModel imageimageper image generated or editedPriced per tier; billed per image produced
LeanModel speechtts_characterper 1,000 charactersPriced per tier
LeanModel musicmusic_secondper second of music producedPriced per tier; the seconds asked for when the model reports no length
LeanModel videovideo_secondper second of video producedPriced per tier
LeanModel avatarstream_minute, managementper connected minute; freePriced per tier; accrued every minute from creation until the stream closes
LeanModel realtime audioaudio_input_tokens, audio_output_tokens, input_tokens, output_tokens, cached_input_tokensper 1,000,000 tokens, as the model reports them per responsePriced per tier, all five together; committed as the conversation goes, and the socket closes with code 1008 when credits run out
Emailemailper recipient (to + cc + bcc, at most 50)Also the native MCP tool email.send
LeanMachineactive_minuteper minute a machine runsMachines are stopped when credits run out
LeanVisionstream_minutepriced per stream-hourAccrued every minute until disposal
LeanMemory: warehouse, vectors, eventsstorage_gb_month, compute_second, ingest_gb, egress_gb, managementGB-month, per 1,000 s, per GiB, per GiB, freeAttributed by the database named
LeanMemory storagestorage_gb_monthper GB-month heldNo ingress, egress or request charge
LeanDatacall, row, monthper query, per 1,000 rows, per subscription monthPriced per dataset (qualifier = dataset key)
LeanConnect connectorscallper completed actionPriced per connector (qualifier = connector key); refused, failed and timed-out actions cost 0

Only measurements and upstream attribution are stored per call (zero data retention): no request or response payload is kept. Per-request rows are archived monthly; aggregates are kept indefinitely.

Caps, budgets and guardrails#

  • Key cap. A monthly spend cap per API key: 402 key_cap_reached once reached, reset on the first of the month (UTC).
  • Tool budget. A monthly credit budget per native tool with "pause at budget": 402 tool_budget_reached. Without pausing, the budget only drives the warning in the console.
  • Connector guardrails. Per connector: calls per minute (429 rate_limited), calls per day (429 daily_cap_reached), the keys allowed to use it, the functions exposed, and whether write actions are held for approval.
  • In-flight reserve. When several calls of one workspace are in flight and the remaining balance no longer covers roughly one credit per running call, new calls are refused with 402 insufficient_credits until they finish or the balance grows (LeanTools.Credits.InFlightReserveCredits).

Reloading credits#

Owners and Billing members reload from Settings → Billing & credits:

  • Any amount between the host's minimum and maximum (LeanTools.Billing.MinReloadUsd, MaxReloadUsd), paid with a saved card. The quote shows the credits added and the balance after. A retried or double-submitted payment is charged once.
  • Auto-reload. When the balance falls under a threshold, the default card is charged a fixed amount, up to a monthly limit. The console banner and the low-balance email warn before credits run out.
  • Invoice. Amounts of LeanTools.Billing.InvoiceThresholdUsd or more can be requested as an invoice; credits are granted when the host confirms the bank transfer (an operator marks the order paid in the admin panel).
  • Receipts. Every paid order has a numbered receipt (HTML) and the credit history exports as CSV.

The payment provider is pluggable (LeanTools.Billing.PaymentProvider). A host running the sandbox provider shows a "sandbox" badge in the console: card numbers ending in 4242 succeed, numbers ending in 0002 are declined, and nothing is charged.

Account endpoints#

GET/api/v1/accountbalances, status, effective package and the rates that apply to the caller
{
  "accountGuid": "…", "name": "Acme", "status": "Active", "trialUnlimited": false,
  "packageCode": "SUB-2K", "packageName": "Subscription 2K", "packageMode": "Subscription",
  "available": 2874.25, "trial": 0, "subscription": 2874.25, "prepaid": 0, "overdraft": 0,
  "nextReloadTime": "2026-10-01T00:00:00+00:00", "trialExpiry": null,
  "services": [ { "key": "TextAssistant", "name": "LeanTools Text Gen", "billingMode": "PerRequest",
      "meters": [ { "meterKey": "input_tokens", "unit": "Token", "unitScale": 1000000, "isFree": false, "requiresTierRate": true, "creditPerUnit": null } ],
      "tiers": [ { "id": "leanmodel-flash", "displayName": "LeanModel Flash", "kind": "Text", "catalog": "LeanTools Text Gen", "isDefault": true, "isStandard": true,
                   "operations": [ "chat.completions", "audio.transcriptions" ],
                   "rates": { "input_tokens": { "creditPerUnit": 1.0, "unitScale": 1000000 }, "output_tokens": { "creditPerUnit": 4.0, "unitScale": 1000000 } } } ] } ]
}
GET/api/v1/account/usage?from=&to=&groupBy=service|meter|dayrequests and credits for the range (default last 30 days)
GET/api/v1/account/transactionsthe latest 200 credit movements other than usage
GET/api/v1/packagesthe public package catalogue
GET/api/v1/servicesevery service with its meters (no authentication)
GET/api/v1/models/tiers?service=the LeanModel tiers the caller may name in model, with catalogue, capabilities, operations and rates; ?service= narrows to one catalogue

Usage feedback on responses#

Chat completion responses (and the final streaming chunk) carry the standard usage object extended with credits_charged, credits_remaining and cost_usd. Image, transcription, music and video responses carry usage with credits_charged and cost_usd; a speech response is the audio itself, so its usage rides in the X-LeanTools-Usage header; an avatar stream reports its minutes and credits when it is closed, and realtime audio is billed per response.done as the conversation goes. Data, connector and tool calls answer a usage block with credits and balance. MCP results embed the same block in the result text.

Updated October 14, 2026 · This page as Markdown · All docs as one file