Gemini API – это самый быстрый способ перейти от запроса к производству с помощью Gemini, Veo, Nano Banana и других инструментов. Он позволяет интегрировать эти генеративные модели в приложения, чтобы создавать текст и изображения, анализировать мультимодальные входные данные и разрабатывать разговорных агентов.
Python
from google import genai
client = genai.Client()
interaction = client.interactions.create(
model="gemini-3.8-flash",
input="Explain how AI works in a few words"
)
print(interaction.output_text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({});
const interaction = await ai.interactions.create({
model: "gemini-3.8-flash",
input: "Explain how AI works in a few words",
});
console.log(interaction.output_text);
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
Client client = new Client();
CreateModelInteraction params =
CreateModelInteraction.builder()
.model(Model.of("gemini-3.7-flash"))
.input(InteractionsInput.of("Explain how AI works in a few words"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
System.out.println(interaction.outputText().orElse(""));
Проложить маршрут
package main
import (
"context"
"fmt"
"log"
"google.golang.org/genai"
"google.golang.org/genai/interactions/models/interactions"
"google.golang.org/genai/interactions/models/operations"
)
func main() {
ctx := context.Background()
client, err := genai.NewClient(ctx, nil)
if err != nil {
log.Fatal(err)
}
res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
Body: operations.NewCreateInteractionRequestBody(interactions.CreateModelInteraction{
Model: interactions.Model("gemini-3.8-flash"),
Input: interactions.NewInteractionsInput("Explain how AI works in a few words"),
}),
})
if err != nil {
log.Fatal(err)
}
if res.Interaction.OutputText != nil {
fmt.Println(*res.Interaction.OutputText)
}
}
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "gemini-3.8-flash",
"input": "Explain how AI works in a few words"
}'
Модели
Весь списокGemini 3.8 Flash Новинка
Наша самая умная модель Flash, разработанная для долгосрочного проектирования ПО, автономных агентов и сложных корпоративных рабочих процессов.
Gemini 3.8 Flash TTS Новинка
Модель студийного уровня для преобразования текста в речь с выразительной интонацией, возможностью создания собственного голоса и его копирования.
Gemini 3.5 Flash-Lite
Модель с высокой пропускной способностью, оптимизированная для выполнения задач суб-агентов с низкой задержкой.
Gemini 3.1 Pro
Наша самая умная модель, лучшая в мире для понимания мультимодальных запросов, созданная на основе передовых технологий рассуждения.
Nano Banana
Передовые модели для создания и редактирования изображений.
Gemini Omni Flash
Наша передовая модель для генерации и редактирования видео.
Gemini 3.5 Transcribe Новое
Модель распознавания речи с низкой задержкой, которая определяет язык на основе высказываний, разделяет говорящих и добавляет временные метки к словам.
Gemini Robotics
Мультимодальная модель, которая позволяет использовать агентные возможности Gemini в робототехнике и обеспечивает расширенные возможности рассуждения в физическом мире.
Изучить возможности
Создание изображений
Создавайте и редактируйте изображения с помощью Nano Banana.
Большое окно контекста
Используйте миллионы токенов для моделей Gemini и получайте информацию из неструктурированных изображений, видео и документов.
Структурированные выходные данные
Ограничьте Gemini, чтобы он отвечал в формате JSON, который подходит для автоматической обработки.
Вызов функций
Создавайте рабочие процессы с агентами, подключая Gemini к внешним API и инструментам.
Создание видео с помощью Veo 3.1
Создавайте высококачественный видеоконтент на основе текстовых или графических запросов с помощью нашей передовой модели.
Голосовые агенты с Live API
Создавайте голосовые приложения и агентов в реальном времени с помощью Live API.
Инструменты
Подключите Gemini к миру с помощью встроенных инструментов, таких как Google Поиск, контекст URL, Google Карты, выполнение кода и использование компьютера.
Анализ документов
Обрабатывайте до 1000 страниц PDF-файлов с полным пониманием мультимодальных запросов или другие текстовые файлы.
Думающая
Узнайте, как возможности мышления помогают агентам и моделям лучше справляться со сложными задачами.
Создание агентов
Управляемые агенты предоставляют Gemini рабочее пространство для планирования и выполнения задач. В одном запросе Gemini может написать и запустить код, выполнить поиск в интернете и создать файлы в размещенной среде песочницы. Используйте готового агента Antigravity или настройте его, добавив собственные инструкции и инструменты.
Python
from google import genai
client = genai.Client()
interaction = client.interactions.create(
agent="antigravity-preview-09-2026",
input=(
"Research the top 5 sustainable fashion brands, "
"compare their materials and pricing tiers, and "
"build an interactive dashboard in analysis.html."
),
environment="remote"
)
print(interaction.output_text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({});
const interaction = await ai.interactions.create({
agent: "antigravity-preview-09-2026",
input:
"Research the top 5 sustainable fashion brands, " +
"compare their materials and pricing tiers, and " +
"build an interactive dashboard in analysis.html.",
environment: "remote",
});
console.log(interaction.output_text);
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.CreateAgentInteractionEnvironment;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
Client client = new Client();
CreateAgentInteraction params =
CreateAgentInteraction.builder()
.agent(AgentOption.of("antigravity-preview-09-2026"))
.input(
InteractionsInput.of(
"Research the top 5 sustainable fashion brands, "
+ "compare their materials and pricing tiers, and "
+ "build an interactive dashboard in analysis.html."))
.environment(CreateAgentInteractionEnvironment.of("remote"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params))
.interaction()
.get();
System.out.println(interaction.outputText().orElse(""));
Проложить маршрут
package main
import (
"context"
"fmt"
"log"
"google.golang.org/genai"
"google.golang.org/genai/interactions/models/interactions"
"google.golang.org/genai/interactions/models/operations"
)
func main() {
ctx := context.Background()
client, err := genai.NewClient(ctx, nil)
if err != nil {
log.Fatal(err)
}
res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
Body: operations.NewCreateInteractionRequestBody(interactions.CreateAgentInteraction{
Agent: interactions.AgentOption("antigravity-preview-09-2026"),
Input: interactions.NewInteractionsInput(
"Research the top 5 sustainable fashion brands, " +
"compare their materials and pricing tiers, and " +
"build an interactive dashboard in analysis.html.",
),
Environment: genai.Ptr(interactions.NewCreateAgentInteractionEnvironment("remote")),
}),
})
if err != nil {
log.Fatal(err)
}
if res.Interaction.OutputText != nil {
fmt.Println(*res.Interaction.OutputText)
}
}
REST
curl -X POST \
"https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"agent": "antigravity-preview-09-2026",
"input": "Research the top 5 sustainable fashion brands, compare their materials and pricing tiers, and build an interactive dashboard in analysis.html.",
"environment": "remote"
}'
Interactions API
Interactions API стал нашим интерфейсом по умолчанию в июне 2026 года. Это лучший способ создавать приложения с использованием моделей и агентов Gemini. Если вы начинаете новый проект, используйте Interactions API. Хотя API generateContent по-прежнему поддерживается, он считается устаревшим.
Обзор взаимодействий
Узнайте, как API взаимодействий управляет состоянием чата, сообщениями и форматами вывода.
Руководство по переносу
Пошаговое руководство по переходу с функции generateContent на Interactions API.
Потоковая передача
Передавать токены, промежуточные мысли и события вызова инструментов в реальном времени.