Skip to main content
@ai-billing/cerebras
@ai-billing/cerebras / createCerebrasV3Middleware

Function: createCerebrasV3Middleware()

createCerebrasV3Middleware<TTags>(options): LanguageModelV3Middleware
Defined in: cerebras/src/ai-sdk/language-model-middleware/v3/language-model-v3-cerebras-billing-middleware.ts:95 Creates a V3 billing middleware for the Cerebras provider (@ai-sdk/cerebras). Deducts cache-read tokens from prompt tokens and reasoning tokens from completion tokens before billing the base rates — Cerebras charges only non-cached input at the prompt rate, cached input separately at the cache-read rate, and reasoning tokens (a subset of completion_tokens) at the completion rate.

Type Parameters

TTags

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

Parameters

options

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

Returns

LanguageModelV3Middleware A V3 billing middleware instance for Cerebras.

Example