As organizations scale their AI workloads on Amazon Bedrock, understanding what’s driving spending turns into essential. Groups may must carry out chargebacks, examine price spikes, and information optimization selections, all of which require price attribution on the workload stage.
With Amazon Bedrock Tasks, you’ll be able to attribute inference prices to particular workloads and analyze them in AWS Price Explorer and AWS Information Exports. On this submit, you’ll learn to arrange Tasks end-to-end, from designing a tagging technique to analyzing prices.
How Amazon Bedrock Tasks and value allocation work
A undertaking on Amazon Bedrock is a logical boundary that represents a workload, reminiscent of an utility, surroundings, or experiment. To attribute the price of a undertaking, you connect useful resource tags and go the undertaking ID in your API calls. You possibly can then activate the price allocation tags in AWS Billing to filter, group, and analyze spend in AWS Price Explorer and AWS Information Exports.
The next diagram illustrates the end-to-end move:
Determine 1: Finish-to-end price attribution move with Amazon Bedrock Tasks
Notes:
- Amazon Bedrock Tasks assist the OpenAI-compatible APIs: Responses API and Chat Completions API.
- Requests with out a undertaking ID are mechanically related to the default undertaking in your AWS account.
Stipulations
To observe together with the steps on this submit, you want:
Outline your tagging technique
The tags that you just connect to tasks grow to be the size you could filter and group by in your price studies. We advocate that you just plan these earlier than creating your first undertaking. A typical method is to tag by utility, surroundings, group, and value heart:
| Tag key | Objective | Instance values |
| Software | Which workload or service | CustomerChatbot, Experiments, DataAnalytics |
| Surroundings | Lifecycle stage | Manufacturing, Improvement, Staging, Analysis |
| Staff | Possession | CustomerExperience, PlatformEngineering, DataScience |
| CostCenter | Finance mapping | CC-1001, CC-2002, CC-3003 |
For extra steering on constructing a value allocation technique, see Greatest Practices for Tagging AWS Assets. Together with your tagging technique outlined, you’re able to create tasks and begin attributing prices.
Create a undertaking
Together with your tagging technique and permissions in place, you’ll be able to create your first undertaking. Every undertaking has its personal set of price allocation tags that move into your billing information. The next instance reveals how you can create a undertaking utilizing the Tasks API.
First, set up the required dependencies:
$ pip3 set up openai requests
Create a undertaking together with your tag taxonomy:
The OpenAI SDK makes use of the OPENAI_API_KEY surroundings variable. Set this to your Bedrock API key.
import os
import requests
# Configuration
BASE_URL = "https://bedrock-mantle..api.aws/v1"
API_KEY = os.environ.get("OPENAI_API_KEY") # Your Amazon Bedrock API key
def create_project(title: str, tags: dict) -> dict:
"""Create a Bedrock undertaking with price allocation tags."""
response = requests.submit(
f"{BASE_URL}/group/tasks",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content material-Sort": "utility/json"
},
json={"title": title, "tags": tags}
)
if response.status_code != 200:
increase Exception(
f"Didn't create undertaking: {response.status_code} - {response.textual content}"
)
return response.json()
# Create a manufacturing undertaking with full tag taxonomy
undertaking = create_project(
title="CustomerChatbot-Prod",
tags={
"Software": "CustomerChatbot",
"Surroundings": "Manufacturing",
"Staff": "CustomerExperience",
"CostCenter": "CC-1001",
"Proprietor": "alice"
}
)
print(f"Created undertaking: {undertaking['id']}")
The API returns the undertaking particulars, together with the undertaking ID and ARN:
{
"id": "proj_123",
"arn": "arn:aws:bedrock-mantle:::undertaking/"
}
Save the undertaking ID. You’ll use it to affiliate inference requests within the subsequent step. The ARN is used for IAM coverage attachment when you should limit entry to this undertaking. Repeat this for every workload. The next desk reveals a pattern undertaking construction for a corporation with three purposes:
| Undertaking title | Software | Surroundings | Staff | Price Heart |
| CustomerChatbot-Prod | CustomerChatbot | Manufacturing | CustomerExperience | CC-1001 |
| CustomerChatbot-Dev | CustomerChatbot | Improvement | CustomerExperience | CC-1001 |
| Experiments-Analysis | Experiments | Manufacturing | PlatformEngineering | CC-2002 |
| DataAnalytics-Prod | DataAnalytics | Manufacturing | DataScience | CC-3003 |
You possibly can create as much as 1,000 tasks per AWS account to suit your group’s wants.
Affiliate inference requests together with your undertaking
Together with your tasks created, you’ll be able to affiliate inference requests by passing the undertaking ID in your API calls. The next instance makes use of the Responses API:
from openai import OpenAI
shopper = OpenAI(
base_url="https://bedrock-mantle..api.aws/v1",
undertaking="", # ID returned while you created the undertaking
)
response = shopper.responses.create(
mannequin="openai.gpt-oss-120b",
enter="Summarize the important thing findings from our This fall earnings report."
)
print(response.output_text)
To take care of clear price attribution, all the time specify a undertaking ID in your API calls moderately than counting on the default undertaking.
Activate price allocation tags
Earlier than your undertaking tags seem in price studies, you will need to activate them as price allocation tags in AWS Billing. This one-time setup connects your undertaking tags to the billing pipeline. For extra details about activating price allocation tags, see the AWS Billing documentation.
It might take as much as 24 hours for tags to propagate to AWS Price Explorer and AWS Information Exports. You possibly can activate your tags instantly after creating your first undertaking to keep away from gaps in price information.
View undertaking prices
With tasks created, inference requests tagged, and value allocation tags activated, you’ll be able to see precisely the place your Amazon Bedrock spend goes. Each dimension that you just outlined in your taxonomy is now obtainable as a filter or grouping in your AWS Billing price studies.
AWS Price Explorer
AWS Price Explorer supplies the quickest solution to visualize your prices by undertaking. Full the next steps to assessment your prices by undertaking:
- Open the AWS Billing and Price Administration console and select Price Explorer.
- Within the Filters pane, broaden Service and choose Amazon Bedrock.
- Below Group by, choose Tag and select your tag key (for instance, Software).

Determine 2: Price Explorer displaying every day Amazon Bedrock spending grouped by the Software tag
For extra methods to refine your view, see Analyzing your prices and utilization with AWS Price Explorer.
For extra granular evaluation and line-item element together with your undertaking tags, see Creating Information Exports within the AWS Billing documentation.
Conclusion
With Amazon Bedrock Tasks, you’ll be able to attribute prices to particular person workloads and monitor spending utilizing the AWS instruments that your group already depends on. As your workloads scale, use the tagging technique and value visibility patterns coated on this submit to keep up accountability throughout groups and purposes.
For extra info, see Amazon Bedrock Tasks documentation and the AWS Price Administration Person Information.
Concerning the authors

