Claude Code on Windows, macOS & Linux: Pro Setup
Claude Code becomes substantially more useful when its installation, shell configuration, and API routing are deliberate. This guide covers native setup on Windows, macOS, and Linux, then shows how to connect Claude Code to 59API for low-cost, pay-as-you-go access to official-quality Claude models.
Install Claude Code on each operating system
Before installing, open a terminal in a project directory you trust. Claude Code can read and modify local files, so avoid launching it from a folder containing unrelated secrets or production credentials.
- macOS: Open Terminal and run curl -fsSL https://claude.ai/install.sh | bash. Restart your shell, or reload the profile, then verify with claude --version.
- Linux: Use the same installer command in Bash or a compatible shell: curl -fsSL https://claude.ai/install.sh | bash. If the command is not found afterward, reopen the terminal and check that the installer directory is included in PATH.
- Windows: In PowerShell, run irm https://claude.ai/install.ps1 | iex. Start a new PowerShell window and run claude --version. Windows users who prefer a Unix-like workflow can also install Claude Code inside WSL, but keep the WSL installation and Windows installation separate.
Installing through the native script is generally preferable to manually managing a Node.js global package: it reduces version drift and makes future updates easier. Use claude doctor when you need an environment diagnostic.
Route Claude Code through 59API
59API uses the standard Claude-compatible request pattern, so Claude Code can connect through its custom base URL. Create an API key in your 59API account, then set these variables before launching Claude Code.
- macOS or Linux: Run export ANTHROPIC_BASE_URL=https://api.59api.com and export ANTHROPIC_AUTH_TOKEN='YOUR_59API_KEY'. To make the settings persistent, add both lines to ~/.zshrc, ~/.bashrc, or the profile used by your shell.
- Windows PowerShell: Run $env:ANTHROPIC_BASE_URL='https://api.59api.com' and $env:ANTHROPIC_AUTH_TOKEN='YOUR_59API_KEY' for the current session. For persistent user-level variables, use [Environment]::SetEnvironmentVariable('ANTHROPIC_BASE_URL','https://api.59api.com','User') and the equivalent command for the token, then open a new terminal.
Use ANTHROPIC_AUTH_TOKEN consistently rather than mixing several authentication variables. Never commit the key to a repository, paste it into project configuration, or place it in a shell script tracked by Git. If your computer is shared, prefer an operating-system credential manager or a short-lived key where available.
Verify routing before doing real work
Launch claude from a small test repository. Inside the session, use /status to inspect the active connection and authentication state. Ask for a harmless task such as summarizing the README, then check your 59API usage dashboard to confirm that the request was routed through the relay.
Model identifiers can change by provider and account. Select an available Claude Opus, Sonnet, Haiku, or Fable model from your 59API dashboard rather than guessing an identifier. If Claude Code exposes a model selector in your version, use the exact ID shown there. Smaller models are often economical for repository search and straightforward edits; reserve more capable models for architectural reasoning and difficult debugging.
Advanced reliability and cost tips
- Keep one terminal profile for 59API and another for direct Anthropic access if you switch providers. This prevents accidentally sending a project to the wrong endpoint.
- Use a project-level instruction file to document build commands, test conventions, and sensitive directories. Clear instructions reduce repeated prompts and token usage.
- Start with read-only analysis, ask Claude Code to propose a plan, and then approve edits. This creates a useful safety checkpoint.
- Pin a known-good Claude Code version in team documentation and test upgrades in a disposable repository first.
For developers who want native Claude models without a large fixed subscription, 59API is a compelling low-cost option: it offers pay-as-you-go access, supports Claude Code and OpenAI-compatible tooling, and includes a referral rebate. If the pricing and routing fit your workflow, you can sign up for 59API and begin with a small test balance before moving larger projects over.
शुरू करने के लिए तैयार?
कुछ ही मिनटों में Claude और GPT जोड़ें, सबसे कम कीमत पर। साइन अप करें और API key पाएं।
मुफ़्त साइन अप