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);
جاوا
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.8-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 4 Argon جدید
مدل استدلال پرچمدار ما با پنجره بافت مشترک ۱ میلیون و رمزگشاییهای طولانی تا ۱ میلیون دادهواحد (توکن).
Gemini 3.8 Flash جدید
هوشمندترین مدل Flash ما که برای مهندسی نرمافزار بلندمدت، عاملهای خودکار، و گردشهای کاری پیچیده سازمانی طراحی شده است.
Gemini 3.8 Flash TTS جدید
مدل نوشتار به گفتار در سطح استودیو با بازیگری رسا، طراحی «صدای» سفارشی، و همانندسازی «صدا».
Gemini 3.5 Flash-Lite
مدل حساس به هزینه و با حجم بالا که برای تکالیف کارگزاری فرعی با توان عملیاتی بالا و تأخیر کم بهینهسازی شده است.
Nano Banana
مدلهای ویرایش و تولید تصویر پیشرفته.
Gemini Omni Flash
مدل پیشرفته ما برای تولید و ویرایش ویدیو.
Gemini 3.5 Transcribe جدید
مدل گفتار به نوشتار با تأخیر کم با تشخیص زبان مبتنی بر گفتار، بخشبندی صدای گوینده، و مُهرهای زمان کلمه.
Gemini Robotics
مدل زبان-بینایی (VLM) که قابلیتهای عاملی Gemini را به رباتیک میآورد و استدلال پیشرفته را در دنیای فیزیکی ممکن میکند.
کاوش قابلیتها
تولید تصویر
با Nano Banana، تصاویر بسیار مرتبط با بافت را بهطور بومی تولید و ویرایش کنید.
پنجره طولانی زمینه
میلیونها توکن را به مدلهای Gemini وارد کنید و از تصاویر، ویدیوها، و اسناد بدون ساختار درک بهدست آورید.
بروندادهای ساختاریافته
Gemini را محدود کنید تا با JSON پاسخ دهد، قالب داده ساختاریافتهای که برای پردازش خودکار مناسب است.
فراخوانی تابع
با متصل کردن Gemini به میاناهای برنامهسازی کاربردی و ابزارهای خارجی، گردش کارهای عاملی بسازید.
تولید ویدیو با Veo 3.1
بااستفاده از مدل پیشرفته ما، از پیاموارههای نوشتاری یا تصویری محتوای ویدیویی با کیفیت بالا بسازید.
عاملهای صوتی با Live API
با Live API، برنامهها و عوامل صوتی همزمان بسازید.
ابزارها
Gemini را ازطریق ابزارهای داخلی مانند «جستجوی Google»، «بافت نشانی وب»، Google Maps، «اجرای کد»، و «استفاده از رایانه» به جهان متصل کنید.
درک سند
تا ۱۰۰۰ صفحه فایل 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);
جاوا
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 از ژوئن ۲۰۲۶ به میانای پیشفرض ما تبدیل شده است و بهترین روش برای ساخت با مدلها و عاملهای Gemini در آینده است. اگر پروژه جدیدی را شروع میکنید، باید از Interactions API استفاده کنید. درحالیکه همچنان پشتیبانی میشود، میانای برنامهسازی کاربردی generateContent اکنون قدیمی درنظر گرفته میشود.