// npm install @heyputer/puter.js
import { puter } from '@heyputer/puter.js';
puter.ai.chat("Explain quantum computing in simple terms", {
model: "google/gemma-4-31b-it"
}).then(response => {
document.body.innerHTML = response.message.content;
});
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
puter.ai.chat("Explain quantum computing in simple terms", {
model: "google/gemma-4-31b-it"
}).then(response => {
document.body.innerHTML = response.message.content;
});
</script>
</body>
</html>
# pip install openai
from openai import OpenAI
client = OpenAI(
base_url="https://api.puter.com/puterai/openai/v1/",
api_key="YOUR_PUTER_AUTH_TOKEN",
)
response = client.chat.completions.create(
model="google/gemma-4-31b-it",
messages=[
{"role": "user", "content": "Explain quantum computing in simple terms"}
],
)
print(response.choices[0].message.content)
curl https://api.puter.com/puterai/openai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_PUTER_AUTH_TOKEN" \
-d '{
"model": "google/gemma-4-31b-it",
"messages": [
{"role": "user", "content": "Explain quantum computing in simple terms"}
]
}'
Model Card
Gemma 4 31B is a dense multimodal model from Google DeepMind, built on the same research foundation as Gemini 3. It is the most capable model in the Gemma 4 family, accepting text, image, and video input with a 256K-token context window.
It delivers strong benchmark results: 89.2% on AIME 2026, 85.2% on MMLU Pro, 80.0% on LiveCodeBench v6, and 84.3% on GPQA Diamond. On the Arena AI text leaderboard, it ranks as the #3 open model globally, outperforming many models with far higher parameter counts.
Gemma 4 31B features native function calling trained into the model, configurable chain-of-thought reasoning, and structured JSON output — making it especially well-suited for agentic workflows, coding tasks, and multi-turn tool use. It supports over 140 languages and serves as a strong foundation for fine-tuning.
Context Window 262K
tokens
Max Output 262K
tokens
Input Cost $0.39
per million tokens
Output Cost $0.97
per million tokens
Input text, image
modalities
Tool Use Yes
Knowledge Cutoff Jan 2025
Release Date Apr 2, 2026
Output Speed 35
tokens / sec
Latency 0.97s
time to first token
Model Playground
Try Gemma 4 31B instantly in your browser.
This playground uses the Puter.js AI API — no API keys or setup required.
Benchmarks
How Gemma 4 31B performs on standard evaluations.
| Benchmark | Score |
|---|---|
| GPQA Diamond Graduate-level science Q&A | 85.7% |
| Humanity's Last Exam Cross-domain reasoning | 23.6% |
| SciCode Scientific programming | 43.4% |
| IFBench Instruction following | 75.6% |
| LCR Long-context reasoning | 68.3% |
| Terminal-Bench Hard Agentic terminal tasks | 36.4% |
| τ²-Bench Tool use / agents | 59.9% |
Scores sourced from Artificial Analysis.
Find other Google models →
Gemini 3.5 Flash-Lite
Gemini 3.5 Flash-Lite is Google's fastest and most cost-efficient model in the Gemini 3.5 series, built for high-throughput, low-latency workloads. It scores 54% on Terminal-Bench 2.1 and 72.2% on GDM-MRCR v2, up from 31% and 60.1% for Gemini 3.1 Flash-Lite. It also outperforms the larger Gemini 3 Flash on SWE-Bench Pro (54.2% vs. 49.6%) and OSWorld-Verified (74.0% vs. 65.1%), while generating output at roughly 350 tokens per second. It supports text, image, video, audio, and PDF input with a 1M token context window, configurable thinking levels, and function calling, including computer use as a built-in tool. It's suited for agentic search, document processing, and other high-volume tasks where throughput and cost matter more than maximum reasoning depth.
ChatGemini 3.6 Flash
Gemini 3.6 Flash is Google's workhorse Flash-tier model, released as the successor to Gemini 3.5 Flash. It's built for running AI agents in production, with improvements in coding precision, computer use, and multimodal understanding. In Google's own benchmarks, it scores 83.0% on OSWorld-Verified (up from 78.4% for 3.5 Flash), 49% on DeepSWE (up from 37%), 63.9% on MLE-Bench (up from 49.7%), and 58.7% on SWE-Bench Pro. It also produces 17% fewer output tokens than 3.5 Flash on comparable tasks. It accepts text, image, video, audio, and PDF input with a 1M token context window, supports function calling and a built-in computer-use tool, and has a March 2026 knowledge cutoff. At $1.50 per million input tokens and $7.50 per million output tokens, it's cheaper on output than 3.5 Flash's $9 rate.
ImageGemini 3.1 Flash Lite Image
Gemini 3.1 Flash Lite Image is Google DeepMind's fastest and lowest-cost image generation and editing model in the Gemini 3.1 family, also known as Nano Banana 2 Lite. It generates a 1K-resolution image in about 4 seconds, roughly 2.7x faster than Gemini 3.1 Flash Image, at $0.0336 per image. It keeps the character consistency, precise natural-language editing, and real-world knowledge of the Nano Banana family while trading some peak quality for speed. It supports text-to-image generation, image editing, and multi-image composition through the same API used by other Gemini image models, with a discrete set of 14 aspect ratios at 1K resolution. It's built for high-volume, latency-sensitive use cases such as rapid prototyping, interactive applications, and batch image generation, where cost and turnaround time matter more than maximum fidelity.
Frequently Asked Questions
You can access Gemma 4 31B by Google through Puter.js AI API. Include the library in your web app or Node.js project and start making calls with just a few lines of JavaScript — no backend and no configuration required. You can also use it with Python or cURL via Puter's OpenAI-compatible API.
Yes, it is free if you're using it through Puter.js. With the User-Pays Model, you can add Gemma 4 31B to your app at no cost — your users pay for their own AI usage directly, making it completely free for you as a developer.
| Price per 1M tokens | |
|---|---|
| Input | $0.39 |
| Output | $0.97 |
Gemma 4 31B was created by Google and released on Apr 2, 2026.
Gemma 4 31B supports a context window of 262K tokens. For reference, that is roughly equivalent to 524 pages of text.
Gemma 4 31B can generate up to 262K tokens in a single response.
Gemma 4 31B has a knowledge cutoff date of Jan 2025. This means the model was trained on data available up to that date.
Gemma 4 31B accepts the following input types: text, image. It produces: text.
Yes, Gemma 4 31B supports tool use (function calling), allowing it to interact with external tools, APIs, and data sources as part of its response flow.
Gemma 4 31B scores 29.7 on the Artificial Analysis Intelligence Index, outperforming 73% of tracked models. On coding, it scores 43.4 (outperforms 55% of models).
Yes — the Gemma 4 31B API works with any JavaScript framework, Node.js, or plain HTML through Puter.js. Just include the library and start building. See the documentation for more details.
Get started with Puter.js
Add Gemma 4 31B to your app without worrying about API keys or setup.
Read the Docs View Tutorials