Path: redb-route/tests/redb.Route.Tests.Llm/TestHelpers/FlatCostCalculator.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/tests/redb.Route.Tests.Llm/TestHelpers/FlatCostCalculator.cs
----
using redb.Route.Llm.Engine.Governance;
namespace redb.Route.Tests.Llm.TestHelpers;
///
/// Deterministic pricing double: every call costs the same, regardless of tokens. Enough to prove the
/// engine prices iterations and enforces a cost ceiling; a per-token table would only test the table.
///
public sealed class FlatCostCalculator : ICostCalculator
{
private readonly decimal _costPerCall;
/// Creates a calculator charging USD for every response.
public FlatCostCalculator(decimal costPerCall)
{
_costPerCall = costPerCall;
}
/// Number of times the engine asked for a price.
public int Estimates { get; private set; }
///
public decimal? Estimate(LlmUsage usage, LlmConnectionFactory factory)
{
Estimates++;
return _costPerCall;
}
}