# Brynq

**The operating system for AI workforces.**

Chain Claude, Gemini, and open-source models together. Brynq orchestrates them — you keep your keys.

```
You: "Analyze this report with Claude, get Gemini's opinion, summarize with Llama"
Brynq: Done. 3 models, 1 chain, 45 seconds.
```

## What is Brynq?

Brynq lets non-technical users chain AI models together through a simple chat interface. Connect your existing Claude/Gemini subscriptions, add free local models via Ollama, and Brynq orchestrates them into multi-step workflows.

- **Subscription login** — Log in with your Claude Pro, Gemini, or ChatGPT account
- **BYOK API keys** — Or bring your own API keys
- **Free tier** — Ollama runs locally on your hardware, no keys needed
- **5 chain strategies** — Sequential, Fan-Out, Debate, Refine, Single

## Quick Start

```bash
# Install
pip install brynq

# Start
brynq-runtime start

# Chat
brynq-runtime chat

# Run a multi-model chain
brynq-runtime chain "analyze this data with Claude then summarize with Llama"

# Check available models
brynq-runtime models
```

## Three Access Tiers

| Tier | Models | Auth | Cost |
|------|--------|------|------|
| **Free** | Ollama (Llama 3, Mistral, Phi) | None needed | $0 |
| **Subscriber** | Claude + Gemini + ChatGPT | OAuth login | Your existing subscription |
| **Developer** | All + custom models | BYOK API keys | Pay per token |

## Architecture

```
brynq.ai (Cloud)                        Your Machine (Runtime)
┌──────────────────────┐                ┌──────────────────────────┐
│ Chain Planner        │   signed       │ Plan Executor            │
│ Model Scorer         │   plans        │ ├── Ollama Bridge        │→ Local models
│ Prompt Engine        │◄──────────────►│ ├── Cloud Bridge         │→ Claude/Gemini
│ Skill Catalog        │   metadata     │ ├── Agent Bridge         │→ 3rd party
│                      │   only         │ OAuth Manager            │
│ Your content NEVER   │                │ Key Vault (encrypted)    │
│ touches our servers  │                │ Privacy Filter           │
└──────────────────────┘                └──────────────────────────┘
```

**Your data stays on your machine.** The cloud only sees request descriptions and execution metadata (timing, token counts). Never your documents, never your API keys.

## Project Structure

```
brynq/
├── runtime/           # The thin client (runs on your machine)
│   ├── app.py         # Local server (port 8003)
│   ├── cli.py         # brynq-runtime CLI
│   ├── executor/      # Plan execution engine
│   ├── auth/          # OAuth (Anthropic, Google, OpenAI)
│   ├── vault/         # Encrypted API key storage
│   ├── sandbox/       # 3rd party agent isolation
│   └── reporter/      # Privacy-safe metrics
├── app/               # Customer-facing web app (React + Vite)
└── docs/              # Documentation
```

## CLI Reference

```bash
brynq-runtime start              # Start runtime + open browser
brynq-runtime start --no-browser # Start without opening browser
brynq-runtime stop               # Stop the runtime
brynq-runtime status             # Show runtime status
brynq-runtime models             # List available models
brynq-runtime login claude       # OAuth login for Claude
brynq-runtime login gemini       # OAuth login for Gemini
brynq-runtime chat               # Interactive terminal chat
brynq-runtime chat --model llama3 # Chat with specific model
brynq-runtime chain "prompt"     # Run a multi-model chain
```

## Security

- **BYOK only** — Brynq never stores or proxies your API keys on our servers
- **Encrypted vault** — Local keys encrypted with Fernet (AES-128-CBC + HMAC-SHA256), PBKDF2 480K iterations, machine-bound
- **Signed plans** — HMAC-SHA256 signed execution plans with TTL
- **Privacy filter** — Only timing + token counts leave your machine, never content
- **Agent sandbox** — 3rd party agents run isolated with path protection and env scrubbing

## License

Apache License 2.0 — see [LICENSE](LICENSE)

## Links

- **Website**: [brynq.ai](https://brynq.ai)
- **Docs**: [docs/](docs/)
