// guide · claude code · antigravity · local gpu

Cut Claude Code & Antigravity Token Costs With a Local GPU.

The pattern: your cloud lead architect (Claude Opus 5.5, Claude Sonnet 5.5, Gemini 4 Argon, GPT-6.2 Astra) stays in the cloud for planning and review — while a local peer model (Qwen3.8-27B / Ternary-Bonsai) executes the expensive part on your own GPU: reading, editing, searching, and testing. Every file byte stays at $0.00.

CLOUD LEAD ARCHITECT · $/token

Claude Opus 5.5 · Claude Sonnet 5.5 · Gemini 4 Argon · GPT-6.2 Astra

Writes the plan, reviews the diff, signs off. Only the reasoning tokens cross the network — at frontier rates ($4–8/M in, $20–40/M out).

LOCAL PEER · $0.00/token

Qwen3.8-27B-W4A16 · Ternary-Bonsai

Executes the loop: read_file, edit_file, search_code, bash, test suites — on loopback, in a 5-layer sandbox, with 93.8% of prompt tokens reused from session KV cache in VRAM.

Wing 01 · cloud + local hybrid · setup 01 / 03

Install Castor as an MCP Server

Castor registers as a stdio MCP server with your existing client (Claude Code, Antigravity, Cursor, or a custom host). If you already run a local engine (vLLM, llama.cpp, SGLang, Ollama, LM Studio), point the status probe at it and you are ready to go.

bash · mcp-castor
  1. # 1. Install & register MCP tools with Claude Code / Antigravity

    $ npx -y mcp-castor install --client all
  2. # 2. Verify your local serving engine (vLLM / llama.cpp / Ollama)

    $ castor server status
  3. # 3. Inspect live token throughput, KV cache hit rate, and savings

    $ castor stats
the reuse math · verified over 78 days 02 / 03

Where the 93.8% KV-Cache Hit Comes From

2.71B

total prompt tokens

Full 49,414 autonomous turns across 1,187 sessions over 78 days.

2.53B

served from VRAM · 93.8%

Multi-turn sessions reuse prior conversation and tool-call history from the KV pool. Snapshot (2026-11-21): 93.8% KV-cache hit, 70.5% MTP draft acceptance, 3.45-token mean acceptance length.

99.83%

net savings vs cloud counterfactual

$10.12 in electricity (56.2 kWh @ $0.18/kWh) against a $6,044.48 Sonnet-tier API counterfactual — $6,034.36 net saved.

What the cloud lead architect still costs · Nov 2026 pricing · verified 2026-11-16

Model Input / 1M Output / 1M Note
Claude Opus 5.5 $4 $20
GPT-6.2 Astra $8 $40
Gemini 4 Argon $2 $10 intro rate (active Nov 2026); $4/$20 standard from Dec 1, 2026
Claude Sonnet 5.5 $2 $10
GPT-6.2 Sol $2 $10
Claude Haiku 5.5 $0.1 $0.5 ≤100K context; $0.50/$2.50 per 1M above 100K
two-tier routing & agent plumbing · developer faq 03 / 03

Developer Questions

How does Claude Code split work with Castor?

It is two-tier routing. Your frontier CLI (Claude Code, Antigravity, Cursor, or Codex) stays in the cloud for the reasoning tier — planning, design decisions, and diff review at frontier rates. Castor takes the execution tier: the high-volume file reads, edits, searches, and test runs route to a local model on your GPU at $0 per token, over a loopback MCP connection. The session context both tiers share means the local peer never starts cold.

How does the 93.8% KV cache hit work?

Multi-turn agent sessions reuse prior-turn history from the local KV cache in VRAM. Over the 78-day window, 2.53B of 2.71B prompt tokens — a 93.8% reported hit rate from the unrounded counts — were served from that session KV cache against a max_model_len of 150,000 tokens.

Which GPU do I need?

A 24 GB+ desktop GPU (RTX 3090, RTX 4090, RTX A5000 Desktop, RTX 5090) runs Qwen3.8-27B-W4A16 natively in VRAM under vLLM 0.33 with MTP speculative decode — 70.4 tok/s sustained at n=1, 260 tok/s aggregate at n=4 concurrent. 8–16 GB GPUs run 7B–14B models natively in VRAM via llama.cpp or Ollama, or run Ternary-Bonsai-2-27B with CPU offload on a 16 GB card.

Does Castor send code to the cloud?

No. In Wing 1 (cloud + local hybrid), your frontier CLI still talks to its own cloud provider for planning and review — that connection belongs to the CLI, not to Castor. Castor itself makes zero cloud calls: local tool execution runs on loopback (127.0.0.1:18020–18022) inside the 5-layer sandbox, and your codebase never leaves your machine through Castor. For zero cloud calls at all, use Wing 2 — the 100% local-only, air-gapped deployment.

How much do I actually save?

As a counterfactual benchmark against Sonnet-tier API pricing ($2/$10 per 1M tokens): the same 78-day workload would have cost $6,044.48 in API fees. Serving it on the local GPU cost $10.12 in electricity (56.2 kWh @ $0.18/kWh) — a $6,034.36 reduction, 99.83% of the cloud cost.

Does this work with Antigravity, Cursor, or any other MCP host?

Yes. Castor exposes exactly 3 MCP tools over stdio — castor_coworker, castor_task, and castor_server — which dispatch a local worker running the 8-tool core, plus the ast tools (ast_search / ast_replace) and the paper tool (paper_lookup). npx -y mcp-castor install auto-installs into Claude Code (--client claude) or Antigravity (--client antigravity); --client all registers both. Cursor, Codex, and any other stdio MCP client connect through the standard MCP config in their client settings.

// quickstart · sixty seconds from zero to telemetry

Run it. Watch it. Verify it.

bash · castor-cli
  1. # 1. Install & register MCP tools with Claude Code / Antigravity

    $ npx -y mcp-castor install --client all
  2. # 2. Verify your local serving engine (vLLM / llama.cpp / Ollama)

    $ castor server status
  3. # 3. Inspect live token throughput, KV cache hit rate, and savings

    $ castor stats

CLAUDE CODE · ANTIGRAVITY · CURSOR · ANY MCP HOST | vLLM · llama.cpp · SGLANG · OLLAMA · LM STUDIO