{
 "kind": "model",
 "slug": "google-gemma-4-31b-it",
 "path": "models/open/google-gemma-4-31b-it/",
 "name": "Gemma 4 31B",
 "maker": "Google",
 "density": "full",
 "crumbs": [
  [
   "Models",
   "models/"
  ],
  [
   "Open models",
   "models/open/"
  ]
 ],
 "lead": "Chat, code and image reading.",
 "chips": [
  {
   "label": "Text and agents",
   "path": "models/open/"
  },
  {
   "label": "Commercial use"
  },
  {
   "label": "Runs on 32 GB"
  }
 ],
 "primary": {
  "label": "Copy model id",
  "copy": "google/gemma-4-31B-it"
 },
 "links": [
  {
   "label": "Hugging Face",
   "href": "https://huggingface.co/google/gemma-4-31B-it"
  },
  {
   "label": "Demos",
   "href": "https://huggingface.co/spaces?search=Gemma 4 31B"
  }
 ],
 "track": "New versions, price and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "Commercial use",
   "value": "Allowed",
   "status": "yes",
   "sub": "Apache 2.0",
   "quote": "each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work",
   "note": "Any use is allowed, paid products included; no fee and no credit line is required to use it.",
   "src": "https://ai.google.dev/gemma/docs/gemma_4_license"
  },
  {
   "key": "local",
   "label": "On your machine",
   "status": "yes",
   "value": "32 GB of memory",
   "sub": "31.3B parameters, ~18.8 GB at 4-bit",
   "note": "Our estimate: about 0.6 GB per billion parameters at 4-bit, with room for the context.",
   "src": "https://huggingface.co/google/gemma-4-31B-it"
  },
  {
   "key": "api",
   "label": "Through an API",
   "status": "yes",
   "value": "$0.1 / $0.34",
   "sub": "per 1M tokens, CoreWeave",
   "note": "Cheapest live provider with tool calling, as the provider reports its price.",
   "src": "https://huggingface.co/docs/inference-providers"
  },
  {
   "key": "tools",
   "label": "Tool calling",
   "status": "yes",
   "value": "10 of 10 providers",
   "sub": "10 providers, 10 with tool calling",
   "note": "Providers whose API supports tool calling for this model, as each reports it.",
   "src": "https://huggingface.co/google/gemma-4-31B-it"
  }
 ],
 "vfoot": "Checked against its official pages on Nov 23, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What Gemma 4 31B does",
   "parts": [
    {
     "t": "prose",
     "text": "Gemma 4 31B is an open text and image model by Google DeepMind that chats, writes code, reasons step by step and reads pictures, documents and screenshots. It is the largest dense size of the Gemma 4 family. The model files are on Hugging Face, free to use in paid products under the Apache 2.0 license."
    },
    {
     "t": "h3",
     "text": "What people use it for"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Chat assistant and drafts",
       "text": "Run your own assistant for support chats, emails, summaries or marketing text, on your own server instead of a paid hosted model.",
       "idea": false
      },
      {
       "title": "Read documents, charts and screenshots",
       "text": "Ask questions about a photo, a scanned page, a chart or an app screen, including text in many languages and handwriting.",
       "idea": false
      },
      {
       "title": "Agents that call your tools",
       "text": "Let the model pick a function from your app (search, booking, database lookup) and fill in its inputs, as the core of an agent.",
       "idea": false
      },
      {
       "title": "Write and fix code",
       "text": "Generate, complete and correct code locally, for example inside a private coding assistant.",
       "idea": false
      },
      {
       "title": "Long files in one go",
       "text": "Give it up to 256K tokens at once, so a long report or a large part of a codebase fits in one request.",
       "idea": false
      },
      {
       "title": "Many languages",
       "text": "Answer users in 35+ languages out of the box; it was trained on text in over 140 languages.",
       "idea": false
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "Gemma 4 31B popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "4,457",
       "l": "likes on Hugging Face"
      },
      {
       "n": "5.6M",
       "l": "downloads, last 30 days"
      },
      {
       "n": "18",
       "l": "Hugging Face trending score"
      }
     ]
    },
    {
     "t": "small",
     "text": "As reported by Hugging Face, checked Nov 26, 2026. Downloads include automated ones; some repositories report none."
    }
   ]
  },
  {
   "id": "run",
   "nav": "Run it",
   "h2": "Where to run Gemma 4 31B",
   "parts": [
    {
     "t": "h3",
     "text": "Through an API"
    },
    {
     "t": "table",
     "head": [
      "Provider",
      "$ per 1M in / out",
      "Tools",
      "Context"
     ],
     "rows": [
      [
       "CoreWeave (99.6% up, 24h)",
       "$0.1 / $0.34",
       "Yes",
       "262K"
      ],
      [
       "Venice (99.8% up, 24h)",
       "$0.12 / $0.36",
       "Yes",
       "256K"
      ],
      [
       "NextBit (100% up, 24h)",
       "$0.125 / $0.34",
       "Yes",
       "262K"
      ],
      [
       "Crusoe (100% up, 24h)",
       "$0.14 / $0.4",
       "Yes",
       "260K"
      ],
      [
       "Parasail (100% up, 24h)",
       "$0.15 / $0.4",
       "Yes",
       "262K"
      ],
      [
       "PrimeIntellect (95.2% up, 24h)",
       "$0.186 / $0.312",
       "Yes",
       "262K"
      ],
      [
       "DeepInfra (99.8% up, 24h)",
       "$0.2 / $0.4",
       "Yes",
       "262K"
      ],
      [
       "OpenRouter",
       "$0.2 / $0.4",
       "Yes",
       "262K"
      ],
      [
       "Modal (100% up, 24h)",
       "$0.34 / $0.1",
       "Yes",
       "131K"
      ],
      [
       "ModelRun (100% up, 24h)",
       "$0.75 / $1",
       "Yes",
       "262K"
      ]
     ],
     "num": true
    },
    {
     "t": "small",
     "text": "As reported by each provider via Hugging Face Inference Providers and OpenRouter, checked Nov 26, 2026."
    },
    {
     "t": "h3",
     "text": "On your machine"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Parameters",
       "v": "31.3B"
      },
      {
       "l": "Memory at 4-bit",
       "v": "about 18.8 GB",
       "sub": "Our estimate: 0.6 GB per billion parameters, with room for the context."
      },
      {
       "l": "GGUF builds",
       "v": "57 on Hugging Face",
       "sub": "For llama.cpp, Ollama and LM Studio; e.g. ggml-org/gemma-4-31B-it-GGUF"
      },
      {
       "l": "MLX builds",
       "v": "15 on Hugging Face",
       "sub": "For Apple silicon"
      }
     ]
    }
   ]
  },
  {
   "id": "license",
   "nav": "License",
   "h2": "Gemma 4 31B license",
   "parts": [
    {
     "t": "prose",
     "text": "Free to use, change and sell inside paid products under Apache 2.0. If you pass the model files on, include a copy of the license and mark the files you changed."
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In a paid product",
       "v": "Yes",
       "status": "yes",
       "sub": "Any use is allowed, paid products included; no fee and no credit line is required to use it.",
       "quote": "each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work",
       "src": "https://ai.google.dev/gemma/docs/gemma_4_license"
      },
      {
       "l": "Ship the weights to users",
       "v": "With conditions",
       "status": "cond",
       "sub": "Shipping the weights or a fine-tuned copy needs a copy of the Apache 2.0 license and a note on changed files.",
       "quote": "You must cause any modified files to carry prominent notices stating that You changed the files",
       "src": "https://ai.google.dev/gemma/docs/gemma_4_license"
      },
      {
       "l": "Work for clients",
       "v": "Yes",
       "status": "yes",
       "sub": "You may build and deliver client projects with it under the same Apache 2.0 terms.",
       "quote": "each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work",
       "src": "https://ai.google.dev/gemma/docs/gemma_4_license"
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "Gemma 4 31B",
       "me": true,
       "facts": [
        "4,457 likes",
        "Apache 2.0"
       ]
      },
      {
       "name": "Qwen3.8-27B",
       "path": "models/open/qwen-qwen3-8-27b/",
       "why": "Qwen · image-text-to-text",
       "facts": [
        "21.7K likes",
        "Apache 2.0"
       ]
      },
      {
       "name": "Kimi-K3",
       "path": "models/open/moonshotai-kimi-k3/",
       "why": "moonshotai · image-text-to-text",
       "facts": [
        "12K likes",
        "Custom license"
       ]
      },
      {
       "name": "Llama-3.1-8B-Instruct",
       "path": "models/open/meta-llama-llama-3-1-8b-instruct/",
       "why": "meta-llama · text-generation",
       "facts": [
        "9,102 likes",
        "Llama 3.1 license"
       ]
      },
      {
       "name": "Qwen3.8-Flash-Next",
       "path": "models/open/qwen-qwen3-8-flash-next/",
       "why": "Qwen · image-text-to-text",
       "facts": [
        "7,502 likes",
        "Custom license"
       ]
      }
     ],
     "more": "All text and agents models",
     "more_path": "models/open/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Run google/gemma-4-31B-it locally with the latest transformers (pip install -U transformers torch accelerate), load it with AutoProcessor and AutoModelForMultimodalLM (dtype=\"auto\", device_map=\"auto\"), put images before text, use temperature 1.0, top_p 0.95, top_k 64, and read answers through processor.parse_response."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Install the libraries.",
       "code": "pip install -U transformers torch accelerate",
       "src": "https://huggingface.co/google/gemma-4-31B-it/raw/main/README.md"
      },
      {
       "text": "Load the model and its processor.",
       "code": "from transformers import AutoProcessor, AutoModelForMultimodalLM\n\nMODEL_ID = \"google/gemma-4-31B-it\"\n\n# Load model\nprocessor = AutoProcessor.from_pretrained(MODEL_ID)\nmodel = AutoModelForMultimodalLM.from_pretrained(\n    MODEL_ID,\n    dtype=\"auto\",\n    device_map=\"auto\"\n)\n",
       "src": "https://huggingface.co/google/gemma-4-31B-it/raw/main/README.md"
      },
      {
       "text": "Send a chat with apply_chat_template and generate; add enable_thinking=True when you want step-by-step reasoning.",
       "code": null,
       "src": "https://huggingface.co/google/gemma-4-31B-it/raw/main/README.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Model id to use"
    },
    {
     "t": "tabs",
     "label": "Where to run",
     "items": [
      {
       "tab": "OpenRouter",
       "intro": "OpenAI-compatible: base URL https://openrouter.ai/api/v1",
       "code": "google/gemma-4-31b-it"
      },
      {
       "tab": "Hugging Face router",
       "intro": "OpenAI-compatible: base URL https://router.huggingface.co/v1",
       "code": "google/gemma-4-31B-it"
      },
      {
       "tab": "Local (GGUF)",
       "intro": "A community GGUF build on Hugging Face; read its card before use.",
       "code": "ggml-org/gemma-4-31B-it-GGUF"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "Loading it with old Gemma code or an old Transformers version",
       "fix": "pip install -U transformers torch accelerate, then AutoProcessor plus AutoModelForMultimodalLM as in the model card",
       "why": "The model card says Gemma 4 needs the latest Transformers and shows only this loading code."
      },
      {
       "dont": "Sending the model's earlier thinking back in the chat history",
       "fix": "Keep only the final answers of earlier turns; keep the thinking only for tool-call turns",
       "why": "The card says earlier thoughts must not be added before the next user turn."
      },
      {
       "dont": "Putting the image after the question in the prompt",
       "fix": "Put image content first, then the text",
       "why": "Google recommends this order for the best results with images."
      },
      {
       "dont": "Keeping sampling settings copied from another model",
       "fix": "temperature=1.0, top_p=0.95, top_k=64",
       "why": "The card gives one standard setting for all uses."
      },
      {
       "dont": "Showing the raw output to users with the thinking tags in it",
       "fix": "Pass the output through processor.parse_response, which splits the thinking from the answer",
       "why": "With thinking on, the raw text holds the reasoning block before the answer."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Can I use Gemma 4 31B in a paid app?",
       "a": "Yes. It is under Apache 2.0, which allows commercial use; keep the license text with any copies of the files you share.",
       "evidence": {
        "url": "https://huggingface.co/google/gemma-4-31B-it/raw/main/README.md",
        "quote": "license: apache-2.0"
       }
      },
      {
       "q": "Does it understand images and audio?",
       "a": "Images and video frames, yes. Audio no; only the E2B, E4B and 12B sizes take audio.",
       "evidence": {
        "url": "https://huggingface.co/google/gemma-4-31B-it/raw/main/README.md",
        "quote": "All models support image inputs and can process videos as frames whereas the E2B, E4B, and 12B models also support audio inputs."
       }
      },
      {
       "q": "How do I turn on thinking?",
       "a": "Set enable_thinking=True in apply_chat_template (or start the system prompt with the think token); parse_response then separates the reasoning from the answer.",
       "evidence": {
        "url": "https://huggingface.co/google/gemma-4-31B-it/raw/main/README.md",
        "quote": "Thinking is enabled by including the `<|think|>` token at the start of the system prompt."
       }
      },
      {
       "q": "What is the difference from Gemma 4 26B A4B?",
       "a": "31B is a dense model and scores higher in Google's table; 26B A4B uses only 3.8B active parameters per step and runs almost as fast as a 4B model.",
       "evidence": {
        "url": "https://huggingface.co/google/gemma-4-31B-it/raw/main/README.md",
        "quote": "This makes it an excellent choice for fast inference compared to the dense 31B model since it runs almost as fast as a 4B-parameter model."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Maker",
   "Google"
  ],
  [
   "Task",
   "Text and agents"
  ],
  [
   "Pipeline",
   "image-text-to-text"
  ],
  [
   "On Hugging Face since",
   "Mar 11, 2026"
  ],
  [
   "License",
   "Apache 2.0"
  ],
  [
   "Parameters",
   "31.3B"
  ],
  [
   "Context",
   "262K tokens"
  ],
  [
   "Hugging Face",
   "google/gemma-4-31B-it"
  ]
 ],
 "good": [
  "It is made for a strong graphics card (GPU) or a workstation, not for phones; the small E2B and E4B sizes are the ones for phones and laptops.",
  "This size reads text, images and video frames but not audio; sound input exists only in the E2B, E4B and 12B sizes.",
  "Video is read as pictures, up to 60 seconds at one frame per second."
 ],
 "checked_line": "Hand-checked from 4 official pages on Nov 23, 2026; numbers refresh daily.",
 "logo": null
}