Developer Tools Artificial Intelligence 110 vues

Stop Burning Claude Tokens! Houtini LM Cuts Costs 90%

B
Bright Coding
Auteur
Stop Burning Claude Tokens! Houtini LM Cuts Costs 90%

Stop Burning Claude Tokens! Houtini LM Cuts Costs 90%

Your Claude Code bill just hit $847 this month. You left it running overnight on a refactor, didn't you? The architecture decisions, the multi-file orchestration, the tool calls—that's worth every penny. But the boilerplate generation? The test stubs? The commit messages and format conversions? You're paying frontier-model prices for intern-level work.

What if Claude stayed the architect—but a local Qwen, Llama, or Nemotron handled all the drafting? No quota burn. No rate limits. Private if local, cheap if cloud. The trade is simple: 3-30× slower wall-clock time for tasks that don't need Claude's reasoning anyway. That's the promise of Houtini LM, and it's why developers are quietly abandoning raw Claude Code for orchestrated workflows.

Ready to stop funding OpenAI's next campus expansion? Let's dive into how this MCP server transforms your token economics.


What Is Houtini LM?

Houtini LM is a Model Context Protocol (MCP) server that acts as an intelligent delegation layer between Claude Code and cheaper LLM alternatives. Built by a developer who got sick of painful overnight token bills, it connects Claude to local inference engines (LM Studio, Ollama, vLLM, llama.cpp) or budget cloud APIs (DeepSeek at $0.28/M tokens, Groq, Cerebras at 3,000 tok/s) through a single OpenAI-compatible interface.

The genius? Claude stays the orchestrator. It handles architecture, planning, multi-file refactoring, and tool access. But when it encounters bounded, self-contained tasks—generate tests, review code, draft docs, convert formats—it fires those to Houtini LM instead. The local model crunches it, returns the result, and Claude validates. Your Claude quota stays pristine for the work that actually needs it.

Here's the architecture at a glance:

Claude Code (orchestrator)
   |
   |-- Complex reasoning, planning, architecture --> Claude API (your tokens)
   |
   +-- Bounded grunt work --> houtini-lm --HTTP/SSE--> Your local LLM (free)
       . Boilerplate & test stubs          Qwen, Llama, Nemotron, GLM...
       . Code review & explanations        LM Studio, Ollama, vLLM, llama.cpp
       . Commit messages & docs            DeepSeek, Groq, Cerebras (cloud)
       . Format conversion
       . Mock data & type definitions
       . Embeddings for RAG pipelines

The project is trending because it solves a real economic pain point that worsens as Claude Code usage scales. Solo developers, agencies, and enterprise teams alike are discovering that 60-80% of their token spend goes to tasks any decent 7B-30B parameter model handles competently. Houtini LM makes that substitution frictionless—and tracks exactly how much you're saving.


Key Features That Make It Irresistible

Intelligent Model Discovery & Routing

Houtini LM doesn't just blast requests to whatever's loaded. At startup, it queries your LLM server for every available model, then enriches each one via HuggingFace's free API. Architecture, license, download count, pipeline type—all cached in a local SQLite database (~/.houtini-lm/model-cache.db). The result? The server knows what your models are good at.

Got Nemotron loaded but Qwen Coder idle? It flags that. Loading a Mistral variant it's never seen? Auto-generated profile from HuggingFace data. Curated profiles exist for GLM-4, Qwen3 Coder, Qwen3, LLaMA 3, Nemotron, Granite, GPT-OSS, and Nomic Embed—each with per-family prompt hints (temperature, output constraints, think-block flags) that optimize results.

Performance Tracking with Real Benchmarks

Every response includes a live performance footer computed from the SSE stream—not vendor APIs:

---
Model: nvidia/nemotron-3-nano | 279→303 tokens (12 reasoning / 291 visible) | TTFT: 485ms, 58.0 tok/s, 5.2s
📊 First measured call on nvidia/nemotron-3-nano: 58.0 tok/s, 485ms to first token — use this to gauge whether to delegate longer tasks.
💰 Claude quota saved — this session: 4,283 tokens / 7 calls · lifetime: 147,432 tokens / 213 calls

Lifetime persistence means per-model TTFT and tok/s averages survive Claude Desktop restarts. The code_task_files pre-flight estimator uses this data to refuse obviously-too-large inputs early with concrete diagnostics—no more silent hangs against MCP client timeouts.

Sophisticated Reasoning Model Handling

