Created
March 17, 2026 08:51
-
-
Save kibotu/2fa719cd83b6a4c0e424d4ed7128a262 to your computer and use it in GitHub Desktop.
Local Proxy to use claude on mac and connect to remote ollama server.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Use the actual model name from `ollama list` | |
| export LM_MODEL="qwen3.5:35b" # or qwen3-coder:30b for coding tasks | |
| export ANTHROPIC_BASE_URL="http://127.0.0.1:8131" # point to local proxy | |
| export ANTHROPIC_AUTH_TOKEN="local" | |
| export CLAUDE_CODE_MAX_OUTPUT_TOKENS=128000 | |
| export ANTHROPIC_MODEL="$LM_MODEL" | |
| export ANTHROPIC_DEFAULT_OPUS_MODEL="$LM_MODEL" | |
| export ANTHROPIC_DEFAULT_SONNET_MODEL="$LM_MODEL" | |
| export ANTHROPIC_DEFAULT_HAIKU_MODEL="$LM_MODEL" | |
| export CLAUDE_CODE_SUBAGENT_MODEL="$LM_MODEL" | |
| 2. Start the proxy (run once, or add to a startup script) | |
| bashpip install 'litellm[proxy]' | |
| litellm --model ollama/qwen3.5:35b \ | |
| --api_base http://1.1.1.1:11434 \ | |
| --host 127.0.0.1 \ | |
| --port 8131 \ | |
| --drop_params | |
| Then in a new terminal just run claude normally. | |
| Optional: auto-start the proxy in .zshrc | |
| bash# Auto-start litellm proxy if not already running | |
| if ! lsof -i :8131 -sTCP:LISTEN &>/dev/null; then | |
| litellm --model ollama/qwen3.5:35b \ | |
| --api_base http://1.1.1.1:11434 \ | |
| --host 127.0.0.1 \ | |
| --port 8131 \ | |
| --drop_params \ | |
| > ~/.litellm.log 2>&1 & | |
| echo "🦙 litellm proxy started (ollama → :8131)" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment