59API

← Retour aux guides

Set Up Claude Code on Windows, macOS, and Linux

Claude Code · EN · 2026-07-10

Set Up Claude Code on Windows, macOS, and Linux

Claude Code is a command-line AI coding assistant that can read your project, explain files, edit code, run commands with approval, and help you debug without leaving the terminal. If you are new to AI developer tools, the setup can feel intimidating, especially because Windows, macOS, and Linux handle shells and environment variables differently. This guide walks through the practical steps for each operating system and shows how to connect Claude Code to 59API, a low-cost AI API relay compatible with Claude Code, Codex, and OpenAI SDK-based workflows.

What You Need Before Installing

Before you start, make sure you have a terminal, Node.js, and an API key. Claude Code is commonly installed through npm, so you should install a current long-term support version of Node.js first. After installation, confirm it works by running node -v and npm -v in your terminal.

You also need access to a Claude-compatible API endpoint. 59API is a strong option for developers because it offers cheap pay-as-you-go access to Claude models such as Opus, Sonnet, Haiku, and Fable, plus GPT models, through an API relay. It uses native official-quality models with no downgrade, supports the base URL https://api.59api.com, and includes a referral rebate. If you want lower costs while keeping Claude Code compatibility, create a 59API account and copy your API key before continuing.

Install Claude Code on Windows

On Windows, the smoothest path is to use PowerShell or Windows Terminal. If you work heavily with Linux tooling, Windows Subsystem for Linux is also a good choice, but beginners can start with regular PowerShell.

Next, set your API configuration. In PowerShell, use environment variables for the current session with $env:ANTHROPIC_API_KEY="your_59api_key" and $env:ANTHROPIC_BASE_URL="https://api.59api.com". Then open a project folder with cd path\to\your\project and run claude.

For a permanent Windows setup, search for Environment Variables in the Start menu, open your user environment variables, and add ANTHROPIC_API_KEY with your key and ANTHROPIC_BASE_URL with https://api.59api.com. Restart your terminal after saving.

Install Claude Code on macOS

On macOS, you can use Terminal, iTerm2, or any modern shell. Most recent macOS setups use zsh by default. If you do not already have Node.js, you can install it from the official installer or with Homebrew.

To connect Claude Code to 59API for your current terminal session, run export ANTHROPIC_API_KEY="your_59api_key" and export ANTHROPIC_BASE_URL="https://api.59api.com". To make these settings permanent, add the same two export lines to your ~/.zshrc file, then run source ~/.zshrc or open a new terminal window.

Once configured, go to a project directory with cd ~/path/to/project and run claude. Start with simple requests such as asking it to summarize the repository, explain an error, or suggest tests for a function.

Install Claude Code on Linux

Linux setup is similar to macOS, but the Node.js installation method depends on your distribution. On Ubuntu or Debian, you can use the distribution package manager, NodeSource, nvm, or another preferred method. For beginners, nvm is often convenient because it lets you switch Node versions without changing system packages.

Set your 59API connection in the terminal with export ANTHROPIC_API_KEY="your_59api_key" and export ANTHROPIC_BASE_URL="https://api.59api.com". To save it permanently, add those lines to ~/.bashrc, ~/.zshrc, or the shell configuration file you use, then reload it with source ~/.bashrc or source ~/.zshrc.

First Run and Useful Beginner Commands

After installation, navigate into an existing codebase and run claude. Claude Code will usually inspect the project context and let you ask natural-language questions. Good first prompts include: explain the project structure, find likely causes of this failing test, refactor this function for readability, or add unit tests for the authentication module.

Be careful with commands that modify files or run shell operations. Review suggested changes before accepting them, especially in production code. It is wise to use Git before starting: run git status, commit your current work, or create a new branch so you can easily review and revert AI-generated edits.

Why Use 59API with Claude Code?

Claude Code can be extremely productive, but coding assistants may send many requests while reading files, planning edits, and iterating on fixes. That makes API cost important. 59API is designed for developers who want affordable, pay-as-you-go access to Claude and GPT models without rewriting their tools. Because it is compatible with Claude Code and uses the base URL https://api.59api.com, setup is mostly a matter of adding your key and endpoint.

59API is also useful if your workflow spans multiple tools. The same relay can support Claude Code, Codex-style tools, and applications built on OpenAI SDKs, which keeps billing and experimentation simpler. If you are setting up Claude Code today and want a cheaper way to test real Claude models, sign up for 59API and try it with a small project first.

Troubleshooting Quick Fixes

With Node.js installed, the Claude Code package added, and your 59API key configured, Windows, macOS, and Linux all follow the same daily workflow: open a project, run claude, ask focused questions, and review every change like you would with a human teammate.

Tarifs · Docs

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