Use cURL to integrate xAI with Helicone to log your xAI LLM usage.
Create an account and generate an API key
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 }'
Verify your requests in Helicone
Was this page helpful?