Grok Responses
Use the Grok / xAI API family for xAI-compatible Responses requests. The Grok / xAI route restricts dispatch to Grok-family models and upstreams; the HTTP request and SSE response bodies use xAI’s OpenAI-compatible Responses shape.
This protocol describes the routing boundary, not a different customer payload
format. An OpenAI SDK can use this API when its base_url is set to
https://api.hao.ai/grok/v1.
Base URL and endpoint
Protocol root:
https://api.hao.ai/grokResponses endpoint:
POST https://api.hao.ai/grok/v1/responsesAuthentication
Pass your HaoAI API key as a Bearer token:
Authorization: Bearer <your HAOAI_API_KEY>Request examples
cURL
curl https://api.hao.ai/grok/v1/responses \
-H "Authorization: Bearer $HAOAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok/grok-4.5",
"input": "Explain how an API gateway works.",
"instructions": "You are a helpful technical assistant.",
"max_output_tokens": 1024
}'Streaming
Set stream: true to receive xAI-compatible SSE events:
stream = client.responses.create(
model="grok/grok-4.5",
input="Write a short welcome message.",
stream=True,
)
for event in stream:
if event.type == "response.output_text.delta":
print(event.delta, end="", flush=True)Continuations and WebSocket clients
Use previous_response_id only with a response previously created by the same
HaoAI principal. The router keeps the continuation bound to its original Grok
upstream account; unavailable or foreign response IDs are rejected instead of
being sent to another account.
A compatible Responses WebSocket ingress is available at:
GET https://api.hao.ai/grok/v1/responsesIt is a HaoAI bridge to xAI HTTP/SSE for each turn. It does not indicate that xAI provides a native WebSocket transport.
Current text models
| Model ID | Notes |
|---|---|
grok/grok-4.5 | Default frontier model with a 500,000-token context window. |
grok/grok-composer-2.5-fast | Text-only coding model with a 200,000-token context window; image input is not supported. |
For Chat Completions instead of the Responses shape, see Grok Chat Completions.