Skip to main content
@ai-billing/anthropic
@ai-billing/anthropic / createAnthropicV3Middleware

Function: createAnthropicV3Middleware()

createAnthropicV3Middleware<TTags>(options): LanguageModelV3Middleware
Defined in: anthropic/src/ai-sdk/language-model-middleware/v3/language-model-v3-anthropic-billing-middleware.ts:62 Creates a V3 billing middleware for the Anthropic provider (@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

AnthropicV3MiddlewareOptions<TTags> Billing options; see AnthropicV3MiddlewareOptions.

Returns

LanguageModelV3Middleware A V3 billing middleware instance for Anthropic.