Skip to main content

Connect xAI

xAI is the company behind the Grok family of models, served through the xAI API. The xAI integration imports your team's daily rated cost and usage data into DoiT Cloud Intelligence so you can analyze Grok API spend in Cloud Analytics.

Prerequisites

Required credentials

FieldDescriptionWhere to find it
Team IDYour xAI team identifier (a UUID)xAI Console > Settings
Management API KeyA management key with read access to billingxAI Console > Settings > Management Keys
Management key required

Inference API keys (the keys you use to call Grok models) do not work for this integration — xAI's billing data is only served by its Management API, which rejects inference keys. You must create a dedicated management key.

Create a management key

  1. Sign in to the xAI Console and open Settings > Management Keys.

  2. Select Create Management Key and give it a descriptive name.

  3. Under Access, set Billing to Read only. Leave every other endpoint at No access.

  4. Leave the Allowed IP Address list empty. DoiT ingests your data from a pool of egress addresses, so restricting the key to a single IP address causes intermittent connection failures.

  5. Select Save and copy the key.

    Caution

    The key is only shown once. Make sure to copy it before closing the dialog.

Connect your xAI team

  1. Sign in to Cloud Intelligence, select Data ingestion and integrations > Integrations from the top navigation mega menu.

  2. Search for xAI in the integrations catalog.

  3. Select Connect + on the integration card.

  4. Enter your Team ID and Management API Key.

  5. Select Test connection to verify DoiT can access your xAI team.

  6. If the test is successful, select Save to complete the setup.

    If the test fails or you need further assistance, please open an expert inquiry.

Note

Upon initial connection, DoiT imports up to 180 days of historical xAI cost data. The import process can take a few hours. You'll receive an email when the data is available in Cloud Analytics.

Data refresh

DoiT refreshes your xAI billing data every six hours at daily granularity.

Reporting dimensions

Once connected, xAI data maps to the following standard Cloud Analytics dimensions:

Cloud Analytics dimensionxAI valueExample
ProviderxAIxAI
Billing AccountTeam ID0000...-0000
ServiceGrok APIGrok API
SKUProduct-prefixed modelAPI grok-4.3

In addition to standard dimensions, the following xAI-specific labels are available:

LabelDescription
ModelThe model that generated the charge
Usage TypeBillable unit, normalized across AI providers (e.g., input_tokens, reasoning_output_tokens)
CachedWhether the tokens were served from prompt cache
RegionThe xAI cluster that served the requests (e.g., us-west-2)
API KeyThe team API key that incurred the charge, by display name