借助 Gemini API,开启从提示词到生产部署的最快路径,支持 Gemini、Veo、Nano Banana 等。您可以将这些生成模型集成到应用中,以生成文本和图片、分析多模态输入,以及构建对话智能体。
Python
from google import genai
client = genai.Client()
response = client.models.generate_content(
model="gemini-3.8-flash",
contents="Explain how AI works in a few words",
)
print(response.text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({});
async function main() {
const response = await ai.models.generateContent({
model: "gemini-3.8-flash",
contents: "Explain how AI works in a few words",
});
console.log(response.text);
}
await main();
Go
package main
import (
"context"
"fmt"
"log"
"google.golang.org/genai"
)
func main() {
ctx := context.Background()
client, err := genai.NewClient(ctx, nil)
if err != nil {
log.Fatal(err)
}
result, err := client.Models.GenerateContent(
ctx,
"gemini-3.8-flash",
genai.Text("Explain how AI works in a few words"),
nil,
)
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Text())
}
Java
package com.example;
import com.google.genai.Client;
import com.google.genai.types.GenerateContentResponse;
public class GenerateTextFromTextInput {
public static void main(String[] args) {
Client client = new Client();
GenerateContentResponse response =
client.models.generateContent(
"gemini-3.8-flash",
"Explain how AI works in a few words",
null);
System.out.println(response.text());
}
}
C#
using System.Threading.Tasks;
using Google.GenAI;
using Google.GenAI.Types;
public class GenerateContentSimpleText {
public static async Task main() {
var client = new Client();
var response = await client.Models.GenerateContentAsync(
model: "gemini-3.8-flash", contents: "Explain how AI works in a few words"
);
Console.WriteLine(response.Candidates[0].Content.Parts[0].Text);
}
}
REST
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"contents": [
{
"parts": [
{
"text": "Explain how AI works in a few words"
}
]
}
]
}'
了解模型
查看全部Gemini 4 Argon New
我们的旗舰推理模型,具有 100 万个 token 的共享上下文窗口,并且解码长度高达 100 万个 token。
Gemini 3.6 Flash 新
我们的最新模型,兼顾了速度和智能,可在智能体任务和多模态任务中提供强大的性能。
Gemini 3.8 Flash TTS 新
工作室级文字转语音模型,具有富有表现力的表演、自定义语音设计和语音复刻功能。
Gemini 3.5 Flash-Lite 新
高吞吐量、对成本敏感的模型,针对低延迟、高吞吐量子智能体任务进行了优化。
Gemini 3.1 Flash-Lite
高吞吐量、对成本敏感的模型,具有 Gemini 3 系列的性能和质量。
Gemini 3 Flash
前沿级性能,可与大型模型相媲美,但成本却远低于大型模型。
Nano Banana
先进的图片生成和编辑模型。
Veo 3.1
我们前沿的视频生成模型,具有原生音频功能。
Gemini Robotics
一种视觉-语言模型 (VLM),可将 Gemini 的智能体功能引入机器人技术,并支持在物理世界中进行高级推理。
探索各项功能
原生图片生成 (Nano Banana)
借助 Gemini 2.5 Flash Image,以原生方式生成和编辑高度情境化的图片。
长上下文
向 Gemini 模型输入数百万个 token,并从非结构化的图片、视频和文档中提取理解。
结构化输出
限制 Gemini 以 JSON 格式响应,JSON 是一种适合自动处理的结构化数据格式。
函数调用
通过将 Gemini 连接到外部 API 和工具来构建 Agentic Workflows。
使用 Veo 3.1 生成视频
使用我们前沿的模型,根据文本或图片提示创建高质量视频内容。
使用 Live API 构建语音智能体
使用 Live API 构建实时语音应用和智能体。
工具
通过 Google 搜索、网址上下文、Google 地图、代码执行和计算机使用等内置工具,将 Gemini 连接到世界。
文档理解
处理多达 1000 页的 PDF 文件,并充分理解多模态内容或其他基于文本的文件类型。
思考
了解思考能力如何改进复杂任务和智能体的推理。