Skip to main content
@ai-billing/amazon-bedrock
@ai-billing/amazon-bedrock / createAmazonBedrockV3Middleware

Function: createAmazonBedrockV3Middleware()

createAmazonBedrockV3Middleware<TTags>(options): LanguageModelV3Middleware
Defined in: amazon-bedrock/src/ai-sdk/language-model-middleware/v3/language-model-v3-amazon-bedrock-billing-middleware.ts:93 Creates a V3 billing middleware for the Amazon Bedrock provider (@ai-sdk/amazon-bedrock). Bills the full inputTokens at the prompt rate and adds cache-read/cache-write cost on top — Bedrock’s Converse API reports inputTokens excluding cached tokens, unlike providers whose prompt-token count already includes them.

Type Parameters

TTags

TTags extends JSONObject The shape of the tags object, extending DefaultTags.

Parameters

options

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

Returns

LanguageModelV3Middleware A V3 billing middleware instance for Amazon Bedrock.

Example