No GPU? Borrow Google's.

colab-serve rents a GPU from Google Colab, from a 16 GB T4 to a 96 GB RTX PRO 6000 Blackwell, and serves an open-weight LLM on it as your own private endpoint at 127.0.0.1:18200. It speaks the OpenAI and the Anthropic API, so Claude Code, Codex, opencode, OpenAI SDKs and most AI tools work with it as they are. One command starts it, one command stops the billing. An L4 runs about $0.15–0.17 an hour, roughly a third of the cheapest on-demand L4 we found elsewhere (how the price compares).

What it is

A dedicated cloud GPU, by the hour, that only you can reach

Google Colab is usually a notebook in the browser. Behind it is a virtual machine with a real GPU, and Google's Colab CLI can rent one from your terminal and open an SSH connection to it. colab-serve automates the rest: it picks the GPU, installs an inference server, downloads the model and connects it to your computer through an SSH tunnel.

$ ./start.sh glm47flash-l4 --bg     # about 5 minutes later:
== READY: glm-4.7-flash-abliterated (glm47flash-l4 on Colab L4, ctx 32768) ==
  OpenAI     http://127.0.0.1:18200/v1   (key: any string, e.g. sk-local)
  Anthropic  http://127.0.0.1:18200      (/v1/messages)
  Web UI     http://127.0.0.1:18200/

$ ./stop.sh                          # tunnel closed, VM released, billing back to 0.00/hr

No hardware to buy

An L4 with 24 GB, an H100 with 80 GB or a G4 with 96 GB, paid by the hour from your Colab compute units, and only while it runs.

Private by design

The server listens on 127.0.0.1 inside the VM and is reached only through an SSH tunnel to 127.0.0.1 on your computer. There is no public URL.

Drop-in for your tools

OpenAI-compatible and Anthropic-compatible APIs plus a chat web UI. Existing clients need only a new base URL.

15 ready profiles

Qwen 3.5, GLM 4.x and 5.3 and Gemma 4, each sized for its GPU. Any other GGUF model on Hugging Face takes a six-line file.

Billing safety

stop.sh ends the session and lists anything still billing on your account, including leaked VMs that Colab's own CLI cannot see.

Made for coding agents

Run Claude Code, Codex, opencode or aider on a private model with no per-token bill. Each needs only a base URL and a model name. Setup for each.

Cheap by the hour

About $0.90–1.00 an hour for a 96 GB G4 in Colab compute units, against $1.69 for the cheapest on-demand RTX PRO 6000 we found. Prices and caveats.

Waits for capacity

When Google has no GPU free, it retries with growing delays. Real errors such as quota or plan limits stop it at once.

How it works

Your computer
  1. start.sh asks Colab for a GPU VM
  2. sends the setup script over SSH
  3. tunnel.sh forwards 127.0.0.1:18200
  4. your tools call 127.0.0.1:18200
⇄
SSH via
Colab proxy
Colab VM with a GPU
  1. checks the GPU with nvidia-smi
  2. installs llama.cpp (or Project Maya for GLM-5.3)
  3. downloads the model from Hugging Face
  4. serves it on the VM's 127.0.0.1 only

Models download on Google's side at datacenter speed, so nothing large goes through your own connection. Colab wipes the VM's disk when it stops, so every start downloads the model again. That is why a start takes minutes, and those minutes are billed.

Capacity

On "503, no capacity", start.sh waits 30 to 120 s with jitter and tries again, without limit (Ctrl+C gives up). 401, 403, 429, quota or "too many sessions" stop it at once, so it never hammers the API.

Provisioning

The setup runs in one SSH session and is retried up to 4 times if the connection drops. If the VM itself disappears, a new one is requested.

Tunnel

Uses SSH keep-alives and reconnects by itself 3 s after a drop. ./tunnel.sh reopens it to a VM that is still running.

Engines

Most profiles use llama.cpp's prebuilt CUDA 12.8 llama-server, which covers every Colab GPU from the T4 (sm_75) to the G4 (sm_120), with no build step. The GLM-5.3 profiles use Project Maya with EXL3 weights.

