Skip to main content

Claude thinks. Gemini speaks. Save up to 80% on AI API costs.

Project description

⚡ RelayAI

Claude thinks. Gemini speaks. Save up to 80% on AI API costs.

RelayAI is an open-source terminal AI tool (like Claude Code) where Claude plans and reasons, then passes the answer to Gemini to output — dramatically reducing your Claude API costs by offloading output tokens to Gemini's free tier.

User Input → Claude (thinks & reasons) → Gemini (presents output) → Terminal

💡 Why RelayAI?

Claude charges $15/million output tokens. Output tokens are 5x more expensive than input.

RelayAI flips this: Claude produces a concise internal plan/answer, then Gemini (free tier) handles the expensive output step.

Normal Claude RelayAI
Per query (avg) $0.031 $0.006
100 queries/day ~$95/mo ~$18/mo
1000 queries/day ~$945/mo ~$180/mo
Savings ~80%

🚀 Install

pip install relayai

Or from source:

git clone https://github.com/yourusername/relayai
cd relayai
pip install -e .

⚙️ Setup

relayai login

You'll be asked to provide:

  1. Claude API Key — from console.anthropic.com
  2. Gemini access — either:
    • Gemini API Key (from ai.google.dev — free)
    • Google Account Login (OAuth — no key needed)

🧑‍💻 Usage

# Ask a single question
relayai "write a binary search in python"

# Fix code / debug
relayai "fix this bug in my FastAPI route"

# Pipe files
cat main.py | relayai "review this code"

# Interactive chat mode
relayai --chat

# Show Claude's internal reasoning (debug)
relayai --verbose "explain transformers"

# Check your config
relayai status

🔁 How It Works

┌─────────────┐
│  User Input │
└──────┬──────┘
       │
       ▼
┌─────────────────────────────────────┐
│  Claude Sonnet (via your API key)   │
│  • Understands the full request     │
│  • Reasons step by step             │
│  • Produces complete answer         │
│  • Uses minimal output tokens       │
└──────────────┬──────────────────────┘
               │ Claude's answer becomes
               │ Gemini's INPUT (free)
               ▼
┌─────────────────────────────────────┐
│  Gemini Flash (free tier)           │
│  • Receives Claude's answer         │
│  • Presents it clearly              │
│  • All output tokens are FREE       │
└──────────────┬──────────────────────┘
               │
               ▼
┌─────────────┐
│  Terminal   │
│  Output     │
└─────────────┘

📂 Project Structure

relayai/
├── relayai/
│   ├── __init__.py
│   ├── cli.py            # Terminal commands
│   ├── auth.py           # Login & credential management
│   ├── claude_client.py  # Claude API (thinker)
│   ├── gemini_client.py  # Gemini API (speaker)
│   └── pipeline.py       # The bridge logic
├── setup.py
├── requirements.txt
└── README.md

🤝 Contributing

PRs welcome! This is fully open source. Feel free to:

  • Add streaming support
  • Add more model options
  • Improve the OAuth flow
  • Build a config TUI

📄 License

MIT — free to use, modify, and distribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

relayai-1.0.0.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

relayai-1.0.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file relayai-1.0.0.tar.gz.

File metadata

  • Download URL: relayai-1.0.0.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for relayai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 40afb28774b5ecd95f6045a0ecf9b2b92753c4fa12635013b68483022df47030
MD5 4fc2d1c39b729305ecb11da24694a48d
BLAKE2b-256 427cdefc6f1d0bfa1ebb67a354268f5d35447179a936381250d9131c79cca038

See more details on using hashes here.

File details

Details for the file relayai-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: relayai-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for relayai-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 210a585f5b1767ed1150502e8021bd94fadf7c9adbcf9b3f6445ca53bce01ea9
MD5 a065e8d4c084a1e0abf25ab7a3690925
BLAKE2b-256 92877a3ff3d5ef2b08a7a295a1a87325762d24f176ab3cd72ee1d9504a7e8098

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page