← All articles
4 min read

Give Claude Code a rupee budget before you give it your repo

Give Claude Code one CI failure to investigate. Connect Claude Sonnet 5.5 through Top Billing, cap the session in rupees, and measure whether the diagnosis earned its cost.

A failed test in a terminal beside a blue spending dial with a red limit marker.
In this article
  1. Set the limits before the first prompt
  2. Connect Claude Code to Top Billing
  3. Give it one failure and a clear finish line
  4. Decide whether to use it on the next failure

A retry test goes red in CI. The failure message tells you what didn’t happen. It doesn’t tell you whether the clock is wrong, the backoff changed, or the test never reached the second attempt. That’s a good first job for a coding agent. You can check the diagnosis against the checkout and decide whether it saved an engineer time.

Thoughtworks’ November 2026 Technology Radar describes the shift toward longer agent tasks and the growing need to control what agents can access and what they cost. Here’s a small way to put that into practice. Give Claude Code one failure to investigate, run Claude Sonnet 5.5 through Top Billing, and measure what it cost to get a diagnosis your team can verify. Thoughtworks Technology Radar

Set the limits before the first prompt

  1. In Projects, create a project called ci-triage and add live credits to its wallet.

  2. Open the project’s Settings. Set a Per-session cap and a Monthly cap. For a small pilot, you might start with ₹100 per session and ₹500 per month. These are example limits you choose, independent of the model’s token price.

  3. Create a dedicated live API key for the project with the chat:write scope. Load it as TOPBILLING_API_KEY from your local secret manager. Keep the key out of the repo.

Top Billing Limits card with a 500 rupee monthly cap and a 100 rupee per-session cap.
Demo project settings. The monthly cap is ₹500 and the per-session cap is ₹100.

Top Billing counts settled charges and in-flight reservations toward the cap. If the next request would exceed it, the gateway returns HTTP 402 before the model runs. That can happen even when Usage shows less than ₹100 spent, because the next request needs room for its estimated cost. Top Billing spend caps · API keys

Connect Claude Code to Top Billing

From your local checkout, run this in Bash or Zsh with Claude Code installed. The parentheses keep the gateway settings scoped to this launch.

(
  unset ANTHROPIC_API_KEY
  export ANTHROPIC_BASE_URL="https://api.topbilling.in"
  export ANTHROPIC_AUTH_TOKEN="${TOPBILLING_API_KEY:?Load your Top Billing project key first}"
  export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
  export CLAUDE_CODE_ATTRIBUTION_HEADER=0
  export CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1
  claude --model tb-claude-sonnet-5-5 --permission-mode plan --name "CI triage pilot"
)

Use the API host without /v1. Claude Code adds the API path. The example includes Top Billing’s compatibility settings for the model’s translated Anthropic route. Run /status to confirm the base URL and auth source, then send your first prompt. Plan mode lets Claude inspect the checkout and propose a fix before you authorize changes. Claude Code permissions · Top Billing’s Claude Code guide · Sonnet 5.5 model page · Claude Code gateway setup, including PowerShell

Give it one failure and a clear finish line

Paste the relevant excerpt of the CI failure with credentials and private data removed. Then give the agent a brief you can grade.

Investigate this retry test failure. Identify the first relevant assertion, point to the file and line that support your explanation, and propose the smallest fix. Give me one regression test to run. If the evidence supports several causes, tell me what would distinguish them. Keep this session in Plan mode.

Open the cited file yourself. A diagnosis earns a pass if another engineer can follow the evidence, reproduce the problem, and see why the suggested change addresses it. If you still have to hunt for the cause, record a miss.

Decide whether to use it on the next failure

Open Usage → Coding sessions in Top Billing and check the charge for the run in INR. For a five-failure pilot, record the minutes until someone can reproduce each failure, how many diagnoses your team accepts, and the total model spend. Divide the spend by the number of accepted diagnoses. Compare the time with how your team usually handles similar failures. Top Billing’s Claude Code FAQ

Top Billing Coding sessions screen showing a demo session with three requests and a cost of ₹1.1200.
Demo data from three simulated requests. Open a session to review its individual requests.

Start with one red build. If Claude Code points your teammate to the right line and the cost makes sense, try it on the next one.

Create a Top Billing project and run your first CI triage session.