Skip to content
Systems

Models

Models is a single endpoint in front of every major model provider. It speaks the chat completions format most libraries already use, so adopting it is a change of base URL. Each call is attributed to the customer who caused it, priced, and checked against the caps you set. Because Dianthan also takes that customer's payments, it can show you what each one paid against what their calls cost.

What Models does

One endpoint, current models

Hundreds of models from every major provider behind one API, kept current as they're released and retired. Your code names a model and nothing else changes.

Fallbacks

List models in order of preference. If the first is unavailable or overloaded, the next one answers the same request.

Spend caps per customer

A monthly cap for the whole app and another for each of your customers. A call that would pass either is refused with a clear error before it costs anything.

Cost on every call

Model, tokens, latency and price are logged for each request, attributed to the customer, and returned in a response header.

Allow-lists

Choose which models each app may call, so a typo or a prompt can't switch production to the most expensive model available.

Margin per customer

What each customer paid this month against what their model calls cost, least profitable first. Revenue comes from Billing, cost from every call.

Credits for your customers

Sell model usage as prepaid credits with a markup you set. Each call draws down the customer's balance and is refused when it runs out.

Your own provider keysIn preview

Use contracts you already have with a provider while keeping caps, logs and fallbacks in one place.

Know what each customer is worth.

A product that calls models usually knows its total model bill and its total revenue, but never the two side by side for one customer. Dianthan takes the payment and routes the call, so it can put them together.

  • Find who you lose money on

    A customer on a $49 plan who runs $71 of model calls doesn't show up in a provider's dashboard. In the margin view they are the first row.

  • Act where you see it

    Cap that customer, move heavy features onto prepaid credits with a markup, or change what a plan includes, without a deploy.

  • Price from evidence

    Tag calls with the feature that made them and see cost per customer, per plan and per feature before you set or change a price.

  • One field to send

    Pass the customer's id as user on each call. Revenue comes from Billing; nothing else to connect.

An example month. Lumen Labs pays for Pro and costs more in model calls than the plan brings in; Fjord is on the free plan and costs $6.80.

In your code.

Point an existing client at Dianthan. Name the customer so caps and costs land on them.

TypeScript
import OpenAI from "openai";

const ai = new OpenAI({
  baseURL: "https://api.dianthan.com/v1/ai",
  apiKey: process.env.DIANTHAN_KEY,
});

const reply = await ai.chat.completions.create({
  model: "anthropic/claude-sonnet-5.5",
  messages: [{ role: "user", content: prompt }],
  user: session.userId, // per-customer cap and cost
});

Better with.

What Models does once another system is switched on in the same app.

  • Billing

    Each customer's model cost is set against what they paid, so you can see who you lose money on.

  • Identity

    Every model call is attributed to a signed-in person, so caps and costs are per customer.

  • Metering

    Usage you meter and model spend sit on the same customer, so a plan's limits can cover both.

  • Observe

    Model latency, errors and spend sit beside the rest of your product's activity.

Endpoints.

The main routes. The API reference lists every parameter and response.

  • POST /v1/ai/chat/completions
  • GET /v1/ai/models
  • GET /v1/ai/usage
  • GET /v1/ai/margin
  • POST /v1/ai/credits

Included in the plan.

Models is part of every account: free within hard limits, then included in the $29 plan that covers every system and every app.

  • Included

    Every model, at the provider's price. Per-customer caps, cost logs and margin. Fallbacks, allow-lists and credits.

  • Beyond that

    Provider price plus 8%, billed monthly.