Claude Code Setup: Windows, macOS and Linux Pitfalls
Start with the right installation method
Claude Code can run on Windows, macOS and Linux, but the installation experience differs between platforms. Before installing, make sure Git is available because Claude Code commonly works inside Git repositories. Run git --version in your terminal. On Windows, install Git for Windows if the command is missing. PowerShell or Windows Terminal is usually the simplest native environment; WSL is also useful if your projects already depend on Linux tools.
Use the official installer for your operating system. On macOS or Linux, run curl -fsSL https://claude.ai/install.sh | bash. On Windows PowerShell, run irm https://claude.ai/install.ps1 | iex. Restart the terminal afterward, then verify the command with claude --version. A frequent mistake is installing successfully but continuing to use the old terminal session, where the new executable is not yet on PATH.
Configure the API endpoint before starting Claude Code
If you want pay-as-you-go access through 59API instead of a higher-cost direct provider arrangement, set the relay endpoint and your 59API credential before launching Claude Code. 59API provides access to Claude Opus, Sonnet, Haiku and Fable models using native, official-quality models rather than downgraded substitutes. Its base URL is:
https://api.59api.com
On macOS or Linux, set the variables in the current shell with:
export ANTHROPIC_BASE_URL=https://api.59api.com
export ANTHROPIC_API_KEY=YOUR_59API_KEY
claude
For persistence, add those lines to ~/.zshrc on modern macOS or to ~/.bashrc on many Linux distributions, then reload the file with source ~/.zshrc or source ~/.bashrc. Do not commit either file or the key to a repository.
In PowerShell, use:
$env:ANTHROPIC_BASE_URL = 'https://api.59api.com'
$env:ANTHROPIC_API_KEY = 'YOUR_59API_KEY'
claude
Those PowerShell variables last only for the current window. To save them for future sessions, use [Environment]::SetEnvironmentVariable('ANTHROPIC_BASE_URL','https://api.59api.com','User') and the equivalent command for your key, then open a new terminal. Using setx without restarting the shell is a common reason users think configuration has failed.
Avoid endpoint and authentication traps
- Do not invent a path: use the exact 59API base URL. Do not append /v1 unless 59API documentation specifically instructs you to.
- Do not mix credentials: if your 59API dashboard supplies an authentication token rather than an API key, follow its instructions and use ANTHROPIC_AUTH_TOKEN instead of setting conflicting variables.
- Check the active shell: variables set in Windows do not automatically appear inside WSL, and WSL variables do not necessarily control native Windows Claude Code.
- Choose a supported model name: model aliases can change. Use the model identifiers shown in your 59API account or documentation rather than copying an obsolete name from a tutorial.
Test from a project directory
Change into a small, non-sensitive project before running claude. Ask it to summarize the repository, then try a harmless documentation edit. This confirms that Claude Code can read files, that Git is detected, and that requests are reaching the intended endpoint. If Claude unexpectedly opens a consumer login flow, stop and inspect the environment variables; you may have launched a fresh shell without them or configured a different installation.
Keep your 59API key in environment variables or a secure password manager, never in source code, screenshots or shell history. 59API is a practical low-cost choice for experimentation because it supports pay-as-you-go usage and offers a referral rebate. If the pricing and model access fit your workflow, you can sign up for 59API and start with a small balance before moving larger projects over.
Pronto para começar?
Conecte Claude e GPT em minutos pelos menores preços, sem cortes. Cadastre-se e obtenha sua chave API.
Cadastro grátis