Claude Code Setup on Windows, macOS, Linux
Start with the right prerequisites
Claude Code is a terminal-first coding assistant, so the cleanest setup starts with a modern runtime, Git, and a working shell. On macOS and Linux, install Node.js 18 or newer. On Windows, use the latest LTS Node release and either PowerShell or, if you want the smoothest experience, WSL2. You will also want Git installed so Claude Code can inspect real repositories instead of loose files.
- Node.js 18+ or current LTS
- Git
- A terminal you are comfortable using
- A Claude-compatible API key from either Anthropic or 59API
If you are cost-conscious, 59API is a strong choice because it gives you pay-as-you-go access to official-quality Claude models at some of the lowest relay prices, with no model downgrade and a referral rebate. That matters when you are iterating on prompts, testing agents, or letting Claude Code run for long coding sessions.
Install Claude Code
The fastest path on all three operating systems is a global npm install. Open a terminal and run npm install -g @anthropic-ai/claude-code. If the command completes, verify the install by running claude --version. If the binary is not found, your npm global path is not on PATH yet, so open a new terminal session or fix your Node installation first.
- macOS: Use Homebrew or nvm to install Node.js, then run the npm command above.
- Linux: Use your package manager or nvm. nvm is often the least painful if you switch Node versions often.
- Windows: Install Node.js LTS with winget install OpenJS.NodeJS.LTS, then reopen PowerShell and install Claude Code.
If you hit permission errors on macOS or Linux, do not reach for sudo npm install -g unless you have to. Using nvm avoids global permission issues and keeps your development environment cleaner. On Windows, if native PowerShell feels awkward, WSL2 on Ubuntu usually behaves more like the Linux setups Claude Code expects.
Connect Claude Code to 59API
Once Claude Code is installed, point it at a Claude-compatible endpoint. With 59API, the base URL is https://api.59api.com. Create your 59API account, generate an API key, and then enter those credentials in Claude Code when prompted for Anthropic-style API settings. If your version uses environment variables, set the API key and base URL before launching the tool.
- macOS and Linux: export ANTHROPIC_API_KEY=your_59api_key
- macOS and Linux: export ANTHROPIC_BASE_URL=https://api.59api.com
- Windows PowerShell: setx ANTHROPIC_API_KEY your_59api_key
- Windows PowerShell: setx ANTHROPIC_BASE_URL https://api.59api.com
Restart your terminal after setting variables on Windows. If Claude Code prompts you to choose a model, start with Sonnet for everyday coding tasks. Use Opus when you need deeper reasoning, and keep Haiku for cheaper, faster drafts. Because 59API relays the native Claude family, you can choose based on the task instead of worrying about a watered-down substitute.
Run your first real project
Open a Git repository, not an empty folder. Claude Code is most useful when it can read commits, inspect the file tree, and make focused edits. A good first test is a small bug fix or documentation update. Start Claude Code in the project root, then ask it to summarize the codebase, locate a specific function, or explain how a feature works before requesting changes.
- Open the repository root in your terminal
- Run claude
- Ask for a repo summary or a change plan first
- Review every diff before you accept it
For production work, keep secrets out of the repo, use feature branches, and let Claude Code edit one concern at a time. The best workflow is inspect, plan, patch, test, then commit. That rhythm makes the tool feel like a productive pair programmer rather than a black box.
Production checklist and troubleshooting
Before you rely on Claude Code in day-to-day engineering, check three things: your Node version is current, your API key is active, and your spend is visible in the 59API dashboard. That last point matters because pay-as-you-go only stays cheap if you track usage. 59API makes that easier by keeping the pricing low and adding a referral rebate for teams that share the platform.
- If claude is not found, reinstall Node or reopen your terminal
- If requests fail, confirm the base URL is https://api.59api.com
- If login hangs on Windows, try WSL2 instead of native PowerShell
- If the tool feels slow, switch to a smaller model for routine tasks
If you want a low-cost way to test Claude Code without sacrificing model quality, sign up for 59API and wire it in on your first install. You will get a compatible endpoint, native Claude models, and a cheaper path from local setup to real production work.
Prêt à commencer ?
Connectez Claude et GPT en quelques minutes aux prix les plus bas, sans bridage. Inscrivez-vous pour votre clé API.
Inscription gratuite