Console RPM/TPM Rate Limits
On this page
Two Metrics to Monitor
The xAI API enforces two types of rate limits, measured per minute and per model:
- RPM (Requests Per Minute): The number of API requests you can send per minute, regardless of their content.
- TPM (Tokens Per Minute): The total number of tokens (input + output) you can consume per minute.
You can hit one limit without hitting the other. For example, 10 short requests of 100 tokens each consume little TPM but count as 10 RPM. Conversely, a single request with 50,000 context tokens consumes a lot of TPM but only 1 RPM.
Tier System
Limits adjust automatically based on your cumulative spend. The tier never goes down once unlocked:
| Tier | Spend Threshold | Access |
|---|---|---|
| Tier 0 | $0 (default) | Base limits |
| Tier 1 | $50 spend | Increased limits |
| Tier 2 | $250 spend | Extended limits |
| Tier 3 | $1,000 spend | High limits |
| Tier 4 | $5,000 spend | Premium limits |
| Enterprise | On request | Negotiated limits |
Cumulative spend includes your entire account history. You don’t need to spend $50 in one month: if you spend $10 per month for 5 months, you reach Tier 1.
Check Your Limits
Head to the xAI console (console.x.ai) to see your current limits per model. Each model has its own RPM and TPM caps. Reasoning models generally have lower limits than standard models.
Calculate Your Effective Throughput
To size your semaphore based on your limits:
# Your limits (example Tier 2)
rpm_limit = 120 # requests per minute
tpm_limit = 200_000 # tokens per minute
# Estimate your requests
avg_input_tokens = 500
avg_output_tokens = 1000
tokens_per_request = avg_input_tokens + avg_output_tokens
# Token limit
max_rpm_by_tokens = tpm_limit / tokens_per_request # 200000 / 1500 = 133
# Effective limit = min of the two
effective_rpm = min(rpm_limit, max_rpm_by_tokens) # min(120, 133) = 120
# Optimal semaphore
avg_duration = 8 # seconds per request
semaphore_value = int(effective_rpm * avg_duration / 60) # 120 * 8 / 60 = 16
In this example, a semaphore of 16 is the theoretical maximum. In practice, use a lower value (12–14) to keep a safety margin.
Track Your Costs in Real Time
Every API response contains a usage field that indicates the cost:
response = await client.chat.completions.create(
model="grok-4.5",
messages=[{"role": "user", "content": prompt}]
)
# Tokens consumed
usage = response.usage
print(f"Input tokens: {usage.prompt_tokens}")
print(f"Output tokens: {usage.completion_tokens}")
print(f"Total: {usage.total_tokens}")
For costs in dollars, the cost_in_usd_ticks field is available in some responses. The conversion is: 10 billion ticks = 1 USD.
Tokenizer to Estimate Before Sending
Before sending an expensive request, you can estimate the token count with the tokenization endpoint:
# Via the REST API
import httpx
async def count_tokens(text: str) -> int:
async with httpx.AsyncClient() as http:
response = await http.post(
"https://api.x.ai/v1/tokenize-text",
headers={"Authorization": f"Bearer {api_key}"},
json={"text": text}
)
return response.json()["token_count"]
This lets you verify that a large prompt won’t exceed your TPM limits before you send it.
Key Takeaways
- RPM and TPM are two independent limits: the stricter one applies
- Tiers increase automatically with your cumulative spend and never go down
- Check
console.x.aifor your exact limits per model - Size your semaphore based on the minimum between RPM and TPM
- Use the
usagefield in responses to track consumption in real time - The
/v1/tokenize-textendpoint lets you estimate tokens before sending