Point coding CLIs at ollama.com's cloud models using one OLLAMA_API_KEY. No ollama launch, no sign-in.
It is however recommended that you have the tool curl -fsSL https://ollama.com/install.sh | sh installed so you can take advantage of local models.
export OLLAMA_API_KEY=... # your ollama.com key (put in shell rc)
# set -gx OLLA... # if you're on fish
mise install # fetch gum (model chooser)
mise run check # verify key + API reachable
mise run install # symlink launchers into ~/.local/binmise run uninstall removes the symlinks. No mise? brew install gum and
ln -s "$PWD"/ollama-{claude,codex,pi,hermes,oh-my-cli,oh-my-cli-app,codex-app,claude-app,gui} ~/.local/bin/.
| Command | Harness | Endpoint |
|---|---|---|
ollama-claude |
Claude Code | Anthropic /v1/messages (Bearer) |
ollama-codex |
Codex CLI | OpenAI /v1/responses |
ollama-pi |
pi | OpenAI /v1/chat/completions |
ollama-hermes |
Hermes agent TUI | OpenAI /v1/chat/completions (ollama-cloud) |
ollama-oh-my-cli |
oh-my-cli | OpenAI /v1/responses |
ollama-oh-my-cli-app |
oh-my-cli Desktop | Electron shell, env-pumped to ollama.com |
Pick a model three ways (first wins): --model NAME, OLLAMA_MODEL=NAME, or the
gum chooser (prefilled with your last pick, remembered per-harness in
~/.config/ollama-scripts/). Everything else is passed through:
ollama-codex --model qwen3-coder:480b exec "fix the failing test"
ollama-claude # chooser, then normal claude sessionSame idea for the GUIs, mirroring ollama launch but keyed straight to
ollama.com — no sign-in. macOS only.
Unlike the CLIs, desktop apps can't read the shell env, so these must write
config files — persistent, not ephemeral. Every touched file is copied to
<file>.ollama-scripts.bak first, and ollama-unset.sh reverts everything.
| Command | App | How |
|---|---|---|
ollama-codex-app |
Codex desktop | writes ~/.codex/config.toml provider (backed up), then restarts Codex |
ollama-claude-app |
Claude Desktop | writes Claude's 3p gateway profile (backed up), then relaunches |
ollama-gui |
Ollama app | launches Ollama.app with OLLAMA_API_KEY in its env |
ollama-codex-app --model glm-5.2 # picks a model like the CLIs
ollama-claude-app # switch Claude Desktop to Ollama Cloud
ollama-gui # open the Ollama app with cloud accessBecause the Codex launchers write a model catalogue covering all your ollama
cloud models, you can switch mid-session with /model inside Codex instead of
restarting the harness. Launching still picks one default (--model, OLLAMA_MODEL,
or the chooser), but the picker lists everything.
ollama-unset.sh returns Codex, Claude Desktop, and pi to their original
providers — restoring each config from its .ollama-scripts.bak (or stripping
only what was added if no backup exists) and quitting the apps so they reload
clean. The CLI wrappers (ollama-claude, ollama-codex) need no undo; they only
set env for their own subprocess.
ollama-unset.sh # revert all app/pi config changesPer-app reverts also exist: ollama-codex-app --restore, ollama-claude-app --restore.
The Ollama VS Code extension
supports cloud models natively — no launcher script needed. Install the
extension, then set two options in VS Code settings (Cmd+,):
ollama.endpoint→https://ollama.comollama.headers→ add anAuthorizationheader with valueBearer <your-key>
Open the model picker in VS Code Chat (Cmd+Shift+M) and your cloud models
appear under the Ollama section.
Each launcher is ~10 lines. Copy one, then:
- Source the lib and require the key:
source "$(dirname "$(readlink -f "$0")")/lib.sh" _require_key
- Resolve the model — parses
--model, else chooser/OLLAMA_MODEL:_resolve_model <harness-name> "$@" # sets $MODEL and array $REST (leftover args)
<harness-name>is just the key for the last-used file. - Wire the endpoint to
https://ollama.comusing$OLLAMA_API_KEY, thenexecthe tool with$MODELand the passthrough args:exec yourtool --model "$MODEL" "${REST[@]+"${REST[@]}"}"

