inference-providers

Gemma 4

by google · family gemma

Facts

Release date2026-03-31
Retired date
Knowledge cutoff
Context (max)262,144
Max output8,192
Modalitiestext, image, audio, video → text
Aliasesgemma-4-31B-itgemma4
Open weightsyes
DescriptionOpen-weight multimodal family (E2B/E4B/26B-A4B/31B dense), 256K context; MTP variants 2026-04-16, 12B Unified 2026-06-03; now served on the Gemini API.

Unknown values are shown as —.

Intelligence Index v4.1.1: 30 · Gemma 4 31B reasoning · Source: Artificial Analysis (accessed 2026-08-20)

Offerings

ProviderWire IDVariantEndpointProtocolStatusPrice (USD / Mtok)Reasoning
Google Gemini APIgemma-4-31b-itgenerate-contentgoogle-generate-contentgaadaptive · default on · returns hidden
IO Intelligence (io.net)google/gemma-4-26b-a4b-itchatopenai-chatga0.11 / 0.41effort · default on · returns reasoning_content
NEAR AI Cloudgoogle/gemma-4-31B-itchatopenai-chatretired0.13 / 0.40adaptive · default on · returns hidden
NVIDIA NIM APIgoogle/gemma-4-31b-itv1-chat-completionsopenai-chatgaadaptive · default on · returns reasoning_content
Ollama Cloudgemma4:31bv1-chat-completionsopenai-chatgaeffort · default on · returns hidden
OpenRoutergoogle/gemma-4-26b-a4b-itchat-completionsopenai-chatga0.07 / 0.34effort · default on · returns reasoning_content · round-trips reasoning_content
OpenRoutergoogle/gemma-4-31b-itchat-completionsopenai-chatga0.09 / 0.34effort · default on · returns reasoning_content · round-trips reasoning_content

Reasoning controls

Google Gemini API· gemma-4-31b-it· generate-content adaptive

adaptive · default on · returns hidden

IO Intelligence (io.net)· google/gemma-4-26b-a4b-it· chat effort

reasoning.effort nonelowmediumhigh● Default not documented — verify.

effort · default on · returns reasoning_content

NEAR AI Cloud· google/gemma-4-31B-it· chat adaptive

adaptive · default on · returns hidden

NVIDIA NIM API· google/gemma-4-31b-it· v1-chat-completions adaptive

adaptive · default on · returns reasoning_content

Ollama Cloud· gemma4:31b· v1-chat-completions effort

reasoning_effort nonelowmediumhigh●max Default level not documented; verify.

effort · default on · returns hidden

OpenRouter· google/gemma-4-26b-a4b-it· chat-completions effort

reasoning.effort nonelowmedium●highxhighmax

effort · default on · returns reasoning_content · round-trips reasoning_content

OpenRouter· google/gemma-4-31b-it· chat-completions effort

reasoning.effort nonelowmedium●highxhighmax

effort · default on · returns reasoning_content · round-trips reasoning_content

Example requests

Google Gemini API · google-generate-content · gemma-4-31b-it

curl 'https://generativelanguage.googleapis.com/v1beta/models/gemma-4-31b-it:generateContent' \
  -H 'Content-Type: application/json' \
  -H 'x-goog-api-key: <YOUR_API_KEY>' \
  -d '{
  "contents": [
    {
      "parts": [
        {
          "text": "Tell me about the weather."
        }
      ]
    }
  ]
}'
Python (requests)
import requests

resp = requests.post(
    "https://generativelanguage.googleapis.com/v1beta/models/gemma-4-31b-it:generateContent",
    headers={
      "Content-Type": "application/json",
      "x-goog-api-key": "<YOUR_API_KEY>"
    },
    json={
      "contents": [
        {
          "parts": [
            {
              "text": "Tell me about the weather."
            }
          ]
        }
      ]
    },
)
print(resp.json())
TypeScript (fetch)
const resp = await fetch("https://generativelanguage.googleapis.com/v1beta/models/gemma-4-31b-it:generateContent", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-goog-api-key": "<YOUR_API_KEY>"
  },
  body: JSON.stringify({
    "contents": [
      {
        "parts": [
          {
            "text": "Tell me about the weather."
          }
        ]
      }
    ]
  }),
})
console.log(await resp.json())

IO Intelligence (io.net) · openai-chat · google/gemma-4-26b-a4b-it

curl 'https://api.intelligence.io.solutions/api/v1/chat/completions' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "google/gemma-4-26b-a4b-it",
  "messages": [
    {
      "role": "user",
      "content": "Tell me about the weather."
    }
  ],
  "reasoning": {
    "effort": "high"
  }
}'
Python (requests)
import requests

resp = requests.post(
    "https://api.intelligence.io.solutions/api/v1/chat/completions",
    headers={
      "Authorization": "Bearer <YOUR_API_KEY>",
      "Content-Type": "application/json"
    },
    json={
      "model": "google/gemma-4-26b-a4b-it",
      "messages": [
        {
          "role": "user",
          "content": "Tell me about the weather."
        }
      ],
      "reasoning": {
        "effort": "high"
      }
    },
)
print(resp.json())
TypeScript (fetch)
const resp = await fetch("https://api.intelligence.io.solutions/api/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "google/gemma-4-26b-a4b-it",
    "messages": [
      {
        "role": "user",
        "content": "Tell me about the weather."
      }
    ],
    "reasoning": {
      "effort": "high"
    }
  }),
})
console.log(await resp.json())

