@ai-billing/deepinfra / createDeepinfraV3Middleware
Function: createDeepinfraV3Middleware()
createDeepinfraV3Middleware<Defined in: deepinfra/src/ai-sdk/language-model-middleware/v3/language-model-v3-deepinfra-billing-middleware.ts:105 Creates a V3 billing middleware for the DeepInfra provider (TTags>(options):LanguageModelV3Middleware
@ai-sdk/deepinfra).
Deducts cache-read tokens from prompt tokens before billing — DeepInfra charges only non-cached input at
the prompt rate, and cached tokens separately at the cache-read rate.
DeepInfra’s raw usage payload may include its own estimated_cost (a USD estimate). That value is never
used as the billed cost — cost is always computed from the resolved ModelPricing table — but when
present and numeric it is additionally surfaced as usage.rawProviderCost for informational purposes.
Type Parameters
TTags
TTags extends JSONObject
The shape of the tags object, extending DefaultTags.
Parameters
options
DeepinfraV3MiddlewareOptions<TTags>
Billing options; see DeepinfraV3MiddlewareOptions. A priceResolver is required.
Returns
LanguageModelV3Middleware
A V3 billing middleware instance for DeepInfra.