Cover: Gemma 4 API test, Gemma 4 31B at $0.55 per 1,000 chatbot answers with all 16 right, 1.19 second median, 1 of 34 free-tier calls went through

Gemma 4 API Pricing: 26B vs 31B on a Chatbot

Google’s Gemma 4 is an open-weight model family, so there is no single Google price for it. On the API side you pay whichever host serves it, and on OpenRouter on 30 November 2026 that meant $0.09 / $0.30 per million tokens for Gemma 4 26B A4B and $0.20 / $0.40 for Gemma 4 31B as headline prices, with individual hosts as low as $0.047 and as high as $0.75 for input. There is also a free route through Google AI Studio.

We put both Gemma 4 API models behind the same WordPress support bot we use for every model test and recorded what each answer cost, how long it took and whether it was right. The short version: Gemma 4 31B got all 16 answers right at $0.55 per 1,000 answers, with a 1.19-second median. That is cheaper than Claude Haiku 5.5 and DeepSeek V4.1 Flash on the same questions, and faster than both. The smaller 26B A4B was cheaper still, from $0.31 per 1,000, but it got the same shop refund sum wrong every time. The free tier was not usable: 1 call in 34 went through.

What Gemma 4 is

Google DeepMind released Gemma 4 on 2 April 2026 under the Apache 2.0 licence, a change from the custom Gemma licence earlier versions used. The family has four sizes. Two are small “edge” models, E2B and E4B, meant for phones and laptops. The two that matter for a hosted chatbot are:

  • Gemma 4 31B, a dense model. OpenRouter ID google/gemma-4-31b-it.
  • Gemma 4 26B A4B, a mixture-of-experts model with about 25 billion parameters in total and about 4 billion active per token. OpenRouter ID google/gemma-4-26b-a4b-it.

Both take text and images, answer in text, have a context window of about 262,000 tokens on most hosts, and support an optional reasoning (“thinking”) mode. Because the weights are public, any inference company can serve them, and dozens do. That is why the price question has more than one answer.

Gemma 4 API pricing on 30 November 2026

Here is what OpenRouter listed, per million tokens. The headline price is the one OpenRouter shows on the model page; the range covers every host serving the model that day.

ModelHeadline input / outputCheapest hostGoogle VertexHosts
Gemma 4 26B A4B$0.09 / $0.30$0.047 / $0.17 (PrimeIntellect flex, Darkbloom int4)$0.15 / $0.6015
Gemma 4 31B$0.20 / $0.40$0.10 / $0.34 (KT, CoreWeave fp4)not listed17
Gemma 4 26B A4B, free$0 / $0Google AI Studio only1
Gemma 4 31B, free$0 / $0Google AI Studio only1
Gemma 3 27B (previous generation)$0.08 / $0.16not comparedseveral

Two things in that table are easy to miss.

The cheapest hosts often run a compressed copy. OpenRouter labels each host’s precision: bf16 is the full model, fp8 is lightly compressed, fp4 and int4 are compressed further. The $0.047 Gemma 4 26B hosts are a “flex” tier and an int4 copy. We have not measured a quality loss from fp8, but if accuracy matters more than a fraction of a cent, pin a host that runs bf16 or fp8.

The headline price moves. On 29 November OpenRouter showed Gemma 4 26B at $0.0675 / $0.225; on 30 November it showed $0.09 / $0.30. Google did not change anything. The headline follows whichever host OpenRouter currently ranks first, so treat it as a typical price, not a fixed one. If you route by default, your bill can land anywhere in the range; if you pin a host, you get that host’s price.

For comparison, here are the models we tested Gemma 4 against:

ModelOpenRouter IDInput / output per 1MCached input
Claude Haiku 5.5anthropic/claude-haiku-5.5$0.10 / $0.50$0.01
GPT-6 Lunaopenai/gpt-6-luna$0.10 / $0.50$0.01
DeepSeek V4.1 Flashdeepseek/deepseek-v4.1-flash$0.05 to $0.45 input by hostvaries
Gemma 3 27Bgoogle/gemma-3-27b-it$0.08 / $0.16none listed

How we tested

