claude_runner — how I eliminated Claude API costs by using the subscription I was already paying for
For months I was paying for Claude twice. The monthly subscription and the API tokens every time an agent made a call. Turns out I didn't have to. The problem When you import the Anthropic SDK dire...

Source: DEV Community
For months I was paying for Claude twice. The monthly subscription and the API tokens every time an agent made a call. Turns out I didn't have to. The problem When you import the Anthropic SDK directly, every token gets billed: This charges per token consumed from anthropic import Anthropic client = Anthropic(api_key="sk-...") response = client.messages.create(...) 1,000 fiscal document analyses per month with Sonnet: between $25 and $80 USD on top of what you already pay for the subscription. And that scales linearly with every new agent you add to the system. The discovery Claude Code CLI has an authentication hierarchy that almost nobody documents: CLAUDE_CODE_USE_BEDROCK / USE_VERTEX (cloud providers) ANTHROPIC_AUTH_TOKEN (proxies / gateways) ANTHROPIC_API_KEY ← per-token billing starts here apiKeyHelper script (rotating credentials) ~/.claude/.credentials.json ← your Max subscription lives here When you run claude login, the CLI stores an OAuth token at ~/.claude/.credentials.json