billing/BillingCostCalculator.java

Nubase · src/main/java/ai/nubase/ai/gateway/billing/BillingCostCalculator.java · java · Apache-2.0
payments

BillingCostCalculator.java from OtterMind/Nubase

// Source: https://github.com/OtterMind/Nubase | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package ai.nubase.ai.gateway.billing;

import ai.nubase.ai.gateway.billing.BillingModels.PriceVersion;
import ai.nubase.ai.gateway.dto.TokenUsage;

import java.math.BigDecimal;
import java.math.RoundingMode;

public final class BillingCostCalculator {

    private static final BigDecimal ONE_MILLION = new BigDecimal("1000000");
    private static final int MONEY_SCALE = 8;

    private BillingCostCalculator() {
    }

    public static BigDecimal reserve(
            PriceVersion price,
            long estimatedInputTokens,
            long maximumOutputTokens,
            BigDecimal sa

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key