Log in·Sign up
BestRelay

Back to the Journal

Feature Costs Become Useful When Every Attempt Counts

Feature budgets need boundaries before they need dashboards

A product’s AI bill rarely explains which feature earned its place. A document assistant might generate one visible answer through retrieval, classification, drafting, and a failed retry. Counting only the final response makes that feature look cheaper than it is. Useful attribution starts with a product action and follows every billable attempt behind it.

Start by defining a small, stable feature catalog: document answers, meeting summaries, and suggested replies, for example. Assign each feature an owner and a measurable outcome. Keep feature identities separate from interface labels, which change more frequently than accounting boundaries should.

Every provider attempt needs a durable feature identity

Next, attach the feature identity when the product accepts an action, before background jobs or model calls begin. Carry an action identifier through queues, tool orchestration, retries, and fallbacks. Give each provider attempt its own identifier, while retaining its parent action. Record the environment, tenant, requested model, timestamps, and completion status.

This creates two useful views: the cost of individual attempts and the complete cost of delivering an outcome. Preserve attribution outside prompt text; accounting metadata should not depend on the model repeating it. Avoid logging sensitive customer content when identifiers and usage fields are sufficient.

Reported token categories need explicit pricing boundaries

Then capture the provider’s usage response and retain its original fields alongside normalized accounting fields. Separate uncached input, cache reads, cache writes, and output where applicable. Providers can report cache usage differently, so determine whether a category is already included in an input total before calculating charges. Otherwise, one token can accidentally become two expenses.

BestRelay, which publishes this walkthrough, is a quality-first API relay that forwards each request to the official model named in it without substitution. Its pay-as-you-go billing uses provider-reported token counts, with cache reads and writes priced separately. Store the applicable rate and billing unit with each attempt so historical costs survive later price changes.

Retries and shared work belong in feature totals

Now aggregate attempts under their originating action. Include failed or canceled attempts whenever they incur charges, rather than assuming unsuccessful work was free. Treat missing usage as unresolved, not zero. Streaming interruptions deserve particular attention because your application might lose the final usage message even when the provider performed billable work.

Allocate shared work with an explicit rule. Charge a dedicated retrieval summary to its consuming feature; distribute genuinely shared preprocessing using a documented basis, such as consumption counts. Keep infrastructure overhead separate if allocating it would create false precision. Consistency matters more than a complicated allocation formula.

Outcome metrics reveal waste that token totals conceal

Calculate cost per attempted action, per completed action, and per accepted outcome. Each answers a different operating question. As an illustrative example, a feature spending thirty dollars across one thousand attempts costs three cents per attempt. If only six hundred outcomes meet your acceptance criterion, its cost per accepted outcome is five cents.

Track latency and quality beside these figures. Lower token spend is not an improvement if users repeatedly regenerate answers or abandon the workflow. For experiments, compare equivalent tasks and include retries, cache behavior, and evaluation costs. Keep development traffic separate from production so testing spikes do not masquerade as customer demand.

Reconciliation turns feature estimates into trustworthy operating numbers

Finally, reconcile daily usage totals against billing records, grouping discrepancies by model, rate period, and token category. Check rounding, currency conversion, delayed usage, and missing attempts before changing allocation rules. Distinguish consumed usage from account funding: top-ups are not feature expenses. BestRelay members can earn referral commission when invited users top up; record that separately from inference consumption.

BestRelay works with Claude Code, Codex, Gemini CLI, and any OpenAI SDK, but attribution still belongs in your application’s execution path. Create a BestRelay account to test this workflow. Begin with one feature, verify its ledger against actual charges, and expand only after the numbers reconcile.

Want to try the models discussed here? Sign up