-
-
P402.IO INFOGRAPHIC
-
LANDING PAGE / SOLUTION
-
PRODUCT FEATURES
-
PRODUCT BENEFITS
-
MISSION CONTROL
-
INTELLIGENCE DASHBOARD (POWERED BY GEMINI PRO 3)
-
SECURITY AUDIT (POWERED BY GEMINI FLASH 3)
-
DISCOVERY BAZAAR
-
FACILITATORS
-
CUSTOM PAYMENT ROUTER
-
CUSTOM POLICIES SETUP
-
END TO END PAYMENT DEMO
-
SDK DOCUMENTATION
-
API DOCUMENTATION
-
MCP DOCUMENTATION
-
QUICKSTART 1
-
QUICKSTART 2
-
QUICKSTART 3
-
QUICKSTART 4
-
QUICKSTART 5
-
NODE SIGNUP
Inspiration
I am a CS Professor of AI Software Development. At the end of every semester, I see the same tragedy. Students build brilliant AI agents that are economically doomed. They hardcode expensive models like Opus 4.5 or GPT-5.2 for simple tasks. They burn budgets on redundant queries. They struggle with payment infrastructure that was not built for machines.
I realized that for the Agentic Economy to exist, agents need more than just intelligence. They need fiscal responsibility. But agents do not know how to save money. They need a manager.
That is why we built P402.
What it does
P402 is an intelligent middleware that sits between your application and AI providers via OpenRouter. It acts as a Protocol Economist, autonomously managing your AI budget so you do not have to.
It utilizes the Gemini 3 Intelligence Quadplex:
1. The Brain (Gemini 3 Pro)
A Marathon Agent that uses 1M token context to analyze 7-day routing histories. It performs forensic audits to find inefficiencies.
2. The Sentinel (Gemini 3 Flash)
A real-time monitor running at a low "Thinking Level" that watches for anomalies in under 500ms.
3. The Memory (text-embedding-004)
A Semantic Cache that intercepts redundant requests before they hit the provider. This reduces costs to $0.
4. The Hands (Tool Use)
7 custom tools that Gemini executes autonomously. These tools adjust routing weights, set rate limits, and substitute models.
🛡️ The Billing Guard (6-Layer Defense)
Beyond optimization, P402 prevents financial disaster with a military-grade Billing Guard. It enforces a 6-layer defense strategy including rate limiting, circuit breakers, concurrency control, and anomaly detection. This ensures no rogue agent or infinite loop can ever drain your wallet.
How we built it
P402 is a Production-Grade Monolith built with Google Antigravity.
- Core Stack: Next.js 15, TypeScript, PostgreSQL (Prisma), Redis (BullMQ for queues).
- Intelligence Layer: We integrated Gemini 3 Pro via the direct Google API rather than OpenRouter. This ensures the "Manager" is separate from the "Workers."
- Tooling: We built a custom
ToolExecutorclass. This allows Gemini to call functions likeconfigure_model_substitutionandadjust_routing_weights. - Vector Search: We use
text-embedding-004to hash incoming prompts. If a prompt creates a vector similarity >0.95 with a stored query, P402 returns the cached response instantly.
Challenges we ran into
The "Watcher" Paradox
We did not want the cost of monitoring the AI to exceed the savings from optimizing the AI. We solved this by using Gemini 3 Flash for the high-frequency "Sentinel" loop. We only call Gemini 3 Pro for the deep-dive "Economist" audits.
Tool Hallucination
Initially, the model would try to optimize routes that did not exist. We fixed this by providing strict JSON schemas for the 7 custom tools. We also used Gemini's high-reasoning mode to validate actions before execution.
Accomplishments that we're proud of
We are most proud of the "Two-Brain Architecture."
Most apps send a prompt to an LLM and get a response. P402 sends the prompt to OpenRouter, but simultaneously sends the metadata of that transaction to Gemini 3.
This means P402 is an application that thinks about itself. It is self-healing, self-optimizing, and fully autonomous.
What's next for P402.io
- Agent-to-Agent Negotiation: Allowing Gemini to negotiate prices with other agents in real-time.
- Predictive Scaling: Using the 1M context window to predict traffic spikes before they happen.
- Public Launch: Moving from a hackathon prototype to a live SaaS for the millions of developers using OpenRouter.
Built With
- base
- ethers
- google-antigravity
- google-gemini-3-flash
- google-gemini-3-pro
- google-text-embedding-004
- next.js
- openrouter
- postgresql
- rainbowkit
- redis
- typescript
- view/wagmi


Log in or sign up for Devpost to join the conversation.