On this page
- Part 1: why token cost is now an architecture problem
- The token math has changed
- Tactics are not a system
- The lever map
- Governance levers on AWS
- Platform levers on AWS
- Technology levers
- Part 2: Datadog’s AI at scale
- Not all AI usage is equal
- Governance: one central AI gateway
- Abstract the model
- The evaluation hub
- Protect the developer experience
- Platform: one fleet, day and night
- Technology: training their own models
- Bringing it together
- What we take away at Bedrock
- Credits
This article is part of a series on AWS re:Invent 2026, written by Bedrock Streaming team members who attended the event.
Why is my AI bill going up, and what can I do about it? This was the single question of the session “How Datadog optimizes cost per token for GenAI at scale” (AIM3317, level 300) at AWS re:Invent 2026 in Las Vegas.
Sujatha Kuppuraju (AWS) opened with the general picture: why AI agents change the cost model and which levers AWS offers. Julien Launay (Datadog), who runs the AI infrastructure team at Datadog, then explained how Datadog uses these levers to serve tens of trillions of tokens a month.
Part 1: why token cost is now an architecture problem
The token math has changed
Diagram based on the talk by Sujatha Kuppuraju (AWS) and Julien Launay (Datadog), AWS re:Invent 2026.
With a chat, the cost is easy to predict: one prompt, one response, a bounded context.
An agent works in a loop: it plans, calls a tool, reads the result, plans again. A single task can take dozens of model calls. On every call, the agent sends the instructions and the full history so far. The context grows with each step, so the number of tokens per task keeps going up.
This is why token cost is no longer only a billing topic. It is an architecture topic.
Tactics are not a system
Most teams start with the same list: a cheaper model tier, prompt caching, shorter prompts, trimmed context, limits on agents, self-hosting. All of these work. But they are tactics, not a system. They do not tell you who uses which tokens, for what, and whether the capacity you pay for is used well.
The lever map
Diagram based on the talk by Sujatha Kuppuraju (AWS) and Julien Launay (Datadog), AWS re:Invent 2026.
To operate at scale, the speaker proposed three families of levers, to address from day one:
- Governance: who uses which model, for what, and is the cost visible?
- Platform: how efficiently does the capacity you pay for turn into tokens?
- Technology: how many tokens do you use, and what does each one cost?
Governance is the one teams skip most often. It is easy to skip at the start and hard to add later.
Governance levers on AWS
- Attribution: every Amazon Bedrock call is tied to an IAM user or role. Add tags (team, cost center, line of business) to these identities and enable them as cost allocation tags in billing. Use Bedrock Projects or application inference profiles to attribute cost per application, and request metadata in invocation logs to attribute per prompt.
- Spend alerts and limits: enable AWS Budgets and Cost Anomaly Detection, built on the same tags, so you learn about a spike before the monthly bill. For agents, the Amazon Bedrock AgentCore harness lets you set a maximum number of iterations and tokens per run.
- Evaluation-driven model choice: most of the time you do not need the biggest model. Do not pick a model from public leaderboards. Run your own evaluations on your own use cases (Amazon Bedrock Evaluations, AgentCore Evaluations for agents).
- Routing: a central LLM gateway gives you one place to route, tag and apply policies. Bedrock Intelligent Prompt Routing covers simple two-model cases.
Platform levers on AWS
Capacity you pay for but do not use is spend with no return. The advice:
- Buy GPU capacity to match demand: Capacity Blocks for ML for planned bursts like training, Savings Plans or reserved capacity for a steady baseline, Spot only for work that can be interrupted.
- Pick the right Bedrock tier per request: Priority for customer-facing features, Flex for evaluation jobs that can wait, and batch inference when you do not need an immediate answer (up to 50% cheaper than on-demand).
- Right-size the accelerator: you do not always need the biggest GPU. Match the instance to the model, and use SageMaker Inference Recommender to check.
- Share GPUs between teams: idle GPUs owned by one team while another team waits is a common waste. Kueue on Amazon EKS lets teams share quotas, borrow and lend capacity.
Technology levers
These are the ones most teams already know:
- Send fewer tokens: trim prompts, and do not send the full history to every agent call. Use a sliding window or a summary.
- Reuse what repeats: turn on prompt caching. Put the stable parts first (system prompt, tool definitions) so they form the cached prefix, and the changing parts last.
- Right-size the model for each use case, based on your evaluations.
Each lever is easy on its own. Pulling all three at scale is harder, and this is where Datadog came in.
Part 2: Datadog’s AI at scale
Not all AI usage is equal
Datadog uses AI in two ways: AI in its products (for example the Bits AI agents for SRE and security investigations) and AI for its own teams. By token volume, about 50% goes to customer-facing features, 30% to internal developer productivity and 20% to R&D (evaluations, new products).
Diagram based on the talk by Sujatha Kuppuraju (AWS) and Julien Launay (Datadog), AWS re:Invent 2026.
In dollars, the picture is different: AI coding is about 30% of tokens but about 60% of the cost.
The challenges Datadog faced while scaling were model fragmentation (every team picking its own model, with a new model every week), uneven agent spend, GPU scarcity, very different inference workloads, and the need for more control over its main workloads.
The goal was not to spend less. Julien said it plainly: spend on AI will keep growing. What matters is more intelligence per dollar: analyze more logs and time series, investigate more alerts, solve more issues on their own. Customers do not ask Datadog to spend less on Bits AI, they ask Bits AI to do more.
Governance: one central AI gateway
Datadog has a central AI platform organization. Product teams build features, and the platform team builds shared infrastructure: the gateway, model serving, and training clusters.
Diagram based on the talk by Sujatha Kuppuraju (AWS) and Julien Launay (Datadog), AWS re:Invent 2026.
Every model call (LLMs, decision models, embeddings) goes through the Datadog AI Gateway, which became a public product the week of re:Invent. Datadog uses it internally on tens of trillions of tokens a month. It gives them:
- Attribution and traceability: which team and feature spends what, and where.
- One control plane: routing decisions and policies in one place, for example who gets access to the most expensive models based on budget.
- Compliance checks: routing based on region constraints, such as keeping EU traffic on EU endpoints for GDPR.
Abstract the model
Each provider has its own format for tool calls, reasoning and parameters. The gateway includes a translation layer that converts requests, so any client (an application, a coding CLI, a direct API call) can reach any model behind it: a proprietary API, Amazon Bedrock or Datadog’s own GPUs.
A concrete example: developers wanted to try a new model, but did not want to leave their usual coding tool. With the translation layer, Datadog exposes the new model inside the tools they already use. The cost of switching from one model to another drops to almost zero.
Datadog goes further: product teams can no longer pick a specific model. They pick a capability tier (high performance, balanced, low cost). The gateway maps each tier to the best model and the best backend at that moment, for example where Datadog has the most remaining commitment. When a better model comes out, it is swapped behind the tier once, and every feature benefits within days, with no code change.
The evaluation hub
Rule at Datadog: every AI feature above a certain spend must have an evaluation registered in the evaluation hub. When a new model is released, it is connected to the hub and run on all evaluations within a few days.
Two views matter:
- The Pareto frontier: the best performance you can get for each cost. Models below the curve are not worth using.
- Evaluation stability: models end up saturating old evaluations, which then cannot tell them apart. Datadog has full teams that keep building new evaluations, so the best models still spread out at the top.
Julien was clear that building and maintaining evaluations is one of the hardest parts and where they spend the most engineering effort. A/B test results are also used, but they are expensive and so less frequent.
Protect the developer experience
Diagram based on the talk by Sujatha Kuppuraju (AWS) and Julien Launay (Datadog), AWS re:Invent 2026.
Datadog works on the idea that most developer spend is justified. There are no hard limits for developers. When usage gets close to a threshold, the developer gets a Slack notification and can self-approve to keep working. The goal is only to catch mistakes, like a job left running or the wrong model selected.
Cost control focuses on changes that developers do not see. The best example is the prompt cache hit rate. Looking at the gateway data, the team saw that cache hits for one coding tool were much lower than for the others. The cause: a default cache duration of 5 minutes. With long-running agent sessions, developers often come back after more than 5 minutes (sometimes just because reading the output takes time), and the cache has expired.
They added a rule in the gateway to use a 1-hour cache instead of 5 minutes for some tasks and users. After a one-week A/B test, they rolled it out. Result: about 25% savings on AI coding spend, which Julien described as millions of dollars. His advice: always monitor your cache hit rates, a change in a tool or a prompt can silently break them.
Governance takeaways: one gateway for all traffic, abstract the model and let evaluations and company-wide policies choose it, and find savings that do not hurt the developer experience.
Platform: one fleet, day and night
Behind the gateway, models run on several backends: Datadog’s own GPUs, Amazon Bedrock and other inference providers. The same model can be served by different backends, and Datadog switches capacity between them.
Self-hosting works like a commitment: it only saves money when the fleet is well sized and used. On-demand APIs are great for flexibility, self-hosting makes sense at high volume, and running it takes real engineering effort. Datadog keeps dashboards on all providers and keeps checking where each workload should run.
Diagram based on the talk by Sujatha Kuppuraju (AWS) and Julien Launay (Datadog), AWS re:Invent 2026.
Inference demand follows the working day: most agents are still driven by humans who work 9 to 5. So Datadog uses the same GPUs for different jobs over 24 hours:
- At night, the fleet mostly runs training.
- During the day, it mostly serves online inference.
- Batch inference (for example synthetic data generation, trillions of tokens) fills the gaps.
To decide, Datadog uses a model inspired by the electricity spot market in Europe: at any time, they compute the marginal cost of serving one more token for each workload, and move spare GPU capacity to the workload with the highest marginal cost.
The cluster runs on Kubernetes with a customized fork of Kueue. Each team has a quota for training and can use capacity other teams do not use. The online inference pool can grow into other pools when demand is high. All training and inference systems are built to be interrupted: a job gets from a few seconds to 15 minutes to save a checkpoint. The fleet mixes many GPU generations. With this setup, GPU utilization is in the low 90%.
For the few workloads that make up most of the traffic, Datadog runs a custom inference stack with its own kernels. One version of Bits AI reaches about 1,000 tokens per second. They also use coding agents to optimize this inference code automatically, which brings gains of tens of percent on these workloads.
Platform takeaways: treat GPUs, clouds and providers as one “token capacity”, route workloads based on marginal cost, and specialize the serving stack only for the highest-impact workloads.
Technology: training their own models
Datadog trains its own models for two reasons:
- More capable agents: models post-trained for software and observability tasks.
- Native understanding of observability: models pre-trained from scratch on logs, traces, metrics and time series, treated as a modality like images. One example is Toto, a time series forecasting model. The long-term idea is close to “world models” in self-driving: predict the future state of an infrastructure and evaluate “what if” changes.
For reinforcement learning, Datadog built its own stack (Harmony) with a single code base for training and inference. It has three parts: a Python SDK for researchers to write RL recipes, a control plane that manages resources at scale, and fast custom model code that only runs a handful of basic instructions.
Building RL environments is harder than for code: a coding agent can run in a sandbox, but an observability agent works on a whole infrastructure, so Datadog has to simulate entire fake infrastructures.
Datadog’s own model for Bits AI reaches the performance of top frontier models at a much lower cost (the slide claimed 5 to 7 times cheaper). A quote from the talk sums up the effort needed: “the frontier is a pace, not a place”. A model that is at the frontier today is behind in two weeks.
Julien also gave a strong warning. For about 99% of companies, training their own models does not make sense: it needs a lot of talent, compute and continuous work to keep up. It only pays off for very high-volume tasks.
Technology takeaways: fine-tune open-weight models only for your highest-volume tasks, small domain specialists can beat general models on your data, and reuse the evaluation hub for both training and model selection.
Bringing it together
There is no silver bullet. Not training your own models, not only open models, not only proprietary models. Datadog manages a portfolio: proprietary models, open models, custom models, several inference providers and its own GPUs, and makes it easy for teams to use the right one. Pulled together, the levers give more data analyzed and more features shipped for the same budget.
What we take away at Bedrock
- Start with governance. Tag every AI call by team and use case from day one, and set budget alerts. It is much harder to add later.
- One gateway for AI traffic gives visibility, policies and the freedom to change models without changing code.
- Measure before choosing a model. Even a small set of evaluations on our own use cases is better than public leaderboards.
- Watch the cache hit rate. It is a simple metric, and a 25% saving on AI coding shows how much it can matter.
- Notify, do not block. Developer trust and productivity are worth more than strict limits.
- Know when not to build. Training custom models is only worth it at very large scale. For most teams, the other levers come first.
Credits
- Talk: “How Datadog optimizes cost per token for GenAI at scale” (AIM3317), AWS re:Invent 2026.
- Speakers: Sujatha Kuppuraju (AWS) and Julien Launay (Datadog).
- The diagrams in this article are our own illustrations of the content presented by the speakers. All ideas, figures and examples are theirs and belong to Datadog and Amazon Web Services.
