Skip to Content

SpaceXAI Responses

Use the SpaceXAI API family for xAI-compatible Responses requests. The SpaceXAI 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/x-ai/v1.

Legacy /grok/... API paths remain directly supported with the same behavior as /x-ai/..., without redirects. Existing model IDs such as grok/grok-4.5 also remain supported; use x-ai/grok-4.5 for new integrations. Grok names the model family; SpaceXAI is the provider and API display name.

Base URL and endpoint

Protocol root:

https://api.hao.ai/x-ai

Responses endpoint:

POST https://api.hao.ai/x-ai/v1/responses

Authentication

Pass your HaoAI API key as a Bearer token:

Authorization: Bearer <your HAOAI_API_KEY>

Request examples

Terminal
curl https://api.hao.ai/x-ai/v1/responses \ -H "Authorization: Bearer $HAOAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "x-ai/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:

grok_responses_stream.py
stream = client.responses.create( model="x-ai/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/x-ai/v1/responses

It 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 IDNotes
x-ai/grok-4.5Default frontier model with a 500,000-token context window.
x-ai/grok-composer-2.5-fastText-only coding model with a 200,000-token context window; image input is not supported.

For Chat Completions instead of the Responses shape, see SpaceXAI Chat Completions.