@standardagents/provider-pricing
v0.42.2
Published
Pure provider pricing tables and cost helpers for Standard Agents
Downloads
6,390
Readme
@standardagents/provider-pricing
Pure provider pricing tables and cost helpers for Standard Agents.
This package contains no provider SDKs and no runtime network calls. It is the
shared pricing source for provider packages, builder request logs, and hosted
platform accounting. Unknown model prices return undefined; callers that bill
money must fail closed instead of guessing.
import { calculateCerebrasUsageCost } from '@standardagents/provider-pricing';
const cost = calculateCerebrasUsageCost('zai-glm-4.7', {
promptTokens: 6298,
completionTokens: 284,
});For platform accounting, use the integer microcent helpers to avoid floating point rounding drift. Pass provider-specific billing fields through instead of flattening them: Google modality token details, generated image counts, Anthropic cache-write/read buckets, OpenAI long-context thresholds, cached tokens, and reasoning tokens all affect exact cost for at least one provider.
OpenAI entries track the standard token-pricing table from the official developer pricing page. They intentionally do not model Batch, Flex, Priority, Fast, or Ultrafast service tiers, regional uplift, hosted tool call fees, image-generation calculator pricing, or audio pricing; billing callers must reject those paths or account for them separately. The GPT-6 rows (gpt-6-astra, gpt-6-sol, gpt-6-luna, gpt-6.1-sol) were synced on 2026-10-01.
TypeSafe AI prices verified on 2026-10-06 cover jev-1.13.0, jev-latest, and
jev-preview: $0.042 per million input tokens and free output. Use
calculateTypeSafeUsageCost(model, { promptTokens, completionTokens }) for USD
or the generic integer helper with provider typesafe. Pass the native
usage.input_tokens total unchanged, including multi-question evaluations; do
not multiply the provider-reported usage by the question count. See
https://docs.typesafe.ai/models and https://docs.typesafe.ai/api. Aliases can move
upstream: these are the verified current rates, not a promise about future Jev
releases. Re-audit the alias mapping and rates when TypeSafe releases a model;
use jev-1.13.0 where a fixed version and price are required.
Catalog audit sources
The static tables were last reconciled on 2026-09-01 against these authoritative catalog and pricing surfaces:
- Anthropic:
GET https://api.anthropic.com/v1/modelsandhttps://platform.claude.com/docs/en/models/overview - Baseten:
GET https://api.baseten.co/v1/model_apis - Cerebras:
GET https://api.cerebras.ai/v1/modelsandhttps://inference-docs.cerebras.ai/models/overview - Cloudflare Workers AI:
GET https://api.cloudflare.com/client/v4/accounts/{account}/ai/models/searchandhttps://developers.cloudflare.com/workers-ai/platform/pricing/ - Google:
GET https://generativelanguage.googleapis.com/v1beta/modelsandhttps://ai.google.dev/gemini-api/docs/pricing - Groq:
GET https://api.groq.com/openai/v1/modelsand the model pages underhttps://console.groq.com/docs/model/ - Novita:
GET https://api.novita.ai/openai/v1/models - OpenAI:
GET https://api.openai.com/v1/modelsandhttps://developers.openai.com/api/docs/pricing - xAI:
GET https://api.x.ai/v1/models,GET https://api.x.ai/v1/language-models, andhttps://docs.x.ai/docs/models
Catalog entries whose billing unit cannot be represented by these token/image helpers, or whose provider publishes no nonzero price, remain unlisted. Never infer a price from a related model.
Anthropic cache reads normally cost 0.1x base input. Claude Fable 5.1 and Claude Mythos 5.1 are explicit exceptions at $0.25/MTok (0.025x base input), and the model-specific rate is used for both request costs and platform accounting.
import { calculateProviderUsageCostMicrocents } from '@standardagents/provider-pricing';
const microcents = calculateProviderUsageCostMicrocents('cerebras', 'zai-glm-4.7', {
input_tokens: 6298,
output_tokens: 284,
});