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 · 7 September 2026 · 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:

bash
curl -fsSL https://claude.ai/install.sh | bash
claude --version

Windows, PowerShell:

bash
irm https://claude.ai/install.ps1 | iex

After 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:

bash
npm install -g @anthropic-ai/claude-code

This 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.

bash
{
  "$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",
    "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: put a cheaper model on the Sonnet slot and switch to Opus deliberately, when the task is genuinely hard. Over a month the difference in the bill is several-fold.

Step 4. Run it

bash
claude

The 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:

bash
export ANTHROPIC_BASE_URL="https://api.zukko.pro"
export ANTHROPIC_AUTH_TOKEN="fetch_your_key"
claude

The 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 costs $0.30 per million against Anthropic's $5.

Keys are created in the dashboard, and the starting dollar is credited on first sign-in to @zukkopro_bot — enough for several real sessions.

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.

Get API keyDocumentation

api.zukko.pro · fetch_*

Claude Code setup from scratch: full guide · Zukko