Every request went from a WordPress server in the US to OpenRouter, in the same layout MxChat uses when you pick OpenRouter as the chat provider: our live system prompt, then the user’s question, then about 4,000 tokens of knowledge-base excerpts from mxchat.ai pages. Nothing was streamed, so the times below are for the complete answer. Temperature was 1. We ran three sets of questions:

  1. Knowledge-base questions (4 questions, 2 runs each). Real MxChat support questions about WooCommerce order lookups, storing embeddings without Pinecone, handing a chat to a human on Slack or Telegram, and using your own OpenRouter key. An answer counted as right if it used the fact the excerpts contained.
  2. Shop arithmetic (4 questions, 2 runs each). A made-up desk-accessories shop with a price list, a bundle, a discount code, shipping rules, delivery days and a returns policy, all in a short prompt of about 480 tokens. The bot had to work out the lowest total for a basket, a discounted total with Canadian shipping, the latest delivery date for an order placed after the cut-off before a no-shipping day, and a refund after return postage. Each has one right number.
  3. An unanswerable question (2 runs). “What is the phone number for MxChat support, and can I get a refund after 45 days?” Neither fact is in the excerpts. A good bot says it does not know.

We ran eight setups: Gemma 4 26B A4B on default routing and pinned to DeepInfra fp8; Gemma 4 31B on default routing and with reasoning set to high; Gemma 3 27B; Claude Haiku 5.5; GPT-6 Luna; and DeepSeek V4.1 Flash. We also tried Gemma 4 26B pinned to Google Vertex and both free Gemma 4 routes, which mostly failed, as described below. Reasoning was left at each model’s default unless stated; for Gemma 4 the default produced no thinking tokens. That came to 148 answered requests between 09:06 and 09:14 UTC on 30 November, and the whole test cost about $0.06.

Results: cost, speed and accuracy

SetupCost per 1,000 answersMedianSlowestOutput tokensRight
Gemma 4 26B A4B, DeepInfra fp8$0.310.93 s5.67 s4914/16
Gemma 4 26B A4B, default routing$0.440.95 s5.17 s4414/16
Gemma 4 31B, default routing$0.551.19 s2.40 s6516/16
Gemma 4 31B, reasoning high$0.684.59 s10.75 s49016/16
Gemma 3 27B$0.372.90 s4.99 s5812/16
GPT-6 Luna$0.35 billed, $0.49 before caching2.46 s3.20 s15216/16
DeepSeek V4.1 Flash$0.701.42 s8.17 s16216/16
Claude Haiku 5.5$0.852.00 s2.74 s30816/16

Cost, median, slowest and output tokens are for the knowledge-base questions, the ones that look like real chatbot traffic. “Right” counts the 8 knowledge-base answers plus the 8 arithmetic answers.

Cost

Bar chart of cost per 1,000 chatbot answers, from Gemma 4 26B A4B on DeepInfra at $0.31 and Gemma 4 31B at $0.55 to Claude Haiku 5.5 at $0.85

Gemma 4 is cheap mainly because it is short. With reasoning off, the 31B wrote about 65 tokens per answer and the 26B about 45. Haiku 5.5 and GPT-6 Luna both spend thinking tokens by default (about 200 and 100 per answer) and are billed for them at the output price.

Input still dominates, though. Every model read about 4,200 tokens per question, except Claude Haiku 5.5, whose tokenizer counted the same prompt as about 6,900 tokens. That is the main reason Haiku came last on cost despite having the same rate card as GPT-6 Luna. We covered the effect in more detail in our Claude tokenizer cost test.

At 10,000 answers a month, which is a busy small-business site, the bills work out roughly like this:

Setup10,000 answers a month100,000 answers a month
Gemma 4 26B A4B, DeepInfra$3.10$31
Gemma 4 31B$5.47$55
GPT-6 Luna (with caching)$3.54$35
DeepSeek V4.1 Flash$7.00$70
Claude Haiku 5.5$8.48$85

At these prices the model is rarely the biggest line in a chatbot budget. The difference between the cheapest and dearest setup here is about $5 a month at 10,000 answers.

Speed

Bar chart of median seconds to a chatbot answer, from Gemma 4 26B A4B at 0.93 s and Gemma 4 31B at 1.19 s to Gemma 4 31B with reasoning high at 4.59 s

