Grok 4.20 vs GPT-5
Both sit behind the same key and the same code on uttapen — the only thing that changes is the model string, so you can run each of them against your own workload without touching anything else. On cost, Grok 4.20 comes out about 3× cheaper.
| Feature | Grok 4.20 | GPT-5 |
|---|---|---|
| Provider | xAI | OpenAI |
| Model id | x-ai/grok-4.20 | openai/gpt-5 |
| Context | 2,000,000 tokens | 400,000 tokens |
| Max output | 1,800,000 tokens | 128,000 tokens |
| Input / 1M tokens | 362,656 toman | 362,656 toman |
| Output / 1M tokens | 725,313 toman | 2,901,250 toman |
| ≈ one 1,000-word request | 1,414 toman | 4,243 toman |
| Input caching | 58,025 toman / 1M | 36,266 toman / 1M |
| Image input | Yes | Yes |
| File input | Yes | Yes |
| Tool calling | Yes | Yes |
| JSON output | Yes | Yes |
| Reasoning mode | Yes | Yes |
Which one for what?
Grok 4.20
- Multi-step problems, maths, and tracking down a bug
- Whole documents or a codebase in a single request
- Reading screenshots, invoices, and scanned forms
- Agents that call your own APIs and database
1,414 toman per 1,000 words · Model page
GPT-5
- Multi-step problems, maths, and tracking down a bug
- Whole documents or a codebase in a single request
- Reading screenshots, invoices, and scanned forms
- Agents that call your own APIs and database
4,243 toman per 1,000 words · Model page
Run both with the same code
Swap the model value between the two ids and send the same request twice; what each answer cost comes back in the X-Uttapen-Cost-Toman header.
curl https://api.uttapen.ir/v1/chat/completions \
-H "Authorization: Bearer sk-up-…" \
-H "Content-Type: application/json" \
-d '{
"model": "x-ai/grok-4.20",
"messages": [{"role": "user", "content": "Introduce yourself in one sentence."}],
"stream": true
}'from openai import OpenAI
client = OpenAI(
base_url="https://api.uttapen.ir/v1",
api_key="sk-up-…",
)
stream = client.chat.completions.create(
model="x-ai/grok-4.20",
messages=[{"role": "user", "content": "Introduce yourself in one sentence."}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="", flush=True)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.uttapen.ir/v1",
apiKey: "sk-up-…",
});
const stream = await client.chat.completions.create({
model: "x-ai/grok-4.20",
messages: [{ role: "user", content: "Introduce yourself in one sentence." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}<?php
// composer require openai-php/client guzzlehttp/guzzle
$client = OpenAI::factory()
->withBaseUri('https://api.uttapen.ir/v1')
->withApiKey('sk-up-…')
->make();
$result = $client->chat()->create([
'model' => 'x-ai/grok-4.20',
'messages' => [['role' => 'user', 'content' => 'Introduce yourself in one sentence.']],
]);
echo $result->choices[0]->message->content;package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithBaseURL("https://api.uttapen.ir/v1"),
option.WithAPIKey("sk-up-…"),
)
resp, err := client.Chat.Completions.New(context.Background(), openai.ChatCompletionNewParams{
Model: "x-ai/grok-4.20",
Messages: []openai.ChatCompletionMessageParamUnion{openai.UserMessage("Introduce yourself in one sentence.")},
})
if err != nil {
panic(err)
}
fmt.Println(resp.Choices[0].Message.Content)
}model = "openai/gpt-5"
More comparisons: all pairs · model rankings · full catalogue
base_url = https://api.uttapen.ir/v1