Skip to content

Step 1: Prerequisites

Before you begin

  1. PyCharm 2024.3 or later installed (Community or Professional)
  2. Node.js 18+ installed (required by Claude Code)
  3. Claude Code CLI installed:
bash
npm install -g @anthropic-ai/claude-code
  1. bsf.ai key ready → Get Key

Step 2: Install Claude Code Plugin

Install from JetBrains Marketplace

  1. Open PyCharm, go to Settings (Mac: Cmd+, / Windows: Ctrl+Alt+S)
  2. Select Plugins → click the Marketplace tab
  3. Search for "Claude Code"
  4. Find the official plugin by Anthropic, click Install
  5. Click Restart IDE to 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 ~/.zshrc

Windows 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

  1. After restarting PyCharm, you'll see a "Claude Code" tab in the bottom tool bar
  2. Click it to open the Claude Code terminal panel
  3. It will automatically run the claude command and connect to bsf.ai

Common operations

  • Chat: Type your questions or requests directly in the panel
  • Reference files: Use @filename to reference project files
  • Clear context: Type /clear to start a fresh conversation and save tokens
  • Get help: Type /help to see all available commands

FAQ

Issue: Claude Code tab not visible
  1. Confirm the plugin is installed and enabled: SettingsPluginsInstalled → search Claude Code
  2. Try opening via menu: ViewTool WindowsClaude Code
  3. 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    # Windows

If not found, reinstall:

bash
npm install -g @anthropic-ai/claude-code
Issue: Connection timeout or errors
  1. Verify environment variables are set correctly (restart PyCharm after changes)
  2. Test in PyCharm's terminal:
bash
echo $ANTHROPIC_BASE_URL
# Should output https://api.bsf.ai
  1. Check if your API key is valid → Console