Grok 4.20 Non-Reasoning
Text Generation • xAI
xai/grok-4.20-0309-non-reasoning
- Third-party
- Zero data retention
xAI's Grok 4.20 non-reasoning model. Skips the thinking trace for fast, single-pass responses while keeping the same training as the reasoning variant.
| Model Info | |
|---|---|
| Context Window ↗ | 2,000,000 tokens |
| Terms and License | link ↗ |
| More information | link ↗ |
| Zero data retention | Yes |
| Request formats | Chat Completions |
| Pricing | <ul><li>Input (per 1M tokens)$2.00</li><li>Output (per 1M tokens)$6.00</li><li>Cached input (per 1M tokens)$0.20</li></ul> |
Usage
const response = await env.AI.run(
'xai/grok-4.20-0309-non-reasoning',
{ messages: [{ content: 'What are the three laws of thermodynamics?', role: 'user' }] },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "xai/grok-4.20-0309-non-reasoning",
"messages": [
{
"content": "What are the three laws of thermodynamics?",
"role": "user"
}
]
}'
**The Three Laws of Thermodynamics** (in their most common, concise form):
### **Zeroth Law of Thermodynamics** (often called the "zeroth" because it logically precedes the others)
> If two systems are each in thermal equilibrium with a third system, then they are in thermal equilibrium with each other.
This is the basis for the concept of **temperature** — it allows us to define a universal temperature scale.
### **First Law of Thermodynamics**
> Energy cannot be created or destroyed, only converted from one form to another.
Mathematically:
**ΔU = Q − W**
(where ΔU is the change in internal energy, Q is heat added to the system, and W is work done *by* the system)
This is essentially the **law of conservation of energy** applied to thermodynamic systems.
### **Second Law of Thermodynamics**
> The entropy of an isolated system always increases over time, or remains constant in ideal reversible processes. Heat flows spontaneously from hot to cold, never the reverse.
Common statements:
- "The entropy of the universe tends to a maximum."
- "It is impossible to construct a heat engine that is 100% efficient."
This law introduces the concept of **irreversibility** and the **arrow of time**.
---
### Bonus: The **Third Law of Thermodynamics** (Nernst Heat Theorem)
> As the temperature of a system approaches absolute zero (0 K), the entropy of a perfect crystal approaches a minimum (usually zero).
This implies it's impossible to reach absolute zero in a finite number of steps.
---
**Summary (popular phrasing):**
1. **Zeroth**: Temperature exists.
2. **First**: You can't win (energy is conserved).
3. **Second**: You can't break even (entropy always increases).
4. **Third**: You can't even quit the game (absolute zero is unreachable).
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "**The Three Laws of Thermodynamics** (in their most common, concise form):\n\n### **Zeroth Law of Thermodynamics** (often called the \"zeroth\" because it logically precedes the others)\n> If two systems are each in thermal equilibrium with a third system, then they are in thermal equilibrium with each other.\n\nThis is the basis for the concept of **temperature** — it allows us to define a universal temperature scale.\n\n### **First Law of Thermodynamics**\n> Energy cannot be created or destroyed, only converted from one form to another.\n\nMathematically: \n**ΔU = Q − W** \n(where ΔU is the change in internal energy, Q is heat added to the system, and W is work done *by* the system)\n\nThis is essentially the **law of conservation of energy** applied to thermodynamic systems.\n\n### **Second Law of Thermodynamics**\n> The entropy of an isolated system always increases over time, or remains constant in ideal reversible processes. Heat flows spontaneously from hot to cold, never the reverse.\n\nCommon statements:\n- \"The entropy of the universe tends to a maximum.\"\n- \"It is impossible to construct a heat engine that is 100% efficient.\"\n\nThis law introduces the concept of **irreversibility** and the **arrow of time**.\n\n---\n\n### Bonus: The **Third Law of Thermodynamics** (Nernst Heat Theorem)\n> As the temperature of a system approaches absolute zero (0 K), the entropy of a perfect crystal approaches a minimum (usually zero).\n\nThis implies it's impossible to reach absolute zero in a finite number of steps.\n\n---\n\n**Summary (popular phrasing):**\n1. **Zeroth**: Temperature exists.\n2. **First**: You can't win (energy is conserved).\n3. **Second**: You can't break even (entropy always increases).\n4. **Third**: You can't even quit the game (absolute zero is unreachable).",
"refusal": null,
"role": "assistant"
}
}
],
"created": 1777675694,
"gatewayMetadata": {
"keySource": "Unified"
},
"id": "ad22f976-34a4-e1f2-5d44-2c6b9c2fb9e5",
"model": "grok-4.20-0309-non-reasoning",
"object": "chat.completion",
"system_fingerprint": "fp_bdeb03b7cd",
"usage": {
"completion_tokens": 378,
"completion_tokens_details": {
"accepted_prediction_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0,
"rejected_prediction_tokens": 0
},
"cost_in_usd_ticks": 10403000,
"num_sources_used": 0,
"prompt_tokens": 130,
"prompt_tokens_details": {
"audio_tokens": 0,
"cached_tokens": 64,
"image_tokens": 0,
"text_tokens": 130
},
"total_tokens": 508
}
}
Examples
<details>
<summary>With System Message — Using a system message to set context</summary>
const response = await env.AI.run(
'xai/grok-4.20-0309-non-reasoning',
{
messages: [
{ content: 'You are a helpful coding assistant specializing in Python.', role: 'system' },
{ content: 'How do I read a JSON file in Python?', role: 'user' },
],
},
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "xai/grok-4.20-0309-non-reasoning",
"messages": [
{
"content": "You are a helpful coding assistant specializing in Python.",
"role": "system"
},
{
"content": "How do I read a JSON file in Python?",
"role": "user"
}
]
}'
```
**Reading a JSON file in Python** is very straightforward using the built-injson` module.
1. Basic Method (Recommended)
```python import json from pathlib import Path
