---
title: "Gemma 4 31B API hosted in the EU"
description: "Run Google's Gemma 4 31B on inference.eu: an open multimodal model with 256K context behind an OpenAI-compatible API, processed in EU data centres."
canonical: "https://inference.eu/models/gemma-4-31b/"
language: "en"
---

Vision · Google DeepMind

# Run Gemma 4 31B in the EU through an OpenAI-compatible API

Gemma 4 31B is the largest dense model in Google DeepMind's Gemma 4 family, released in April 2026 under the Apache 2.0 licence. It reads text and images and handles a 256K-token context. On inference.eu you call it with the OpenAI or Anthropic request format, processed in EU data centres and never used for training.

[Contact sales](https://inference.eu/contact/)[Example request](#example)

1.  0130.7B
2.  02EU data centres
3.  03Apache 2.0

## What Gemma 4 31B is

Gemma 4 is Google DeepMind's family of open models, built from the same research as Gemini 3. The 31B model is the dense flagship: about 30.7 billion parameters, a vision encoder of roughly 550 million parameters, and a context window of 256K tokens. It accepts text and images in any order within one prompt and generates text.

The architecture mixes local sliding-window attention with global attention layers, which keeps memory use manageable on long inputs. Google states support for more than 35 languages out of the box, with pre-training on over 140. Unlike earlier Gemma releases, Gemma 4 uses the standard Apache 2.0 licence rather than custom Gemma terms.

## What it does well, and where it falls short

Gemma 4 31B is a capable mid-sized model for reasoning, coding, agent workflows and image understanding. It reads charts, screenshots, scanned pages and photos alongside text, which makes it useful for document workflows that mix layouts and prose. Its dense design gives steady, predictable output quality across tasks.

Because every token passes through all 31 billion parameters, it does more work per token than mixture-of-experts models such as Gemma 4 26B A4B. It does not take audio input: in the Gemma 4 family only the E2B, E4B and 12B models do. For very long agentic coding sessions, larger models such as GLM-5.3 or Kimi K3 go further.

## Calling Gemma 4 31B through the API

inference.eu speaks the OpenAI request format, so the OpenAI SDKs for Python and JavaScript, LangChain, LlamaIndex and the Vercel AI SDK work as they are. Set the base URL to the inference.eu API, use your inference.eu key and set the model to `gemma-4-31b`.

Send images as `image_url` content parts in the same message as your text; the model handles interleaved text and images. Tool calls, JSON output and streaming work as usual. If your tools use the Anthropic Messages format, Gemma 4 31B is available there as well, so you can switch by changing the base URL, key and model name.

## Data residency for Gemma 4 31B

Gemma 4 is published by Google, but on inference.eu the model runs on infrastructure in the European Union. Your prompts, images and the responses are processed in EU data centres, are not sent to Google, and are never used to train any model.

Every customer gets a data processing agreement under Article 28 of the GDPR and our subprocessor list, so you can show exactly who processes the data and where. Billing is in euros. Because Gemma 4 uses the Apache 2.0 licence, there are no usage thresholds or prohibited-use addenda beyond the law itself, which makes it simple to approve for commercial products.

## Gemma 4 31B

Maker

Google DeepMind

Made in

United States

Type

Vision

Parameters

30.7B

Context window

262,144 tokens

Licence

[Apache 2.0](https://ai.google.dev/gemma/docs/gemma_4_license)

Released

April 2026

Model ID

gemma-4-31b

Processing

EU data centres

Training on your data

Never

Source

[huggingface.co](https://huggingface.co/google/gemma-4-31B-it)

gemma-4-31b · Python

```
import os
from openai import OpenAI

client = OpenAI(base_url="https://api.inference.eu/v1", api_key=os.environ["INFERENCE_EU_API_KEY"])

response = client.chat.completions.create(
    model="gemma-4-31b",
    messages=[{"role": "user", "content": "Summarise this contract in five bullet points."}],
)
print(response.choices[0].message.content)
```

## What teams use it for

-   1

    ### Document and form understanding

    Read invoices, delivery notes and forms as images, and return the fields you need as structured JSON.

-   2

    ### Visual support assistants

    Let users upload a screenshot or photo of a problem and get an answer that takes the image into account.

-   3

    ### Agent workflows

    Plan and call tools in multi-step workflows where a dense, predictable model is easier to test than a larger one.

## Gemma 4 31B: common questions

The questions buyers, developers and legal teams ask us most. Something missing? Ask us directly.

GDPR compliance depends on how you process data. On inference.eu, Gemma 4 31B requests are processed in EU data centres, not used for training and covered by a data processing agreement under Article 28 GDPR with a published subprocessor list. That gives you the contractual basis to process personal data with it.

Gemma 4 31B supports 256K tokens of context, which is 262,144 tokens. The smaller E2B and E4B models in the family support 128K. Images count towards the context, and prompt and response together must fit inside the window.

Yes. Gemma 4 is released under the Apache 2.0 licence, which allows commercial use, modification and redistribution without user limits. Earlier Gemma generations used custom Gemma terms with a prohibited use policy; Gemma 4 moved to the standard Apache licence.

Yes. Gemma 4 31B accepts images with variable aspect ratios and resolutions, mixed freely with text in one prompt. It can describe photos, read charts and extract text from documents. It generates text only and does not accept audio input.

The 31B model is dense, so all 30.7 billion parameters work on every token. The 26B A4B is a mixture-of-experts model with about 3.8 billion active parameters, which makes it much lighter per token. The 31B is the choice when quality matters more than throughput.

Google states out-of-the-box support for more than 35 languages and pre-training on more than 140. The main European languages, including German, French, Spanish, Italian, Dutch and Polish, are well covered. Test smaller languages on your own content first.

Change the base URL of your OpenAI client to the inference.eu API, use your inference.eu key and set the model to \`gemma-4-31b\`. Text, image inputs, tool calls and streaming keep working with your existing code.

Both are dense multimodal models of similar size with 256K context. Qwen3.8 27B also understands video and has a controllable thinking mode aimed at agentic coding. Gemma 4 31B comes from Google with an Apache 2.0 licence. Compare them on your own tasks.

No. Google publishes the open weights; it is not involved in serving your requests. On inference.eu the model runs in EU data centres, your data stays with us under the data processing agreement, and it is never used for training.

Yes. Gemma 4 is built for agentic workflows and supports tool use. Pass your tools in the standard OpenAI \`tools\` parameter and the model returns tool calls in the usual format, so existing agent frameworks work without changes.

[Ask a question](https://inference.eu/contact/)

## Related

[All models](https://inference.eu/models/#directory)

-   [Gemma 4 26B A4BRun Google's Gemma 4 26B A4B on inference.eu: a fast mixture-of-experts model with image input and 256K context, processed in EU data centres.Vision](https://inference.eu/models/gemma-4-26b-a4b/)
-   [Qwen3.8 27BRun Qwen3.8 27B on inference.eu: a dense open model with image and video input, adjustable reasoning and 256K context, OpenAI-compatible, processed in the EU.Reasoning](https://inference.eu/models/qwen3-8-27b/)
-   [Mistral Small 4 119BRun Mistral Small 4 119B from French lab Mistral AI on inference.eu: reasoning, vision and code in one model, processed in EU data centres.Chat](https://inference.eu/models/mistral-small-4-119b/)
-   [Llama 3.3 70B InstructRun Meta's Llama 3.3 70B Instruct on inference.eu: an OpenAI-compatible API with requests processed in EU data centres and billed in euros.Chat](https://inference.eu/models/llama-3-3-70b-instruct/)

## Move your AI workloads to EU infrastructure

Tell us which models you use and roughly how much traffic you have. We reply within one working day with pricing and next steps.

-   Reply within one working day
-   Pricing for your volume
-   DPA ready to sign
