Mubit and Neon AI Gateway Integration Reduces Token Usage by 73%
Mubit and Neon AI Gateway integration reduces token usage by 73% through a small model tuned on its own traffic, improving efficiency and lowering costs.
Overview of Mubit and Neon AI Gateway Integration
Mubit and Neon AI Gateway have integrated to create an agent that reduces its own frontier-model token usage by 73%. This integration leverages Neon Functions, Lakebase Postgres, and AI Gateway to route routine steps through a small model tuned on its own traffic. According to Anil Peri, CEO at Mubit, 'Mubit sits in between and learns from every call, so an agent on Neon gets cheaper and more reliable the more it runs.' The system is designed to allow agents on Neon to call frontier models through a single endpoint, as stated by the Neon team. This approach aims to optimize costs and improve performance by reducing reliance on large models for routine tasks.
How the Agent Operates with Mubit and Neon
The agent operates by leveraging Mubit and Neon to reduce reliance on large frontier models. In the example provided, a data analyst agent answers business questions over Postgres, but the setup is applicable to any agent on Neon that interacts with frontier models through AI Gateway (source). Once Mubit has tuned a small model for routine steps, it serves those steps itself, allowing the agent to avoid repeating mistakes based on verified runs. For instance, answering a question like 'What was net revenue by country in August 2026?' would typically require about 10 model calls using gpt-5.5 alone. However, Mubit ensures that only steps the small model has proven it can perform are delegated to it, while gpt-5.5 retains responsibility for writing SQL queries by design (source).
Performance Metrics and Token Reduction
In performance tests conducted by Mubit, the agent demonstrated significant improvements in efficiency when integrated with a tuned small model. According to the results, the setup using gpt-5.5 alone achieved an accuracy of 60%, with 21.7k input tokens per question, costing $5.79 for 60 runs and taking 26 seconds per question. When combined with Mubit lessons, accuracy increased to 68%, reducing input tokens to 14.3k, lowering the cost to $4.30, and decreasing time per question to 20.1 seconds. Further integration with a tuned small model maintained 65% accuracy while cutting input tokens to 5.9k, reducing costs to $1.78 and decreasing time per question to 15.6 seconds. The tuned model handled approximately two-thirds of the calls, resulting in a 73% reduction in gpt-5.5 tokens and a 40% improvement in speed, as reported by Mubit's tests.
Handling Schema Changes and Data Consistency
Handling schema changes and maintaining data consistency is a critical challenge in database management. According to Shankha Dutta, CTO of Mubit, Neon branches allow for the creation of a copy of the backend in seconds, enabling efficient testing of schema migrations without the need for data dumping and restoration. To demonstrate how an agent copes with schema changes, two versions of the same database are required—one before the migration and one after, with identical business data to ensure the only difference is the schema. The migration only commits if revenue totals match before and after, ensuring both branches describe the same business. The agent-control system stores the agent's runs, verdicts, and lessons separately from demo data, allowing demo branches to be reset or migrated without losing historical information. The agent, its data, and its frontier-model calls operate on a Neon backend.
Implementation Details and Configuration
Implementation Details and Configuration involve setting up the agent to route requests through Mubit and Neon AI Gateway. As a human developer, you would store your AI Gateway token in a Mubit project once, as that project's only provider key Hacker News Show. The agent then keeps its OpenAI SDK and changes two settings: importing the OpenAI module and configuring the API key and base URL to point to Mubit's endpoint. From then on, until a tuned model takes over a step, every call goes through Mubit to Neon AI Gateway and back unchanged Hacker News Show. This configuration is applicable to any agent on Neon that calls frontier models through AI Gateway Hacker News Show.
Sources and reporting notes
Based on published source material. No independent hands-on testing is claimed.