A transparent, edge-first API gateway for Claude, OpenAI, and Gemini with built-in usage analytics, rate limiting, and beautiful dashboards.
- Transparent Proxy: Forwards Claude, OpenAI, and Gemini API requests without wrapping or modifying the API
- Edge Runtime: Global distribution with Vercel Edge for ultra-low latency
- Rate Limiting: Per-minute and per-day limits enforced at the edge with Vercel KV
- Quota Management: Token-based quotas with real-time tracking
- Usage Analytics: Detailed logging with cost tracking and model breakdowns
- No User Auth: Users view usage by searching with their API key (no login required)
- Admin Dashboard: Full control over API keys, quotas, and analytics
- Streaming Support: SSE streaming responses with real-time token extraction
npm installCreate .env.local:
DATABASE_URL=postgresql://...neon.tech/conduit?sslmode=require
KV_REST_API_URL=https://....kv.vercel-storage.com
KV_REST_API_TOKEN=xxx
NEXTAUTH_SECRET=your-secret-32-chars
NEXTAUTH_URL=http://localhost:3000
CRON_SECRET=your-long-random-cron-secret
METRICS_SECRET=your-long-random-metrics-secret
API_KEY_ENCRYPTION_KEY=your-256-bit-hex-key
CLAUDE_API_KEY=sk-ant-your-key-herenpm run db:pushCreate your first admin user to access the dashboard:
Interactive mode (recommended):
npm run db:seedOr specify credentials directly:
npm run db:seed -- --email admin@example.com --password securepass --name "Admin User"The script will:
- ✅ Validate email format
- ✅ Hash the password securely (bcrypt)
- ✅ Create the admin user in the database
- ✅ Warn if using a weak password
npm run devVisit http://localhost:3000
- Login at http://localhost:3000/login with your admin credentials
- Go to http://localhost:3000/admin/keys
- Click "Create New Key"
- Enter your Claude API key and set limits
- Copy the generated key (shown once)
- Go to http://localhost:3000/usage
- Enter your API key
- View usage stats and remaining quota
curl -X POST http://localhost:3000/api/claude/v1/messages \
-H "Authorization: Bearer sk-cond_xxx" \
-H "Content-Type: application/json" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-3-5-sonnet-20241022",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello!"}]
}'
### Make OpenAI API Requests (ChatGPT / Responses)
```bash
curl -X POST http://localhost:3000/api/openai/v1/responses \
-H "Authorization: Bearer sk-cond_xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.1-codex-mini",
"input": "Explain what this repository does."
}'curl -X POST http://localhost:3000/api/gemini/v1beta/models/gemini-1.5-flash:generateContent \
-H "Authorization: Bearer sk-cond_xxx" \
-H "Content-Type: application/json" \
-d '{
"contents": [{ "role": "user", "parts": [{ "text": "Hello!" }] }]
}'
## Tech Stack
- Next.js 16 + TypeScript
- Neon PostgreSQL
- Vercel KV (Redis)
- Drizzle ORM
- Tailwind CSS
## Project Structure
src/ ├── app/ │ ├── (public)/usage/ # User dashboard │ ├── (admin)/admin/ # Admin dashboard │ ├── api/ │ │ ├── claude/[...path]/ # Main proxy │ │ ├── openai/[...path]/ # OpenAI proxy │ │ ├── gemini/[...path]/ # Gemini proxy │ │ ├── admin/keys/ # Key management │ │ └── usage/ # Usage API │ └── page.tsx # Landing ├── lib/ │ ├── auth/ # API key validation │ ├── proxy/ # Proxy & streaming │ ├── rate-limit/ # Rate limiting │ ├── analytics/ # Usage tracking │ └── db/ # Database └── types/ # TypeScript types
## Deployment
### Vercel (Recommended)
```bash
vercel
Set up Neon PostgreSQL and Vercel KV in Vercel Dashboard > Storage.
- Set
NEXTAUTH_SECRET,API_KEY_ENCRYPTION_KEY,CRON_SECRET, andMETRICS_SECRETto strong random values - Set
NEXTAUTH_URLand optionallyNEXT_PUBLIC_APP_URLto your canonical HTTPS origin - Provision Neon PostgreSQL and Vercel KV before enabling traffic
- Run
npm run buildin CI for every change - Configure the cron jobs in vercel.json
- Keep
.env.locallocal-only and use.env.exampleas the shareable template - Wire a real provider-backed cache warming implementation before enabling that admin workflow
- Admin routes are protected with NextAuth and proxy-level gating; restrict admin user creation operationally
- Rotate encryption keys regularly
- Never log full API keys
- Enable monitoring and alerts
- Use HTTPS everywhere
MIT