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.
How it works
Section titled “How it works”Claude Code --> LiteLLM Proxy --> CompactifAI APIClaude 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.
1. Install Claude Code
Section titled “1. Install Claude Code”If you don’t have Claude Code installed yet, run:
curl -fsSL https://claude.ai/install.sh | bashecho 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrcclaude --version2. Install LiteLLM
Section titled “2. Install LiteLLM”pip install 'litellm[proxy]'3. Create a LiteLLM config file
Section titled “3. Create a LiteLLM config file”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_KEYlitellm_settings: drop_params: trueReplace 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.
4. Set your API key
Section titled “4. Set your API key”Export your CompactifAI API key as an environment variable (the config above references it via os.environ/):
export COMPACTIFAI_API_KEY="your-compactifai-api-key"5. Start the LiteLLM proxy
Section titled “5. Start the LiteLLM proxy”litellm --config litellm_config.yaml --port 4000You should see output confirming the proxy is running on http://localhost:4000.
6. Configure Claude Code
Section titled “6. Configure Claude Code”Claude Code reads its provider settings from environment variables. Set the following before launching Claude Code:
export CLAUDE_CODE_USE_BEDROCK=0export ANTHROPIC_BASE_URL="http://localhost:4000"export ANTHROPIC_API_KEY="dummy"Then launch Claude Code:
claude7. Select a CompactifAI model
Section titled “7. Select a CompactifAI model”Inside Claude Code, use the /model command to switch to one of the model names you defined in litellm_config.yaml:
/model hypernova-60bOr set it via environment variable before starting:
export ANTHROPIC_MODEL="hypernova-60b"claudeClaude Code will now send all coding requests through LiteLLM to CompactifAI.
8. Verify it works
Section titled “8. Verify it works”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.
Troubleshooting
Section titled “Troubleshooting”| Issue | Solution |
|---|---|
Connection refused on localhost:4000 | Make sure the LiteLLM proxy is running (litellm --config litellm_config.yaml --port 4000) |
401 Unauthorized from CompactifAI | Verify COMPACTIFAI_API_KEY is set and matches the key from your MultiverseIAM dashboard |
| Model not found error | Ensure 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 URL | Confirm 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.