Grok text API
Use Grok text models with streaming, function tools, and token billing.
Use an Official Group API key with https://app.apipool.dev.
Models and pricing
Prices are in US dollars per million tokens and include the group discount. A request with at least 200,000 input tokens uses long-context rates for the entire request. The threshold includes cached input.
| Model | Input | Cached input | Output | Long-context input / cached / output |
|---|---|---|---|---|
| grok-4.20-0309-non-reasoning, grok-4.20-0309-reasoning, grok-4.20-multi-agent-0309, grok-4.3 | 1.0625 | 0.17 | 2.125 | 2.125 / 0.34 / 4.25 |
| grok-4.5 | 1.70 | 0.255 | 5.10 | 3.40 / 0.51 / 10.20 |
| grok-4.6, grok-4.7 | 1.70 | 0.425 | 5.10 | 3.40 / 0.85 / 10.20 |
| grok-build-0.1 | 0.85 | 0.17 | 1.70 | 1.70 / 0.34 / 3.40 |
Output usage includes reasoning tokens. The service determines cache hits automatically. Check the model page for the active price.
Chat and streaming
Use POST /v1/chat/completions for the chat models.
curl https://app.apipool.dev/v1/chat/completions \
-H "Authorization: Bearer $APIPOOL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"grok-4.7","messages":[{"role":"user","content":"Introduce yourself in one sentence."}],"stream":true}'messages is an array. stream defaults to false. Read streaming responses through the final usage event. Reasoning models can consume reasoning tokens before producing the visible answer. Use reported usage to track reasoning costs.
Multi-Agent
Use POST /v1/responses with grok-4.20-multi-agent-0309 and a text string in input.
{
"model": "grok-4.20-multi-agent-0309",
"input": "Compare the benefits and trade-offs of two approaches.",
"reasoning": { "effort": "low" },
"stream": true
}reasoning.effort supports low, medium, high, and xhigh. Multi-agent collaboration can consume additional input and reasoning tokens. Billing uses the total reported usage.
Tools and limits
Chat models accept client-defined function tools. Your application executes the returned tool calls and sends the results. Multi-Agent accepts text input only. Built-in search, code execution, explicit caching, and passthrough containers are unavailable. Requests using unsupported fields can return HTTP 400.
Grok 4.6 and 4.7 support a 500,000-token context window and up to 12,800 output tokens. Grok 4.5 has a 500,000-token context window, Grok Build has 256,000, and the other listed models have 1,000,000. Open the model catalog to choose a model and try the playground.
Troubleshooting
- HTTP 400. Check the model's endpoint, field names, and supported tools.
- HTTP 401. Verify your Official Group API key.
- Insufficient balance. Add funds before submitting another request.
- Timeout or disconnect. Check usage with the request ID before retrying.