@ai-billing/amazon-bedrock / createAmazonBedrockV4Middleware
Function: createAmazonBedrockV4Middleware()
createAmazonBedrockV4Middleware<Defined in: amazon-bedrock/src/ai-sdk/language-model-middleware/v4/language-model-v4-amazon-bedrock-billing-middleware.ts:93 Creates a V4 billing middleware for the Amazon Bedrock provider (TTags>(options):LanguageModelV4Middleware
@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
AmazonBedrockV4MiddlewareOptions<TTags>
Billing options; see AmazonBedrockV4MiddlewareOptions. A priceResolver is
required.
Returns
LanguageModelV4Middleware
A V4 billing middleware instance for Amazon Bedrock.