Skip to main content

Function: anthropicModelPricing()

anthropicModelPricing(modelId): AnthropicModelPrice | undefined

Defined in: packages/agentos/src/core/llm/providers/implementations/anthropicCatalog.ts:546

A Claude model's prices for a host that admits a call before it is made, as openAIModelPricing prices an OpenAI call: the host strips any anthropic: prefix first, as it does for OpenAI. Resolution is by an exact catalog id, else the id with its dated suffix removed, else the catalog row that is the id plus a dated suffix (a retired snapshot only by its exact id); an id the catalog does not name this way (claude-opus-4, claude) is undefined, never the provider's prefix guess, so a spend guard refuses what it cannot price instead of pricing it as another model.

Parameters​

modelId​

string | undefined

Returns​

AnthropicModelPrice | undefined

Prices in USD per 1K tokens, cacheRead being the row's cache-read rate or 0.1x its input price, and longContext (its own input, output and cacheRead over fromTokens) on a model priced by prompt length; undefined for an empty, unknown or unpriced id.