How our sync engine learned to keep 1,000 lanes honest
new-api-sync started as a script that copied prices. Ten months later it tests, prices and polices every route we serve. What it does, and the gaps it closed one by one.
Every model on UnoRouter is served by one or more lanes, a route to an upstream that runs the model. Something has to decide which lanes exist, whether they work, whether they are what they claim, and what they cost. That is new-api-sync, our open-source sync engine.
It started on January 15 as a small script that copied models and prices into our gateway. Today it watches 1,092 live lanes for 2,004 models, has recorded 16,487 test verdicts and has caught 3,456 lanes that were not what they claimed. This post is how it got there.
What it does today
- Discovers what every upstream offers and keeps the catalog in step, adding, updating and retiring lanes on its own.
- Tests every lane before it serves a single request. Plain replies, streaming and tool calls come first, then the identity and authenticity checks.
- Prices each model against what the market lists it for, with a hard cap at that price. It never charges more than the official price.
- Keeps watching after launch. Lanes are retested on a schedule, and live traffic is compared lane against lane.
- Accounts for every test request it pays for, in real money.
How it got here
Each part of the sync exists because something went wrong without it.
Lanes that did not work. The first version trusted the upstream's model list, and plenty of listed models simply failed. So every lane now has to answer real requests before it goes live, streaming and tool calls included. See the code
Lanes that were not the model they claimed. In April we found 183 lanes sold as Claude that were coding assistants wearing a Claude name tag. That became our authenticity checks, which we later published as ai-model-verifier. See the code
Prices that were simply wrong. Upstreams publish prices in every format, and some are plain mistakes. The sync now takes the list price that several public sources agree on, and caps every lane at it. See the code
Testing everything on every run. Re-probing thousands of lanes each cycle was slow and expensive. Verdicts are now cached with an expiry. A pass lasts days on a stable lane, a fail expires and is retested, and three failed retests make it permanent. The cache is shared, so every machine running the sync sees the same history. See the code
Lanes that changed after passing. Some upstreams swap what they serve once a lane has been approved. So the riskiest lanes are rechecked every few hours, and a source that fails on several models is now blocked as a whole, not one model at a time. See the code
Selling below cost. Some upstreams bill in their own units that are worth far less than they look. Each lane is now priced from what it really costs us, with a margin floor, and lanes that cannot clear it are dropped. See the code
Lanes that pass a test but fail real users. A short probe cannot see everything. Since October a lane grader compares every lane with the other lanes of the same model on real traffic and pulls the outliers, including lanes that bill more tokens than any model could produce. See the code
Only Claude was checked properly. The checks now cover every model maker. About 30 rules look at identity, hidden instructions, reasoning, billing, text encoding and fake replies. Two of them come from lm-detector, an open-source project that fingerprints a model from the numbers it picks and the tokenizer it counts with. A new rule only records what it finds at first, and it gets the power to pull a lane once its record shows it is right. See the code
The last missing piece was knowing what testing costs. Every test request now lands in a ledger in real dollars. Testing the whole catalog costs a few dollars a day, and we can see which models and sources that money goes to. See the code
What is still open
A lane can still change between two checks, and some behaviour only shows on real traffic, which is why the grader and your reports matter. When something slips through, it usually becomes a new rule within a day.
Use it
The sync is open source on GitHub, and the checks are on GitHub and npm as ai-model-verifier. You can test any provider yourself with our model tester.
It is not tied to UnoRouter. The sync works with any gateway built on new-api, including an unmodified one. There it only manages the channels it created and leaves your own channels, models, prices and groups alone, so you can point it at a gateway you already run.
Trending models this week
Pick the image and video models of your own OpenAI-compatible provider in UnoRouter chat. Prompts go straight from your browser to the provider, and the results are saved on your device.
Qronos AI runs its LLM gateway on UnoRouter and hosts a Discord community for AI roleplay and storytelling. Who they are, and how our partner program works.
Consent on UnoRouter now belongs to the provider instead of the free model, and one consent covers every model that provider serves, paid or free. Here is who asks, how to consent or object, and what API clients will see.
Comments
Loading comments