Available Models
On this page
Discover available models
This endpoint answers a question you might mistakenly assume you can handle from memory: which models your team can actually call, and at what price today. Public docs describe the general catalog; the API describes your catalog, including current pricing.
The gap between the two isn’t theoretical. Tiers evolve, prices shift, and an ID copied from a six-month-old blog post produces an access error that’s hard to diagnose. Make it a habit to query this endpoint rather than assume—it’s also what keeps your cost comparison scripts reliable over time. This information is essential for choosing the right model for your use case and budget.
List models
curl "https://management-api.x.ai/auth/teams/$TEAM_ID/models" \
-H "Authorization: Bearer $MANAGEMENT_API_KEY"
The response contains for each model:
- ID: the exact name to use in API calls (ex:
grok-4.20-0309-reasoning) - Cluster: the server group hosting the model
- Pricing: price per million tokens for input and output
- Capabilities: context size, multimodal support, etc.
Use in key management
This is where the endpoint becomes indispensable rather than just practical. An ACL that names a non-existent model—because the ID format changed or the model was retired—doesn’t fail loudly: it simply authorizes nothing, and you end up looking for the error in your code. Verify the ID at the source before locking it into a key.
{
"acls": [
"api-key:model:grok-4.20-0309-reasoning",
"api-key:model:grok-4.3"
]
}
If you restrict a key to specific models, verify first that they are available to your team via this endpoint.
List ACL endpoints
The same logic applies to endpoints: the list below is the authoritative one for composing your ACLs. It also provides a useful view of a key’s actual scope—a key limited to chat can neither generate embeddings nor process images, regardless of the models it otherwise references.
curl "https://management-api.x.ai/auth/teams/$TEAM_ID/endpoints" \
-H "Authorization: Bearer $MANAGEMENT_API_KEY"
The available endpoints are:
- chat: text conversations (chat completions)
- embed: embedding generation
- image: image generation and analysis
- models: model list
- sample: sampling
- tokenize: text tokenization
- documents: document processing
Choose the right model
By use case
| Use case | Recommended model | Why |
|---|---|---|
| Complex reasoning | grok-4.20-0309-reasoning | Advanced chain of thought |
| Simple tasks, high volume | grok-4.3 | Fast, economical |
| Image analysis | Multimodal model | Vision support |
| Embeddings / RAG | Embed model | Optimized for search |
By budget
Compare the rates returned by the API rather than the ones you have in mind. The arbitrage logic is always the same: a classification or extraction task gains no benefit from a reasoning model, yet you pay its price on every call—and this is precisely the type of task you run thousands of times. The reasoning model is necessary for complex analyses.
Model comparison script
import requests
import json
MANAGEMENT_API = "https://management-api.x.ai"
MGMT_KEY = "xai-mgmt-..."
TEAM_ID = "team-..."
# Retrieve models
response = requests.get(
f"{MANAGEMENT_API}/auth/teams/{TEAM_ID}/models",
headers={"Authorization": f"Bearer {MGMT_KEY}"}
)
models = response.json().get("models", [])
print(f"{'Model':<35} {'Input ($/M)':<15} {'Output ($/M)':<15}")
print("-" * 65)
for model in models:
name = model.get("id", "N/A")
input_price = model.get("inputPrice", "N/A")
output_price = model.get("outputPrice", "N/A")
print(f"{name:<35} {input_price:<15} {output_price:<15}")
Monitor new models
The catalog changes several times a year, and the most interesting changes aren’t new models but price drops on old ones. A periodic check that compares against the previous record flags both, and costs a few lines of cron.
import requests
import json
import os
MANAGEMENT_API = "https://management-api.x.ai"
MGMT_KEY = "xai-mgmt-..."
TEAM_ID = "team-..."
CACHE_FILE = "/tmp/xai_models_cache.json"
# Retrieve current models
response = requests.get(
f"{MANAGEMENT_API}/auth/teams/{TEAM_ID}/models",
headers={"Authorization": f"Bearer {MGMT_KEY}"}
)
current_models = {m["id"] for m in response.json().get("models", [])}
# Compare with cache
if os.path.exists(CACHE_FILE):
with open(CACHE_FILE) as f:
cached_models = set(json.load(f))
new_models = current_models - cached_models
removed_models = cached_models - current_models
if new_models:
print(f"New models: {', '.join(new_models)}")
if removed_models:
print(f"Removed models: {', '.join(removed_models)}")
# Update cache
with open(CACHE_FILE, "w") as f:
json.dump(list(current_models), f)
Combine models and analytics
The final cross-reference is what drives the decision: on one side what each model costs, on the other how much you use it. An expensive and marginal model doesn’t deserve attention; an expensive model that absorbs the bulk of your requests is the first candidate for change, and this is what this script brings to light in one line.
# 1. List available models
curl -s "https://management-api.x.ai/auth/teams/$TEAM_ID/models" \
-H "Authorization: Bearer $MANAGEMENT_API_KEY" > /tmp/models.json
# 2. Analyze usage by model
curl -s -X POST "https://management-api.x.ai/v1/billing/teams/$TEAM_ID/usage" \
-H "Authorization: Bearer $MANAGEMENT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"analyticsRequest": {
"timeRange": {
"startTime": "2026-03-01 00:00:00",
"endTime": "2026-04-01 00:00:00",
"timezone": "UTC"
},
"timeUnit": "MONTH",
"values": [{"name": "tokens", "aggregation": "SUM"}],
"groupBy": ["model"]
}
}' > /tmp/usage.json
# 3. Compare
python3 -c "
import json
with open('/tmp/models.json') as f:
available = {m['id'] for m in json.load(f).get('models', [])}
with open('/tmp/usage.json') as f:
used = {p.get('model') for p in json.load(f).get('dataPoints', [])}
unused = available - used
if unused:
print(f'Available models not used: {unused}')
"
Pricing as of August 5, 2026 — prices evolve regularly: before any budget calculation, verify the current grid on the official xAI models and pricing page.
Key takeaways
GET /auth/teams/{teamId}/modelslists models with pricing and capabilitiesGET /auth/teams/{teamId}/endpointslists endpoints for ACLs- Use this information to create API keys with precise ACLs
- Compare rates to choose the most economical model suited to your usage
- Regularly monitor new available models