Grok configuration

Use Grok through the dedicated Grok channel. Create an API key in the dashboard, select Grok as its channel, and send the key as a Bearer token. The channel changes consumption speed (0.4×); it does not change the amount of token quota you purchased.

The channel exposes the text models grok-4.5, grok-4.6, and grok-4.7 over an OpenAI-compatible protocol. Use GET /api/grok/v1/models with the same key to list the models available to it. This service does not proxy Grok image endpoints.

Endpoint and key

Point an OpenAI-compatible client at this base URL:

1
https://api.aiinide.com/api/grok/v1

Chat requests use POST https://api.aiinide.com/api/grok/v1/chat/completions, and every request must carry Authorization: Bearer <key>. Create the key in the dashboard with Grok selected as its channel; other channel keys are rejected.

Streaming and non-streaming responses are both supported. A non-streaming response can take longer than 40 seconds; the proxy waits up to 15 minutes for the upstream response. Prefer streaming for interactive clients.

Supported models

The base rates below apply before the channel multiplier. The effective rates already include the 0.4× factor. All values are USD per 1M tokens, ordered input, cache read, and output. Requests are billed from actual usage against your purchased quota.

Base rates (before the channel multiplier)

ModelInputCache readOutput
grok-4.520.306
grok-4.620.506
grok-4.720.506

Effective rates (including the 0.4× channel multiplier)

ModelInputCache readOutput
grok-4.50.80.122.4
grok-4.60.80.202.4
grok-4.70.80.202.4

See the Grok 4.5, Grok 4.6, and Grok 4.7 model pages for channel availability. Upstream rates are documented in the official xAI pricing; model capabilities are described in the official model catalog. This service forwards text chat completions only.

Create a chat completion

The example below is a billable request. Replace the placeholder with your Grok dashboard key; running it consumes your available quota.

1
export GROK_API_KEY="YOUR_DASHBOARD_API_KEY"
2
 
3
curl --globoff --fail-with-body 'https://api.aiinide.com/api/grok/v1/chat/completions' \
4
  -H "Authorization: Bearer $GROK_API_KEY" \
5
  -H "Content-Type: application/json" \
6
  -d '{
7
    "model": "grok-4.7",
8
    "messages": [{"role": "user", "content": "Explain in one sentence what this JavaScript function returns: function add(a, b) { return a + b; }"}],
9
    "max_tokens": 256
10
  }'

Read the answer from choices[0].message.content and confirm that choices[0].finish_reason is "stop". For example: “It adds two numbers, or concatenates them if either value is a string.” Wording may vary. If no answer appears, inspect the error response and finish_reason; "length" means the output limit was reached. The proxy records actual usage after the response; check your usage history.

Stream a response

Reuse the key exported above. Set "stream": true and display arriving chunks with curl -N:

1
curl --globoff --fail-with-body -N 'https://api.aiinide.com/api/grok/v1/chat/completions' \
2
  -H "Authorization: Bearer $GROK_API_KEY" \
3
  -H "Content-Type: application/json" \
4
  -d '{
5
    "model": "grok-4.7",
6
    "messages": [{"role": "user", "content": "Explain in one sentence what this JavaScript function returns: function add(a, b) { return a + b; }"}],
7
    "stream": true
8
  }'

The response contains SSE data: events. Read the answer chunks from choices[].delta.content in order, then confirm that the stream ends with a final data: [DONE] event. HTTP 200 or a first text chunk alone does not confirm completion; a disconnected stream needs inspection.

Troubleshooting

  • 401: use a valid, non-expired dashboard key with the Grok channel.
  • 400: check the model ID, the request body, and the key's channel. The retired grok-4-5 ID returns 400; use grok-4.5 instead. Image endpoints are not available on this service.
  • 429: check error.message in the response body. If it says Quota exhausted, check your API key and account quotas. Grok's upstream can rate-limit requests even when you have quota left. For an upstream rate limit, wait as directed by the Retry-After response header if present before retrying.
  • 503: the Grok upstream is temporarily unavailable; retry later.