@ai-billing/huggingface / createHuggingfaceV3Middleware
Function: createHuggingfaceV3Middleware()
createHuggingfaceV3Middleware<Defined in: huggingface/src/ai-sdk/language-model-middleware/v3/language-model-v3-huggingface-billing-middleware.ts:92 Creates a V3 billing middleware for the Hugging Face provider (TTags>(options):LanguageModelV3Middleware
@ai-sdk/huggingface).
Deducts cache-read tokens from prompt tokens before billing — Hugging Face 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
HuggingfaceV3MiddlewareOptions<TTags>
Billing options; see HuggingfaceV3MiddlewareOptions. A priceResolver is required.
Returns
LanguageModelV3Middleware
A V3 billing middleware instance for Hugging Face.