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

Steps

  1. Install the Liquid CLI.

    curl -fsSL https://inference.ai.exchange/cli/install.sh | bash
    

    The installer checks the checksum and puts liquid in ~/.local/bin.

  2. Sign in with permission to manage keys.

    liquid login --keys
    

    Your browser opens. Approve the request. The terminal shows that you are signed in. This token lasts one day and cannot place jobs.

  3. Make a key with a spending limit and save it for your coding agents.

    liquid keys create agent --spend-limit 5 --period day --save
    

    The terminal prints created agent and 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 week or --period month for a longer period.

  4. Start Claude Code with a cap on each request.

    liquid claude --model liquid/auto:cheapest --cap 0.50
    

    Claude Code opens. --cap is the most that one request can cost in USD. The key limit bounds the total. The cap bounds each request.

  5. Give the agent one small task. For example:

    Explain what this repository does in five lines.
    
  6. Leave Claude Code. When the session ends, liquid prints 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:

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.

  1. Open Rules in the console, then Guardrails.
  2. Choose New guardrail and select the key agent under Select keys.
  3. Set a budget, then save.

The next call follows the new rules. See Guardrails.

If something goes wrong

Next steps