Problem
All API routes are currently unprotected. There is no authentication for the admin console or the public API. This blocks production use.
Design
Admin key (full access)
Generated on first boot, stored as ADMIN_API_KEY env var.
Required on: all /admin/* routes, /api/agents write operations.
Service keys (scoped)
Created by admin via:
POST /api/admin/keys
{
"name": "my-integration",
"scopes": ["x402:quote", "x402:settle", "agents:read"],
"expiresAt": "2027-01-01"
}
Returns: { key: "osk_live_abc...", id: "key_123" }
Request auth
Authorization: Bearer osk_live_abc...
Or for simple integrations: ?apiKey=osk_live_abc...
Rate limits
| Tier |
Requests/min |
| No key |
10 |
| Free |
60 |
| Pro |
600 |
| Admin |
unlimited |
Rate limits enforced via Vercel KV (sliding window counter).
Admin UI
- Keys management page in admin console
- Show: name, scopes, last used, request count, status
- Revoke / rotate buttons
Files to create
lib/auth/api-keys.ts — key generation, validation, rate limiting
lib/auth/middleware.ts — Next.js middleware for route protection
middleware.ts — root middleware applying auth
app/admin/keys/page.tsx
🎁 Evidencia visual = reward extra
- Si tu PR incluye video demo o capturas de pantalla mostrando la funcionalidad pedida funcionando end-to-end, va a ser considerado para rewards de GrantFox en esta issue. No es obligatorio, pero suma mucho para la evaluación.
Problem
All API routes are currently unprotected. There is no authentication for the admin console or the public API. This blocks production use.
Design
Admin key (full access)
Generated on first boot, stored as
ADMIN_API_KEYenv var.Required on: all
/admin/*routes,/api/agentswrite operations.Service keys (scoped)
Created by admin via:
Returns:
{ key: "osk_live_abc...", id: "key_123" }Request auth
Or for simple integrations:
?apiKey=osk_live_abc...Rate limits
Rate limits enforced via Vercel KV (sliding window counter).
Admin UI
Files to create
lib/auth/api-keys.ts— key generation, validation, rate limitinglib/auth/middleware.ts— Next.js middleware for route protectionmiddleware.ts— root middleware applying authapp/admin/keys/page.tsx🎁 Evidencia visual = reward extra