2-3 min setup

Connect Grok (xAI) to StackSpend

Track Grok API costs including Grok 3, Grok 4, and other models. Uses the xAI Management API for billing and usage monitoring.

StackSpend tracks Grok (xAI) API costs via the Management API. Get daily cost visibility and anomaly alerts. xAI costs grow with usage—we help you see them before the invoice.

Management API Key Required

Cost tracking uses the xAI Management API, which is separate from the inference API. You must create a Management API key in xAI Console → Settings → Management Keys. Your standard API key used for chat completions will not work for cost data.

Prerequisites

  • An xAI account with API access
  • Access to xAI Console
  • Management API key (not the inference API key)
  • Team ID from your xAI Console URL
Step 1

Create a Management API Key and Find Team ID

Create a Management API key in the xAI Console. This key is different from the API key you use for chat completions.

  1. 1Go to xAI Console
  2. 2Navigate to SettingsManagement Keys
  3. 3Click to create a new Management API key
  4. 4Important: Copy the key immediately. You won't be able to see it again.
  5. 5Find your Team ID in the console URL. For example, if the URL is console.x.ai/team/default, your Team ID is default.

Note: Management API keys have full access to your team billing data. Store them securely and never share them publicly.

Step 2

Connect in StackSpend

  1. 1Go to SettingsProviders in your StackSpend dashboard
  2. 2Click Add Provider → Select Grok (xAI)
  3. 3Paste your Management API key
  4. 4Enter your Team ID (e.g. default)
  5. 5Click Test Connection to verify
  6. 6Once the test succeeds, click Connect

After Connecting

Once Grok is connected, StackSpend fetches cost data from the xAI Management API. Costs are synced on your regular schedule.

  • Costs sync automatically every 6 hours
  • Model-level usage tracking (Grok 3, Grok 4, etc.)
  • Token and tool usage costs when available

Know where your cloud and AI spend stands — every day, starting today.

Sign up
Connect Grok (xAI) to StackSpend — Step-by-Step Guide