Skip to main content
@ai-billing/chutes
@ai-billing/chutes / createChutesV3Middleware

Function: createChutesV3Middleware()

createChutesV3Middleware<TTags>(options): LanguageModelV3Middleware
Defined in: chutes/src/ai-sdk/language-model-middleware/v3/language-model-v3-chutes-billing-middleware.ts:76 Creates a V3 billing middleware for the Chutes provider (llm.chutes.ai via @ai-sdk/openai-compatible). Deducts cache-read tokens from prompt tokens before billing — Chutes 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

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

Returns

LanguageModelV3Middleware A V3 billing middleware instance for Chutes.

Example