Gemini API

‫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(""));

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"
  }'

التعرّف على النماذج

عرض الكل

استكشاف الإمكانات

‫Interactions API

أصبحت ‫Interactions API واجهتنا التلقائية اعتبارًا من يونيو 2026، وهي أفضل طريقة للإنشاء باستخدام نماذج Gemini والوكلاء من الآن فصاعدًا. إذا كنت تبدأ مشروعًا جديدًا، عليك استخدام Interactions API. على الرغم من أنّ واجهة برمجة التطبيقات generateContent لا تزال متاحة، إلا أنّها تُعتبر الآن قديمة.