Skip to content

API for the pricing of Bedrock Foundational models

0

Is there any existing API where we get the pricing for the input and output tokens for a given bedrock foundational model?

2 Answers
0

Currently, AWS does not provide a specific API for retrieving the pricing of foundation models in Amazon Bedrock. The pricing information for Amazon Bedrock is typically made available through the official AWS pricing page and documentation.

Amazon Bedrock pricing is based on several factors including:

  • The specific foundation model being used
  • The volume of input and output tokens
  • Whether you're using On-Demand and Batch pricing or Provisioned Throughput
  • The AWS Region where you're using the service

For example, the Writer models have different pricing tiers:

  • Palmyra X4: $0.0025 per 1,000 input tokens and $0.010 per 1,000 output tokens
  • Palmyra X5: $0.0006 per 1,000 input tokens and $0.006 per 1,000 output tokens

If you need programmatic access to pricing information for your applications, you might consider creating your own pricing database based on the published rates and updating it regularly. You could also contact AWS support or your account representative to inquire about any potential future plans for a pricing API.

While there is an API called ListFoundationModelAgreementOffers that retrieves offers associated with foundation models, it does not specifically provide pricing information in the way you're asking for.
Sources
API for Bedrock Foundation models pricings. | AWS re:Post
Pricing
Amazon Bedrock pricing - Amazon Bedrock
ListFoundationModelAgreementOffers - Amazon Bedrock

answered a year ago

0

You can get pricing information for Amazon Bedrock foundational models through the AWS Price List API. Here's what you need to know:

1. AWS Price List API

2. Pricing Information Access Methods:

  • AWS Price List API (JSON and CSV formats)
  • AWS Price List Bulk API
  • AWS Pricing Calculator API

3. For real-time token counting and pricing estimation:

  • You can use the model-specific token counting libraries
  • For Claude models: use Anthropic's tokenizer
  • For Titan models: use AWS's token counting utilities
  • For other models: use their respective tokenizers
  1. Current pricing information can also be found in the AWS documentation.

Note: Pricing may vary by region and can change over time. It's recommended to always fetch the latest pricing information through the API rather than hardcoding values.

To implement this, you would need to:

  1. Set up AWS SDK access
  2. Use the Price List API client
  3. Query for "Bedrock" service pricing
  4. Filter for specific model pricing information

**[AWS Price List API] ** https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/price-changes.html

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.