YepAPI

Command Palette

Search for a command to run...

xAIText Generation/v1/ai/chat

Grok 4.20

Access Grok 4.20 through one API key. xAI's flagship model with the largest context window.

xAI's flagship model. Industry-leading 2M token context window with strong reasoning, real-time knowledge, and competitive output pricing.

No credit card required. Takes 30 seconds.

2,400+

Developers

1.2M+

API calls served

100+

Endpoints

$0.01

Per call

Yep, that's it.

Try it live

Send a message and see Grok 4.20 respond in real time.

POST/v1/ai/chat

Maximum tokens in the response.

Real-time tokens

Hit "Send Request" to see the response

Context Window

2M tokens

Max Output

16K tokens

Input Price

$2.95 / 1M tokens

Output Price

$8.86 / 1M tokens

Strengths

✓
2M token context

An industry-leading 2,000,000-token context window ingests entire codebases, document libraries, or very long transcripts in one request — double most 1M-context rivals.

✓
Strong reasoning

Reliable multi-step reasoning across that huge window, able to synthesize and cross-reference information spread over millions of tokens of input.

✓
Real-time knowledge

Built with access to current information, making it well suited to questions about recent events and fast-moving topics rather than static, dated knowledge.

✓
Competitive pricing

At $2.95 / $8.86 per 1M tokens it offers a 2M-token window at rates well below flagship reasoning models, strong value for very large-context work.

Quick start

Copy this snippet and start making calls with Grok 4.20.

const res = await fetch('https://api.yepapi.com/v1/ai/chat', {
  method: 'POST',
  headers: {
    'x-api-key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "model": "x-ai/grok-4.20",
    "messages": [
      {
        "role": "user",
        "content": "Explain API gateways in 2 sentences."
      }
    ],
    "maxTokens": 256
  }),
});
const { data } = await res.json();
console.log(data.message.content);

Why use Grok 4.20 through YepAPI?

✓One API key for all models — no separate accounts
✓OpenAI SDK compatible — just change the base URL
✓No monthly minimums — pay per token
✓Switch models with one line of code
✓Full provider passthrough — citations, search results, and all extras included
✓Streaming and non-streaming support on every model
✓Works with Cursor, Claude, LangChain, and any LLM tool
✓Unified billing across all providers

Grok 4.20 API — pricing, context window & access

Grok 4.20 is xAI's flagship model, headlined by an industry-leading 2M-token context window paired with strong reasoning, real-time knowledge, and up to 16,384 output tokens. It is built for the largest-context tasks available.

Through YepAPI you reach Grok 4.20 over an OpenAI-compatible endpoint with one key that also covers the cheaper Grok 4.3, Claude, Gemini, Qwen, Mistral, and Perplexity Sonar, plus SEO, SERP, and web-scraping endpoints.

What is Grok 4.20?

Grok 4.20 is xAI's flagship, distinguished by a 2,000,000-token context window — among the largest in production, and double the 1M offered by most rivals. It combines that window with strong reasoning and access to real-time information, and returns up to 16,384 output tokens. The model is designed for workloads where the bottleneck is input size: feeding a whole codebase, a large document set, or an enormous conversation history into a single, coherent request.

Build with Grok 4.20 via YepAPI

Set the model to grok-4.20 on YepAPI's OpenAI-compatible /v1/ai/chat endpoint; standard OpenAI SDK code needs only a base-URL and model-name change. For shorter requests you can drop to the cheaper Grok 4.3 by editing one string, and the same key reaches Claude, Gemini, and Sonar — so you reserve the 2M window for the calls that actually need it.

Grok 4.20 API pricing — $2.95 / $8.86 per 1M tokens

Grok 4.20 costs $2.95 per 1M input tokens and $8.86 per 1M output tokens on YepAPI. For a 2M-token context model those rates are highly competitive, well under flagship reasoning models. Note that filling the full window is itself expensive at the input rate, so use the large context deliberately. Billing is per token with no minimums.

Grok 4.20 for whole-codebase and large-document analysis

Grok 4.20's 2M-token window is its reason to exist: analyzing an entire repository at once, querying across a large legal or financial document set, or maintaining a very long agent conversation without losing earlier context. Combined with real-time knowledge, it suits research and analysis over both big static corpora and current information that smaller-context models would have to truncate or chunk.

Try Grok 4.20 free

Sign up for $5 in free YepAPI credit, no card required. It is enough to run Grok 4.20 on a genuinely large input and see how the 2M-token window handles a document or codebase that breaks smaller models.

Start generating in 30 seconds

$5 free credit on signup. No credit card required. Pay per call.

What developers say

“Switched from SerpAPI and cut our SERP costs by 80%. Same data quality, way simpler billing.”

Marcus T.

SEO Platform Founder

“One API key for AI models, SERP data, and web scraping. Saved us from managing 4 separate providers.”

Priya S.

Full-Stack Developer

“The $5 free credit let us prototype our entire rank tracking feature before committing. No other API does that.”

Jake R.

Indie Hacker

Frequently asked questions

xAI's flagship model. Industry-leading 2M token context window with strong reasoning, real-time knowledge, and competitive output pricing.

Input tokens cost $2.95 per 1M tokens and output tokens cost $8.86 per 1M tokens through YepAPI. No monthly minimums — you only pay for what you use.

Sign up for a free API key, then send requests to the /v1/ai/chat endpoint.

Grok 4.20 supports a 2M token context window with up to 16K output tokens per request.

Ready to use Grok 4.20?

$5 free credit on signup. No credit card required. Pay per call.

Explore more models