Skip to main content

xAI (Grok)

[official website]

You can connect to Grok models via your Grok subscription, or, via the API key. They are charged separately, and normal users are likely to use the Grok subscription way.

Grok subscription​

Use a Grok account eligible for the OAuth flow below. A paid subscription does not by itself establish eligibility for every model or API. This integration is tested with offline fixtures, not a live subscription; compatibility does not guarantee provider authorization or account safety.

1. Configure the provider​

If Grok subscription is already configured under Downstreams with these settings, skip to the next section 2. Connect.

  1. Open Downstreams, click + Add Provider, then select the new provider in the list.
  2. Set its name to Grok subscription. Under API Formats, select only OpenAI.
  3. Set API Host to https://api.x.ai/v1.
  4. Under Authentication, select OAuth, then expand Advanced OAuth settings.
  5. Set Flow to Auth Code + PKCE (loopback), then fill in:
FieldValue
Discovery URLhttps://auth.x.ai/.well-known/openid-configuration
Client IDb1a00492-073a-47ea-816f-4c329264a828
Scopesopenid profile email offline_access grok-cli:access api:access
Refresh skew (seconds)120
Default token lifetime (seconds)3600
Allowed endpoint hosts (one per line)Enter x.ai on the first line and *.x.ai on the second.
  1. Check Request nonce, Require refresh token, Refresh on unknown expiry, and Persist discovered endpoints.
  2. Leave Authorization URL, Token URL, Client Secret, Extra Authorize Params, and Extra Headers empty. Discovery supplies the endpoints. Changes save automatically; no restart is needed. Continue to 2. Connect.

2. Connect​

  1. Open Downstreams in the left sidebar, then click Grok subscription in the provider list.
  2. Click Connect below that section. Tresor opens the provider's authorization page in a new tab; allow the popup if your browser blocks it.
  3. Sign in to your eligible Grok account and approve access. Let the page redirect back to Tresor; it should show Connected.
  4. Return to the dashboard and wait for Connected below the Connect button.
  5. Under Models, click Fetch Models, then click Add beside the models you need. If discovery is unavailable, click + Add Model and enter a model ID available to your account.

To disconnect, click Disconnect beside Connect, then confirm.

xAI API​

Direct xAI API access uses an API key from the xAI Console. API billing and subscription access are separate.

Web UI is more intuitive, but requires more manual operations.

In the "Downstreams" tab:

  1. Click + Add Provider to create a separate API provider, then select it in the list.
  2. Enter xAI API as its name.
  3. Under API Formats, select OpenAI and OpenAI Responses.
  4. Under Authentication, select API key and enter a key from xAI Console.
  5. Under API Host, enter https://api.x.ai. Changes save automatically.
  6. Under Models, click Fetch Models, then + Add beside each model you need. If discovery is unavailable, click + Add Model and enter a model ID.

For xAI's U.S.-only inference endpoint, use https://us.api.x.ai as the API host or base_url. Check regional availability and pricing before switching.

Done! Clients accessing Tresor can now use your configured Grok models.

Next step​