Grok 4.7 API
xAI's Grok. Direct answers and one of the cheapest big-name models. Served through RouterHub at $0.07175 input / $0.2152 output per million tokens (prices as of ).
Grok 4.7 pricing
−96% vs the official API price of $2.00 input / $6.00 output per 1M tokens (source, checked 2026-10-13).
- Input
- $0.07175
- Cached input
- $0.01794
- Output
- $0.2152
- Typical message
- ≈ 0.018¢
USD per 1 million tokens. A typical message is about 1,000 input and 500 output tokens. Cached input uses the cache-read rate when the provider reports a cache hit. Billed from your prepaid balance.
API compatibility and context
- Exact model ID
grok-4.7- Provider
- xAI
- Variant
- Standard
- Supported API
- OpenAI-compatible Chat Completions API (
/v1/chat/completions) - Availability
- Preview
- Context window
- 500,000 tokens
- Maximum input
- Not published
- Maximum output
- Not published
Use Grok 4.7 through the API
Create a RouterHub account, add prepaid credits and create an API key. Set ROUTERHUB_API_KEY locally, then send a first request with the exact model ID.
curl --connect-timeout 30 --max-time 600 https://routerhub.si/v1/chat/completions \
-H "Authorization: Bearer $ROUTERHUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"grok-4.7","messages":[{"role":"user","content":"Write a short noir scene set in a lighthouse."}],"max_tokens":256}'Python: install openai with pip. The example requests 256 output tokens and disables automatic retries, so check Usage before resending a paid request.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["ROUTERHUB_API_KEY"],
base_url="https://routerhub.si/v1",
timeout=600.0,
max_retries=0,
)
response = client.chat.completions.create(
model="grok-4.7",
messages=[{"role": "user", "content": "Write a short noir scene set in a lighthouse."}],
max_tokens=256,
)
print(response.choices[0].message.content)Coding tools that work with Grok 4.7
Common questions
What is Grok 4.7?
Grok 4.7 is a xAI language model served through RouterHub using the OpenAI-compatible Chat Completions API. Its exact API model ID is grok-4.7.
How much does Grok 4.7 cost?
RouterHub charges $0.07175 input, $0.01794 cached input and $0.2152 output per million tokens (prices as of 2026-11-08). A typical chat message of about 1,000 input and 500 output tokens costs about 0.018¢. Usage is billed against your prepaid balance.
What is the Grok 4.7 context window?
Context window: 500,000 tokens. Maximum input: Not published. Maximum output: Not published.
Which API does Grok 4.7 support?
Use the OpenAI-compatible Chat Completions API at https://routerhub.si/v1/chat/completions with the exact model ID grok-4.7 and your RouterHub API key (Authorization: Bearer header).
Which coding tools work with Grok 4.7?
OpenCode, VS Code + Continue, VS Code + Cline, Hermes Agent. Each setup guide lists only compatible model IDs.
Can I try Grok 4.7 for free?
Grok 4.7 needs a free RouterHub account with prepaid credits. New accounts get $5 free on their first top-up of $20 or more.