Both Gemma 4 models answered in about a second, the fastest of anything we tested. The 26B was slightly quicker in the middle but had a slow tail: on both routes, one answer took over 5 seconds. The 31B’s slowest answer was 2.40 seconds. Turning reasoning to high on the 31B quadrupled the median to 4.59 seconds and produced one answer that took 10.75 seconds, without improving the score, because the 31B already got everything right with reasoning off.

Accuracy

Bar chart of right answers out of 16, Gemma 4 31B, Claude Haiku 5.5, GPT-6 Luna and DeepSeek V4.1 Flash at 16, Gemma 4 26B A4B at 14, Gemma 3 27B at 12

Every setup answered all 8 knowledge-base questions correctly. The differences came from the shop arithmetic.

  • Gemma 4 31B: 8 of 8. It found the bundle price, applied the discount only above the threshold, counted business days around the 26 November no-shipping day, and bought cable wraps as a 5-pack plus two singles.
  • Gemma 4 26B A4B: 6 of 8, on both routes. It missed the same question four times out of four. Asked for the refund on seven cable wraps “bought the cheapest way”, it priced them at $4.25 each ($29.75) instead of a 5-pack plus two ($25.50), so it gave $24.75 instead of $20.50. The answer is confident and the arithmetic inside it is correct; it just missed the cheaper option.
  • Gemma 3 27B: 4 of 8. It made the same cable-wrap mistake and twice got the delivery date wrong, giving 29 or 30 November instead of 1 December.
  • Haiku 5.5, GPT-6 Luna and DeepSeek V4.1 Flash: 8 of 8.

On the unanswerable question, no setup invented a phone number or a refund rule. Every answer said the information was not available and pointed to a support ticket or the documentation.

The jump from Gemma 3 to Gemma 4 is real: the 31B scored 16/16 against Gemma 3’s 12/16, answered more than twice as fast, and cost about 50% more per answer, roughly two cents more per hundred.

Short-prompt costs

On the shop questions, where the whole prompt is about 480 tokens, output decides the bill. Per 1,000 answers:

SetupCost per 1,000 shop answersMedianOutput tokens
Gemma 4 26B A4B$0.060.92 s66
Gemma 3 27B$0.071.92 s75
Gemma 4 31B$0.080.77 s69
GPT-6 Luna$0.122.56 s156
Gemma 4 31B, reasoning high$0.253.75 s521
Claude Haiku 5.5$0.282.09 s420
DeepSeek V4.1 Flash$0.352.40 s436

Gemma 4 31B got every shop question right without thinking, in under a second, for 8 cents per 1,000. The models that reason by default got the same score at one and a half to four times the price.

The free tier and Google Vertex: mostly rate-limited

“Gemma 4 free” is a common search, and OpenRouter does list free versions of both models, served by Google AI Studio. In our test they were not usable for a live chatbot. Of 18 requests to the free 26B A4B, none went through; of 16 to the free 31B, one did. Every failure was an HTTP 429 with the message that the model was “temporarily rate-limited upstream”. We spread the retries over about seven minutes on a Monday morning, US time.

Pinning the paid 26B to Google Vertex, at $0.15 / $0.60, did not help much: 3 of 16 requests went through, with the rest returning the same 429. The answers that did come back took about a second.

This is a snapshot, not a verdict on Google’s capacity; free and first-party routes are often busiest when a model is popular. But a support bot that fails 33 times in 34 is worse than one that costs $3 a month. Use the paid third-party hosts for production and keep the free route for testing, if at all. OpenRouter’s own trade-offs between routing and direct keys are in our OpenRouter pricing vs direct API comparison.

Gemma 4 26B or 31B?

  • Pick the 31B if your bot does anything with numbers: prices, bundles, discounts, delivery dates, refunds. It was the only Gemma that got every shop question right, its slowest answer was under 2.5 seconds, and it costs about $5.50 per 10,000 answers.
  • Pick the 26B A4B if your bot mostly answers from documentation, where both models scored 8 of 8, and you want the lowest bill. Pinned to DeepInfra it was the cheapest setup in this test, and it answered every knowledge-base question correctly with a median under a second.
  • Leave reasoning off for chat. On the 31B it added 3 to 4 seconds and 25% to the cost without changing a single answer in our test.
  • Move off Gemma 3. Gemma 4 31B costs a fraction of a cent more per answer and fixed every mistake Gemma 3 made here.

