Skip to content
reaatech

Files · OpenRouter Code Sandbox for SMB Financial Modeling

76 (1 binary, 587.7 kB total)attempt 1

README.md·1824 B·markdown
markdown
# OpenRouter Code Sandbox for SMB Financial Modeling
 
> A secure, budget‑aware AI code sandbox that lets non‑technical SMB analysts run Python financial models and get repaired, validated results without writing code.
 
A tutorialized reference solution from [reaatech.com](https://reaatech.com), demonstrating how to build production-grade AI systems with the `@reaatech/*` package family.
 
## What it does
 
A secure, budget-aware AI code sandbox for SMB financial modeling. Wraps OpenRouter + E2B with REAA safety libraries.
 
## Architecture
 
The execution pipeline: user query → confidence-router (ROUTE/CLARIFY/FALLBACK) → OpenRouter LLM generates Python code → budget check via agent-budget-engine → E2B sandbox execution (firewall-protected via tool-use-firewall-core) → structured-repair-core fixes malformed output → cost telemetry via llm-cost-telemetry → session persistence via session-continuity with Upstash Redis.
 
## Quick Start
 
```bash
cp .env.example .env
# Fill in API keys: OPENROUTER_API_KEY, E2B_API_KEY, UPSTASH_REDIS_REST_URL/TOKEN
pnpm install
pnpm dev
```
 
## API Reference
 
| Endpoint | Method | Description |
|---|---|---|
| `/api/code` | POST | Execute a financial modeling query. Body: `{ query, sessionId?, tenant? }` |
| `/api/health` | GET | Health check returning `{ status, timestamp }` |
 
## Running locally
 
```bash
pnpm install
pnpm test            # vitest run with coverage
pnpm dev             # next dev
```
 
## Project layout
 
```
app/                  Next.js App Router pages + API routes
src/                  services, lib, adapters
tests/                vitest suite (mirrors src/)
packages/             API references for every dependency (read these first)
DEV_PLAN.md           build plan for this recipe
```
 
## License
 
MIT — see [LICENSE](./LICENSE).