Grok ↗ is s a general purpose model that can be used for a variety of tasks, including generating and understanding text, code, and function calling.
Endpoint
URL structure
When making requests to Grok ↗, replace https://api.x.ai/v1 in the URL you are currently using with https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/grok.
Examples
cURL
If you are using the OpenAI SDK with JavaScript, you can set your endpoint like this:
If you are using the OpenAI SDK with Python, you can set your endpoint like this:
If you are using the Anthropic SDK with JavaScript, you can set your endpoint like this:
If you are using the Anthropic SDK with Python, you can set your endpoint like this: