توفّر واجهة 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
أحدث النماذج لإنشاء الفيديوهات وتعديلها
speech_to_text Gemini 3.5 Transcribe جديد
نموذج منخفض زمن الانتقال لتحويل الكلام إلى نص مع رصد اللغة المستند إلى الجملة وتحديد المتحدثين والطوابع الزمنية للكلمات
Gemini Robotics
نموذج للرؤية واللغة (VLM) يوفّر إمكانات Gemini للوكلاء في مجال الروبوتات ويتيح الاستدلال المتقدّم في العالم المادي
استكشاف الإمكانات
إنشاء الصور
يمكنك إنشاء الصور وتعديلها بشكل أصلي باستخدام Nano Banana مع مراعاة السياق بشكل كبير.
سياق طويل
يمكنك إدخال ملايين الرموز المميّزة إلى نماذج Gemini واستخلاص المعلومات من الصور والفيديوهات والمستندات غير المنظَّمة.
مُخرجات منظَّمة
يمكنك حصر ردود Gemini بتنسيق JSON، وهو تنسيق بيانات منظَّمة مناسب للمعالجة الآلية.
استدعاء الدالة
يمكنك إنشاء مهام سير عمل للوكلاء من خلال ربط Gemini بواجهات برمجة التطبيقات والأدوات الخارجية.
إنشاء الفيديوهات باستخدام Veo 3.1
يمكنك إنشاء محتوى فيديو عالي الجودة من طلبات نصية أو صور باستخدام أحدث النماذج.
الوكلاء الصوتيون باستخدام Live API
يمكنك إنشاء تطبيقات ووكلاء صوتيين في الوقت الفعلي باستخدام Live API.
الأدوات
يمكنك ربط Gemini بالعالم من خلال أدوات مضمّنة، مثل "بحث Google" و"سياق عنوان URL" و"خرائط Google" و"تنفيذ الرموز البرمجية" و"استخدام الكمبيوتر".
فهم المستندات
يمكنك معالجة ما يصل إلى 1,000 صفحة من ملفات 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 واجهتنا التلقائية اعتبارًا من يونيو 2026، وهي أفضل طريقة للإنشاء باستخدام نماذج Gemini والوكلاء من الآن فصاعدًا. إذا كنت تبدأ مشروعًا جديدًا، عليك استخدام واجهة Interactions API. على الرغم من أنّ واجهة برمجة التطبيقات generateContent لا تزال متاحة، إلا أنّها تُعدّ الآن واجهة برمجة تطبيقات قديمة.
نظرة عامة على Interactions API
تعرَّف على كيفية إدارة واجهة Interactions API لحالة المحادثة والرسائل وتنسيقات الإخراج.
دليل نقل البيانات
دليل مفصّل لنقل الرموز البرمجية من `generateContent` إلى واجهة Interactions API
البث
يمكنك بث الرموز المميّزة في الوقت الفعلي والأفكار المتزايدة وأحداث استدعاء الأدوات.