Run a coding agent on a budget
Start Claude Code on the exchange with a key that cannot spend more than you set.
In about ten minutes, you start Claude Code through liquid with a key limited to $5 each day. Then you read the receipt of your first job.
Before you start
- You need a workspace with a balance. See the Quickstart.
- You must be an owner or an admin of the workspace. Only they can make keys.
- Claude Code must be on your
PATH. The installer supports macOS and Linux.
Steps
-
Install the Liquid CLI.
curl -fsSL https://inference.ai.exchange/cli/install.sh | bashThe installer checks the checksum and puts
liquidin~/.local/bin. -
Sign in with permission to manage keys.
liquid login --keysYour browser opens. Approve the request. The terminal shows that you are signed in. This token lasts one day and cannot place jobs.
-
Make a key with a spending limit and save it for your coding agents.
liquid keys create agent --spend-limit 5 --period day --saveThe terminal prints
created agentand the key id. The command does not print a saved key, so you cannot lose it in your scrollback.The limit is $5 each day. When the key reaches it, jobs fail with
402 budget_exhausted, even if the workspace has more balance. Use--period weekor--period monthfor a longer period. -
Start Claude Code with a cap on each request.
liquid claude --model liquid/auto:cheapest --cap 0.50Claude Code opens.
--capis the most that one request can cost in USD. The key limit bounds the total. The cap bounds each request. -
Give the agent one small task. For example:
Explain what this repository does in five lines. -
Leave Claude Code. When the session ends,
liquidprints the number of requests, the cost and the largest charge against your cap.
Check it works
List your latest jobs:
liquid job
Each row shows the job id, the model, the provider and the amount charged. Type to filter and press Enter to open one job. You can also pass the id:
liquid job <job-id>
Look for three things:
- Provider. This is the provider that answered.
- Outcome. A normal job shows
completed. - Charged. The exchange charged the tokens used. It is never more than your cap.
The receipt adds the supplier charge and the fee. See Receipts for every field. To check the limit itself, open API keys in the console. The key agent shows its limit and period.
Add a guardrail (optional)
A spending limit stops one key. A guardrail also limits which offers can serve a call, and it can block sensitive text.
- Open Rules in the console, then Guardrails.
- Choose New guardrail and select the key
agentunder Select keys. - Set a budget, then save.
The next call follows the new rules. See Guardrails.
If something goes wrong
liquid keyssays you need a token. Runliquid login --keysagain. A member cannot approve this token. Ask an owner or an admin to make a key, then runliquid login --key sk-liquid-....- Claude Code does not start. A
.claude/settings.jsonfile may setANTHROPIC_API_KEY,ANTHROPIC_AUTH_TOKENorANTHROPIC_BASE_URL. Remove that value fromenv. See Claude Code. - A job fails with
402. The key reached its limit, or the workspace has no balance. Check the balance withliquid workspace balance.
Next steps
- API keys: scopes, expiry and revocation.
- Purchasing rules: choose price, speed or region for each request.
- Liquid CLI: models, cap and workspace settings.