Usage and pricing
opentine normalizes provider consumption and estimates cost from a pinned, effective-dated catalog. Provider usage is not a final invoice: credits, taxes, enterprise terms, regional adjustments, and post-processing may differ.
Normalized records
Usage keeps exclusive input, output, cache-read, cache-write, and reasoning dimensions so the same token is not charged twice. BillingResult reports complete, partial, unknown, or unmetered, plus its known subtotal, warnings, calculation inputs, catalog provenance, and selected rate card.
All arithmetic uses Decimal. The legacy numeric cost field remains the known USD subtotal, so it may be nonzero while an incomplete billing.amount_usd is null.
Catalog resolution
- Explicit adapter or run
rates=, when the reported model still matches. - An explicitly selected catalog or
TINE_PRICING_CATALOG. - Workspace
.tine/pricing.json. - User
$XDG_CONFIG_HOME/opentine/pricing.json. - The bundled signed snapshot.
- An explicit unknown result, never another provider's price.
tine pricing list --provider openai
tine pricing show openai gpt-5.6 --json
tine pricing check
tine pricing update ./new-signed-catalog.jsonInference never downloads prices. Updates are explicit and signed catalogs must verify before installation. Unsigned local overlays can represent negotiated discounts or infrastructure cost without altering the signed upstream snapshot.
Coverage is not an allowlist
The signed snapshot includes provider-scoped cards for current OpenAI, Anthropic, Kimi, DeepSeek, Gemini, Grok/xAI, GLM/Z.AI, Qwen, Groq, Together, Mistral/Ministral, and OpenRouter Hermes families. Any model identifier can still run; an identifier without an exact effective card remains visibly unknown.
Streaming and strict budgets
Some OpenAI-compatible services do not return stream usage unless include_usage=True, while others reject that field. opentine uses a provider allowlist and adapter overrides rather than sending it everywhere. Confirm billing.status on a short streamed call before trusting cost enforcement.
1from opentine import Budget
2
3budget = Budget(
4 max_cost=1.00,
5 max_steps=25,
6 strict_cost=True,
7 on_breach="stop",
8)
strict_cost=True stops before the next model call after a hosted price or observed usage dimension becomes indeterminate. Local adapters default to unmetered, not “free”; add explicit rates to account for infrastructure.
Read the tagged pricing reference for exact rate-card and overlay rules.