# Feature-Level Acceptance Criteria

Source: `docs/business/prd.md` §5

## P0 Features (Phase 1 -- Must Ship)

| ID | Feature | Acceptance Criteria |
|----|---------|-------------------|
| F-001 | OpenAI API Proxy | 1. POST /v1/chat/completions returns valid response. 2. Streaming works. 3. /v1/models lists all available. 4. Response includes model + cost metadata. |
| F-002 | Anthropic API Proxy | 1. POST /v1/messages returns valid Anthropic response. 2. Streaming works. 3. Same backend routing as OpenAI dialect. |
| F-003 | Ollama Auto-Discovery | 1. Detect Ollama at localhost:11434. 2. List all models. 3. Register in routing table. 4. Works if Ollama starts after LLMHosts. |
| F-004 | BYOK Cloud Keys | 1. `llmhosts keys add openai sk-xxx` encrypts and stores. 2. Validated on add. 3. Never in logs. 4. `llmhosts keys list` shows providers only. |
| F-005 | Rule-Based Router | 1. Explicit model → that model. 2. "auto" → best local match. 3. No local → cloud fallback. 4. Decision logged with reason. |
| F-006 | Cost Tracking | 1. Local = $0. 2. Cloud = provider pricing. 3. Running total by day/week/month. 4. "Estimated cloud cost" for local requests. |
| F-007 | Exact Hash Cache | 1. Same query = same response in <5ms. 2. 0% false positive rate. 3. Hit/miss logged. 4. `llmhosts cache stats` works. |
| F-008 | TUI Dashboard | 1. Savings ticker. 2. Recent requests with routing decisions. 3. Cache hit rate. 4. Backend health. 5. Real-time updates. |
| F-009 | Web Dashboard | 1. React SPA served by proxy. 2. Same data as TUI. 3. WebSocket real-time. 4. Baseline capture on first visit. |
| F-010 | `llmhosts serve`/`up` | 1. Starts proxy, discovers Ollama, loads keys, starts dashboard. 2. Prints API endpoints. 3. <5 second startup. 4. Ctrl+C graceful. |
| F-011 | `llmhosts doctor` | 1. Checks Python, Ollama, GPU, keys, proxy, cache, router. 2. Clear pass/fail. 3. Actionable fix suggestions. 4. <10 seconds. |
| F-012 | Hardware Detection | 1. GPU name, VRAM, driver. 2. CPU, RAM, disk. 3. Profile table. 4. Refresh on start. |

## P1 Features (Phase 2 -- Should Ship)

| ID | Feature | Acceptance Criteria |
|----|---------|-------------------|
| F-013 | Tunnel / Relay | 1. Auto-detects available provider. 2. Generates HTTPS URL. 3. Works with Cursor/Claude Code. 4. Encrypted E2E. **Conversion trigger.** |
| F-014 | kNN Router (Tier 1) | 1. ONNX embedding <15ms. 2. FAISS nearest-K. 3. Handles 75% of routing. 4. 5% exploration. 5. Retrainable. |
| F-015 | Entity Namespace Cache | 1. Extracts language/framework entities. 2. Isolated by namespace. 3. Cross-namespace never matches. 4. <10ms extraction. |
| F-016 | vCache Semantic (Tier 2) | 1. Adaptive per-embedding thresholds. 2. <1% FP rate (formally guaranteed). 3. Online logistic regression. |
| F-017 | Cloud Cost Dashboard | 1. Imports billing data. 2. Shows current/projected/savings. 3. Works without local install (web-only). |
| F-018 | Multi-Device Mesh | 1. Register up to 5 devices. 2. Route to device with GPU. 3. Per-device usage on dashboard. |
| F-019 | Honest Savings | 1. Baseline captured from user. 2. Real savings calculation. 3. Routing decision per request. 4. Never >100%. |
| F-020 | ModernBERT Router (Tier 2) | 1. 6-signal analysis. 2. <50ms GPU, <100ms CPU. 3. Handles 20% of routing. 4. PII detection → local-only. |

## Status: All P0 and P1 features are IMPLEMENTED and TESTED (2,413+ backend tests, 808+ frontend tests).
