عند تطوير حلول الذكاء الاصطناعي التوليدي باستخدام Gemini، تقدّم Google منتجَين من واجهات برمجة التطبيقات: Gemini Developer API وGemini Enterprise Agent Platform API.
توفّر واجهة Gemini Developer API أسرع طريقة لإنشاء تطبيقات تستند إلى Gemini وتجهيزها للإنتاج وتوسيع نطاقها. على معظم المطوّرين استخدام Gemini Developer API ما لم تكن هناك حاجة إلى أدوات تحكّم محدّدة للمؤسسات.
توفّر منصة Gemini Enterprise Agent Platform منظومة متكاملة شاملة من الميزات والخدمات الجاهزة للمؤسسات من أجل إنشاء تطبيقات الذكاء الاصطناعي التوليدي ونشرها، وهي تستند إلى Google Cloud Platform.
لقد سهّلنا مؤخرًا عملية نقل البيانات بين هاتين الخدمتَين. يمكن الآن الوصول إلى كل من Gemini Developer API وGemini Enterprise Agent Platform API من خلال حزمة تطوير البرامج (SDK) الموحّدة من Google للذكاء الاصطناعي التوليدي وواجهة Interactions API.
مقارنة الرموز البرمجية: Interactions API (يُنصح به)
Interactions API هي الطريقة المقترَحة لإنشاء التطبيقات باستخدام نماذج ووكلاء Gemini. تقدّم الأمثلة التالية مقارنة بين إنشاء النصوص باستخدام Gemini Developer API وGemini Enterprise Agent Platform.
Python
يمكنك الوصول إلى كلّ من Gemini Developer API وخدمات Gemini Enterprise Agent
Platform من خلال مكتبة google-genai (>= 2.3.0). راجِع صفحة
المكتبات للحصول على تعليمات حول كيفية تثبيت
google-genai.
Gemini Developer API
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)
Gemini Enterprise Agent Platform API
from google import genai
client = genai.Client(
enterprise=True, project="your-project-id", location="global"
)
interaction = client.interactions.create(
model="gemini-3.8-flash",
input="Explain how AI works in a few words",
)
print(interaction.output_text)
JavaScript وTypeScript
يمكنك الوصول إلى كل من Gemini Developer API وGemini Enterprise Agent Platform من خلال مكتبة @google/genai (>= 2.3.0). راجِع صفحة المكتبات للحصول على تعليمات حول كيفية تثبيت @google/genai.
Gemini Developer API
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);
Gemini Enterprise Agent Platform API
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({
enterprise: true,
project: "your_project",
location: "global",
});
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);
مقارنة الرموز البرمجية: واجهة برمجة التطبيقات generateContent
على الرغم من أنّنا ننصح باستخدام Interactions API للمشاريع الجديدة، سيظل بإمكانك استخدام واجهة برمجة التطبيقات generateContent.
Python
يمكنك الوصول إلى كل من Gemini Developer API وGemini Enterprise Agent
Platform من خلال مكتبة google-genai. يمكنك الاطّلاع على صفحة
المكتبات للحصول على تعليمات حول كيفية تثبيت
google-genai.
Gemini Developer API
from google import genai
client = genai.Client()
response = client.models.generate_content(
model="gemini-3.8-flash", contents="Explain how AI works in a few words"
)
print(response.text)
Gemini Enterprise Agent Platform API
from google import genai
client = genai.Client(
vertexai=True, project='your-project-id', location='us-central1'
)
response = client.models.generate_content(
model="gemini-3.8-flash", contents="Explain how AI works in a few words"
)
print(response.text)
JavaScript وTypeScript
يمكنك الوصول إلى كل من Gemini Developer API وGemini Enterprise Agent Platform
من خلال مكتبة @google/genai. يُرجى الاطّلاع على صفحة المكتبات للحصول على تعليمات حول كيفية تثبيت @google/genai.
Gemini Developer API
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({});
async function main() {
const response = await ai.models.generateContent({
model: "gemini-3.8-flash",
contents: "Explain how AI works in a few words",
});
console.log(response.text);
}
main();
Gemini Enterprise Agent Platform API
import { GoogleGenAI } from '@google/genai';
const ai = new GoogleGenAI({
vertexai: true,
project: 'your_project',
location: 'your_location',
});
async function main() {
const response = await ai.models.generateContent({
model: "gemini-3.8-flash",
contents: "Explain how AI works in a few words",
});
console.log(response.text);
}
main();
Go
يمكنك الوصول إلى كلّ من Gemini Developer API وGemini Enterprise Agent Platform
من خلال مكتبة google.golang.org/genai. يُرجى الاطّلاع على صفحة المكتبات للحصول على تعليمات حول كيفية تثبيت google.golang.org/genai.
Gemini Developer API
import (
"context"
"encoding/json"
"fmt"
"log"
"google.golang.org/genai"
)
// Your Google API key
const apiKey = "your-api-key"
func main() {
ctx := context.Background()
client, err := genai.NewClient(ctx, nil)
if err != nil {
log.Fatal(err)
}
// Call the GenerateContent method.
result, err := client.Models.GenerateContent(ctx, "gemini-3.8-flash", genai.Text("Tell me about New York?"), nil)
}
Gemini Enterprise Agent Platform API
import (
"context"
"encoding/json"
"fmt"
"log"
"google.golang.org/genai"
)
// Your Google Cloud project
const project = "your-project"
// A Google Cloud location like "us-central1"
const location = "some-gcp-location"
func main() {
ctx := context.Background()
client, err := genai.NewClient(ctx, &genai.ClientConfig
{
Project: project,
Location: location,
Backend: genai.BackendVertexAI,
})
// Call the GenerateContent method.
result, err := client.Models.GenerateContent(ctx, "gemini-3.8-flash", genai.Text("Tell me about New York?"), nil)
}
حالات الاستخدام والمنصات الأخرى
راجِع الأدلة الخاصة بحالات الاستخدام على مستندات Gemini Developer API ومستندات Gemini Enterprise Agent Platform لمزيد من المعلومات حول المنصات وحالات الاستخدام الأخرى.
اعتبارات نقل البيانات
عند نقل البيانات:
يجب استخدام حسابات خدمة Google Cloud للمصادقة. لمزيد من المعلومات، يُرجى الاطّلاع على مستندات Gemini Enterprise Agent Platform.
يمكنك استخدام مشروعك الحالي على Google Cloud (المشروع نفسه الذي استخدمته لإنشاء مفتاح واجهة برمجة التطبيقات) أو يمكنك إنشاء مشروع جديد على Google Cloud.
قد تختلف المناطق التي تتوفّر فيها واجهة Gemini Developer API عن تلك التي تتوفّر فيها واجهة Gemini Enterprise Agent Platform API. خلال فترة المعاينة، لا تتيح واجهة Interactions API على Gemini Enterprise Agent Platform سوى نقطة النهاية
global(location="global"). اطّلِع على قائمة المناطق التي تتوفّر فيها ميزات الذكاء الاصطناعي التوليدي على Google Cloud.يجب إعادة تدريب أي نماذج أنشأتها في Google AI Studio في "منصة الوكلاء في Gemini Enterprise".
إذا لم تعُد بحاجة إلى استخدام مفتاح Gemini API لواجهة Gemini Developer API، اتّبِع أفضل ممارسات الأمان واحذفه.
لحذف مفتاح واجهة برمجة تطبيقات، اتّبِع الخطوات التالية:
افتح صفحة بيانات الاعتماد من Google Cloud API.
ابحث عن مفتاح واجهة برمجة التطبيقات الذي تريد حذفه وانقر على رمز الإجراءات.
انقر على حذف مفتاح واجهة برمجة التطبيقات.
في نافذة حذف بيانات الاعتماد، انقر على حذف.
يستغرق نشر عملية حذف مفتاح واجهة برمجة التطبيقات بضع دقائق. بعد اكتمال عملية النشر، سيتم رفض أي زيارات تستخدم مفتاح واجهة برمجة التطبيقات المحذوف.
الخطوات التالية
- يمكنك الاطّلاع على دليل المطوّرين لواجهة Interactions API على Gemini Enterprise Agent Platform.
- يمكنك الاطّلاع على نظرة عامة حول الذكاء الاصطناعي التوليدي على Gemini Enterprise Agent Platform لمعرفة المزيد حول حلول الذكاء الاصطناعي التوليدي على Gemini Enterprise Agent Platform.