Platform

Products

Private AI infrastructure — from compute to agents.

Target groups

Use Cases

For enterprise, SMBs, and individual developers.

Knowledge & Support

Resources

Everything you need to succeed with Mycelis.

Integration · 4 min min read

Use Claude Code with the Mycelis API Gateway

Claude Code is Anthropic's official CLI for AI-assisted software engineering. By pointing it at your Mycelis workspace endpoint you get:

  • Your own model selection — use any model available in your workspace, not just Claude
  • Centralized usage tracking — see token consumption per team member in the Mycelis dashboard
  • Team policy enforcement — rate limits, budget caps, and routing rules apply automatically

Prerequisites

  • A Mycelis account with a workspace
  • At least one commercial deployment (Anthropic via Managed Keys or BYOK) configured in your workspace
  • An Agent created in your workspace (the agent slug is used as the model identifier)
  • Claude Code installed: npm install -g @anthropic-ai/claude-code

Step 1 — Create a PAT (Personal Access Token)

In the Mycelis dashboard, navigate to Workspace Settings → API Keys and create a new Personal Access Token. Copy it — you'll use it as the API key.

Step 2 — Find your agent slug

Go to Agents in your workspace sidebar and click the agent you want to use with Claude Code. Copy the Slug shown in the agent detail view (e.g. my-coding-agent).

Step 3 — Set environment variables

Set the following two environment variables in your shell profile (~/.zshrc, ~/.bashrc, or equivalent):

export ANTHROPIC_BASE_URL="https://mycelis.ai/api/proxy/v1"
export ANTHROPIC_API_KEY="your-mycelis-pat-key"

Reload your shell:

source ~/.zshrc

Step 4 — Start Claude Code with your agent

Claude Code uses the CLAUDE_MODEL environment variable (or --model flag) to select which model to call. Pass your agent slug here:

CLAUDE_MODEL="my-coding-agent" claude

Or set it permanently in your shell profile:

export CLAUDE_MODEL="my-coding-agent"

Then simply run:

claude

Claude Code now routes all requests through Mycelis. Every call is logged in your workspace dashboard under Usage.

Verifying the setup

Send a quick test prompt to confirm routing is working:

claude -p "Say hello and confirm which model you are."

You should see a response from the model configured in your Mycelis agent. Check the dashboard to confirm the request appears in your usage logs.

Tips

  • Switch models without changing code — update the model in your agent configuration and all Claude Code sessions immediately pick it up, no env-var change needed.
  • Per-project configurations — create a .env file in your project root with CLAUDE_MODEL=project-specific-agent and use direnv to load it automatically.
  • Budget limits — set a monthly spending cap on the workspace to prevent runaway usage from long coding sessions.