Add the credential
Open Settings > Model Providers, click Add Model Provider and select xAI. Give the row a name, pick the organization, team or project it belongs to, and fill in:
| Field | Value |
|---|---|
XAI_API_KEY | Your xAI API key. |
Save the row. Every virtual key whose scope can see the row can now dispatch to it, unless the key restricts its providers. See Virtual keys.

Model names
Write xai/<model>, for example xai/grok-4. The gateway does not infer xAI from a bare name.
Send a request
example.shBash
curl https://gateway.langwatch.ai/v1/chat/completions \ -H "Authorization: Bearer $LANGWATCH_VIRTUAL_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "xai/grok-4", "messages": [{"role": "user", "content": "Say hi in one word"}] }'Endpoints
| Endpoint | Served |
|---|---|
POST /v1/chat/completions | Yes |
POST /v1/messages | Yes, translated |
GET /v1/models | Yes, from the xAI catalog |