Home / Learn / Using LiteLLM with a Claude Key
Using LiteLLM with a Claude Key — LiteLLM Guide

Using LiteLLM with a Claude Key

LiteLLM gives all your apps one OpenAI-compatible endpoint, and a purchased Claude key is all it needs upstream — no Anthropic account. Buy a key, drop it into config.yaml, and every app behind LiteLLM can call Claude.

Buy a key, configure model_list

Get a key on ClaudeAPIKey.dev. In config.yaml, add a model_list entry where litellm_params.model carries a prefix — openai/<model> for the OpenAI-compatible surface (api_base with /v1) or anthropic/<model> for native Messages.

Set api_base to the gateway and api_key via os.environ/<VAR>. Start with litellm --config config.yaml.

The suffix gotcha

anthropic/<model> auto-appends /v1/messages to the root api_base; disable with LITELLM_ANTHROPIC_DISABLE_URL_SUFFIX=true for custom paths. openai/<model> appends /chat/completions to a /v1 base. Mismatch the prefix and you get 400s.

The client-facing model_name stays whatever your apps already use.

Why route a bought key through LiteLLM

One purchased key behind LiteLLM serves every app, script, and teammate through a single endpoint — no per-app Anthropic accounts. Pay as you go and top up with card or crypto.

It's the 'litellm claude code proxy' pattern: Claude Code and other tools target LiteLLM, which routes to your Claude key.

One endpoint, many apps

Swap upstream models or keys in config.yaml without touching clients, and keep unified logging and fallbacks across everything.

New accounts get a free credit to validate the proxy before scaling.

# config.yaml
model_list:
  - model_name: claude-sonnet-4-5
    litellm_params:
      model: openai/claude-sonnet-4-5
      api_base: https://claudeapikey.dev/v1
      api_key: os.environ/AIPRIME_KEY
# litellm --config config.yaml

Frequently asked questions

How do I use a Claude key with LiteLLM?
Buy a key on ClaudeAPIKey.dev, add a model_list entry with model: openai/claude-sonnet-4-5, api_base {SITE}/v1, and api_key via os.environ.

openai/ or anthropic/ prefix?
openai/ for the OpenAI-compatible surface (base with /v1); anthropic/ for native Messages (root + /v1/messages).

Stop LiteLLM appending /v1/messages?
Set LITELLM_ANTHROPIC_DISABLE_URL_SUFFIX=true and give the full path.

Do I need an Anthropic account?
No — a purchased gateway key works. New accounts get a free credit to test.

Start using Claude in minutes

Get an API key — no Anthropic account or waitlist required.

Get your API key

Claude API Key is an independent API gateway. It is not affiliated with, endorsed by, or a reseller of Anthropic. Claude and related model names are trademarks of their respective owners.