Skip to content
Vercel AI Gateway

Xai/Grok 2

Xai/Grok 2 is available via Vercel AI Gateway with a 131K context window and up to 4,000 output tokens. Pricing: $2.00/1M input tokens, $10.00/1M output tokens.

Xai/Grok 2 Pricing & Specifications

Input Price$2.00 per 1M tokens
Output Price$10.00 per 1M tokens
Context Window131,072 tokens (131K)
Max Output4,000 tokens
ProviderVercel AI Gateway

What is Xai/Grok 2?

Xai/Grok 2 is a large language model by Vercel AI Gateway with a 131K context window and up to 4,000 output tokens. It costs $2.00 per 1M input tokens and $10.00 per 1M output tokens. Xai/Grok 2 is available via Vercel AI Gateway with a 131K context window and up to 4,000 output tokens. Pricing: $2.00/1M input tokens, $10.00/1M output tokens.

Capabilities

text function calling

Xai/Grok 2 Cost Examples

Short prompt (500 tokens)

$0.001000

Medium prompt (2K tokens)

$0.00400

Long output (4K tokens)

$0.04000

Count tokens for Xai/Grok 2

Paste your prompt to see exact token counts and API cost estimates.

Open Token Counter

Similar Models to Xai/Grok 2

Vercel AI Gateway

Mistral/Magistral Medium

$2.00/1M in 128K ctx

Vercel AI Gateway

Mistral/Mistral Large

$2.00/1M in 32K ctx

Vercel AI Gateway

Mistral/Pixtral Large

$2.00/1M in 128K ctx

Vercel AI Gateway

Openai/Gpt 4.1

$2.00/1M in 1.0M ctx

Frequently Asked Questions

How much does Xai/Grok 2 cost per token? +
Xai/Grok 2 costs $2.00 per 1M input tokens and $10.00 per 1M output tokens. For a typical 1,000-token request with a 500-token response, that works out to roughly $0.007000.
What is the context window for Xai/Grok 2? +
Xai/Grok 2 supports a context window of 131,072 tokens (131K). This determines the maximum combined length of your prompt and conversation history in a single API call.
What is the maximum output length for Xai/Grok 2? +
Xai/Grok 2 can generate up to 4,000 tokens in a single response. If you need longer outputs, you can make multiple API calls and concatenate the results.
Is Xai/Grok 2 good for coding tasks? +
Yes, Xai/Grok 2 supports capabilities well-suited for coding tasks including code generation, debugging, and refactoring.
Token Counter | Pricing Calculator | Model Comparison | All Vercel AI Gateway Models