Step 1: Prerequisites
Before you begin
- PyCharm 2024.3 or later installed (Community or Professional)
- Node.js 18+ installed (required by Claude Code)
- Claude Code CLI installed:
bash
npm install -g @anthropic-ai/claude-code- bsf.ai key ready → Get Key
Step 2: Install Claude Code Plugin
Install from JetBrains Marketplace
- Open PyCharm, go to
Settings(Mac:Cmd+,/ Windows:Ctrl+Alt+S) - Select
Plugins→ click theMarketplacetab - Search for "Claude Code"
- Find the official plugin by Anthropic, click
Install - Click
Restart IDEto restart PyCharm
NOTE
The plugin embeds a terminal within PyCharm to run the Claude Code CLI, so the CLI must be installed first.
Step 3: Configure the bsf.ai Gateway
Option 1: Claude Code config file (Recommended)
Edit ~/.claude/settings.json (Windows: C:\Users\YourUsername\.claude\settings.json):
json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your_bsf_ai_key",
"ANTHROPIC_BASE_URL": "https://api.bsf.ai",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1
},
"permissions": {
"allow": [],
"deny": []
}
}Option 2: System environment variables
macOS / Linux:
bash
echo 'export ANTHROPIC_BASE_URL="https://api.bsf.ai"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="your_api_key"' >> ~/.zshrc
source ~/.zshrcWindows PowerShell:
powershell
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.bsf.ai", "User")
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "your_api_key", "User")Restart PyCharm after setting environment variables.
Step 4: Start Using
Open the Claude Code panel
- After restarting PyCharm, you'll see a "Claude Code" tab in the bottom tool bar
- Click it to open the Claude Code terminal panel
- It will automatically run the
claudecommand and connect to bsf.ai
Common operations
- Chat: Type your questions or requests directly in the panel
- Reference files: Use
@filenameto reference project files - Clear context: Type
/clearto start a fresh conversation and save tokens - Get help: Type
/helpto see all available commands
FAQ
Issue: Claude Code tab not visible
- Confirm the plugin is installed and enabled:
Settings→Plugins→Installed→ search Claude Code - Try opening via menu:
View→Tool Windows→Claude Code - Check that your PyCharm version is >= 2024.3
Issue: claude command not found
Make sure Claude Code CLI is globally installed and in your PATH:
bash
which claude # macOS/Linux
where claude # WindowsIf not found, reinstall:
bash
npm install -g @anthropic-ai/claude-codeIssue: Connection timeout or errors
- Verify environment variables are set correctly (restart PyCharm after changes)
- Test in PyCharm's terminal:
bash
echo $ANTHROPIC_BASE_URL
# Should output https://api.bsf.ai- Check if your API key is valid → Console