Claude Code from scratch: install and configure with your own key
Installing Claude Code and configuring it to run on your own API key, step by step, including the mistakes almost everyone makes.
3 min · · Updated · claude-code · setup · guides
Claude Code is Anthropic's console agent: it reads your project, edits files, runs commands and keeps context between steps. Below is a from-scratch install and the configuration that points it at your own API key.
Step 1. Install
macOS and Linux:
curl -fsSL https://claude.ai/install.sh | bash
claude --versionWindows, PowerShell:
irm https://claude.ai/install.ps1 | iexAfter installing, close PowerShell completely and open a new window — otherwise the updated PATH is not picked up and the command is not found.
Via npm, on any system:
npm install -g @anthropic-ai/claude-codeThis route helps when claude.ai returns 403 in your region: npm works everywhere.
Step 2. A permanent config
Claude Code reads ~/.claude/settings.json on every start — configure once and forget. On Windows the file lives at %USERPROFILE%\.claude\settings.json. The CLI and the VS Code extension share the same file.
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"env": {
"ANTHROPIC_BASE_URL": "https://api.zukko.pro",
"ANTHROPIC_AUTH_TOKEN": "fetch_your_key",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5-5",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-5"
}
}If the file already exists, add the env block inside it rather than overwriting the whole thing.
Two places where nearly everyone slips. The URL takes no /v1 — Claude Code appends the path itself. And the variable is ANTHROPIC_AUTH_TOKEN: with ANTHROPIC_API_KEY the agent decides you have an Anthropic account and starts asking you to sign in.
Step 3. Model slots
The /model menu has three fixed slots — Opus, Sonnet, Haiku. The variables in the config above remap each slot to a specific model, so the built-in switcher keeps working.
This is a cost lever, with the prices in mind: at Zukko Opus 5.5 and Sonnet 5 cost the same ($0.30/$0.30), while gpt-5.6-luna ($0.10) and glm-5.3-flash ($0.04) are noticeably cheaper. You can put one of them on the Haiku slot for simple tasks; whether they handle yours — test it on your own tasks.
Step 4. Run it
claudeThe config is picked up automatically. Ask any question — an answer means it works, and the first spend entry appears in your dashboard history.
The VS Code extension
Install Claude Code from the Marketplace, make sure ~/.claude/settings.json already exists, enable Claude Code: Disable Login Prompt in VS Code settings, and reload the window via Developer: Reload Window.
A one-off run without a config
For a quick test, without editing files:
export ANTHROPIC_BASE_URL="https://api.zukko.pro"
export ANTHROPIC_AUTH_TOKEN="fetch_your_key"
claudeThe variables live until you close the terminal.
If something does not work
claude not found on Windows. Open a new PowerShell window. If that does not help, run where.exe claude; empty output means reinstall.
It asks you to sign in to Anthropic. Check the variable name and that your JSON is valid. If you previously signed in with an account, run /logout once.
401. A typo in the key, whitespace around it, or a revoked key.
402. An empty balance.
404 on every request. A stray /v1 in the URL.
What it costs
You pay for the tokens you use. An agent session is mostly input tokens, so look at their price first: at Zukko Opus 5.5 costs $0.30 per million against Anthropic's official $4 (output: $0.30 against $20). One caveat: vendors charge ~10% of the input price for prompt-cache reads, while we bill cached tokens at the regular price, so for agents with a large context the real gap is smaller than a straight comparison suggests.
Keys are created in the dashboard, and there's a free $0.50 credit for subscribing to @zukkopro: link Telegram in the dashboard and confirm the subscription.
zukko
Pay 25×
less
for Claude Code & ChatGPT
One fetch_* key and base URL api.zukko.pro — for Cursor, Claude Code, Codex, and any SDK.
Related articles
- opencode agents: setting up roles, models and toolsA custom agent in opencode is a role, a model and a set of permissions. A working config where a cheap model handles routine work and a stronger one edits code.
- OpenAI API Keys in the Open: Why You Should Not Use ThemWhere free keys on GitHub come from, why using them is dangerous for you and for the owner, and how to protect your own key from the same leak.
- GLM API Errors: Why the Request Fails and How to Fix ItA wrong model id, an overflowing 128K context, the key, the balance, limits: the typical causes of GLM API errors and a quick way to find yours.
- Plan mode in Claude Code: plan first, then edit the codeIn plan mode Claude Code reads your code and proposes a plan but edits nothing until you agree. How to enable it, use it and what it costs.