Skip to main content

Claude Code — IDE Integration

Claude Code is Anthropic’s agentic coding assistant. By pointing it at SecureAI’s Anthropic-compatible proxy, every prompt your developers send passes through SMLTP, DLP, PII scanning, Prompt Shield, rate limiting, and model governance — without any changes to the developer’s workflow.

How it works

SecureAI exposes an Anthropic Messages API-compatible endpoint at:
Claude Code natively supports redirecting all traffic to a custom base URL via the ANTHROPIC_BASE_URL environment variable. When configured, it speaks its native Anthropic protocol directly to SecureAI — no local proxy or wrapper script required.
All activity appears in the SecureAI admin dashboard under AI Gateway → Audit Logs, attributed to the developer’s API key.

Step 1 — Install Claude Code


Step 2 — Generate an API key

  1. Go to Admin → API Keys (https://<your-host>/admin/apis)
  2. Click Create API Key
  3. Set a name (e.g. claude-code-dev-jane)
  4. Configure:
    • Allowed models — select which LLMs the key can use (see available models)
    • SMLTP policy — select the compliance policy (internal, confidential, hipaa, etc.)
    • Rate limits as required
  5. Copy the sk-… value — it is shown only once

Step 3 — Configure Claude Code

The recommended approach is to add the settings to the project-level local settings file (.claude/settings.local.json), which is git-ignored by default.
.claude/settings.local.json
ANTHROPIC_API_KEY must be explicitly set to an empty string to prevent Claude Code from trying to authenticate directly with Anthropic.
Shell profile (alternative)You can also add the variables to ~/.zshrc, ~/.bashrc, or your PowerShell $PROFILE instead of the settings file. The settings file is preferred for team projects so every developer inherits the same configuration automatically.

Step 4 — Verify the connection

Start Claude Code from your project directory:
Run /status inside the session. You should see:
That confirms all traffic is routing through SecureAI.

Available models

SecureAI exposes the same model catalog available in the chat interface. Use any id value from the table below in the env vars above.

Anthropic (Claude)

OpenAI

Google (Gemini)

Meta (Llama)

Mistral

DeepSeek

xAI (Grok)

Qwen

Self-Hosted (Remote SMLTP Endpoints)

Self-hosted models registered as active remote SMLTP endpoints are automatically available. Their IDs follow the pattern self-hosted/<model-name>. Run /status in Claude Code or call GET /api/claude-code/v1/models to see the live list.

Claude Code model roles

Claude Code uses different models for different internal tasks. Map each role to any model from the catalog above: You can mix providers freely. For example, use Gemini for fast/cheap sub-tasks and Claude for the main reasoning loop:

Security enforcement

Every request through the proxy is subject to the full SecureAI security stack: The SMLTP policy is inherited from the API key configuration. To change the policy for a key, go to Admin → API Keys, edit the key, and select a different SMLTP Policy.

Troubleshooting

/status still shows api.anthropic.com

Claude Code has cached credentials from a previous login. Run /logout inside a Claude Code session, then restart:

401 Unauthorized

  • Verify the sk-… key is active in Admin → API Keys
  • Check that ANTHROPIC_API_KEY is set to an empty string ("")

Model not available

  • Check the API key’s Allowed Models list in Admin → API Keys
  • Call GET /api/claude-code/v1/models (with your Bearer sk-… token) to see exactly what the key can access

DLP / PII block

If a prompt is blocked, Claude Code will receive an error response with a message explaining the violation. The incident is logged in Admin → Incidents and visible in AI Gateway → Audit Logs.