Claude Code on Windows: $0 Setup and a $10 First Receipt
01 / Free tools first: $0 in software and a first spend you control
The software bill for this whole walkthrough is zero. Windows 10 and Windows 11 already include Windows PowerShell 5.1, and Windows Terminal is free from the Microsoft Store. Claude Code installs as a free command line tool, either through its native Windows installer or through npm if you already run Node.js LTS. So the receipt before your first AI call reads: software 0.00, license 0.00, subscription 0.00.
The only line that can grow is API usage. CheapRelay, at cheapapirelay.com, is a pay-as-you-go AI API relay where one key reaches Claude, GPT, Gemini, DeepSeek, Kimi, GLM, Qwen, Grok and more. Billing is per real token, with no monthly fee and no subscription. That structure suits a beginner because you can fund a small balance and watch it move in fractions of a cent instead of committing to a plan you may use twice.
Two practical notes before touching any variables. First, open a fresh PowerShell window after installing Claude Code so the updated PATH is loaded. Second, pick one low-cost model for your first hours of practice, such as Claude Haiku 4.5 or DeepSeek V4 Flash. A cheap model turns a 10 dollar balance into a long learning session, and you can switch to a stronger model once your prompts are doing real work.
02 / The three environment variables Claude Code reads before anything else
Environment variables are key and value pairs that Windows stores for your login session, and PowerShell exposes them with the dollar sign env colon prefix. Claude Code cares about a short list. The first is ANTHROPIC_API_KEY, which some setups also accept as ANTHROPIC_AUTH_TOKEN. The second is ANTHROPIC_BASE_URL, which tells the tool where to send requests instead of the default host. The third is optional: ANTHROPIC_MODEL, which pins a default model so you do not type it on every run.
Check what your machine currently holds with these commands, typed exactly as shown:
- ■ Get-ChildItem Env: | Where-Object Name -like ANTHROPIC*
- ■ echo $env:ANTHROPIC_BASE_URL
- ■ echo $env:ANTHROPIC_API_KEY
If nothing prints, you are starting clean, which is the easiest state to work from. If stale values do print, remember that a variable set in an old window or by another tool can silently override the one you think you configured. Verification before you spend money is the cheapest debugging step available.
One caution about secrets: avoid pasting a key into shared scripts, chat logs, or repositories. Treat the key like a password, because anyone who holds it can spend your balance.
03 / Session variables with $env: and permanent variables with setx
PowerShell lets you set a variable for the current window only. Commands of the form $env:ANTHROPIC_BASE_URL equals a URL, written as assignment, last until that window closes. This is the safest way to test, because a wrong value disappears when you close the terminal and cannot break tomorrow's work.
When the values are right, make them permanent with the setx utility:
- ■ setx ANTHROPIC_API_KEY your_key_here
- ■ setx ANTHROPIC_BASE_URL https://api.cheapapirelay.com
- ■ setx ANTHROPIC_MODEL a_model_name_from_your_dashboard
setx writes to your user environment, and it applies only to windows opened after the command runs. That detail wastes more beginner time than any other, so open a new PowerShell window and rerun the echo commands to confirm. Also note that setx silently truncates values longer than 1024 characters, which is another reason to keep keys and URLs short and separate.
To remove a variable you no longer want, use the .NET call $null form: $env:NAME plus [Environment]::SetEnvironmentVariable with a null value and the User scope. Clearing an old, wrong ANTHROPIC_BASE_URL is often the fix when requests go to the wrong host.
04 / Pointing one key at the relay base and verifying the route
CheapRelay exposes OpenAI-compatible routes under /v1 and Gemini-native routes under /v1beta, with the API base at https://api.cheapapirelay.com. For Claude Code you only need the base URL and your key. The same key also works with Codex, Gemini CLI, and any OpenAI SDK, so a single environment setup covers your other tools later.
Sign up at cheapapirelay.com, copy your key into the ANTHROPIC_API_KEY variable, and run one small test prompt. Keep that first prompt short, roughly one or two hundred tokens of context, so the verification costs almost nothing. If the answer arrives, your routing is correct and every later problem is prompt or budget related rather than configuration related.
If the call fails, work through three checks in order. Confirm the base URL has no trailing path. Confirm the key has no leading or trailing space, which happens when a value is pasted with a newline. Confirm the model name you set is a name your dashboard lists. Those three mistakes cover the majority of first-run errors.
05 / What the receipt actually shows: cache reads and cache writes bill too
Pay-as-you-go billing is only honest if the meter matches real usage. CheapRelay bills per real token, and that includes cache reads and cache writes, not just the visible input and output text. In long Claude Code sessions, cached context can be a large share of the line items, which is exactly why a session that feels cheap can still show several distinct token categories on the receipt.
A practical budget habit for a beginner is to work in 10 dollar increments. Before each session, note the balance; after, check the change. Divide the change by the number of prompts to get your personal cost per prompt. That single ratio tells you more about your spending than any marketing page, and it tells you when to switch to a cheaper model for routine edits.
- ■ Use a low-cost model for boilerplate, tests, and renaming work.
- ■ Switch to a stronger model only for architecture and hard debugging.
- ■ Keep context tight by asking targeted questions instead of pasting whole files.
- ■ Close and reopen long sessions when the conversation stops paying for itself.
- ■ Track one week of receipts before changing your setup.
- ■ Keep a second key for experiments so a leak is easy to revoke.
Finally, if you bring other developers into the same workflow, the referral program returns 20 percent of what invited users pay. Treat that as a small rebate on your own token bill, not as a reason to overspend. The goal of a 0 dollar setup is a token cost you can see, predict, and cut whenever the work allows it.
Sign up Try the prices yourself, sign-up credit included.
More reading
| Date | Aisle | Written in | Title |
|---|---|---|---|
| 2026-10-30 | Coding agents, cheaply | EN | One Claude Code fix: $18.40 first, $2.13 second Two Claude Code receipts judged on price per useful result, plus the two environment variables that changed the bill. |
| 2026-10-30 | Coding agents, cheaply | EN | Running Claude Code on $4.10 a Day Instead of $38 Two daily receipts, the same coding work, and a price-per-useful-result verdict. Real token math, no subscriptions. |
| 2026-10-30 | Coding agents, cheaply | EN | The $50 Coding Bill: 6 Habits That Quietly Double It Six coding assistant habits that quietly double an AI bill, and a $5-a-month workflow that keeps token costs honest. |
| 2026-10-30 | Coding agents, cheaply | EN | One $5 Receipt Covers Claude, Codex and Gemini CLI A beginner walkthrough for running Claude Code, Codex and Gemini CLI on one cheap relay key, with a $5 first-month cap and honest token math. |
| 2026-10-30 | Coding agents, cheaply | EN | $0.50 per pipeline run: the hard cap for CI agents A beginner walkthrough for capping coding agent spend in CI: token math, hard stops and a $0.50 per run budget. |
| 2026-10-30 | Coding agents, cheaply | EN | My $0.40 Receipt After Pairing Cheap First A beginner walkthrough: pair with a cheap model first, escalate only when stuck, and keep an evening receipt at $0.40. |