-
Notifications
You must be signed in to change notification settings - Fork 15
docs: query cost limits for API tokens and roles #695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
benenharrington
wants to merge
4
commits into
main
Choose a base branch
from
docs/query-spend-limits
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a88f998
docs: query spend limits for API tokens and roles
benenharrington 897b422
docs: rename query spend limits to query cost limits
benenharrington 9c9ec80
docs: trim query cost limits page
benenharrington c2ce042
docs: reframe query cost limits intro around the value of connecting …
benenharrington File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
content/docs/(documentation)/console/intelligence/query-cost-limits.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| --- | ||
| title: Set query cost limits for AI agents | ||
| description: 'This page explains how to cap hourly and daily query costs on API tokens and roles so that AI agents can query your data autonomously without creating unexpected costs.' | ||
| sidebarTitle: Query cost limits | ||
| keywords: ["ai agents", "query cost limits", "budget", "mcp", "api tokens", "roles", "query usage", "429"] | ||
| --- | ||
|
|
||
| AI agents are heavy query users. An agent investigating an incident or exploring a dataset can run hundreds of queries in minutes, and unlike a human, it doesn’t pause to consider what the session costs. Query cost limits put a hard cap on that risk: you give a token or a role an hourly and a daily query budget in dollars, and Axiom blocks further queries for that identity when the budget is spent. The block lifts automatically when the window resets. | ||
|
|
||
| With a capped token, you can let an agent work autonomously against your data and know your worst case in advance: an agent with a $1 hourly and $10 daily limit can never spend more than $10 per day on queries, no matter what it does. | ||
|
|
||
| <Note> | ||
| Query cost limits are available on the Axiom Cloud and Enterprise plans. | ||
|
|
||
| Query cost limits are separate from your organization’s [monthly spending limit](/reference/usage-billing#spending-limit). The spending limit caps your whole organization’s bill; query cost limits cap the query costs of individual tokens and members. | ||
| </Note> | ||
|
|
||
| ## How query cost limits work | ||
|
|
||
| - Limits apply to **query costs**: the billed cost of the query compute (GB-hours) an identity uses, measured the same way as in [Usage and billing](/reference/usage-billing). Ingest, storage, and other operations don’t count towards the limit and are never blocked by it. | ||
| - You can set an **hourly limit**, a **daily limit**, or both, in dollars. The hourly window resets at the top of each hour (UTC), and the daily window resets at midnight UTC. | ||
| - When an identity exceeds a limit, its query requests fail with HTTP status code `429` until the window resets. Other requests continue to work as normal. | ||
|
|
||
| You can set query cost limits on two kinds of identity: | ||
|
|
||
| - **API tokens.** The limit caps everything that authenticates with that token. Use token limits for agents that hold an API token: local MCP server setups, [Axiom Skills](/console/intelligence/skills), coding agents like Claude Code, and any script or SDK. | ||
| - **Roles.** The limit caps each member that holds the role, individually. A member’s queries count against their budget whether they query in the Axiom console, with a personal access token, or through an OAuth session such as the remote [Axiom MCP Server](/console/intelligence/mcp-server), because all of these act as the member. If a member holds several roles with limits, the strictest limit for each window applies. | ||
|
|
||
| ## Give an agent a budget | ||
|
|
||
| The typical setup for an agent that connects with an API token: | ||
|
|
||
| 1. Click <Icon icon="gear" iconType="solid"/> **Settings > API tokens**, and then click **New API token**. | ||
| 1. Create a dedicated token for the agent with the minimum permissions it needs. For more information, see [Token hygiene for AI agents](/console/intelligence/ai-agents-overview#token-hygiene-for-ai-agents). | ||
| 1. In **Query cost limits**, enter an hourly limit, a daily limit, or both, in dollars. | ||
| 1. Click **Create**, and then configure your agent with the new token. | ||
|
|
||
| The agent now queries freely within its budget. If it exhausts the budget, its queries fail with an error that states the limit and when it resets. | ||
|
|
||
| To add limits to an existing token, click <Icon icon="gear" iconType="solid"/> **Settings > API tokens**, select the token, and then edit **Query cost limits**. The token page also shows live usage meters for each limit with a countdown to the next reset. | ||
|
|
||
| If your agents connect through the remote Axiom MCP Server, they authenticate with OAuth and act as your user account, so token limits don’t apply to them. Instead, set limits on a role you hold. Role limits cap everything you run as that member, including your own console queries. | ||
|
|
||
| ## Set limits on a role | ||
|
|
||
| To cap the query costs of each member that holds a role: | ||
|
|
||
| 1. Click <Icon icon="gear" iconType="solid"/> **Settings > Roles**, and then select the role. | ||
| 1. In **Query cost limits**, click **Edit**. | ||
| 1. Enter an hourly limit, a daily limit, or both, in dollars, and then save. | ||
|
|
||
| The limit applies to each member individually, not to the role as a group. For example, a $5 daily limit on a role with 10 members lets each member spend up to $5 per day. | ||
|
|
||
| Role limits work on both built-in and custom roles. | ||
|
|
||
| ## Monitor usage against limits | ||
|
|
||
| - To see how much of its budget a token has used, click <Icon icon="gear" iconType="solid"/> **Settings > API tokens**, and then select the token. The usage meters show current usage against each limit and when the window resets. | ||
| - To see usage across members, click <Icon icon="gear" iconType="solid"/> **Settings > Users**. Members with limits show their current query usage. | ||
| - To see your own usage, go to your profile. The **Query usage** section shows your effective limits and current usage. | ||
|
|
||
| Axiom only tracks and displays usage for identities that have limits configured. | ||
|
|
||
| ## What happens when a limit is reached | ||
|
|
||
| When a token or member exceeds a limit, query requests return HTTP status code `429` with a `Retry-After` header that states the number of seconds until the window resets. The error message identifies which limit tripped, for example the token’s hourly limit or the member’s daily limit. | ||
|
|
||
| - Queries from that identity are blocked until the window resets. No action is needed: an hourly limit unblocks at the top of the next hour (UTC), a daily limit at midnight UTC. | ||
| - Other identities are unaffected. Other tokens, members, monitors, and dashboards keep querying as usual. | ||
| - Ingest and management operations from the limited identity keep working. | ||
|
|
||
| To unblock an identity before the window resets, raise or clear its limits. The change takes effect for new queries within moments. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See this is in draft so forgive the early comment - noticed when linking gtm a preview for question from customer.
Just a thought... Let's not instil fear with "are heavy query users" and "it doesn’t pause to consider what the session costs".
"can be..." and "might not always be so thoughtful about..." etc can soften