Skip to main content
@ai-billing/mistral
@ai-billing/mistral / createMistralV4Middleware

Function: createMistralV4Middleware()

createMistralV4Middleware<TTags>(options): LanguageModelV4Middleware
Defined in: mistral/src/ai-sdk/language-model-middleware/v4/language-model-v4-mistral-billing-middleware.ts:98 Creates a V4 billing middleware for the Mistral provider (@ai-sdk/mistral). Deducts cache-read tokens from prompt tokens before billing — Mistral charges only non-cached input at the prompt rate, and cached tokens separately at the cache-read rate.

Type Parameters

TTags

TTags extends JSONObject The shape of the tags object, extending DefaultTags.

Parameters

options

MistralV4MiddlewareOptions<TTags> Billing options; see MistralV4MiddlewareOptions. A priceResolver is required.

Returns

LanguageModelV4Middleware A V4 billing middleware instance for Mistral.

Example