Thinking models (DeepSeek R1, Qwen3, Nemotron) can burn their entire output budget on hidden reasoning and return empty bodies. Houtini LM solves this three ways:

  • Suppression at source: Auto-detects enable_thinking support via chat-template inspection, disables it at inference time
  • Budget inflation: Silently expands max_tokens (×4 or +2000, whichever's larger) so reasoning can't starve content
  • Capture + stripping: Extracts reasoning from delta.reasoning_content / delta.reasoning channels, strips inline <think> blocks, returns captured reasoning as fallback if budget exhausts entirely

For OpenRouter, it sends reasoning: { exclude: true } on every call—thinking models normalized to text-only output at the provider level.

Structured JSON Output with Grammar Constraints

Both chat and custom_prompt accept json_schema parameters that force valid JSON output. LM Studio uses grammar-based sampling—no more praying the model remembers to close brackets.

Automatic Request Serialization

Local single-GPU hosts can only serve one request at a time. Houtini LM enforces a request semaphore on local providers (LM Studio, Ollama, vLLM, llama.cpp), queuing parallel MCP tool calls to run sequentially. On remote providers (OpenRouter, DeepSeek, Groq, Cerebras), it skips the semaphore—upstream handles parallelism natively. Fully automatic; zero configuration.


Real-World Use Cases Where Houtini LM Dominates

1. Overnight Refactors Without the Morning Bill

You're modernizing a 50K-line TypeScript codebase. Claude Code's architecture decisions—file structure, dependency injection patterns, migration strategy—are irreplaceable. But generating the actual boilerplate for 200 new service classes? Converting snake_case APIs to camelCase? That's 15,000 tokens of Claude spend that Qwen 3 Coder handles for pennies locally. Set Houtini LM running, check the morning stats: "💰 Lifetime: 147,432 tokens / 213 calls."

2. Code Review at Scale

Your team commits 40 PRs daily. Claude reviewing each one? Bankruptcy. Instead, Claude orchestrates: "Review these 5 related files for memory safety issues." Houtini LM's code_task_files reads them directly from disk—source never passes through MCP client's context window—and returns structured findings. Claude validates, prioritizes, suggests fixes. Review throughput 10×, cost 1/20×.

3. Commit Message & Documentation Hygiene

Developers hate writing commit messages. Result? "fix stuff" and "wip" pollute your history. With Houtini LM, Claude delegates: "Draft conventional commits for this diff." The local model outputs polished messages; Claude approves or refines. Zero Claude tokens for a task that needs no reasoning. Same for API docs, README updates, and changelog generation.

4. RAG Pipeline Embeddings

Building semantic search? You need thousands of text embeddings. Claude's API doesn't even offer embeddings—you'd need another OpenAI call. Houtini LM's embed tool hits your local Nomic Embed model (or any OpenAI-compatible /v1/embeddings endpoint), returning vectors with dimension counts and usage stats. Private, fast, and your embedding spend drops to zero.


Step-by-Step Installation & Setup Guide

Prerequisites

  • Node.js 18+ (for npx)
  • Claude Code or Claude Desktop installed
  • A local LLM server OR cloud API credentials

Option A: LM Studio on Localhost (Zero Config)

  1. Install LM Studio from lmstudio.ai and load any model (Qwen 3 Coder recommended)
  2. Start the local server on port 1234 (default)
  3. Add Houtini LM to Claude Code:
# One command. That's it.
claude mcp add houtini-lm -- npx -y @houtini/lm

Claude detects LM Studio automatically and starts delegating immediately.

Option B: LLM on Network GPU Box

Got a dedicated inference server? Point Claude at it:

claude mcp add houtini-lm \
  -e HOUTINI_LM_ENDPOINT_URL=http://192.168.1.50:1234 \
  -- npx -y @houtini/lm

Replace 192.168.1.50:1234 with your GPU box's IP and port.

Option C: Cloud APIs (DeepSeek, Groq, Cerebras)

# DeepSeek - $0.28 per million tokens
claude mcp add houtini-lm \
  -e HOUTINI_LM_ENDPOINT_URL=https://api.deepseek.com \
  -e HOUTINI_LM_API_KEY=your-key-here \
  -- npx -y @houtini/lm

# Groq - ~750 tok/s
claude mcp add houtini-lm \
  -e HOUTINI_LM_ENDPOINT_URL=https://api.groq.com/openai \
  -e HOUTINI_LM_API_KEY=your-groq-key \
  -- npx -y @houtini/lm

Option D: OpenRouter (300+ Models)

claude mcp add houtini-lm \
  -e HOUTINI_LM_ENDPOINT_URL=https://openrouter.ai/api \
  -e HOUTINI_LM_API_KEY=sk-or-v1-... \
  -e HOUTINI_LM_MODEL=nvidia/nemotron-3-nano-30b-a3b:free \
  -- npx -y @houtini/lm

Auto-detection kicks in: attribution headers, reasoning.exclude, retry-with-backoff—all handled transparently.

Claude Desktop Configuration

Edit your claude_desktop_config.json:

Advertisement
{
  "mcpServers": {
    "houtini-lm": {
      "command": "npx",
      "args": ["-y", "@houtini/lm"],
      "env": {
        "HOUTINI_LM_ENDPOINT_URL": "http://localhost:1234"
      }
    }
  }
}

Verify Installation: The Shakedown

npm run shakedown

This end-to-end test exercises all seven tools and prints real performance data:

Summary

   7/7 steps passed on LM Studio, model=nvidia/nemotron-3-nano

| Tool              | OK  | TTFT (ms) | tok/s  | Tokens in→out        | Reasoning | Notes
| chat              | ✅  |      891  |   36.9 | 48→104               |        —  | answered
| custom_prompt     | ✅  |      872  |   43.9 | 170→333              |        —  | 5 valid items
| code_task         | ✅  |      857  |   41.6 | 180→189              |        —  | tests generated
| code_task_files   | ✅  |   11028   |   39.5 | 6891→3000            |        —  | cross-referenced
| embed             | ✅  |      —    |     —  | —                    |        —  | 768-dim vector

   Tokens offloaded: 10,915 (prompt: 7,289, completion: 3,626, reasoning: 0)

REAL Code Examples from the Repository

Example 1: Quick Start with Environment Variables

The README's installation commands are designed for copy-paste deployment. Here's the cloud API variant with full annotation:

# Add Houtini LM to Claude Code with DeepSeek cloud API
claude mcp add houtini-lm \
  -e HOUTINI_LM_ENDPOINT_URL=https://api.deepseek.com \
  -e HOUTINI_LM_API_KEY=your-key-here \
  -- npx -y @houtini/lm

What's happening: claude mcp add registers a new MCP server. The -e flags inject environment variables into the server process. HOUTINI_LM_ENDPOINT_URL tells Houtini LM where to send OpenAI-compatible requests; HOUTINI_LM_API_KEY becomes the Bearer token. The -- separator distinguishes Claude's flags from the command to run (npx -y @houtini/lm). The -y skips npm's install confirmation, enabling true one-liner setup.

Example 2: Claude Desktop Configuration with OpenRouter

{
  "mcpServers": {
    "houtini-lm": {
      "command": "npx",
      "args": ["-y", "@houtini/lm"],
      "env": {
        "HOUTINI_LM_ENDPOINT_URL": "https://openrouter.ai/api",
        "HOUTINI_LM_API_KEY": "sk-or-v1-...",
        "HOUTINI_LM_MODEL": "nvidia/nemotron-3-nano-30b-a3b:free"
      }
    }
  }
}

Deep dive: This JSON configures Claude Desktop's MCP client. The command/args spawn the server process. The env object sets process-level variables—note HOUTINI_LM_MODEL pins a specific model, overriding auto-routing. OpenRouter auto-detection triggers on the URL pattern, enabling: (1) proper attribution headers for fair use, (2) reasoning.exclude for thinking models, (3) jittered backoff on 429/5xx errors, and (4) parallel request allowance (no semaphore). The :free suffix in the model ID selects OpenRouter's zero-cost tier.

Example 3: Structured JSON Output with Schema

{
  "json_schema": {
    "name": "code_review",
    "schema": {
      "type": "object",
      "properties": {
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "line": { "type": "number" },
              "severity": { "type": "string" },
              "description": { "type": "string" }
            },
            "required": ["line", "severity", "description"]
          }
        }
      },
      "required": ["issues"]
    }
  }
}

