Gemini 中文指南
获取 API 密钥 ↗

Gemini 3.1 Flash-Lite

↓ 下载 MarkdownInteractions API

Gemini 3.1 Flash-Lite 是一种低延迟、经济高效的多模态模型,针对高频、轻量级任务进行了优化。该模型支持文本、图像、视频、音频和 PDF 输入,专为大容量智能体工作流程、简单数据提取以及延迟和 API 成本为主要限制的应用程序而设计。

在 Google AI Studio 中体验

gemini-3.1-flash-lite #

属性

说明

模型代码

gemini-3.1-flash-lite

支持的数据类型

输入 文本、图像、视频、音频和 PDF

输出 文本

token 限制[*]

输入token限制 1,048,576

输出 token 限制 65,536

功能

音频生成

− 不支持

代码执行

✓ 支持

计算机使用

− 不支持

上下文缓存

✓ 支持

文件搜索

✓ 支持

函数调用

✓ 支持

图像生成

− 不支持

Live API

− 不支持

结构化输出

✓ 支持

思考

✓ 支持

URL 上下文

✓ 支持

消费选择

Batch API

✓ 支持

弹性推理

✓ 支持

优先推理

✓ 支持

版本

阅读 模型版本模式 了解更多详情。

  • Stable: gemini-3.1-flash-lite

最新更新

5月 2026

模型详情

模型详情

价格

价格

开发者指南 #

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

  • 翻译:快速、廉价、大容量的翻译,例如大规模处理聊天消息、评论和支持票证。您可以使用系统指令将输出限制为仅翻译文本,没有额外的注释:
python
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)
  • 转录:处理录音、语音笔记或任何需要文本转录的音频内容,而无需启动单独的语音到文本管道。支持多模态输入,因此您可以直接传递音频文件进行转录:
python
from google import genai

client = genai.Client()

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 输出。例如,从电子商务客户评论中提取结构化数据:
python
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 并返回简洁的摘要,例如构建文档处理管道或快速分类传入文件:
python
from google import genai
from google.genai import types
import httpx

client = genai.Client()

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。
python
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)
  • 思考:为了从逐步推理中受益的任务获得更高的准确性,请配置思维,以便模型在生成最终输出之前在内部推理上花费额外的计算:
python
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)

搜索标题、API 名称或正文内容