Long-running coding
Work through changes across files, from planning and implementation to verification in your development workflow.
xAI / TEXT & CODE
From your next idea.
To your next build.
One API key for Grok 4.7, 4.6, 4.5, 4.3, 4, 4.20, and Build 0.1. Choose a model for coding, agents, and knowledge work.
Input from $0.0993/1M tokens · Unlimited concurrency for every user
01 / CAPABILITIES
Coding · Agents · Knowledge work
Work through changes across files, from planning and implementation to verification in your development workflow.
The launch notes emphasize self-verification and context management. Keep tests, sources, and human review in important workflows.
Connect research, analysis, and report drafting to your application. Official documentation lists a 500K-token context window.
Capabilities are based on official release notes and the catalog. Check the documentation for the model and endpoint you use. Grok 4.7 release notes ↗
02 / USAGE PRICING
Clear input and output rates, billed by token usage.
| Operation / tier | Model ID | Price (USD) |
|---|---|---|
| Grok 4.7 Base tier · input ≤ 200,000 tokens | ||
| Input | grok-4.7 | $0.1985 / 1M tokens |
| Output | grok-4.7 | $0.5956 / 1M tokens |
| Cache-hit input | grok-4.7 | $0.0496 / 1M tokens |
| Grok 4.7 Long-input tier · 200,000 < input ≤ 500,000 tokens | ||
| Input | grok-4.7 | $0.3971 / 1M tokens |
| Output | grok-4.7 | $1.191 / 1M tokens |
| Grok 4.6 Base tier · input ≤ 200,000 tokens | ||
| Input | grok-4.6 | $0.1985 / 1M tokens |
| Output | grok-4.6 | $0.5956 / 1M tokens |
| Cache-hit input | grok-4.6 | $0.0496 / 1M tokens |
| Grok 4.6 Long-input tier · 200,000 < input ≤ 500,000 tokens | ||
| Input | grok-4.6 | $0.3971 / 1M tokens |
| Output | grok-4.6 | $1.191 / 1M tokens |
| Grok 4.5 Base tier · input ≤ 200,000 tokens | ||
| Input | grok-4.5 | $0.1985 / 1M tokens |
| Output | grok-4.5 | $0.5956 / 1M tokens |
| Cache-hit input | grok-4.5 | $0.0298 / 1M tokens |
| Grok 4.5 Long-input tier · 200,000 < input ≤ 500,000 tokens | ||
| Input | grok-4.5 | $0.3971 / 1M tokens |
| Output | grok-4.5 | $1.191 / 1M tokens |
| Grok 4.3 Base tier · input ≤ 200,000 tokens | ||
| Input | grok-4.3 | $0.1241 / 1M tokens |
| Output | grok-4.3 | $0.2482 / 1M tokens |
| Cache-hit input | grok-4.3 | $0.0199 / 1M tokens |
| Grok 4.3 Long-input tier · 200,000 < input ≤ 500,000 tokens | ||
| Input | grok-4.3 | $0.2482 / 1M tokens |
| Output | grok-4.3 | $0.4963 / 1M tokens |
| Grok 4 Input / output | ||
| Input | grok-4 | $0.2978 / 1M tokens |
| Output | grok-4 | $1.4890 / 1M tokens |
| Grok 4.20 Reasoning Base tier · input ≤ 200,000 tokens | ||
| Input | grok-4-20-reasoning | $0.1241 / 1M tokens |
| Output | grok-4-20-reasoning | $0.2482 / 1M tokens |
| Grok 4.20 Reasoning Long-input tier · 200,000 < input ≤ 500,000 tokens | ||
| Input | grok-4-20-reasoning | $0.2482 / 1M tokens |
| Output | grok-4-20-reasoning | $0.4963 / 1M tokens |
| Grok 4.20 Non-Reasoning Base tier · input ≤ 200,000 tokens | ||
| Input | grok-4-20-non-reasoning | $0.1241 / 1M tokens |
| Output | grok-4-20-non-reasoning | $0.2482 / 1M tokens |
| Grok 4.20 Non-Reasoning Long-input tier · 200,000 < input ≤ 500,000 tokens | ||
| Input | grok-4-20-non-reasoning | $0.2482 / 1M tokens |
| Output | grok-4-20-non-reasoning | $0.4963 / 1M tokens |
| Grok Build 0.1 Base tier · input ≤ 200,000 tokens | ||
| Input | grok-build-0.1 | $0.0993 / 1M tokens |
| Output | grok-build-0.1 | $0.1985 / 1M tokens |
| Grok Build 0.1 Long-input tier · 200,000 < input ≤ 500,000 tokens | ||
| Input | grok-build-0.1 | $0.1985 / 1M tokens |
| Output | grok-build-0.1 | $0.3971 / 1M tokens |
Prices are in USD. Successfully submitted requests are metered by actual input and output tokens; current catalog rates apply. The 200K / 500K boundaries describe input billing tiers, not context limits for every model. Unlisted cache rates do not mean free usage; actual cache hits and other charges follow your bill.
100,000 input + 20,000 output tokens
$0.1985 × 0.1 + $0.5956 × 0.02$0.031762100,000 input + 20,000 output tokens each
10 × $0.031762$0.31762Examples use the base input tier, without cache hits or additional tool charges.
03 / USE CASES
Supply code and constraints for implementation suggestions, test plans, and review notes. Verify with your project tools.
Connect queries, calculations, and internal systems into traceable multi-step tasks. Confirm tool support for your chosen model.
Turn supplied material into summaries, proposals, and report drafts, with sources and review for key facts.
AnyAIGC
One API key and shared balance for 300+ models.
Direct access with published unit rates for budgeting.
Unlimited concurrency for every user of this series.
04 / QUICKSTART
Start with a minimal request, then connect it to your application.
The cURL examples use Bash / WSL. Python uses the standard library without an SDK. Requests return complete JSON; Python reads choices[0].message.content.
curl https://anyaigc.ai/v1/chat/completions \
-H "Authorization: Bearer $ANYAIGC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-4.7",
"messages": [
{
"role": "user",
"content": "Design a retry strategy for a Python API project. List implementation steps and the tests to cover."
}
],
"stream": false
}'import json
import os
import urllib.request
payload = {'model': 'grok-4.7', 'messages': [{'role': 'user', 'content': 'Design a retry strategy for a Python API project. List implementation steps and the tests to cover.'}], 'stream': False}
request = urllib.request.Request(
"https://anyaigc.ai/v1/chat/completions",
data=json.dumps(payload).encode("utf-8"),
headers={
"Authorization": f"Bearer {os.environ['ANYAIGC_API_KEY']}",
"Content-Type": "application/json",
},
method="POST",
)
with urllib.request.urlopen(request, timeout=180) as response:
result = json.load(response)
print(result["choices"][0]["message"]["content"])curl https://anyaigc.ai/v1/messages \
-H "Authorization: Bearer $ANYAIGC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-4.7",
"messages": [
{
"role": "user",
"content": "Design a retry strategy for a Python API project. List implementation steps and the tests to cover."
}
],
"stream": false,
"max_tokens": 1024
}'AnyAIGC documentation defines request and response fields. The Messages page does not document Grok-specific response differences, so that example shows the request without assuming extra response fields.
05 / ENTERPRISE
Bring procurement, finance, and engineering into one integration process.
Issue invoices yourself in the console for the amount you actually topped up.
Dedicated support and technical contacts for integration and troubleshooting.
Trial credit, top-ups, refunds, data handling and billing, spelled out up front.
New accounts get trial credit, so you can test before you top up.
Top up from $1. Unused balance can be refunded with no fee.
Requests go to official model channels, never cheaper or reverse-engineered substitutes.
Unless the law requires it, your prompts and outputs are not persistently stored or used for training. See the privacy policy.
See tokens and cost for every request in the console, and set a quota on each API key.
Contact support any time about integration, billing or incidents.
07 / FAQ
This guide covers grok-4.7, grok-4.6, grok-4.5, grok-4.3, grok-4, grok-4-20-reasoning, grok-4-20-non-reasoning, grok-build-0.1. grok-4.x is the guide URL, not an API model ID; examples use grok-4.7.
Series input starts at $0.0993 per million tokens for grok-build-0.1. Grok 4.7 input is $0.1985 and output is $0.5956 per million tokens. For Grok 4.7 requests with over 200,000 and up to 500,000 input tokens, input is $0.3971 and output is $1.191 per million tokens. These are the lowest displayed catalog rates; check the model catalog for current pricing.
All listed models support POST /v1/chat/completions. Grok 4.7, 4.6, 4.5, and 4.3 also support POST /v1/messages.
All models listed here have unlimited concurrency by default for every user, with no separate activation. Manage connections, timeouts, and retries in your application.
Ordinary chat does not automatically include live events. xAI requires search tools for live data; the basic examples here do not use search or promise support for every upstream search tool. Commercial use is governed by xAI terms.
Yes. You can issue invoices yourself in the console, for the amount you actually topped up.
You can top up with WeChat Pay, Alipay, USDT or a credit card. Your balance is in USD and works across every model on the platform. Invoices can be issued in the console for the amount you topped up.
Yes. New accounts get 5 million tokens of trial credit, so you can test before deciding to top up. Top-ups start at $1.
Yes. Unused balance can be refunded with no fee. Contact support to start a refund.
Requests go to official model channels, never cheaper or reverse-engineered substitutes. Unless the law requires it, we do not persistently store your prompts or outputs or use them for training, and the console shows tokens and cost for every request.