Metadata-Version: 2.4
Name: breviadev
Version: 0.1.1
Summary: Save 55-93% on Claude API tokens. Same quality, fraction of the cost.
Project-URL: Homepage, https://brevia.dev
Project-URL: Documentation, https://brevia.dev/docs
Project-URL: Repository, https://github.com/brevia-dev/brevia
Project-URL: Issues, https://github.com/brevia-dev/brevia/issues
Author-email: Brevia <hello@brevia.dev>
License: Proprietary
License-File: LICENSE
Keywords: anthropic,claude,cost-reduction,llm,proxy,tokens
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Requires-Dist: click>=8.0
Requires-Dist: httpx>=0.27
Requires-Dist: rich>=13.0
Requires-Dist: starlette>=0.38
Requires-Dist: uvicorn>=0.30
Description-Content-Type: text/markdown

# Brevia

**Use Claude smarter. Save 55-93% on tokens without losing quality.**

Brevia is a local proxy that makes your Claude API calls cheaper and often better. It runs between your tools and Anthropic, automatically trimming unnecessary context so Claude focuses on what actually matters.

Works with Claude Code, Cursor, Continue, aider, and anything that uses the Anthropic SDK. No code changes needed.

---

## Quick Start

```bash
pip install breviadev
brevia login          # Opens browser — sign in with GitHub or Google
brevia serve          # Starts on localhost:8420
```

Then add to your shell profile (`~/.zshrc`, `~/.bashrc`):

```bash
export ANTHROPIC_BASE_URL=http://localhost:8420
```

That's it. Everything works exactly as before — but cheaper and often better.

---

## How It Works

```
Your Tool (Claude Code, Cursor, etc.)
    │
    │  ANTHROPIC_BASE_URL=http://localhost:8420
    ▼
┌─────────────────────────────────┐
│           Brevia                │  ← Runs on your machine
│                                 │
│  Reads your request, figures    │
│  out what's relevant, removes   │
│  the noise, and enhances the    │
│  prompt for better results.     │
└─────────────────────────────────┘
    │
    │  Smaller, focused payload
    ▼
┌─────────────────────────────────┐
│      api.anthropic.com          │  ← Your API key
│                                 │     Your account
│  Claude gets less noise,        │     You pay less
│  gives better answers.          │
└─────────────────────────────────┘
    │
    │  Response streams back
    ▼
Your Tool (unchanged behavior)
```

**Why it works:** When Claude gets 2k tokens of the right code instead of 95k tokens of everything, it gives more precise answers. Less noise in, better signal out.

---

## Benchmarks

Tested on real codebases (Django, FastAPI, psf/requests) with Claude Opus:

| Context Size | Cost Savings | Quality |
|-------------|--------------|---------|
| < 2k tokens | 0% (passthrough) | Same |
| 10k tokens | ~55% | Same |
| 50k tokens | 76-93% | Same |
| 95k tokens | 76% | **Better** (more precise) |

### Real-World Example

| Setup | Total Cost | Compared to Direct |
|-------|-----------|-------------------|
| Direct Claude (full context) | $0.836 | — |
| With Brevia | $0.278 | **67% cheaper** |

### Large Data (50k token input)

| Metric | Value |
|--------|-------|
| Token reduction | 97% |
| Cost savings | 93% |
| Accuracy | Perfect (found all issues) |

Full benchmark details: [benchmarks/BENCHMARKS.md](benchmarks/BENCHMARKS.md)

---

## Commands

| Command | What it does |
|---------|-------------|
| `brevia login` | Sign in (opens browser) |
| `brevia serve` | Start Brevia |
| `brevia serve -p 9000` | Start on a different port |
| `brevia stats` | See how much you've saved |
| `brevia stats -d 30` | See last 30 days |
| `brevia logout` | Sign out |

---

## What You'll See

When `brevia serve` is running:

```
╭─ Brevia ─────────────────────────────────────╮
│ Brevia is running                             │
│                                               │
│   Address:  http://127.0.0.1:8420             │
│   User:     @yourname                         │
│   Status:   Active                            │
│                                               │
│   Add to your shell:                          │
│   export ANTHROPIC_BASE_URL=http://127.0.0.1:8420 │
╰───────────────────────────────────────────────╯
```

Check your savings anytime with `brevia stats`:

```
╭─ Brevia Stats ────────────────────────────────╮
│                                               │
│   Days active:    12                          │
│   Total requests: 847                         │
│   Tokens saved:   4,230,000                   │
│   Avg reduction:  71%                         │
│   Est. $ saved:   $63.45                      │
╰───────────────────────────────────────────────╯
```

---

## Where It Helps Most

- **Big contexts (50k+ tokens):** The more noise, the more Brevia saves
- **Multi-file projects:** Keeps only the files that matter for your question
- **Repetitive code:** Strips boilerplate so Claude focuses on the real problem

## Where It Doesn't Help

- **Short prompts (< 2k tokens):** Already small — Brevia passes these through unchanged
- **Already focused:** If you're manually sending only relevant code, there's nothing to trim

---

## Privacy & Security

- **Your API key stays yours** — Brevia passes it through, never stores it
- **Your code stays local** — nothing leaves your machine
- **We only collect usage stats** — token counts and savings, never content
- Credentials are stored locally in `~/.brevia/` with restricted file permissions

---

## Platforms

- macOS (Intel + Apple Silicon)
- Linux (x86_64 + ARM64)
- Windows 10+

Requires Python 3.10+.

---

## Enterprise

Need team-wide deployment, custom rules, or dedicated support?

**Contact us:** enterprise@brevia.dev

---

## How It Compares

| | Brevia | Prompt Caching | Manual Trimming |
|---|---|---|---|
| Setup | One command | Built into SDK | You do it yourself |
| Effort | Zero — automatic | Zero — automatic | High — manual work |
| Savings | 55-93% | Varies (cache hits only) | Depends on you |
| Quality | Same or better | Same | Risk of cutting too much |
| Works with | Any Anthropic tool | SDK only | Your code only |

Brevia works alongside prompt caching — use both for maximum savings.

---

## License

Proprietary. Free for individual use. See [LICENSE](LICENSE) for details.

---

Built for developers who'd rather spend money on building, not on sending noise to an API.
