Skip to main content
@ai-billing/alibaba
@ai-billing/alibaba / createAlibabaV3Middleware

Function: createAlibabaV3Middleware()

createAlibabaV3Middleware<TTags>(options): LanguageModelV3Middleware
Defined in: alibaba/src/ai-sdk/language-model-middleware/v3/language-model-v3-alibaba-billing-middleware.ts:98 Creates a V3 billing middleware for the Alibaba provider (@ai-sdk/alibaba). Deducts cache-read tokens from prompt tokens before billing — Alibaba 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

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

Returns

LanguageModelV3Middleware A V3 billing middleware instance for Alibaba.

Example