Skip to content

Instantly share code, notes, and snippets.

@decagondev
Created July 23, 2026 20:22
Show Gist options
  • Select an option

  • Save decagondev/db98647dd3e181351842e047605be2ac to your computer and use it in GitHub Desktop.

Select an option

Save decagondev/db98647dd3e181351842e047605be2ac to your computer and use it in GitHub Desktop.

Linux setup — Claude Code using remote Ollama (GLM‑5.2 Cloud) over Tailscale

This machine runs Claude Code only. All model inference happens on the Windows machine (rizen) on your tailnet. No Ollama is installed here.

Model used: glm-5.2:cloud • Server: rizen (Windows, Ollama on port 11434)


Before you start (on the Windows rizen machine)

These must already be true — you set them up earlier:

  • Ollama is running with OLLAMA_HOST=0.0.0.0:11434 (listening on all interfaces).
  • Windows firewall allows inbound TCP 11434.
  • Ollama is signed in to Ollama Cloud (ollama signin) and the model is pulled: ollama pull glm-5.2:cloud
  • rizen is online on the tailnet.

Step 1 — Install Tailscale

Open a terminal and run:

curl -fsSL https://tailscale.com/install.sh | sh

This auto-detects your distro and installs the Tailscale client and daemon.

Step 2 — Set up your account / join the tailnet

Bring Tailscale up:

sudo tailscale up

It prints a URL like https://login.tailscale.com/a/xxxxxxxx. Copy it into a browser and sign in:

  • Joining an existing tailnet (this machine should be on the same network as rizen): sign in with the same account that owns rizen.
  • New account: sign in with Google / GitHub / Microsoft / email — that creates your tailnet.

Once authenticated in the browser, the terminal command completes and this machine is on the tailnet.

Verify it can see the Windows box:

tailscale status

You should see a line for rizen with a 100.x.y.z address, marked online.

If rizen is not listed, the two machines are on different tailnets — sign in with the correct account, or share/invite as needed.

Step 3 — Confirm you can reach Ollama on rizen

Test the full network path before installing anything else:

curl http://rizen:11434/api/tags
  • Returns JSON listing models → the tunnel works, continue.
  • Hostname won't resolve → MagicDNS isn't enabled. Use the raw IP instead: curl http://100.x.y.z:11434/api/tags (get the IP from tailscale status).
  • Hangs / times out → Windows firewall is blocking 11434.
  • Connection refused → Ollama on rizen is still bound to localhost, not 0.0.0.0.

Step 4 — Install Claude Code

Claude Code needs Node.js 18 or newer. Check what you have:

node --version

If Node is missing or older than 18, install it (nvm is the easiest, distro-independent way):

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
# restart the shell, then:
nvm install --lts

Then install Claude Code:

npm install -g @anthropic-ai/claude-code

Confirm it's installed:

claude --version

Step 5 — Point Claude Code at the remote Ollama

Add these three environment variables to your shell profile so every session uses rizen automatically. Open ~/.bashrc (or ~/.zshrc if you use zsh) and add:

export ANTHROPIC_BASE_URL=http://rizen:11434
export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_API_KEY=""

If the rizen hostname didn't resolve in Step 3, use the IP form instead: export ANTHROPIC_BASE_URL=http://100.x.y.z:11434

Reload the profile:

source ~/.bashrc      # or: source ~/.zshrc

Sanity check the variables are set:

echo $ANTHROPIC_BASE_URL      # should print http://rizen:11434

Step 6 — Launch Claude Code with GLM‑5.2 Cloud

From any project directory:

claude --model glm-5.2:cloud

That's it. Claude Code talks to Ollama on rizen over Tailscale, and rizen runs the model via Ollama Cloud. Your GPU on rizen stays idle because :cloud inference runs on Ollama's infrastructure — the Windows box is just the endpoint.


Quick reference

Item Value
Server hostname (tailnet) rizen
Ollama port 11434
Base URL http://rizen:11434
Auth token ollama
API key (empty string)
Model glm-5.2:cloud
Launch command claude --model glm-5.2:cloud

Troubleshooting

  • claude can't connect / API errors → re-run the curl http://rizen:11434/api/tags test. If that fails, it's a network/Ollama problem on rizen, not Claude Code.
  • Works by IP but not by rizen → enable MagicDNS in the Tailscale admin console (DNS settings), or just keep using the 100.x.y.z IP in ANTHROPIC_BASE_URL.
  • glm-5.2:cloud not found → on rizen, run ollama pull glm-5.2:cloud and make sure it's signed in with ollama signin.
  • Env vars blank in a terminal → you edited the profile but didn't source it, or opened the terminal before saving. Open a fresh terminal or re-run source ~/.bashrc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment