Run Ollama Cloud models inside Claude Desktop's embedded Claude Code sessions on macOS.
Claude Desktop does not currently expose a normal setting to swap its built-in Claude model for an Ollama Cloud model. This workaround routes Claude Desktop's embedded Claude Code / local code sessions through Ollama's Anthropic-compatible local gateway.
It turns this:
Claude Desktop local code session -> Claude Code -> Anthropic default model
into this:
Claude Desktop local code session -> wrapper -> Claude Code -> Ollama -> deepseek-v4-pro:cloud
ollama signin
ollama list | grep ':cloud'
security add-generic-password \
-a "$USER" \
-s "ollama-cloud-api-key" \
-w "PASTE_YOUR_OLLAMA_API_KEY_HERE" \
-U
./scripts/install.sh
./scripts/smoke-test.shThen open Claude Desktop, start a Claude Code / local code session, and watch:
tail -f /tmp/claude-desktop-ollama-wrapper.logIf the log says routed Claude Code launch to ...:cloud, the route is working.
This does not replace the normal Claude chat model in Claude Desktop.
It targets the Claude Code / local agent sessions that Claude Desktop launches internally. Those sessions can edit files, run tools, and work in local code folders.
- macOS on Apple Silicon
- Claude Desktop
1.6608.0 - Claude Code CLI
2.1.140 - Ollama
0.21.2 - Ollama Cloud model
deepseek-v4-pro:cloud
This is an unsupported workaround. Claude Desktop and Ollama change quickly, and a Claude Desktop update may overwrite the helper or change the launch path.
If this works for you, please open a tested configuration issue with your macOS, Claude Desktop, Claude Code, Ollama, and model versions.
That helps other users see which combinations are working.
- Try Ollama Cloud models inside a familiar Claude Desktop code workflow.
- Use models like
deepseek-v4-pro:cloud,kimi-k2.6:cloud,glm-5.1:cloud, orqwen3.5:397b-cloud. - Keep the API key out of plaintext files by storing it in macOS Keychain.
- Restore normal Claude Desktop behavior with one command.
Claude Desktop launches a helper named:
/Applications/Claude.app/Contents/Helpers/disclaimer
The installer preserves the original helper as:
/Applications/Claude.app/Contents/Helpers/disclaimer.real
Then it installs a small Bash wrapper at the original path. When Claude Desktop starts an embedded Claude Code session, the wrapper:
- Reads your Ollama API key from macOS Keychain.
- Sets
ANTHROPIC_BASE_URL=http://127.0.0.1:11434. - Rewrites Claude model arguments such as
claude-sonnet-4-6to your selected Ollama Cloud model. - Launches the host Claude Code CLI.
- Logs the route to
/tmp/claude-desktop-ollama-wrapper.log.
flowchart LR
A["Claude Desktop"] --> B["helper wrapper"]
B --> C["Claude Code CLI"]
C --> D["Ollama local gateway"]
D --> E["Ollama Cloud model"]
Install Ollama and sign in:
ollama signin
ollama --versionConfirm cloud models are available:
ollama list | grep ':cloud'Confirm Claude Code is installed:
"$HOME/.local/bin/claude" --versionIf needed:
curl -fsSL https://claude.ai/install.sh | bashSave your Ollama API key in Keychain:
security add-generic-password \
-a "$USER" \
-s "ollama-cloud-api-key" \
-w "PASTE_YOUR_OLLAMA_API_KEY_HERE" \
-UDo not commit or paste your real API key.
./scripts/install.shThe installer defaults to the first Claude model listed in:
~/.ollama/config.json
If no model is found there, it falls back to:
deepseek-v4-pro:cloud
Override the model at install or launch time:
OLLAMA_CLAUDE_MODEL="kimi-k2.6:cloud" ./scripts/install.shRun the terminal smoke test:
./scripts/smoke-test.shExpected output:
ok
Then open Claude Desktop and start a Claude Code / local code session. Ask:
What model are you running? Then create /tmp/ollama_desktop_test.txt with "hello from ollama desktop" and read it back.
Verify:
cat /tmp/ollama_desktop_test.txt
tail -3 /tmp/claude-desktop-ollama-wrapper.logThe wrapper log is the reliable proof. A model may not always self-report accurately.
Edit the Claude integration model in Ollama's config:
jq '.integrations.claude.models = ["glm-5.1:cloud"]' \
"$HOME/.ollama/config.json" > /tmp/ollama-config.json \
&& mv /tmp/ollama-config.json "$HOME/.ollama/config.json"Or override per launch:
OLLAMA_CLAUDE_MODEL="qwen3.5:397b-cloud" open -a Claude./scripts/restore.shThis moves disclaimer.real back to disclaimer and restores normal Claude Desktop behavior.
No wrapper log:
tail -f /tmp/claude-desktop-ollama-wrapper.logThen start a Claude Desktop local code session.
No cloud models:
ollama signin
ollama list | grep ':cloud'Authentication fails:
security find-generic-password -a "$USER" -s "ollama-cloud-api-key" >/dev/null && echo okClaude Desktop update broke it:
./scripts/install.shNeed to undo everything:
./scripts/restore.sh- Store the Ollama API key in Keychain.
- Do not paste the key into chat, shell history, screenshots, or GitHub.
- Rotate the key if it was exposed anywhere.
- This modifies the Claude Desktop app bundle. Keep the restore script nearby.
The original tutorial gist is here:
https://gist.github.com/FernellysM/2ce62ea017ae9d78d7b2c54603e718c6
MIT