NEAR AI Cloud · openai-chat · google/gemma-4-31B-it

curl 'https://cloud-api.near.ai/v1/chat/completions' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "google/gemma-4-31B-it",
  "messages": [
    {
      "role": "user",
      "content": "Tell me about the weather."
    }
  ]
}'
Python (requests)
import requests

resp = requests.post(
    "https://cloud-api.near.ai/v1/chat/completions",
    headers={
      "Authorization": "Bearer <YOUR_API_KEY>",
      "Content-Type": "application/json"
    },
    json={
      "model": "google/gemma-4-31B-it",
      "messages": [
        {
          "role": "user",
          "content": "Tell me about the weather."
        }
      ]
    },
)
print(resp.json())
TypeScript (fetch)
const resp = await fetch("https://cloud-api.near.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "google/gemma-4-31B-it",
    "messages": [
      {
        "role": "user",
        "content": "Tell me about the weather."
      }
    ]
  }),
})
console.log(await resp.json())

NVIDIA NIM API · openai-chat · google/gemma-4-31b-it

curl 'https://integrate.api.nvidia.com/v1/chat/completions' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "google/gemma-4-31b-it",
  "messages": [
    {
      "role": "user",
      "content": "Tell me about the weather."
    }
  ]
}'
Python (requests)
import requests

resp = requests.post(
    "https://integrate.api.nvidia.com/v1/chat/completions",
    headers={
      "Authorization": "Bearer <YOUR_API_KEY>",
      "Content-Type": "application/json"
    },
    json={
      "model": "google/gemma-4-31b-it",
      "messages": [
        {
          "role": "user",
          "content": "Tell me about the weather."
        }
      ]
    },
)
print(resp.json())
TypeScript (fetch)
const resp = await fetch("https://integrate.api.nvidia.com/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "google/gemma-4-31b-it",
    "messages": [
      {
        "role": "user",
        "content": "Tell me about the weather."
      }
    ]
  }),
})
console.log(await resp.json())

Ollama Cloud · openai-chat · gemma4:31b

curl 'https://ollama.com/v1/chat/completions' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "gemma4:31b",
  "messages": [
    {
      "role": "user",
      "content": "Tell me about the weather."
    }
  ],
  "reasoning_effort": "high"
}'
Python (requests)
import requests

resp = requests.post(
    "https://ollama.com/v1/chat/completions",
    headers={
      "Authorization": "Bearer <YOUR_API_KEY>",
      "Content-Type": "application/json"
    },
    json={
      "model": "gemma4:31b",
      "messages": [
        {
          "role": "user",
          "content": "Tell me about the weather."
        }
      ],
      "reasoning_effort": "high"
    },
)
print(resp.json())
TypeScript (fetch)
const resp = await fetch("https://ollama.com/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "gemma4:31b",
    "messages": [
      {
        "role": "user",
        "content": "Tell me about the weather."
      }
    ],
    "reasoning_effort": "high"
  }),
})
console.log(await resp.json())

OpenRouter · openai-chat · google/gemma-4-26b-a4b-it

curl 'https://openrouter.ai/api/v1/chat/completions' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "google/gemma-4-26b-a4b-it",
  "messages": [
    {
      "role": "user",
      "content": "Tell me about the weather."
    }
  ],
  "reasoning": {
    "effort": "medium"
  }
}'
Python (requests)
import requests

resp = requests.post(
    "https://openrouter.ai/api/v1/chat/completions",
    headers={
      "Authorization": "Bearer <YOUR_API_KEY>",
      "Content-Type": "application/json"
    },
    json={
      "model": "google/gemma-4-26b-a4b-it",
      "messages": [
        {
          "role": "user",
          "content": "Tell me about the weather."
        }
      ],
      "reasoning": {
        "effort": "medium"
      }
    },
)
print(resp.json())
TypeScript (fetch)
const resp = await fetch("https://openrouter.ai/api/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "google/gemma-4-26b-a4b-it",
    "messages": [
      {
        "role": "user",
        "content": "Tell me about the weather."
      }
    ],
    "reasoning": {
      "effort": "medium"
    }
  }),
})
console.log(await resp.json())
  • ⚠ Responses include reasoning_content artifacts — pass them back unmodified on subsequent turns (dropping them triggers 400s or quality loss).

OpenRouter · openai-chat · google/gemma-4-31b-it

curl 'https://openrouter.ai/api/v1/chat/completions' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "google/gemma-4-31b-it",
  "messages": [
    {
      "role": "user",
      "content": "Tell me about the weather."
    }
  ],
  "reasoning": {
    "effort": "medium"
  }
}'
Python (requests)
import requests

resp = requests.post(
    "https://openrouter.ai/api/v1/chat/completions",
    headers={
      "Authorization": "Bearer <YOUR_API_KEY>",
      "Content-Type": "application/json"
    },
    json={
      "model": "google/gemma-4-31b-it",
      "messages": [
        {
          "role": "user",
          "content": "Tell me about the weather."
        }
      ],
      "reasoning": {
        "effort": "medium"
      }
    },
)
print(resp.json())
TypeScript (fetch)
const resp = await fetch("https://openrouter.ai/api/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "google/gemma-4-31b-it",
    "messages": [
      {
        "role": "user",
        "content": "Tell me about the weather."
      }
    ],
    "reasoning": {
      "effort": "medium"
    }
  }),
})
console.log(await resp.json())
  • ⚠ Responses include reasoning_content artifacts — pass them back unmodified on subsequent turns (dropping them triggers 400s or quality loss).