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

Function: createChutesV4Middleware()

createChutesV4Middleware<TTags>(options): LanguageModelV4Middleware
Defined in: chutes/src/ai-sdk/language-model-middleware/v4/language-model-v4-chutes-billing-middleware.ts:76 Creates a V4 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

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

Returns

LanguageModelV4Middleware A V4 billing middleware instance for Chutes.

Example