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

Function: createMistralV3Middleware()

createMistralV3Middleware<TTags>(options): LanguageModelV3Middleware
Defined in: mistral/src/ai-sdk/language-model-middleware/v3/language-model-v3-mistral-billing-middleware.ts:98 Creates a V3 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

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

Returns

LanguageModelV3Middleware A V3 billing middleware instance for Mistral.

Example