Skip to content

Claude Code

Claude Code is Anthropic’s agentic coding tool that runs in the terminal. By default it uses Anthropic models, but it supports any OpenAI-compatible provider through a custom API endpoint. You can route Claude Code through LiteLLM — a lightweight proxy that translates OpenAI-format requests — to use CompactifAI models for coding assistance.

You need a CompactifAI API key and the model id for each model you plan to use (for example hypernova-60b or glm-5-1). Use CompactifAI API https://api.compactif.ai/v1 unless you are explicitly targeting another environment.

Claude Code --> LiteLLM Proxy --> CompactifAI API

Claude Code sends requests in OpenAI chat-completion format to a local LiteLLM proxy. LiteLLM forwards them to CompactifAI’s /v1/chat/completions endpoint and streams the response back.

If you don’t have Claude Code installed yet, run:

Terminal window
curl -fsSL https://claude.ai/install.sh | bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc
claude --version
Terminal window
pip install 'litellm[proxy]'

Create a litellm_config.yaml in your project (or anywhere on disk):

model_list:
- model_name: hypernova-60b
litellm_params:
model: compactifai/hypernova-60b
api_base: https://api.compactif.ai/v1
api_key: os.environ/COMPACTIFAI_API_KEY
- model_name: glm-5-1
litellm_params:
model: compactifai/glm-5-1
api_base: https://api.compactif.ai/v1
api_key: os.environ/COMPACTIFAI_API_KEY
- model_name: llama-4-scout
litellm_params:
model: compactifai/llama-4-scout
api_base: https://api.compactif.ai/v1
api_key: os.environ/COMPACTIFAI_API_KEY
litellm_settings:
drop_params: true

Replace the model_name entries with any models from the models catalog you have access to. You can discover the full list of available model IDs programmatically via GET /v1/models (see API reference). The litellm_params.model value must be prefixed with openai/ so LiteLLM uses the OpenAI-compatible path.

Export your CompactifAI API key as an environment variable (the config above references it via os.environ/):

Terminal window
export COMPACTIFAI_API_KEY="your-compactifai-api-key"
Terminal window
litellm --config litellm_config.yaml --port 4000

You should see output confirming the proxy is running on http://localhost:4000.

Claude Code reads its provider settings from environment variables. Set the following before launching Claude Code:

Terminal window
export CLAUDE_CODE_USE_BEDROCK=0
export ANTHROPIC_BASE_URL="http://localhost:4000"
export ANTHROPIC_API_KEY="dummy"

Then launch Claude Code:

Terminal window
claude

Inside Claude Code, use the /model command to switch to one of the model names you defined in litellm_config.yaml:

/model hypernova-60b

Or set it via environment variable before starting:

Terminal window
export ANTHROPIC_MODEL="hypernova-60b"
claude

Claude Code will now send all coding requests through LiteLLM to CompactifAI.

Ask Claude Code a simple question — for example, type “list the files in this directory”. If the response streams back, the integration is working. Requests use the same /v1/chat/completions flow described in Chat Completion.

IssueSolution
Connection refused on localhost:4000Make sure the LiteLLM proxy is running (litellm --config litellm_config.yaml --port 4000)
401 Unauthorized from CompactifAIVerify COMPACTIFAI_API_KEY is set and matches the key from your MultiverseIAM dashboard
Model not found errorEnsure the model_name in litellm_config.yaml matches what you pass to /model in Claude Code, and that the underlying model id (e.g. hypernova-60b) exists in the models catalog
Claude Code ignores the base URLConfirm ANTHROPIC_BASE_URL is exported before launching claude. Also ensure CLAUDE_CODE_USE_BEDROCK is 0

For request and response fields, see Chat Completion and the API reference.