This integration is used to log usage with the xAI API.
1

Create an account and generate an API key

Log into Helicone or create an account. Once you have an account, you can generate an API key here.
2

Modify the base URL path and set up authentication

curl -X POST https://x.helicone.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -H "Helicone-Auth: Bearer $HELICONE_API_KEY" \
  -d '{
    "model": "grok-4-latest",
    "messages": [
      {
        "role": "user",
        "content": "Hello, how are you?"
      }
    ],
    "max_tokens": 50,
    "temperature": 0.7
  }'
3

Verify your requests in Helicone

With the above setup, any calls to xAI will automatically be logged and monitored by Helicone. Review them in your Helicone dashboard.