---
title: "Guide: Give Claude Code a spend boundary"
canonical_url: "https://tokenobserve.com/guides/claude-code-spend-controls"
published: 2026-10-15
last_updated: 2026-10-15
---

# Guide: Give Claude Code a spend boundary

The question: How do I give Claude Code a budget and inspect its evidence?

## The answer, in one paragraph

Configure a supported Claude Code client with your workspace gateway address and issued agent key. Give that agent a checked price table and a spend ceiling before using it. Review the recorded decision for routed requests. A billing connection alone does not govern Claude Code.

## Facts

- Client credential: Workspace-issued agent key
- Upstream credential: Separate Anthropic inference key in the workspace
- Budget scope: One governed agent; not a shared team or fleet pool
- Walkthrough evidence: Synthetic example; no live provider call is required to read it

## The limit

Routed API use: This controls supported gateway traffic, not a Claude subscription seat or a client that bypasses the gateway.

### Set up one named agent

Create your cloud workspace, then save a separate Anthropic inference key and supported model. Saving the inference key sends no model request. Register a Claude Code agent, give it a named owner and the model permissions it needs, and issue its scoped workspace key.

Check the current integration compatibility and your client version before changing configuration. Use the exact workspace gateway base address from the portal. For the Anthropic dialect, avoid adding a second /v1 suffix. Claude Code uses ANTHROPIC_AUTH_TOKEN for the gateway credential.

Configure locally with placeholders, never a real key in chat
    export ANTHROPIC_BASE_URL="<workspace-gateway-base-address>"
    export ANTHROPIC_AUTH_TOKEN="<issued-workspace-agent-key>"
    # Select a supported model configured for this workspace.

### Set a ceiling you can explain

Confirm the price table covers the model and every reachable fallback. Set per-request, rolling-hour, UTC-day or UTC-month USD ceilings on this agent as appropriate. Rates and limits must come from your own approved configuration; this guide invents no recommended spend or saving.

Under a hard ceiling, a request gets one potentially billable attempt. An unpriced reachable model is refused before egress rather than estimated at zero. Per-agent ceilings do not pool a team’s budget and do not control traffic sent directly to Anthropic.

### Inspect the decision before a real workload

Synthetic example: an agent has a USD 10 daily ceiling, USD 9 reserved or recorded and a conservatively priced USD 2 proposed request. The projection is USD 11, so the request is refused before provider egress. The example is arithmetic, not a result from a customer deployment.

In your workspace, inspect the agent, timestamp, blocked outcome and typed budget reason on the trace. Read metadata first. Bounded, redacted prompt and reply capture is opt-in and cannot reveal hidden reasoning. A source-only or synthetic check does not prove your live provider key or workload is qualified.

A real permitted model call can incur provider charges. Use an approved small workload only after checking the configuration, then confirm its trace and account evidence. Restore the client configuration if you stop routing through the workspace.

## Resources

- Read the Anthropic integration compatibility: https://tokenobserve.com/integrations/anthropic
- Review hard-ceiling behaviour: https://tokenobserve.com/use-cases/cap-ai-agent-spend
- Connect Anthropic reporting separately: https://tokenobserve.com/guides/connect-anthropic-billing

## The capabilities behind this

- https://tokenobserve.com/platform/spend-controls
- https://tokenobserve.com/platform/flight-recorder
- https://tokenobserve.com/platform/agent-registry

## Questions and answers

Q: Can I cap every developer’s Claude subscription?
A: No. A subscription seat and routed API requests have different billing. This walkthrough applies to the supported API traffic you configure through the gateway.

Q: Does a refusal prove we saved that amount?
A: No. It records a blocked proposed request. The example’s upper-bound estimate is not a measured saving or a final invoice charge.