If you are comparing all the budget options, our cheapest LLM for a chatbot test covers 14 models under $1 per 1,000 answers, and our DeepSeek V4.1 Flash pricing guide covers the main open-weight alternative.

How to use Gemma 4 in MxChat

  1. Create an API key at OpenRouter and add a few dollars of credit. At Gemma 4 prices, $5 covers roughly 9,000 answers on the 31B.
  2. In WordPress, go to MxChat’s settings, choose OpenRouter as the provider and paste your key. The MxChat documentation covers each setting.
  3. Choose google/gemma-4-31b-it or google/gemma-4-26b-a4b-it as the chat model. Avoid the :free versions for a live site.
  4. Ask your bot a few questions that involve your own prices or policies and check the arithmetic before you switch it on for visitors.

Because Gemma 4 is open-weight under Apache 2.0, you can also run it on your own hardware with tools like Ollama and point a chatbot at that server, but for most WordPress sites a hosted API at these prices is simpler and cheaper than a GPU. MxChat Pro adds the knowledge-base, WooCommerce and live-handoff features we used in this test. See MxChat Pro for what is included.

Limits of this test

This is a small test: 8 setups, 18 answered requests each, one morning, one server location. The knowledge-base questions were easy for every model, so accuracy differences come from 8 arithmetic questions, and one question decided the 26B’s score. Default routing spread requests across several hosts, so the default-routing costs are an average of those hosts’ prices that morning. The monthly figures are our per-answer costs multiplied up, not measured bills. The free-tier and Vertex results reflect one seven-minute window. Prices were read from OpenRouter on 30 November 2026 and change often, especially the headline price on open-weight models.

FAQ

How much does the Gemma 4 API cost?

It depends on the host. On OpenRouter on 30 November 2026, Gemma 4 26B A4B was listed at $0.09 / $0.30 per million input and output tokens and Gemma 4 31B at $0.20 / $0.40, with individual hosts from $0.047 to $0.75 for input. In our test that came to $0.31 to $0.44 per 1,000 support answers for the 26B and $0.55 for the 31B.

Is Gemma 4 free?

The weights are free to download under Apache 2.0, and OpenRouter lists free API versions served by Google AI Studio. In our test the free API versions were rate-limited almost every time: 1 request in 34 went through.

What is the difference between Gemma 4 26B A4B and Gemma 4 31B?

The 31B is a dense model; the 26B A4B is a mixture-of-experts model with about 4 billion parameters active per token, which makes it cheaper to serve. In our test both answered documentation questions perfectly, but only the 31B got all the shop arithmetic right.

Is Gemma 4 good enough for a customer support chatbot?

Gemma 4 31B scored 16 out of 16 on our support and shop questions, the same as Claude Haiku 5.5, GPT-6 Luna and DeepSeek V4.1 Flash, and answered faster than all three. It did not invent a phone number or refund policy when the answer was not in the knowledge base.

Should I turn on Gemma 4 reasoning for a chatbot?

Not for typical support questions. Reasoning high on the 31B raised the median answer time from 1.19 to 4.59 seconds and the cost by 25%, with no change in accuracy on our questions.

Is Gemma 4 cheaper than Claude Haiku 5.5?

Yes, on our questions. Gemma 4 31B cost $0.55 per 1,000 answers against $0.85 for Haiku 5.5, mainly because Claude’s tokenizer counted our prompt as about 65% more tokens and Haiku spends thinking tokens by default.

Why does the Gemma 4 price on OpenRouter keep changing?

OpenRouter’s headline price follows the host it currently ranks first. Google sets no API price for open-weight Gemma; each host sets its own. Pin a host in your request if you need a fixed price.

Can I use Gemma 4 in a WordPress chatbot?

Yes. MxChat connects to OpenRouter, so you can pick google/gemma-4-31b-it or google/gemma-4-26b-a4b-it as the chat model with your own API key and use it with your knowledge base.

Similar Posts