Gemma-4-31B

    google/gemma-4-31b

    Open-weights dense model with stronger math and coding, plus native function calling for self-hosted agent workflows.

    CodingMathLocal DeploymentAgent
    Modality
    Input / Output Pricing
    $0.14 / $0.4M tokens
    Context
    262144
    Release date
    2026-04-02

    Pricing

    SpecificationPrice
    Input$0.14/ M tokens
    Output$0.4/ M tokens
    Cache read--
    Cache write--

    Quick Start

    Paste and run the sample code below. The Gate.AI API is OpenAI-compatible—most SDKs only need a new base URL. To switch models, change the model ID.

    1

    Get your API key

    Sign in to the Gate.AI console and create a new key under "API Keys". Keep it safe and send it via the Authorization header on every request.

    Create a key in the console
    2

    Make a request

    Send a POST request to the Chat Completions endpoint with a model ID and an array of messages to get a reply.

    POSThttps://api.gate.ai/openai/v1/chat/completions
    curl --location "https://api.gate.ai/openai/v1/chat/completions" \
      --header "Authorization: Bearer {API_KEY}" \
      --header "Content-Type: application/json" \
      --data '{
      "model": "gemma-4-31b",
      "messages": [
        {"role": "user", "content": "Hello"}
      ]
    }'
    3

    Handle the response \\\\\& streaming

    By default a full JSON response is returned. Add "stream": true to the request body to receive incremental chunks over SSE.

    POSThttps://api.gate.ai/openai/v1/chat/completions
    curl --no-buffer --location "https://api.gate.ai/openai/v1/chat/completions" \
      --header "Authorization: Bearer {API_KEY}" \
      --header "Content-Type: application/json" \
      --data '{
      "model": "gemma-4-31b",
      "messages": [
        {"role": "user", "content": "Hello"}
      ],
      "stream": true
    }'

    Endpoint

    Base URL, method, and required headers are rendered from the active protocol template for this model.

    POSThttps://api.gate.ai/openai/v1/chat/completions
    Field
    Value
    Authorization
    Authentication header containing the API key in the format Bearer {API_KEY}
    Content-Type
    Request content type, fixed to application/json
    model
    Model ID; the current model is gemma-4-31b
    messages
    Ordered array of conversation messages
    stream
    Whether to return the result as an SSE stream

    Related Models

    Gemini 3.8 Flash

    Flash tier in Gemini 3.8 with gains over 3.7 Flash across software engineering, agent workflows, and multi-step reasoning.

    Nano Banana 2 Lite (Gemini 3.1 Flash Lite Image)

    The lightest image model in its series, producing images in about four seconds with consistent character rendering and precise edits. Suited for high-throughput pipelines and interactive visual iteration.

    Gemini 3.5 Flash

    Designed for efficient multimodal AI tasks, offering strong coding, reasoning, real-time chat, and agent execution at Flash-tier cost and speed.

    Gemini 3.1 Flash Lite

    A high-efficiency multimodal lite model for low-latency, high-volume workloads like translation, classification, and data extraction, priced at about half of Gemini 3 Flash.

    Nano Banana 2 (Gemini 3.1 Flash Image)

    Mid-tier image generation and editing model in the series, with near-flagship visual quality at higher generation speed. Renders legible text and photorealistic subjects, suited for infographics and marketing visuals.

    Gemini 3.1 Pro

    Google's latest. Strong reasoning with native image and video.

    Gemini 3 Flash

    Speed-tier variant in the Gemini 3 line, pairing Pro-grade reasoning with Flash-level latency and cost, built for agent workflows and high-throughput interactive apps.

    Nano Banana Pro (Gemini 3 Pro Image)

    Built-in reasoning; complex multi-turn creation; up to 4K; optional web grounding.

    Nano Banana (Gemini 2.5 Flash Image)

    Built for fast generation and conversational editing; low latency and cost; multimodal text-and-image input.

    Gemini 2.5 Flash Lite

    A lightweight reasoning model in the Gemini 2.5 family, optimized for ultra-low latency and cost efficiency, with faster token generation and higher throughput. Thinking is disabled by default but can be enabled via API.