
What happened
The walkthrough points the CLI at a local mock via the ANTHROPIC_BASE_URL environment variable. The mock implements only the /v1/messages endpoint, returning scripted SSE answers, including tool_use blocks that call Bash.
Why it matters
Because only the model is billed, developers building Claude Code hooks and MCP servers can test them repeatedly at no cost and see exactly what the CLI passes in, since the CLI stays real.
Summaries like this, in your inbox every morning.
Claude Code separates into two halves: the CLI running on your own machine and the model running on Anthropic's servers. Billing applies only to the model's work of reading requests and producing answers, so swapping just that half for a small server that returns scripted responses leaves the CLI's real behavior intact while removing the cost. Requests are sent as HTTP calls to the Messages API, and the mock only needs to implement the /v1/messages endpoint, since answers come back as replies to those requests rather than as separate calls.
The write-up uses the setup to inspect what the CLI actually transmits. A request captured during a run includes a system prompt the CLI adds, tool definitions, and the prior conversation. As an example, the author adds a UserPromptSubmit hook and finds its output delivered inside the CLI's added preamble, under a heading that reads 'UserPromptSubmit hook success:'. The same method was used previously to check how /compact replaces a conversation with a summary, how MCP server descriptions and skills reach the model, and how MCP tools are moved to the background after 120 seconds.
Beyond inspection, the piece shows the mock can simulate failures. Returning HTTP 529 responses a set number of times lets you observe how the CLI retries, with the number of retries controlled by CLAUDE_CODE_MAX_RETRIES. The author also runs this pattern at a larger scale for their own macOS app tanacode, driving the real CLI with the mock every day in GitHub Actions to catch breakage when Claude Code updates.
Pick your industry and the AI tools you use, and get news related to your work every day.
Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →
Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.
Chunghwa Telecom president Rong-shy Lin said the shift from conversational AI to autonomous AI agents is resha…

Apple and Meta said they would jointly release a new open-weight AI model designed to run on high-end Macs, ai…

A writer and entrepreneur opened his daily to-do list and found 156 items, and concluded that an AI assistant…

A Zenn contributor sorted AI use into three modes — AI as an assistant, AI running alongside people, and AI th…

A non-engineer operator says one person ships four smartphone apps on Google Play, three on the App Store, wit…

A developer released agent-guardrails, a one-script Python standard-library plugin that guards Bash, Write, Ed…
