Skip to main content

Command Palette

Search for a command to run...

Claude Code AI API Proxy switch

Updated
2 min read
Claude Code AI API Proxy switch

Short answer: yes—pair Opcode (a native Claude Code GUI) with a GUI-driven LLM gateway like LiteLLM + Open WebUI (both open-source). This lets you keep using Claude Code while switching the underlying API/provider from a Mac GUI.

What to use

  • Opcode — a macOS desktop GUI built specifically for Claude Code (sessions, agents, MCP, usage). It doesn’t switch providers by itself, but it’s the nicest Claude Code GUI to sit on top of your workflow. (GitHub)

  • LiteLLM (Proxy/Gateway) — open-source router that exposes an OpenAI/Anthropic-compatible endpoint and lets you map aliases to 100+ providers (Anthropic Console, AWS Bedrock, Vertex AI, OpenRouter, local models, etc.). (GitHub)

  • Open WebUI or LibreChat — open-source, self-hosted GUIs that plug into LiteLLM so you can select/swap models/providers from a web interface instead of editing config files. (GitHub)

Why this works with Claude Code

Claude Code respects Anthropic-style env vars (e.g., ANTHROPIC_API_KEY) and can be pointed at a custom Anthropic-compatible base URL—so you can route it through LiteLLM (or even Bedrock/Vertex in enterprise setups). (Claude Help Center)

Minimal setup (macOS)

  1. Install Opcode for a nice Claude Code GUI. (GitHub)

  2. Run LiteLLM proxy (Docker or pip) and define routes in config.yaml (e.g., alias anthropic/sonnet → Anthropic Console, Bedrock, or Vertex). (GitHub)

  3. Add a GUI: run Open WebUI and connect it to LiteLLM; you can now switch the active model/provider from the browser. (docs.litellm.ai)

  4. Point Claude Code at the gateway:

     export ANTHROPIC_API_KEY=your_gateway_key
     export ANTHROPIC_BASE_URL=http://localhost:4000/v1  # LiteLLM’s Anthropic/OpenAI-compatible endpoint
    

    Claude Code will use whatever provider/model the gateway maps to; change it in Open WebUI and you’ve “switched the API” without touching Claude Code. (Claude Code prioritizes ANTHROPIC_API_KEY when present.) (Claude Help Center)

If you’d prefer a single app name to start with: Opcode for the Claude GUI, and Open WebUI + LiteLLM for the clickable provider switch. This combo is fully open-source and runs great on macOS.

More from this blog

T

Tenten - AI / ML Development

225 posts

🚀 Revolutionize your business with AI! 🤖 Trusted by tech giants since 2013, we're your go-to LLM experts. From startups to corporations, we bring ideas to life with custom AI solutions