Claude Code Setup Guide
Claude Code Setup Guide: CLI, VS Code, and JetBrains
Claude Code is Anthropic's official agentic coding assistant that runs directly in your terminal and integrates with popular IDEs. It can edit files, run commands, search codebases, and manage git workflows autonomously. This guide covers complete setup for the CLI, Visual Studio Code, and JetBrains IDEs.
Prerequisites
- Node.js 18+ — Required for the CLI runtime. Check with
node --version. - An API key — Either a direct Anthropic key (
sk-ant-) or a relay key from claude4u.com (cr_). - Git — Claude Code works best within git repositories for safe code changes.
Installing Claude Code CLI
Install Claude Code globally using npm:
# Install globally
npm install -g @anthropic-ai/claude-code
# Verify installation
claude --version
Configuring the API Connection
For direct Anthropic access, set your API key:
export ANTHROPIC_API_KEY="sk-ant-your-key-here"
To use a relay service like claude4u.com for better availability and cost management:
export ANTHROPIC_BASE_URL="https://claude4u.com/antigravity"
export ANTHROPIC_API_KEY="cr_your_relay_key_here"
~/.zshrc or ~/.bashrc so they persist across terminal sessions. Using a relay service like claude4u.com gives you automatic failover and multi-account load balancing.
First Run
Navigate to any project directory and launch Claude Code:
cd /path/to/your/project
claude
Claude Code will analyze your project structure, read any CLAUDE.md instructions, and present an interactive prompt. Try a simple command to verify everything works:
# Inside Claude Code, type:
> Explain the project structure
VS Code Extension Setup
Claude Code integrates directly with Visual Studio Code through an official extension:
- Open VS Code and go to the Extensions panel (
Cmd+Shift+Xon macOS,Ctrl+Shift+Xon Linux/Windows). - Search for "Claude Code" and install the extension by Anthropic.
- Open VS Code settings (
Cmd+,) and search for "claude". - Set the API key and base URL if using a relay service.
- Restart VS Code to apply the changes.
Alternatively, configure via VS Code settings JSON:
{
"claude-code.apiKey": "cr_your_relay_key_here",
"claude-code.baseUrl": "https://claude4u.com/antigravity"
}
Access Claude Code in VS Code by pressing Cmd+Shift+P (or Ctrl+Shift+P) and typing "Claude Code" to see available commands.
JetBrains IDE Setup
Claude Code supports JetBrains IDEs including IntelliJ IDEA, PyCharm, WebStorm, and GoLand:
- Open your JetBrains IDE and navigate to Settings > Plugins.
- Search the Marketplace for "Claude Code" and install the plugin.
- Restart the IDE when prompted.
- Go to Settings > Tools > Claude Code.
- Enter your API key and set the base URL to
https://claude4u.com/antigravityif using a relay.
The Claude Code panel will appear in your IDE's tool window. You can open it with the keyboard shortcut shown in the Tools menu.
Useful CLI Flags
# Start with a specific prompt
claude "fix the failing tests in src/auth"
# Print output to stdout (non-interactive mode)
claude -p "explain this function" --file src/utils/parser.js
# Resume the most recent conversation
claude --continue
# Use a specific model
claude --model claude-sonnet-4-20250514
# Allow specific tools without prompting
claude --allowedTools "Bash(npm test)" "Edit"
Creating a CLAUDE.md File
A CLAUDE.md file in your project root provides persistent instructions to Claude Code. This is essential for maintaining consistent behavior across sessions:
# CLAUDE.md
## Project Overview
Node.js REST API using Express and PostgreSQL.
## Development Commands
- `npm run dev` — Start dev server
- `npm test` — Run test suite
- `npm run lint` — Check code style
## Code Style
- Use TypeScript strict mode
- Prefer async/await over callbacks
- Write Jest tests for all new functions
Verifying Your Setup
Run through this checklist to confirm everything is working:
- Open a terminal and run
claude --versionto confirm installation. - Run
echo $ANTHROPIC_BASE_URLto verify the relay URL is set. - Navigate to a git repository and run
claudeto start a session. - Ask Claude to make a small change and verify it edits the correct file.
- In VS Code or JetBrains, open the Claude Code panel and send a test message.
Troubleshooting
- "API key not found" — Ensure
ANTHROPIC_API_KEYis exported in your current shell session. - Connection timeout — Check your network connection and verify the base URL is correct.
- "Model not available" — Verify your API key has access to the requested model.
- Slow responses — Try switching to Claude Sonnet for faster responses on routine tasks.
With Claude Code configured, you now have a powerful AI coding assistant ready to help with code generation, debugging, refactoring, and more. See our tips and tricks guide for advanced productivity techniques.
Get Started with 轻舟 AI
Stable, fast AI API relay — supports Claude, OpenAI, Gemini and more
Sign Up Free
轻舟 AI