Auto-generated OpenCode and Claude Code configuration for our LiteLLM proxy.
When using OpenCode with a LiteLLM proxy via @ai-sdk/openai-compatible, OpenCode cannot look up model capabilities (vision, PDF support, reasoning, costs, context limits) from models.dev because the model names are custom aliases that don't match any known provider/model entries.
This means features like image input silently fail — OpenCode strips the image before it ever reaches the proxy.
Claude Code also needs configuration to route through LiteLLM's Bedrock pass-through endpoint, with the correct model names pinned.
The generate.py script:
- Reads the LiteLLM
config.ymlto get model aliases and their underlying provider models - Fetches the full model metadata from models.dev
- Maps litellm provider prefixes (
azure/,bedrock/,vertex_ai/) to models.dev providers - Generates an
opencode.jsonwith full metadata (modalities, costs, limits, capabilities) - Generates a
claude-settings.jsonfor Claude Code with Bedrock pass-through configuration
Copy or symlink opencode.json to your global opencode config:
cp opencode.json ~/.config/opencode/opencode.jsonOr symlink it:
ln -sf $(pwd)/opencode.json ~/.config/opencode/opencode.jsonThe generated claude-settings.json configures Claude Code to use LiteLLM's Bedrock pass-through. It auto-detects the latest opus, sonnet, and haiku models from the LiteLLM config.
git clone git@github.com:i-dot-ai/coding-agent-litellm-config.git
cd coding-agent-litellm-config
./install.shThe install script will:
- Deep-merge
claude-settings.jsoninto~/.claude/settings.json(creating it if it doesn't exist, preserving your existing hooks, plugins, and extra env vars if it does) - Prompt for your LiteLLM API key (
ANTHROPIC_AUTH_TOKEN) and save it to settings — you can also skip and add it later - Register a
SessionStarthook so Claude Code auto-pulls updates when a new session starts (throttled to once per hour, runs in background)
The install works from any branch — if claude-settings.json doesn't exist locally, it reads it from origin/main.
The API key is per-user and not included in the generated config, but the merge preserves it across updates.
Now install and run Claude Code:
npm install -g @anthropic-ai/claude-code
claudeA backup of your settings is saved before each auto-update to ~/.config/coding-agent-litellm-config/settings.json.backup.
To restore and pause auto-updates:
cp ~/.config/coding-agent-litellm-config/settings.json.backup ~/.claude/settings.json
touch ~/.config/coding-agent-litellm-config/pausedTo resume auto-updates:
rm ~/.config/coding-agent-litellm-config/paused./uninstall.shRemoves the auto-update hook. Your other settings (hooks, plugins, env vars) are preserved.
{
"model": "bedrock-claude-4.6-opus",
"env": {
"ANTHROPIC_BEDROCK_BASE_URL": "https://llm-gateway.i.ai.gov.uk/bedrock",
"CLAUDE_CODE_USE_BEDROCK": "1",
"CLAUDE_CODE_SKIP_BEDROCK_AUTH": "1",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "bedrock-claude-4.6-opus",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "bedrock-claude-4.6-sonnet",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "bedrock-claude-4.5-haiku"
}
}CLAUDE_CODE_USE_BEDROCKtells Claude Code to use the Bedrock API formatCLAUDE_CODE_SKIP_BEDROCK_AUTHskips local AWS auth since LiteLLM handles authentication with AWSANTHROPIC_BEDROCK_BASE_URLpoints to LiteLLM's Bedrock pass-through endpointANTHROPIC_DEFAULT_*_MODELpins Claude Code to specific model aliases from the LiteLLM config
The model names are auto-detected from the LiteLLM config by finding bedrock Claude models and picking the latest version of each tier (opus, sonnet, haiku).
pip install -r requirements.txt
python generate.py \
--litellm-config /path/to/core-llm-gateway/backend/config/config.yml \
--base-url "https://llm-gateway.i.ai.gov.uk/v1" \
--output opencode.json \
--claude-output claude-settings.jsonServer-side: A GitHub Action runs daily and whenever the litellm config changes, regenerating both opencode.json and claude-settings.json and committing any updates.
Client-side: If you ran ./install.sh, Claude Code will fetch origin/main on new session start (background, throttled to once/hour) and merge any changes into ~/.claude/settings.json. This works regardless of which branch is checked out locally.
To trigger from core-llm-gateway when the config changes, add a dispatch step to the gateway's CI:
- name: Trigger opencode config update
if: contains(github.event.commits.*.modified, 'backend/config/config.yml')
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.GH_PAT }}
repository: i-dot-ai/coding-agent-litellm-config
event-type: litellm-config-updated| LiteLLM prefix | models.dev provider |
|---|---|
azure/ |
azure |
bedrock/ |
amazon-bedrock |
vertex_ai/ |
google-vertex |
openai/ |
openai |
anthropic/ |
anthropic |
gemini/ |
google |
mistral/ |
mistral |
For each model, the script copies from models.dev:
modalities(input: text/image/pdf/audio/video, output: text)limit(context window, max output tokens)cost(input/output per million tokens, cache read/write)reasoning,temperature,tool_call,attachmentcapability flags