@ai-billing/togetherai / createTogetheraiV3Middleware
Function: createTogetheraiV3Middleware()
createTogetheraiV3Middleware<Defined in: togetherai/src/ai-sdk/language-model-middleware/v3/language-model-v3-togetherai-billing-middleware.ts:88 Creates a V3 billing middleware for the Together AI provider (TTags>(options):LanguageModelV3Middleware
@ai-sdk/togetherai).
Together AI’s usage payload does not report any cache fields, so cache-read/cache-write tokens are
always billed as zero; reasoning_tokens is read as a flat top-level field (not nested, unlike some
other OpenAI-compatible providers in this repo) and deducted from completion tokens before billing.
Type Parameters
TTags
TTags extends JSONObject
The shape of the tags object, extending DefaultTags.
Parameters
options
TogetheraiV3MiddlewareOptions<TTags>
Billing options; see TogetheraiV3MiddlewareOptions. A priceResolver is required.
Returns
LanguageModelV3Middleware
A V3 billing middleware instance for Together AI.