Fix: add LiteLLM proxy so Claude Code can use qwen2.5-coder:32b

This commit is contained in:
root 2026-04-02 13:59:34 -04:00
parent 23173fac3f
commit 676a54ec7b
2 changed files with 29 additions and 4 deletions

View file

@ -22,22 +22,37 @@ services:
- OLLAMA_HOST=0.0.0.0 - OLLAMA_HOST=0.0.0.0
- OLLAMA_KEEP_ALIVE=24h - OLLAMA_KEEP_ALIVE=24h
litellm:
image: ghcr.io/berriai/litellm:main-latest
container_name: litellm
restart: unless-stopped
depends_on:
- ollama
ports:
- "4000:4000"
volumes:
- ./litellm-config.yaml:/app/config.yaml
command: ["--config", "/app/config.yaml", "--port", "4000"]
claude-code: claude-code:
image: node:20-slim image: node:20-slim
container_name: claude-code container_name: claude-code
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
- ollama - litellm
environment: environment:
- ANTHROPIC_BASE_URL=http://ollama:11434/v1 # Point Claude Code at LiteLLM which fully speaks the Anthropic API
- ANTHROPIC_BASE_URL=http://litellm:4000
- ANTHROPIC_API_KEY=ollama - ANTHROPIC_API_KEY=ollama
- CLAUDE_CODE_DEFAULT_MODEL=qwen2.5-coder:32b
volumes: volumes:
- workspace:/workspace - workspace:/workspace
- claude_config:/root/.claude
working_dir: /workspace working_dir: /workspace
command: > command: >
sh -c "npm install -g @anthropic-ai/claude-code && sh -c "npm install -g @anthropic-ai/claude-code &&
echo 'Claude Code installed. Run: claude' && mkdir -p /root/.claude &&
echo '{\"model\": \"qwen2.5-coder:32b\"}' > /root/.claude/settings.json &&
echo 'Claude Code ready. Run: claude' &&
tail -f /dev/null" tail -f /dev/null"
stdin_open: true stdin_open: true
tty: true tty: true
@ -47,3 +62,5 @@ volumes:
driver: local driver: local
workspace: workspace:
driver: local driver: local
claude_config:
driver: local

8
litellm-config.yaml Normal file
View file

@ -0,0 +1,8 @@
model_list:
- model_name: qwen2.5-coder:32b
litellm_params:
model: ollama/qwen2.5-coder:32b
api_base: http://ollama:11434
general_settings:
master_key: ollama