@ai-billing/anthropic / createAnthropicV4Middleware
Function: createAnthropicV4Middleware()
createAnthropicV4Middleware<Defined in: anthropic/src/ai-sdk/language-model-middleware/v4/language-model-v4-anthropic-billing-middleware.ts:62 Creates a V4 billing middleware for the Anthropic provider (TTags>(options):LanguageModelV4Middleware
@ai-sdk/anthropic).
Maps AI SDK usage into billing fields and resolves cost from pricing plus usage.
Type Parameters
TTags
TTags extends JSONObject
The shape of the tags object, extending DefaultTags.
Parameters
options
AnthropicV4MiddlewareOptions<TTags>
Billing options; see AnthropicV4MiddlewareOptions.
Returns
LanguageModelV4Middleware
A V4 billing middleware instance for Anthropic.