Models

Gemma 4 31B (Free) vs Grok 4.7

API price, context window, capabilities and live speed, side by side.

Grok 4.7 has the larger context window (500K vs 262K tokens). Both run on the same UltraGPT API key, so you can switch between them by changing the model field - or list both in models: [...] for automatic fallback.

Gemma 4 31B (Free)Grok 4.7
LabGooglexAI
Model idgemma-4-31b-freegrok-4.7
Input / 1M tokensFree$2
Cached input / 1MFree$0.5
Output / 1M tokensFree$6
Context window262K500K
Inputimage, text, videotext, image, file
Outputtexttext
Tool calling✓✓
Vision (image input)✓✓
Reasoning——

Cost of 1,000 requests

Estimated from the list prices above; your real cost is reported per request in usage.cost.

Chatbot1.5K tokens in, 400 outGemma 4 31B (Free) $0.00Grok 4.7 $5.40
RAG over documents20K in, 800 outGemma 4 31B (Free) $0.00Grok 4.7 $44.80
Coding agent step40K in (80% cached), 1.5K outGemma 4 31B (Free) $0.00Grok 4.7 $41.00

Use both, with automatic fallback

Same key, same endpoint: change the model id between "gemma-4-31b-free" and "grok-4.7".

curl https://staging-api.ultragpt.pro/v1/chat/completions \
  -H "Authorization: Bearer $ULTRAGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemma-4-31b-free",
    "models": ["grok-4.7"],
    "messages": [{ "role": "user", "content": "Hello!" }]
  }'

FAQ

Which is cheaper, Gemma 4 31B (Free) or Grok 4.7?

Gemma 4 31B (Free): Free in / Free out per 1M. Grok 4.7: $2 in / $6 out per 1M. Prices are in USD and billed per use from your UltraGPT balance.

Can I use Gemma 4 31B (Free) and Grok 4.7 with the same API key?

Yes. Both are available through the OpenAI-compatible UltraGPT API at https://staging-api.ultragpt.pro/v1: set model to "gemma-4-31b-free" or "grok-4.7".

Which has a bigger context window, Gemma 4 31B (Free) or Grok 4.7?

Gemma 4 31B (Free): 262,144 tokens. Grok 4.7: 500,000 tokens.

More comparisons