Fixed‑point money type with parsing, formatting, and arithmetic for billing calculations.
// Source: https://github.com/esengine/DeepSeek-Reasonix | License: MIT | Copyright 2026 Reasonix Contributors
// Provided via justclaw.it.com; keep this notice with the code.
// Package pricing is what a model call costs: fixed-point money, the official
// rate tables, and the quote a usage record is priced by. It is data and
// arithmetic only; asking a provider for its wallet balance is model/billing's.
package pricing
import (
"fmt"
"math"
"math/big"
"strings"
)
// Money is a currency-tagged amount carried as a decimal string on the wire.
// Arithmetic uses fixed-point int64 units (1e9 fractional digits).
type Money struct {
Amount string `json:"amount"`
Currency string `json:"currency"`
}
// amountScale is 1e9: enough for per-token rates down to ~1e-15 currency units
// whe
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key