Implementation pattern: Pass this as the json_schema parameter to chat or custom_prompt. LM Studio's grammar-based sampler constrains token generation to valid JSON matching this schema—guaranteed syntactic validity, not probabilistic hope. The "name" field identifies the schema for caching; "required" arrays enforce presence. Use this for: structured code reviews, API response parsing, configuration generation, or any downstream system needing machine-readable output. Claude receives the validated JSON, validates semantically, and incorporates into its reasoning.

Example 4: Session Metrics Resource

{
  "session": {
    "totalCalls": 14,
    "promptTokens": 3200,
    "completionTokens": 5250,
    "totalTokensOffloaded": 8450
  },
  "perModel": {
    "qwen3-coder-30b-a3b": {
      "calls": 14,
      "avgTtftMs": 2100,
      "avgTokPerSec": 15.2
    }
  }
}

Advanced usage: Access via the houtini://metrics/session MCP resource. Claude reads this proactively to make dynamic delegation decisions—if avgTokPerSec drops below a threshold on long tasks, it might keep work on Claude instead. Build automation that queries this resource every 100 calls to optimize your routing strategy. The totalTokensOffloaded figure is your provable ROI—show this to your manager when requesting local GPU hardware.


Advanced Usage & Best Practices

Prompt Engineering for Local Models

