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.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
مدل زبان-دیداری (VLM) که قابلیتهای عامل Gemini را به رباتیک میآورد و استدلال پیشرفته در دنیای فیزیکی را ممکن میکند.
کاوش قابلیتها
تولید تصویر
با Nano Banana، تصویرهای بسیار زمینهای را بهصورت بومی تولید و ویرایش کنید.
پنجره طولانی زمینه
میلیونها نشان را به مدلهای Gemini وارد کنید و از تصاویر، ویدیوها، و اسناد ساختارنیافته درک کنید.
بروندادهای ساختاریافته
Gemini را محدود کنید تا با JSON، قالب داده ساختاریافته مناسب برای پردازش خودکار، پاسخ دهد.
فراخوانی تابع
با متصل کردن Gemini به میاناهای برنامهسازی کاربردی و ابزارهای خارجی، گردش کار عاملمحور بسازید.
تولید ویدیو با Veo 3.1
بااستفاده از مدل پیشرفته ما، از پیاموارههای نوشتاری یا تصویری محتوای ویدیویی با کیفیت بالا بسازید.
عاملهای صوتی با Live API
بااستفاده از «میانای برنامهسازی کاربردی پخش زنده»، برنامهها و کارگزاران صوتی همزمان بسازید.
ابزارها
ازطریق ابزارهای داخلی مثل «جستجوی Google»، «زمینه نشانی وب»، Google Maps، «اجرای کد»، و «استفاده از رایانه»، Gemini را به جهان متصل کنید.
درک سند
تا ۱۰۰۰ صفحه از فایلهای PDF را با درک کامل چندحالته یا انواع دیگر فایلهای مبتنی بر نوشتار پردازش کنید.
درحال فکر کردن
ببینید چگونه قابلیتهای تفکر استدلال را برای تکالیف و نمایندگان پیچیده بهبود میبخشد.
ایجاد عاملها
«عاملهای مدیریتشده» به Gemini فضای کاری میدهند تا تکلیفها را بهتنهایی برنامهریزی و تکمیل کند. در یک درخواست واحد، Gemini میتواند کد بنویسد و اجرا کند، در وب جستجو کند، و در محیط جعبه ایمنی میزبانیشده فایل ایجاد کند. با نماینده پیشساخته «ضدجاذبه» ما شروع کنید یا آن را با دستورالعملها و ابزارهای خودتان سفارشیسازی کنید.
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 (میانای برنامهسازی کاربردی تعاملات)
میانای برنامهسازی کاربردی تعاملات از ژوئن ۲۰۲۶ به رابط پیشفرض ما تبدیل شده است و بهترین روش برای ساختن با مدلها و کارگزاران Gemini در آینده است. اگر پروژه جدیدی را شروع میکنید، باید از «میانای برنامه کاربردی تعاملات» استفاده کنید. درحالیکه همچنان پشتیبانی میشود، میانای برنامهسازی کاربردی generateContent اکنون قدیمی درنظر گرفته میشود.