DEV Community

nRouter
nRouter

Posted on

Splitting the AI bill: when the LLM half outgrows the marketplace

A multi-service AI platform earns its keep early. One account, one SDK, one invoice, and your product gets text generation, OCR, speech and translation without four vendor evaluations. The trouble starts quietly, when one line on that invoice stops behaving like the others.

For most teams the line is language. Chat completions grow from a feature into the product's centre of gravity — most of the spend, most of the incidents, and every compliance question — while the controls around them are still the controls a marketplace builds evenly for every task type. Three walls show up, usually in this order.

Wall one: governance designed per-task, not per-token

An OCR call and a chat completion do not need the same controls. OCR needs throughput and accuracy. A completion needs a prompt version, an injection check on the input, a PII check on the output, and an eval that tells you whether last week's prompt edit quietly broke four cases while fixing the one you were looking at. Platforms that treat both as "an AI task" build the controls that generalise. The LLM-specific ones arrive last, if they arrive.

Wall two: attribution stops at the task type

When language is a small share of the bill, nobody asks which team spent it. When it is most of the bill, somebody does — and the answer they need is per team, per customer, per prompt template. A category total ("text generation was the big line last month") is not attribution. It is a sum wearing a label.

Wall three: breadth is a roadmap decision

Keeping many task types normalised across many providers is real, unglamorous engineering work, and it consumes the budget that would otherwise go to routing depth, evals and governance. A focused gateway spends the same budget on one task type. Neither allocation is wrong. They just produce different products two years out, and you are choosing which one to be a customer of.

The boundary is the honest part

Splitting does not mean consolidating. What a specialised gateway serves is the generative half:

  • Served: chat and text generation, text-to-speech, speech-to-text.
  • Not served, permanently: OCR and document parsing, image analysis, translation endpoints, sentiment and entity-extraction endpoints.

Your OCR client keeps pointing where it points today. Both SDKs living in one codebase is not a transition state; it is the end state, and any comparison that hides that is selling you a rewrite.

The switch itself is two lines

Because both sides speak the OpenAI wire format, moving a language call site is a base URL and a key:

const client = new OpenAI({
  baseURL: "https://api.nrouter.ai/v1",
  apiKey: process.env.NROUTER_API_KEY,
});
Enter fullscreen mode Exit fullscreen mode

Model strings, message arrays, tool calls and streaming consumers do not change. What changes is what sits behind the call: a fallback chain in the router config instead of client-side retry, budget ceilings scoped to an organisation, a team, a user or a single key, virtual keys per downstream customer, and a per-request cost written on the response itself — x-nr-request-id, x-nr-request-cost, x-nr-cost-status. When the cost cannot be computed, the header is absent and the status says unpriced. It is never reported as zero, because dashboards happily sum zeros into a confident, wrong total.

One use case deserves a mention because it only exists in the split world: text that came out of a document is the highest-risk input a model in your stack will ever read — unstructured, customer-supplied, and the classic indirect-injection route. An output guardrail on the completion that summarises that text is worth more than one on a chat box, and it is the kind of control a per-token platform builds and a per-task one defers.

Do the invoice test before anything else

Pull last month's invoice. Isolate the language line — text generation, plus speech-to-text and text-to-speech if you use them — and set everything else aside entirely. Divide language spend by total AI spend. Under about half, the two-vendor overhead probably is not worth it yet. Well over half, and it is worth pricing properly, including any plan tier you would have to buy to unlock the LLM-side controls you actually need.

And the stay cases are real: three or more task types in production, a team too small to reconcile two vendors, a model you depend on that the gateway does not serve, or a completed SOC 2 Type II report needed this quarter. A comparison with no losses is an advertisement.

The full comparison, including the served/not-served table and the move/stay checklists: Eden AI alternative

Top comments (0)