The Brain

The Brain

"Claude orchestrates. Free AI does the heavy lifting. Git remembers everything."

🐍 Python
πŸ’° Saves Claude tokens
πŸ”€ 8 free providers
πŸ“Š Usage logging

How it works

Every AI task gets routed to the cheapest capable provider. Claude only handles what only Claude can do.

You β†’ Orchestrator (Claude) β†’ Router
                                    β†“
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  classification / yes-no  β†’  Cerebras   (FREE, ~284ms) β”‚
β”‚  factual Q&A / general    β†’  Groq       (FREE, ~366ms) β”‚
β”‚  summarisation / long textβ†’  Gemini     (FREE, 1M ctx) β”‚
β”‚  code generation          β†’  Mistral    (FREE) β”‚
β”‚  translation              β†’  Gemini     (FREE) β”‚
β”‚  deep reasoning / analysisβ†’  SambaNova  (FREE, 70B) β”‚
β”‚  creative writing         β†’  Mistral    (FREE) β”‚
β”‚  image generation         β†’  Pollinations (no key) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β†“
                    stats/usage.json (every call logged)

Why it exists

πŸ’Έ

Claude tokens are expensive

Simple tasks like classification, summarisation, and Q&A don't need Claude's intelligence β€” route them to free providers instead.

🎯

Different AIs excel at different tasks

Cerebras is the fastest. Gemini handles million-token contexts. SambaNova runs the biggest open models. Use each for what it does best.

πŸ“‹

Every call is logged

All usage goes to stats/usage.json. A nightly report shows how many tokens were saved vs. the cost of running everything through Claude.

πŸ”Œ

Drop-in for Claude Code

Lives in your global CLAUDE.md. Claude reads the routing table and delegates automatically β€” no extra steps.


Free Providers

Provider Model Best for Speed
Cerebras FREELlama 3.1 8BClassification, scoring, yes/no~284ms
Groq FREELlama 3.1 8BFactual Q&A, general~366ms
Gemini FREE2.5 Flash LiteSummarisation, translation, 1M context~541ms
Mistral FREEMistral SmallCoding, creative writing~1172ms
SambaNova FREELlama 3.3 70BDeep reasoning, analysis~1.4s
HuggingFace FREELlama 3 8BOpen-source fallback~924ms
Pollinations NO KEYFluxImage generationvaries

Get Started

1

Clone the repo

git clone https://github.com/SoylentAquamarine/the-brain.git
cd the-brain && pip install -r requirements.txt
2

Add your API keys

Copy config/keys.example.json to config/keys.json and add free keys from Cerebras, Groq, Gemini, Mistral, and SambaNova.

3

Add to your global CLAUDE.md

python delegate.py --provider cerebras --type classification --prompt "Is this a question?"

Claude reads your CLAUDE.md routing table and delegates automatically.