Claude Code
Install Claude Code on Windows or macOS, configure the API endpoint and key with one command or manually, and start a conversation.
Follow the Windows or macOS steps to install, configure, and start using Claude Code.
Windows
1. Install
Find PowerShell in the Start menu, open it, paste the installation command, and press Enter:
winget install --id Anthropic.ClaudeCode --exactAfter installation, close and reopen PowerShell and check the version:
claude --versionContinue when a version number appears. See the official installation guide for other installation methods.
2. Configure
Prepare an API Key.
Copy the command below into PowerShell and press Enter. The script backs up your configuration before updating the endpoint and authentication. You enter your API key only on your computer.
& ([scriptblock]::Create((Invoke-RestMethod -Uri 'https://get-apikey.com/docs/setup/claude-code?platform=powershell&action=configure&lang=en' -ErrorAction Stop)))Paste the command into your terminal, press Enter, then paste your API key. Key input stays hidden; press Enter after pasting.
Changes the API endpoint and authentication, keeping your model settings.
Restore previous configuration
Restores fields changed by this script, keeping values you edited afterward. Other settings and sessions are preserved.
& ([scriptblock]::Create((Invoke-RestMethod -Uri 'https://get-apikey.com/docs/setup/claude-code?platform=powershell&action=restore&lang=en' -ErrorAction Stop)))After “Configuration saved” appears, continue to “Use” below. You can also configure the file manually as follows.
The configuration file is %USERPROFILE%\.claude\settings.json:
- Press
Win + Eto open File Explorer. - Enter
%USERPROFILE%\.claudein the address bar and press Enter. - Right-click
settings.jsonand choose Open with → Notepad, or use VS Code. - If the folder is missing, create
.claudeinside%USERPROFILE%. If the file is missing, create it in Notepad.
Enter the following configuration:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.get-apikey.com",
"ANTHROPIC_AUTH_TOKEN": "your-api-key"
}
}Replace your-api-key with your API Key. Use the address shown, without a trailing /v1.
Press Ctrl + S to save. For a new file, use Save As, choose the .claude folder, name the file settings.json, and select All files and UTF-8. Show file extensions in File Explorer and check that the filename is not settings.json.txt.
For an existing file, make a backup and merge the fields into the same env object, keeping other settings. Use straight double quotes and no trailing comma after the last JSON entry.
3. Use
- Open your project folder in File Explorer.
- Type
powershellin the address bar and press Enter to open a terminal in that folder. - Run:
claudeConfirm the project prompts, then run /status. Check that the endpoint is https://api.get-apikey.com and the credential source is ANTHROPIC_AUTH_TOKEN. Send Reply only OK. Once you receive a reply, describe a coding task in the same input box. After editing the configuration, exit and restart Claude Code.
macOS
1. Install
Press Command + Space to find and open Terminal. Paste the installation command and press Enter:
curl -fsSL https://claude.ai/install.sh | bashAfter installation, close and reopen Terminal and check the version:
claude --versionContinue when a version number appears. See the official installation guide for other installation methods.
2. Configure
Prepare an API Key.
Copy the command below into Terminal and press Enter. The script backs up your configuration before updating the endpoint and authentication. You enter your API key only on your computer.
bash -c 'script=$(curl -fsSL "https://get-apikey.com/docs/setup/claude-code?platform=bash&action=configure&lang=en") && bash -c "$script"'Paste the command into your terminal, press Enter, then paste your API key. Key input stays hidden; press Enter after pasting.
Changes the API endpoint and authentication, keeping your model settings.
Restore previous configuration
Restores fields changed by this script, keeping values you edited afterward. Other settings and sessions are preserved.
bash -c 'script=$(curl -fsSL "https://get-apikey.com/docs/setup/claude-code?platform=bash&action=restore&lang=en") && bash -c "$script"'After “Configuration saved” appears, continue to “Use” below. You can also configure the file manually as follows.
The configuration file is ~/.claude/settings.json:
- Open Finder and press
Command + Shift + G. - Enter
~/.claudeand select Go. - Open
settings.jsonin TextEdit or VS Code. PressCommand + Shift + .to show hidden files if needed. - If the folder or file is missing, open VS Code, choose File → Open Folder, press
Command + Shift + G, and enter~to open your home directory. In the Explorer sidebar, create a.claudefolder and asettings.jsonfile inside it.
Enter the following configuration:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.get-apikey.com",
"ANTHROPIC_AUTH_TOKEN": "your-api-key"
}
}Replace your-api-key with your API Key. Use the address shown, without a trailing /v1.
Press Command + S to save. In TextEdit, choose Format → Make Plain Text and keep the filename settings.json.
For an existing file, make a backup and merge the fields into the same env object, keeping other settings. Use straight double quotes and no trailing comma after the last JSON entry.
3. Use
- Open Terminal and type
cdwith a trailing space. - Drag your project folder from Finder into the terminal and press Enter to enter that project.
- Run:
claudeConfirm the project prompts, then run /status. Check that the endpoint is https://api.get-apikey.com and the credential source is ANTHROPIC_AUTH_TOKEN. Send Reply only OK. Once you receive a reply, describe a coding task in the same input box. After editing the configuration, exit and restart Claude Code.
On Linux, use the same installation command and configuration, with the file at ~/.claude/settings.json. One-command setup requires Bash, curl, and Python 3. Without Python 3, use the manual steps above.
Use in VS Code
Install the official VS Code Claude Code extension to enter tasks in the sidebar. Configure gateway authentication as described on the extension page; CLI settings alone do not guarantee that the extension passes its login check.
What the script changes
The script merges the env fields in settings.json, preserving other settings and sessions. It sets ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, and clears the conflicting ANTHROPIC_API_KEY. It changes the default model, Opus / Sonnet / Haiku / Fable tiers, and subagent model only when you select a model.
The original file is backed up to settings.json.getrun-*.bak in the same directory. getrun-setup-state.json records the fields needed for restoration. These files can contain keys; keep them on your own computer. Expand “Restore previous configuration” in the command panel, then copy and run the restore command. Fields you edited afterward are kept and listed by name in the terminal.
If your existing model is absent from the model catalog, select an available model and run setup again. Project and managed settings can override user settings; use /status to check what loaded when an endpoint or model differs from your selection.
Common problems
| Symptom | Check first |
|---|---|
| 401 or repeated login prompts | Key, address, and conflicting authentication variables |
| Command not found | Reopen the terminal and run claude --version |
| Old sessions missing | Original project, user, and CLAUDE_CONFIG_DIR; do not clear .claude |
If CLAUDE_CONFIG_DIR is set, edit settings.json in that directory. This configuration uses ANTHROPIC_AUTH_TOKEN; if env also contains ANTHROPIC_API_KEY, back up the file and remove that field to avoid conflicting credentials.
If the script reports invalid JSON, fix the original file and retry; do not delete .claude. If another cloud provider is enabled, review CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEX, and CLAUDE_CODE_USE_FOUNDRY. The script does not change these provider settings.
Configuration reference: official Claude Code gateway documentation. For the graphical desktop app, see Claude Desktop.