Before you start

Requirements

A Google account with Colab compute units
required

A paid Colab plan that includes compute units: Colab Pro, Google AI Pro or Google AI Ultra. The L4, A100, H100 and G4 GPUs need a paid plan; a T4 may also be available on lower tiers.

Every GPU uses compute units per hour while its VM exists, whether you send it requests or not. The rates differ per GPU, roughly T4 < L4 << A100 < G4 ≈ H100, and Google changes them over time. A G4 uses about 10 units an hour. colab usage shows your balance and the current rate.

Linux or macOS
required

Any ordinary computer: the GPU work happens at Google. You need bash, ssh, ssh-keygen, curl and python3, which come with macOS and most Linux distributions. No local GPU, no Docker and no disk space for models.

Google's Colab CLI
required

google-colab-cli (the colab command), installed with uv or pipx and signed in once with colab login. The login opens a Google sign-in in your browser, so it must run in a real, interactive terminal. The scripts look for colab at ~/.local/bin/colab; set COLAB_BIN if yours is elsewhere.

An SSH key
automatic

The first run creates ~/.ssh/id_ed25519_colab if it does not exist. Set COLAB_SSH_KEY to use another one.

Hugging Face
not needed

No account or token. The models come from public Hugging Face repositories. Gated repositories are not supported yet, because no token is sent to the VM.

A client for the endpoint
optional

Anything that speaks the OpenAI or Anthropic API: Claude Code, the OpenAI Python or JS SDK, aider, Open WebUI, LangChain, or just curl. The built-in web UI needs only your browser.

The fast way

Let your coding agent set it up

colab-serve is a few shell scripts and a README, which is exactly what coding agents handle well. Claude Code, Codex or any other popular agent CLI can check your tools, install the Colab CLI, clone the project, start a GPU, test the endpoint, connect your tools to it and shut it down again. You do two things yourself: sign in to Google, and decide which GPU to pay for.

Works with the agent you already use

Claude CodeCodex CLIGemini CLIopencodeCursorGitHub Copilot CLIaider

Open your agent in an empty folder and paste this:

