[FEATURE] VS Code Extension: Support for Custom API Endpoints and Authentication (settings.json parity)

Resolved 💬 2 comments Opened Oct 2, 2025 by karlAlnebratt Closed Oct 2, 2025

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

The Problem

The Claude Code VS Code extension currently doesn't support custom API endpoints or authentication configurations that are available in the CLI version via ~/.claude/settings.json. This prevents enterprise users from using the VS Code extension with:

  • Custom API gateways (LiteLLM, internal proxies, etc.)
  • Custom authentication headers for enterprise SSO/authentication
  • Dynamic token generation via apiKeyHelper commands
  • Self-hosted or regional deployments requiring custom base URLs

Our organization uses a LiteLLM gateway with gcloud service account authentication, which works perfectly with the CLI but completely blocks VS Code extension usage.

Current State

CLI (works):

{
  "apiKeyHelper": "bash -c 'echo $(gcloud auth print-identity-token --impersonate-service-account=...)'",
  "env": {
    "ANTHROPIC_BASE_URL": "https://llm-gateway.my-company.dev",
    "CLAUDE_CODE_API_KEY_HELPER_TTL_MS": "3600000",
    "ANTHROPIC_CUSTOM_HEADERS": "X-Litellm-Key: Bearer ..."
  }
}

VS Code Extension (doesn't work):

  • Only supports standard Anthropic authentication
  • No way to configure custom endpoints
  • No support for dynamic token generation
  • Completely blocked from using the extension

Impact

This creates a fragmented experience where enterprise users can only use the CLI, missing out on the VS Code integration benefits like inline suggestions, better UI, and IDE integration.

Proposed Solution

Add support in the VS Code extension to read and respect the same ~/.claude/settings.json configuration file that the CLI uses, achieving feature parity.

Configuration Support Needed

  1. ANTHROPIC_BASE_URL - Custom API endpoint
  2. ANTHROPIC_CUSTOM_HEADERS - Custom authentication headers
  3. apiKeyHelper - Command to generate dynamic API keys/tokens
  4. CLAUDE_CODE_API_KEY_HELPER_TTL_MS - Token refresh interval

Ideal User Experience

  1. User configures ~/.claude/settings.json once (same file for both CLI and VS Code)
  2. VS Code extension automatically reads this configuration on startup
  3. Extension uses custom endpoint + authentication seamlessly
  4. Token refresh happens automatically based on TTL
  5. No duplicate configuration needed

UI/UX Considerations

  • Settings location: Read from ~/.claude/settings.json (same as CLI)
  • Fallback behavior: If no custom config, use standard Anthropic auth (current behavior)
  • Status indication: Show in VS Code status bar which endpoint is being used
  • Error handling: Clear error messages if custom endpoint fails
  • Token refresh: Handle token expiration gracefully with automatic renewal

Example Flow

User opens VS Code
  ↓
Extension reads ~/.claude/settings.json
  ↓
Finds custom ANTHROPIC_BASE_URL
  ↓
Executes apiKeyHelper command to get token
  ↓
Makes requests to custom endpoint with custom headers
  ↓
Auto-refreshes token every CLAUDE_CODE_API_KEY_HELPER_TTL_MS

Alternative Solutions

Current Workaround: CLI Only

Currently, we're forced to use only the Claude Code CLI instead of the VS Code extension. This works but has significant limitations:

  • No inline code suggestions in the editor
  • Less integrated IDE experience
  • Have to switch between terminal and editor constantly
  • Missing VS Code-specific features and UI improvements

Alternatives Considered

1. VS Code Extension Settings (Doesn't Exist)

Tried looking for VS Code-specific settings to configure custom endpoints, but the extension doesn't expose any such configuration options.

2. Environment Variables

Attempted setting ANTHROPIC_BASE_URL and other env vars before launching VS Code:

export ANTHROPIC_BASE_URL=https://llm-gateway.my-company.dev
code .

Result: Extension doesn't respect these environment variables.

3. Direct Anthropic API Key

Could bypass the gateway and use direct Anthropic API keys, but this:

  • Violates corporate security policies
  • Bypasses usage tracking and cost allocation
  • Loses centralized authentication management
  • Not a sustainable solution for enterprise deployments

4. Proxy Configuration

Considered using system-level HTTP proxies, but:

  • Doesn't solve authentication header injection
  • Can't handle dynamic token generation
  • Too invasive for just one application

Why These Don't Work

None of these alternatives address the core issue: the VS Code extension simply doesn't have the capability to use custom endpoints and authentication, features that already exist and work perfectly in the CLI version.

Priority

Medium - Would be very helpful

Feature Category

Developer tools/SDK

Use Case Example

Enterprise Developer Scenario

Context: I'm a developer at my company, we use a centralized LiteLLM gateway for all AI services to ensure:

  • Centralized cost tracking and billing
  • Usage analytics and monitoring
  • Service account-based authentication via Google Cloud

Current Workflow (Broken with VS Code Extension)

  1. VS Code Extension: Login prompt appears - asks for Anthropic API key
  2. Workaround: Use Claude CLI instead of the VS Code extension

Desired Workflow (With This Feature)

  1. One-time setup: Configure ~/.claude/settings.json with gateway details
  2. Extension: Auto-reads settings, executes gcloud token helper, connects to gateway
  3. Status bar: Shows "Connected to llm-gateway.my-company.dev"
  4. Work: Use Claude seamlessly with all VS Code features
  5. Token refresh: Happens automatically every hour (TTL configured)

Additional Context

_No response_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