@ai-billing/zai / createZaiV3Middleware
Function: createZaiV3Middleware()
createZaiV3Middleware<Defined in: zai/src/ai-sdk/language-model-middleware/v3/language-model-v3-zai-billing-middleware.ts:87 Creates a V3 billing middleware for the Z.ai provider (TTags>(options):LanguageModelV3Middleware
@ai-sdk/zai).
Deducts cache-read tokens from prompt tokens and reasoning tokens from completion tokens before
billing — reasoning tokens are a subset of completion_tokens (GLM has no separate reasoning rate), and
cached tokens are billed separately at the cache-read rate.
Type Parameters
TTags
TTags extends JSONObject
The shape of the tags object, extending DefaultTags.
Parameters
options
ZaiV3MiddlewareOptions<TTags>
Billing options; see ZaiV3MiddlewareOptions. A priceResolver is required.
Returns
LanguageModelV3Middleware
A V3 billing middleware instance for Z.ai.