Use any model with Claude Code

Claude Code speaks Anthropic's Messages API, and CompanyFabric serves it at /v1/messages. Set two variables and Claude Code runs on any model in the library. Claude models go to Anthropic as Claude Code sends them, so prompt caching keeps working; other models are translated, tool calls included, so file edits and commands work on them too.

Step by step

Setup

  1. 1

    Create a key in your CompanyFabric dashboard, then point Claude Code at CompanyFabric. These variables apply to the terminal you set them in:

    export ANTHROPIC_BASE_URL="https://api.companyfabric.com"
    export ANTHROPIC_API_KEY="sk-cf-…"
  2. 2

    Start a session on any model. Claude models take their usual names; everything else takes its catalog id:

    claude --model claude-sonnet-5-5
    claude --model openai/gpt-5.5
    claude --model deepseek/deepseek-v4-1-flash
    claude --model companyfabric/auto
  3. 3

    Claude Code asks once whether to use the API key; answer yes. Every turn then appears in your dashboard's usage feed with its exact cost, and the key's budget cap applies.

  4. 4

    Optional: add the CompanyFabric MCP server too, so Claude Code can search models, quote prices, search the web and check spend for you:

    claude mcp add --transport http companyfabric https://companyfabric.com/api/mcp \
      --header "Authorization: Bearer sk-cf-YOUR_KEY"

Recommended

Models that shine in Claude Code

FAQ

Frequently asked questions

Does prompt caching still work?

Yes. Claude models are sent to Anthropic exactly as Claude Code writes them, cache markers included, and billed at Anthropic's cache rates: the first turn of a session writes Claude Code's large prompt to the cache, later turns read it back at a fraction of the price. Other providers cache on their own side; where a model's page lists a cache price (DeepSeek, Gemini 4 Argon), cached input is billed at it.

I'm also logged in to a Claude subscription. Which one pays?

With ANTHROPIC_API_KEY set and approved, the key does, and Claude Code shows "API Usage Billing". It may warn that both are set; that is expected. Open a new terminal without the variables to go back to your subscription.

Claude Code says my model "isn't recognized". Is that a problem?

No. Claude Code knows Anthropic's model names, not ours, so for a model like openai/gpt-5.5 it assumes a 200k-token context and compacts before that. Everything else works normally.

Can I cap what Claude Code spends?

Yes. Set a monthly budget cap on the key in the dashboard; requests stop at the cap instead of surprising you at invoice time.

One key. Every model. Exact prices.

One key gives Claude Code the whole library. Free starter credits included, no subscription required.