The gap between good and bad local results is prompt quality, not model capability. Houtini LM's author tested this extensively:

  • Send complete code — never truncate with .... Local models hallucinate missing details aggressively.
  • Be explicit about output format — "Return JSON array" or "bullet points only." Smaller models need this constraint.
  • Set specific personas — "Expert Rust developer who cares about memory safety" outperforms "helpful assistant" measurably.
  • State negative constraints — "No preamble," "max 5 bullet points," "reference line numbers."
  • Include surrounding context — imports, types, signatures for generation tasks.

Override the Router Strategically

Auto-routing fails on OpenRouter's 300+ model catalog (unknown models score zero, ties break arbitrarily). Pin explicitly:

# Per-process: set HOUTINI_LM_MODEL env var
# Per-call: pass "model" parameter to any tool
{
  "message": "Generate tests",
  "model": "nvidia/nemotron-3-nano-30b-a3b:free"
}

Per-call overrides per-process overrides auto-routing. Use this for A/B testing models on identical tasks.

Monitor Reasoning-Token Overhead

The stats footer shows reasoning-token percentage:

124 / 47,183 completion tokens spent on hidden reasoning (0.3%). Low — reasoning is effectively suppressed.

Above ~30%? Your reasoning_effort isn't being honored—investigate backend configuration. This is your canary for misconfigured thinking models.


Comparison with Alternatives

Feature Houtini LM Raw Claude Code Direct API Calls Generic MCP Proxy
Token cost for grunt work Near-zero (local) or cheap (cloud) Full frontier pricing Manual, no orchestration No intelligent routing
Model-aware delegation ✅ Auto-routes by task type ❌ All to Claude ❌ Manual selection ❌ Dumb pass-through
Performance tracking ✅ Real TTFT, tok/s, lifetime stats ❌ Basic usage only ❌ Per-call only ❌ None
Reasoning model handling ✅ Suppress/strip/inflate automatically N/A (Claude handles its own) ❌ Manual configuration ❌ None
Structured JSON output ✅ Grammar-constrained ❌ Prose only ✅ Via response_format ❌ Unreliable
Setup complexity One-liner Built into Claude Custom integration Varies
Privacy for sensitive code ✅ Local inference option ❌ All to cloud ✅ If local ✅ If local
Request serialization ✅ Auto for local, parallel for cloud N/A ❌ Manual queueing ❌ None

Verdict: Houtini LM wins on intelligent orchestration—it's not just a proxy, it's a delegation strategist that knows your models' capabilities and tracks real performance.


FAQ

Is Houtini LM free to use?

The MCP server is open-source (Apache-2.0) and free. You pay only for your chosen backend: $0 for local inference (your electricity), or cloud API rates (DeepSeek at $0.28/M tokens, etc.).

Will this slow down my Claude Code workflow?

3-30× slower wall-clock for delegated tasks—but Claude continues working in parallel. The real question: is saving $0.03-0.30 per thousand tokens worth 5-30 seconds? For batch tasks run overnight, absolutely.

Can I use this with Claude Desktop, not just Claude Code?

Yes. Use the JSON configuration in claude_desktop_config.json shown in the setup guide. All features work identically.

What if my local model returns garbage?

Claude QA's everything. The architecture explicitly keeps Claude as validator. Plus, quality metadata flags (TRUNCATED, think-blocks-stripped, tokens-estimated) inform Claude's trust decisions. Start with code_task on well-defined tasks—local models excel there.

Does this work with my existing Ollama setup?

Zero changes needed. Set HOUTINI_LM_ENDPOINT_URL=http://localhost:11434. Ollama's thinking models (Qwen3, DeepSeek-R1) are handled transparently—reasoning captured, output budget inflated automatically.

How do I know if delegation is actually saving money?

The 💰 footer updates every call with session and lifetime totals. The stats tool gives compact markdown↗ Smart Converter dumps. The houtini://metrics/session resource exposes JSON for programmatic monitoring. You'll have hard numbers from day one.

Can I contribute or add new backends?

Absolutely. See DEVELOPER.md for architecture docs, the reasoning-model pipeline, SQLite cache internals, and instructions for extending tools or backends.


Conclusion

The future of AI-assisted development isn't replacing Claude—it's orchestrating it intelligently. Houtini LM represents a mature, economically rational approach: frontier models for frontier problems, capable local models for bounded tasks, with zero friction between them.

The author's own stats tell the story: 147,432 tokens offloaded across 213 calls. That's not a prototype—that's production validation. The SQLite-backed model cache, the automatic reasoning handling, the performance persistence across sessions: this is battle-tested infrastructure, not a weekend hack.

Your move. Install it in 30 seconds, run the shakedown, watch your first delegation succeed, and never again pay frontier prices for intern work.

👉 Star Houtini LM on GitHub — and start cutting your Claude Code bill today.

Advertisement

Commentaires 0

Aucun commentaire pour l'instant. Soyez le premier à réagir !

Laisser un commentaire

Advertisement