Balance and deductions
LLMTune uses a prepaid balance (your “wallet”), measured in USD. You add funds up front, and usage outside your Coding Plan quota — inference on non-plan models, embeddings, fine-tuning, and Agent requests — is deducted from your wallet in real time. There are no end-of-cycle invoices; you only pay for what you use.If you subscribe to a Coding Plan, requests against your plan’s included GLM models consume your request quota, not your wallet. Your wallet is only charged for usage outside the plan — non-plan models, fine-tuning, and embeddings. See Deposit funds for the deposit flow.
Because billing is prepaid, a request only runs if your balance can cover it. If it can’t, you get a 402 Payment Required instead of the response — see What happens when balance runs out.
How balance is used
| Workload | How it charges |
|---|---|
Inference (/v1/chat/completions) | Per request, based on input + output tokens. |
Embeddings (/v1/embeddings) | Per request, based on input tokens. |
Fine-tuning (/api/training) | Per GPU hour, billed while the job runs (not while queued). |
Agent (/api/agent/v1/...) | Per request / per step, like inference. |
How deductions work
-
When you call inference, embeddings, or the Agent, the platform:
- Validates your API key.
- Checks that your balance is sufficient (using an estimate or actual cost).
- If sufficient — runs the request, computes usage (tokens), and deducts the cost from your balance.
- If insufficient — returns 402 Payment Required and does not run the request or deduct anything.
- For fine-tuning, the job is billed per GPU hour while it runs. Insufficient balance can prevent the job from starting or cause it to fail — so fund the account before launching large jobs.
- Failed requests are not charged. If a request errors (4xx/5xx), no tokens are billed. Only successful completions are deducted.
Every request outside your Coding Plan quota — including free / Confidential (own-your-data) models, fine-tuning, embeddings, and non-plan models — is checked against your wallet balance first. A
$0.00 balance returns 402 regardless of model tier. Requests against your plan’s included models consume quota, not wallet. See Coding Plans.What happens when balance runs out
When your balance can’t cover a request, the API returns 402 Payment Required with this body:- Meaning — Your balance is too low for this request (or its estimated cost).
- What to do — Add funds in the dashboard at Deposit funds, then retry. In your app, surface a clear message (e.g. “Add funds”) and link to billing.
Handling 402 in code
Treat402 as a billing issue, not a transient failure. Don’t retry the same request in a loop — it will keep failing until the balance is topped up.
Best practices
- Monitor balance — Track spend on the Usage dashboard and top up before it hits zero.
- Handle 402 explicitly — Catch it in code, prompt the user to add funds, and do not retry until balance is updated.
- Estimate before batch — For large batch or fine-tuning jobs, check balance first so you don’t start work that will fail mid-way.
- Fund before fine-tuning — Training is billed per GPU hour; ensure enough balance for the whole run.
- Watch for unexpected drain — A sudden balance drop often means a loop or runaway job. Check audit logs and usage by model/endpoint.
Next
- Deposit funds — How to add funds and the deposit flow.
- Billing & usage — How token usage and cost are calculated and tracked.
- API endpoints — The endpoints that consume balance.