Skip to main content
@ai-billing/gmicloud
@ai-billing/gmicloud / createGmicloudV4Middleware

Function: createGmicloudV4Middleware()

createGmicloudV4Middleware<TTags>(options): LanguageModelV4Middleware
Defined in: gmicloud/src/ai-sdk/language-model-middleware/v4/language-model-v4-gmicloud-billing-middleware.ts:91 Creates a V4 billing middleware for the GMI Cloud provider (@ai-sdk/gmicloud). Deducts cache-read tokens from prompt tokens before billing — GMI Cloud 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

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

Returns

LanguageModelV4Middleware A V4 billing middleware instance for GMI Cloud.

Example