Connect xAI Grok to LLM Cost Tracker
Binadox tracks your Grok API spend and token usage through a read-only xAI management key. The connection takes about five minutes.
Prerequisites
Before you start, make sure you have:
- An xAI Console team with Grok API usage.
- A console account with the Management Keys permission.
- A Binadox account.
Note:
Binadox requires an xAI management key, not an API key. Create a key with read access to billing only.
Step 1: Create a management key in xAI
Sign in to the xAI Console as a member of the team you want to track.
Go to Settings > Management Keys. Click Create a new key.
Enter a descriptive name, for example Binadox LLM Cost Tracker.
Grant the key read access to billing only. Leave API keys, team members, and other permissions unchecked.
Create the key from the team’s settings. If you create an organization-scoped key, you will need the Team ID when connecting it to Binadox.
Copy the key. It starts with xai- and is shown only once.
Step 2: Connect xAI Grok to Binadox
Open your Binadox dashboard and go to LLM Cost Tracker. Click Add account. Select xAI Grok.
Enter a connection name and paste the key into Management key.
For a team-scoped key, leave Team ID empty. For an organization-scoped key, enter the ID of the team you want to track. You can find it under Settings > Team in the xAI Console.
Click Connect.
Binadox validates the key, identifies the team, and schedules the first sync.
What happens after connecting
- The first sync loads the last 60 days of spend and usage.
- Later syncs run once a day.
- Spend is shown by day and model based on xAI usage analytics.
- Token counts are estimated from monthly invoice data and apportioned by daily spend.
- The Grok price list is refreshed monthly.
Binadox uses the xAI Management API in read-only mode. It does not read prompts or completions and does not change anything in your xAI team.
What Binadox reads
| Call | Used for |
|---|---|
GET /auth/management-keys/validation | Checking the key when you connect and identifying its team |
POST /v1/billing/teams/{team_id}/usage | Spend per day and per model |
GET /v1/billing/teams/{team_id}/invoices | Token counts per model from closed monthly invoices |
GET /v1/billing/teams/{team_id}/postpaid/invoice/preview | Token counts for the current month |
Binadox also downloads xAI’s public pricing page once a month to keep the Grok price list current. This does not require a key.
All calls to the xAI Management API are read-only. Binadox does not create, change, or delete anything in your xAI team.
Troubleshooting
| Issue | What you see | What to do |
|---|---|---|
| Wrong kind of key | Connection fails with Please check correctness of the connection parameters | Create an xAI management key under Settings > Management Keys and connect with it. An inference API key is not supported. |
| Key cannot read billing | Connection works, but the first sync fails with an authentication error | Edit the key permissions in the xAI Console to allow billing reads, or create a new key with billing read access. |
| Organization-scoped key without a team | Connection fails with This management key is organization-scoped; enter the Team ID to track | Copy the team ID from Settings > Team in the xAI Console and enter it in the Team ID field. |
| Key revoked or expired | The connection shows an authentication error | Create a new management key and reconnect the account with it. |
| Key belongs to another team | The connection works, but the spend shown is not what you expect | Create a team-scoped key in the team you want to track, or use an organization-scoped key with that team’s ID. |
| xAI unavailable | Connecting or syncing fails with a connection error rather than an authentication error | The xAI Management API may be temporarily unavailable. Binadox retries automatically. Try again later. |
| No usage after connecting | The connection is active, but no data appears | Check that the team had Grok API traffic in the last 60 days. Grok Business seats and consumer Grok subscriptions are not included. |
| Last days of a month are missing | Spend stops a few days before the month end and resumes later | These days may be waiting for xAI to issue the monthly invoice. They appear after the invoice is available, or after seven days without token counts. |
| Token counts look approximate | Daily token counts do not match your own logs | Token counts are apportioned from the monthly invoice by spend and are estimates. Exact per-request cost is available in xAI API responses as cost_in_usd_ticks. |
| Spend without a model | A day’s total cost is higher than the sum of its model rows | Server-side tools such as web search can be billed without a model. They are included in the day’s cost but have no token row. |
Revoke or rotate the key
To stop Binadox from reading your xAI team, delete the management key under Settings > Management Keys in the xAI Console.
To rotate the key without missing a sync:
- Create a new management key.
- Reconnect the Binadox account with the new key.
- Delete the old key.
Support and Resources
Binadox Support:
- Email: support@binadox.com
- Documentation: Binadox LLM Cost Tracker Documentation
xAI Resources: