Gemini 3.1 Flash-Lite

Gemini 3.1 Flash-Lite 是一款低延迟、高性价比的多模态模型,针对高频、轻量级任务进行了优化。该模型支持文本、图片、视频、音频和 PDF 输入,专为高调用量 Agentic Workflows、简单数据提取以及延迟时间和 API 费用是主要限制因素的应用而设计。

gemini-3.1-flash-lite

属性 说明
模型代码 gemini-3.1-flash-lite
支持的数据类型

输入源

文本、图片、视频、音频和 PDF

输出

文本

Token 限制[*]

输入 token 限制

1,048,576

输出 token 限制

65536

功能

音频生成

不受支持

缓存

支持

代码执行

支持

Computer Use

不受支持

文件搜索

支持

函数调用

支持

Grounding with Google Maps

支持

图片生成

不受支持

Live API

不受支持

利用 Google 搜索建立回答依据

支持

结构化输出

支持

思考

支持

网址上下文

支持

使用选项

Batch API

支持

Flex 推理

支持

优先级推断

支持

个版本
如需了解详情,请参阅模型版本模式。
  • Stable: gemini-3.1-flash-lite
最后更新时间 2026 年 5 月
模型卡片 模型卡片

开发者指南

Gemini 3.1 Flash-Lite 最擅长处理大规模的简单任务。以下是一些最适合 Gemini 3.1 Flash-Lite 的应用场景:

  • 翻译:快速、低成本、大批量的翻译,例如大规模处理聊天消息、评价和支持服务工单。您可以使用系统指令将输出限制为仅包含翻译后的文本,不包含任何额外评论:

    from google import genai
    
    client = genai.Client()
    text = "Hey, are you down to grab some pizza later? I'm starving!"
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-lite",
        config={
            "system_instruction": "Only output the translated text"
        },
        contents=f"Translate the following text to German: {text}"
    )
    
    print(response.text)
    
  • 转写:处理录音、语音备忘录或任何需要文本转写稿的音频内容,而无需启动单独的语音转文字流水线。支持多模态输入,因此您可以直接传递音频文件进行转写:

    from google import genai
    
    client = genai.Client()
    
    # URL = "https://storage.googleapis.com/generativeai-downloads/data/State_of_the_Union_Address_30_January_1961.mp3"
    # Upload the audio file to the GenAI File API
    uploaded_file = client.files.upload(file='sample.mp3')
    
    prompt = 'Generate a transcript of the audio.'
    
    response = client.models.generate_content(
      model="gemini-3.1-flash-lite",
      contents=[prompt, uploaded_file]
    )
    
    print(response.text)
    
  • 轻量级智能体任务和数据提取:支持实体提取、分类和轻量级数据处理流水线,并提供结构化 JSON 输出。例如,从电子商务客户评价中提取结构化数据:

    from google import genai
    from pydantic import BaseModel, Field
    
    client = genai.Client()
    
    prompt = "Analyze the user review and determine the aspect, sentiment score, summary quote, and return risk"
    input_text = "The boots look amazing and the leather is high quality, but they run way too small. I'm sending them back."
    
    class ReviewAnalysis(BaseModel):
        aspect: str = Field(description="The feature mentioned (e.g., Price, Comfort, Style, Shipping)")
        summary_quote: str = Field(description="The specific phrase from the review about this aspect")
        sentiment_score: int = Field(description="1 to 5 (1=worst, 5=best)")
        is_return_risk: bool = Field(description="True if the user mentions returning the item")
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-lite",
        contents=[prompt, input_text],
        config={
            "response_mime_type": "application/json",
            "response_json_schema": ReviewAnalysis.model_json_schema(),
        },
    )
    
    print(response.text)
    
  • 文档处理和摘要:解析 PDF 并返回简明摘要,例如用于构建文档处理流水线或快速分类传入文件:

    from google import genai
    from google.genai import types
    import httpx
    
    client = genai.Client()
    
    # Download a sample PDF document
    doc_url = "https://storage.googleapis.com/generativeai-downloads/data/med_gemini.pdf"
    doc_data = httpx.get(doc_url).content
    
    prompt = "Summarize this document"
    response = client.models.generate_content(
        model="gemini-3.1-flash-lite",
        contents=[
            types.Part.from_bytes(
                data=doc_data,
                mime_type='application/pdf',
            ),
            prompt
        ]
    )
    
    print(response.text)
    
  • 模型路由:使用低延迟和低成本模型作为分类器,根据任务复杂性将查询路由到适当的模型。这是生产环境中的一种实际模式,开源 Gemini CLI 使用 Flash-Lite 对任务复杂度进行分类,并相应地路由到 Flash 或 Pro。

    from google import genai
    
    client = genai.Client()
    
    FLASH_MODEL = 'flash'
    PRO_MODEL = 'pro'
    
    CLASSIFIER_SYSTEM_PROMPT = f"""
    You are a specialized Task Routing AI. Your sole function is to analyze the user's request and classify its complexity. Choose between `{FLASH_MODEL}` (SIMPLE) or `{PRO_MODEL}` (COMPLEX).
    1.  `{FLASH_MODEL}`: A fast, efficient model for simple, well-defined tasks.
    2.  `{PRO_MODEL}`: A powerful, advanced model for complex, open-ended, or multi-step tasks.
    
    A task is COMPLEX if it meets ONE OR MORE of the following criteria:
    1.  High Operational Complexity (Est. 4+ Steps/Tool Calls)
    2.  Strategic Planning and Conceptual Design
    3.  High Ambiguity or Large Scope
    4.  Deep Debugging and Root Cause Analysis
    
    A task is SIMPLE if it is highly specific, bounded, and has Low Operational Complexity (Est. 1-3 tool calls).
    """
    
    user_input = "I'm getting an error 'Cannot read property 'map' of undefined' when I click the save button. Can you fix it?"
    
    response_schema = {
      "type": "object",
      "properties": {
        "reasoning": {
          "type": "string",
          "description": "A brief, step-by-step explanation for the model choice, referencing the rubric."
        },
        "model_choice": {
          "type": "string",
          "enum": [FLASH_MODEL, PRO_MODEL]
        }
      },
      "required": ["reasoning", "model_choice"]
    }
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-lite",
        contents=user_input,
        config={
            "system_instruction": CLASSIFIER_SYSTEM_PROMPT,
            "response_mime_type": "application/json",
            "response_json_schema": response_schema
        },
    )
    
    print(response.text)
    
  • 思考:对于需要逐步推理的任务,为了提高准确率,请配置思考功能,以便模型在生成最终输出之前,在内部推理上花费额外的计算资源:

    from google import genai
    from google.genai import types
    
    client = genai.Client()
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-lite",
        contents="How does AI work?",
        config=types.GenerateContentConfig(
            thinking_config=types.ThinkingConfig(thinking_level="high")
        ),
    )
    
    print(response.text)