Corpland Revenue

Cost tracking

Report what OpenRouter, fal and other providers charge you, and see the margin each customer leaves.

One costs.track call after every paid provider call. Attach the customer and the feature so the cost lands on the right margin.

OpenRouter

OpenRouter returns the exact cost of every generation. Ask for it with usage: { include: true } and report it as is.

const completion = await openrouter.chat.completions.create({
  model: "anthropic/claude-sonnet-4.5",
  messages,
  usage: { include: true },
});

await trackCost(
  {
    customer_id: user.id,
    provider: "openrouter",
    model: completion.model,
    feature_id: "scripts",
    amount_usd: completion.usage.cost,
    units: completion.usage.total_tokens,
    unit: "tokens",
  },
  `cost:${completion.id}`
);

fal

Most fal models bill per second of compute or per output. When the response does not carry a price, report the units and let a rate card price them.

const result = await fal.subscribe("fal-ai/minimax/speech-02-hd", { input: { text } });

await trackCost(
  {
    customer_id: user.id,
    provider: "fal",
    model: "fal-ai/minimax/speech-02-hd",
    feature_id: "voiceovers",
    units: text.length,
    unit: "characters",
  },
  `cost:${result.requestId}`
);

Anything else

The provider name is free text in lowercase. DataForSEO returns cost on every task; Firecrawl and Cloudinary bill in credits, which you report as units.

Rate cards

When a cost arrives with units and unit but no amount_usd, Revenue multiplies by the matching rate card: the card for that provider, model and unit, else the card for that provider and unit with any model. Revenue ships defaults from public price pages for fal, DataForSEO, Firecrawl, Cloudinary and OpenRouter. Add your own under Provider costs, Rate cards when you have a negotiated price or a model the defaults miss.

Rows that match no card are stored as unpriced with a cost of zero, and the dashboard warns you. Add a card and new rows are priced from then on.

What to attribute

  • Always send customer_id when a customer caused the cost. Unattributed costs appear in totals but no customer's margin.
  • Send feature_id with the same id you track usage with. The pricing advisor divides cost by usage per feature, so without it there is no suggested price.
  • Use the provider's request id as the idempotency key so a retried job does not double count.

On this page