Set up colab-serve (https://github.com/nemke82/colab-serve) for me. Read its README first.

1. Check that I have bash, ssh, ssh-keygen, curl and python3.
2. Install Google's Colab CLI with `uv tool install google-colab-cli` (or `pipx install google-colab-cli`) if `colab` is missing.
3. Ask me to run `colab login` myself in an interactive terminal (it opens a Google sign-in). Then run `colab usage` to confirm it works.
4. Clone the repository and run `./start.sh --list`. Recommend a profile for what I want to do, and ask me before starting any GPU, because it bills compute units by the hour.
5. Start it with `./start.sh <profile> --bg` and test it with `curl -s -m 10 http://127.0.0.1:18200/v1/models`.
6. Show me how to point my tools at the endpoint. For Claude Code, use the separate `CLAUDE_CONFIG_DIR` command that the README gives.
7. When I say I'm done, run `./stop.sh` and confirm that it reports `Usage rate: 0.00/hr`.

Signing in from inside an agent. Agents cannot complete Google's sign-in for you. In Claude Code, type ! colab login at the prompt: the ! runs it in your session, interactively. In other agents, run it in a second terminal.

Keep your agent and the rented model apart. The agent you use to set things up runs on its usual service. If you then point Claude Code at the Colab model, use the separate config the README gives (CLAUDE_CONFIG_DIR=~/.claude-colab), so your normal memory, instructions and MCP servers are not sent to the VM.

Step by step

Set it up manually

  1. Install the Colab CLI
    uv tool install google-colab-cli     # or: pipx install google-colab-cli
    No uv? curl -LsSf https://astral.sh/uv/install.sh | sh, or use pipx from your package manager.
  2. Sign in to Google
    colab login     # in a real terminal: it opens a Google sign-in
    colab usage     # prints your compute-unit balance
  3. Get colab-serve
    git clone https://github.com/nemke82/colab-serve.git
    cd colab-serve
    ./start.sh --list     # the 15 profiles, with GPU and model
  4. Start a GPU and a model
    ./start.sh qwen9b-t4 --bg          # cheapest smoke test, T4
    ./start.sh glm47flash-l4 --bg      # recommended start: good at tools and coding, L4
    With --bg the script returns when the endpoint answers. Expect about 2 to 5 minutes on a T4 or L4, 5 to 10 for the 70 to 100 GB models and 10 to 12 for GLM-5.3. If Google has no GPU free, it waits and retries; Ctrl+C gives up.
  5. Check that it answers
    curl -s -m 10 http://127.0.0.1:18200/v1/models
    Or open http://127.0.0.1:18200/ for the chat web UI.
  6. Use it from your tools (next section)
  7. Stop the billing
    ./stop.sh     # closes the tunnel, releases the VM, shows usage and any leaked VMs
    Check that it reports Usage rate: 0.00/hr.

Use the endpoint

OpenAI base URLhttp://127.0.0.1:18200/v1
Anthropic base URLhttp://127.0.0.1:18200 (/v1/messages)
Web UIhttp://127.0.0.1:18200/
API keyany non-empty string, such as sk-local
Model namethe profile's model name, also listed by /v1/models

OpenAI SDKs and tools

export OPENAI_BASE_URL=http://127.0.0.1:18200/v1
export OPENAI_API_KEY=sk-local

Coding agents

Run your coding agent on it

Pick a model that's good at tool calls, such as glm47flash-*, qwen35b-* or glm53-g4*, with at least 32K context. Each agent below runs with its own empty config folder, so your normal memory, instructions and MCP servers aren't sent to the Colab VM, and your normal setup is untouched.

Claude Code

When the tunnel opens, start.sh prints the exact command for the profile you started. For glm47flash-l4 (32K context):

CLAUDE_CONFIG_DIR=~/.claude-colab ANTHROPIC_API_KEY= \
ANTHROPIC_BASE_URL=http://127.0.0.1:18200 ANTHROPIC_AUTH_TOKEN=sk-local \
ANTHROPIC_MODEL=glm-4.7-flash-abliterated ANTHROPIC_DEFAULT_HAIKU_MODEL=glm-4.7-flash-abliterated \
CLAUDE_CODE_MAX_CONTEXT_TOKENS=32768 CLAUDE_CODE_MAX_OUTPUT_TOKENS=4096 \
claude --permission-mode manual

It only applies to that run: plain claude still uses your normal account. The first start asks for a theme, shows security notes, then asks whether you trust the folder: "No, exit" is selected by default, so choose "Yes, I trust this folder".

For another profile, change both model names and set CLAUDE_CODE_MAX_CONTEXT_TOKENS to its context: 32K = 32768, 64K = 65536, 128K = 131072. At 64K or more, leave out CLAUDE_CODE_MAX_OUTPUT_TOKENS.

SettingWhy it is there
CLAUDE_CONFIG_DIRPrivacy. Your normal Claude Code memory, instructions and MCP servers can hold private data, and Claude Code would send it to the Colab VM. This uses a separate config that starts empty.
ANTHROPIC_API_KEY=keeps a real API key in your terminal from being used
ANTHROPIC_DEFAULT_HAIKU_MODELthe model for Claude Code's background tasks (replaces the deprecated ANTHROPIC_SMALL_FAST_MODEL)
CLAUDE_CODE_MAX_CONTEXT_TOKENSClaude Code doesn't know these models; with an unknown model name it assumed 1M tokens in our test. It must match the server, or long chats fail.
CLAUDE_CODE_MAX_OUTPUT_TOKENS=409632K profiles only. Claude Code's own instructions took about 11K tokens in our test, and it reserves room for its reply. On a small task at 32K it compacted the chat 3 times by default and 0 times with this. A single reply, including a file it writes, can then be at most 4,096 tokens.
--permission-mode manualA new config can start in auto mode, which approves low-risk actions by itself, and here the same uncensored model may be doing those checks. Check that the status line says "manual mode on".

This isn't a sandbox. Claude Code has the same access to your files as you do, and whatever it reads goes to the Colab VM. It can still load CLAUDE.md files and project settings from the current folder and the folders above it. Use an empty folder or a project you're happy to share.

Codex

Codex only speaks the OpenAI Responses API. The llama.cpp llama-server the profiles use serves /v1/responses. The GLM-5.3 profiles run Project Maya instead, so check that route with curl before relying on Codex there. Codex reads custom providers only from the user config, so give it its own folder: ~/.codex-colab/config.toml (example for glm47flash-l4):

model = "glm-4.7-flash-abliterated"
model_provider = "colab"
model_context_window = 32768        # the profile's ctx

[model_providers.colab]
name = "colab-serve"
base_url = "http://127.0.0.1:18200/v1"
env_key = "COLAB_SERVE_API_KEY"
wire_api = "responses"
mkdir -p ~/colab-test && cd ~/colab-test
CODEX_HOME=~/.codex-colab COLAB_SERVE_API_KEY=sk-local codex

We checked this config with Codex 0.174: it sends POST /v1/responses with the key to the tunnel. A warning that Codex has no metadata for the model name is expected. As with Claude Code, what Codex reads goes to the VM, and it still loads AGENTS.md files from the folder you start it in.

opencode

Put this in opencode.json in an empty project folder, then run COLAB_SERVE_API_KEY=sk-local opencode. The syntax is from opencode's provider docs; we haven't tested it yet.

{
  "$schema": "https://opencode.ai/config.json",
  "model": "colab/glm-4.7-flash-abliterated",
  "providers": {
    "colab": {
      "name": "colab-serve",
      "env": ["COLAB_SERVE_API_KEY"],
      "package": "@opencode/ai/providers/openai-compatible",
      "settings": { "baseURL": "http://127.0.0.1:18200/v1" },
      "models": {
        "glm-4.7-flash-abliterated": {
          "name": "GLM-4.7-Flash (Colab)",
          "limit": { "context": 32768, "output": 4096 }
        }
      }
    }
  }
}

aider and other OpenAI-compatible agents

export OPENAI_API_BASE=http://127.0.0.1:18200/v1 OPENAI_API_KEY=sk-local
aider --model openai/glm-4.7-flash-abliterated

Workflows

What people use it for

The server handles one request at a time, so batch jobs run in sequence.

A private coding agent

Start glm47flash-l4 (about $0.16/hr), point Claude Code or Codex at it, and work on code you'd rather not send to a model provider. The A100 profiles give 128K context.

Batch extraction and summaries

Loop over your own files with the OpenAI SDK: summaries, tags, structured fields. The snippet is below.

Screenshots and scans

glm46v-t4 takes images on the cheapest GPU: transcribe text, read a chart, describe a UI.

Try a 100B+ model first

qwen122b-g4 or glm53-g4 give you a 122B or 321B model for about an hour of G4 time, before you spend thousands on hardware.

Compare two models

Run two sessions on different ports and send the same prompts to both: --session llm2 --port 18201.

Your existing tools

Open WebUI, LangChain, LlamaIndex and anything else that takes an OpenAI base URL work unchanged.

# pip install openai
import pathlib
from openai import OpenAI

client = OpenAI(base_url="http://127.0.0.1:18200/v1", api_key="sk-local")
for f in sorted(pathlib.Path("notes").glob("*.md")):
    r = client.chat.completions.create(
        model="glm-4.7-flash-abliterated",
        messages=[{"role": "user", "content": "Summarize in 3 bullet points:\n\n" + f.read_text()}],
    )
    print(f"## {f.name}\n{r.choices[0].message.content}\n")

Models

Pick a profile

A profile is a GPU plus a model that fits it. All 15 bundled profiles are abliterated (uncensored) community builds. Sizes are the weight files only, and the context is the default, which --ctx changes. ./start.sh --list prints them.

Light: T4 and L4

ProfileGPUModelQuantCtxNotes
qwen9b-t4T4 16 GBQwen3.5-9BQ6_K, 7.4 GB64Kcheapest
glm46v-t4T4 16 GBGLM-4.6V-Flash 9BQ6_K, 8.3 GB + mmproj32Kvision input
qwen35b-l4L4 24 GBQwen3.5-35B-A3B MoEi1-IQ4_XS, 18.7 GB32Kfast, 3B active
glm47flash-l4L4 24 GBGLM-4.7-Flash 30B-A3B MoEi1-Q4_K_M, 18.1 GB32Krecommended start: strong tool use, tiny KV cache
gemma26b-l4L4 24 GBGemma-4-26B-A4B-it MoEUD-Q4_K_M, 16.9 GB32Kanother model family
qwen27b-l4L4 24 GBQwen3.5-27B densei1-Q4_K_S, 15.6 GB32Kslower, dense

Mid: A100 and H100

ProfileGPUModelQuantCtx
qwen35b-a100A100 40 GBQwen3.5-35B-A3Bi1-Q6_K, 28.5 GB128K
glm47flash-a100A100 40 GBGLM-4.7-Flashi1-Q6_K, 24.6 GB128K
glm45air-h100H100 80 GBGLM-4.5-Air 106B-A12BQ3_K_M, 57 GB (split)64K
qwen122b-h100H100 80 GBQwen3.5-122B-A10Bi1-Q4_K_S, 69.6 GB64K

Heavy: G4 (RTX PRO 6000 Blackwell, 96 GB)

ProfileModelQuantCtxEngine
glm45air-g4GLM-4.5-Air 106B-A12BQ4_K_M, 73 GB (split)64Kllama.cpp
qwen122b-g4Qwen3.5-122B-A10Bi1-Q4_K_M, 74.2 GB128Kllama.cpp
glm53-g4GLM-5.3-Flash 321B-A18B UncensoredEXL3 2.51 bpw128KMaya, ~102 tok/s, fastest
glm53-g4-305GLM-5.3-Flash 321B-A18B UncensoredEXL3 3.05 bpw128KMaya, ~90 tok/s, balanced
glm53-g4-405GLM-5.3-Flash 321B-A18B UncensoredEXL3 4.05 bpw128KMaya, ~72 tok/s, best quality

Why GLM-5.3 uses another engine. The only uncensored GGUF of that model is a 1-bit quant, too lossy to be useful. These profiles use Project Maya with EXL3 weights and a DFlash2 speculative drafter instead. Maya is compiled for sm_120 and the weights take about 98 GiB, so they only run on a G4 (start.sh refuses other GPUs). A cold start takes 10 to 12 minutes. The KV cache is int8, and --ctx 262144 also turns on KV streaming. The speeds above were measured before the switch to int8. A higher bpw costs the same per hour, but starts and generates more slowly.

For coding agents, pick a model that is good at tool calls, such as glm47flash-*, qwen35b-* or glm53-g4*, with at least 32K of context. The 9B models work, but make more mistakes.

Add your own model

Any GGUF model on Hugging Face takes one small file, profiles/<name>.env:

DESC="Mistral Small 3.2 24B, Q4_K_M on L4"
GPU="L4"                               # T4 | L4 | A100 | H100 | G4
HF_REPO="bartowski/mistralai_Mistral-Small-3.2-24B-Instruct-2506-GGUF"
HF_FILE="mistralai_Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M.gguf"
MODEL_NAME="mistral-small-3.2"         # what clients send as "model"
CTX="32768"

# optional
MMPROJ_FILE="mmproj-F16.gguf"          # vision projector from the same repo
EXTRA_ARGS="--temp 0.7 --top-p 0.95"   # extra llama-server flags

Cost and billing safety

A Colab VM bills compute units until it is released, whether you use it or not. Always finish with ./stop.sh and check for Usage rate: 0.00/hr.

How the price compares

Checked on 5 December 2026: on demand, per GPU-hour, before tax. All of these change often, so check before you decide.

GPUColab CU/hr (measured)Colab ≈ $/hrRunPod Community / SecureLambda (1 GPU)
T4 16 GB1.1–1.2$0.11–0.12not offerednot offered
L4 24 GB1.5–1.7$0.15–0.17$0.44 / $0.69not offered
A100 40 GB5.3–5.4$0.53–0.5480 GB only: $1.19 / $2.09 (PCIe)$1.99
H100 80 GB~18~$1.80PCIe $1.99 / $2.89, SXM $2.69 / $4.39PCIe $3.79
G4: RTX PRO 6000 96 GB8.7–10$0.87–1.00$1.69 / $2.69not offered

What the lower price doesn't include. Colab has no capacity guarantee: G4 and H100 are often busy and reportedly need Colab Pro+. A VM can be reclaimed, and its disk is wiped, so every start downloads the model again, and you pay for that time. RunPod and Lambda give you persistent disks, reservations and multi-GPU machines. Colab is the cheaper choice for occasional sessions of an hour or a few on one GPU, most of all on the L4 and G4. On an H100 the gap is small. For an endpoint that runs all day, a dedicated provider is the better fit.

Good to know

Reference

Commands and options

CommandWhat it does
./start.sh <profile> [options]rent the GPU, set it up, open the tunnel
./start.sh --listlist the profiles
./stop.sh [SESSION] [PORT]close the tunnel, stop the VM, show sessions, usage and leaked VMs
./tunnel.sh [SESSION] [PORT] [--bg]reopen the tunnel to a VM that is still running
./orphans.shlist every GPU assignment on your account
./orphans.sh --kill <endpoint>release a leaked one

start.sh options

OptionDefaultWhat it does
--gpu T4|L4|A100|H100|G4from the profilerun a profile on another GPU (it must fit)
--ctx Nfrom the profilecontext length
--port N18200local port
--session NAMEllmColab session name. Different names and ports run two models at once
--high-memoffask for the high-RAM machine (T4, A100)
--bgoffrun the tunnel in the background and return once the endpoint answers
--no-waitofffail on 503 instead of waiting for capacity

Without --bg the tunnel stays in the foreground. Ctrl+C closes the tunnel but leaves the VM running; ./tunnel.sh reconnects to it.

Environment variables

VariableDefaultWhat it sets
LLAMA_TAGb12816pinned llama.cpp release
MAYA_COMMIT38f1b77… (v1.1.86)pinned Project Maya version for GLM-5.3, a full 40-character commit hash
COLAB_BIN~/.local/bin/colabpath of the Colab CLI
COLAB_SSH_KEY~/.ssh/id_ed25519_colabSSH key, created if missing
COLAB_MAX_ATTEMPTS0 (unlimited)give up after N capacity retries
COLAB_PYthe uv tool venv's pythonPython of the Colab CLI install, used by orphans.sh

Troubleshooting

SymptomFix
G4 busy (503) loops for a long timeG4 and H100 are scarce during US daytime. Try late night or early morning US time, or a smaller GPU.
colab login fails or hangsRun it in a real interactive terminal, not through a wrapper without a TTY (in Claude Code: ! colab login).
Colab refused (hard stop)Quota, a plan that doesn't include that GPU, or a rate limit. Check colab usage.
llama-server exited during loadUsually out of memory: lower --ctx or use a smaller quant. The end of the VM's /content/llm/server.log is printed.
The endpoint hangsAlways use curl -m <seconds>. Check /tmp/colab-serve-<session>-<port>.log, then ./tunnel.sh llm 18200 --bg.
Address already in use on 18200Another tunnel is open: ./stop.sh, or use --port.
HTTP 429 Already-active SSH sessionColab allows one SSH connection per VM and the tunnel holds it. Debug through the kernel with colab exec -s llm -f script.py, or stop the tunnel first.
Debugging on the VM (tunnel closed)ssh -i ~/.ssh/id_ed25519_colab -o "ProxyCommand=colab ssh --proxy-mode -s llm -i ~/.ssh/id_ed25519_colab" root@colab, then tail -f /content/llm/server.log (Maya: /content/maya-server.log)

Credits