כשמפתחים פתרונות AI גנרטיבי באמצעות Gemini, Google מציעה שני מוצרי API: Gemini Developer API ו-Gemini Enterprise Agent Platform API.
Gemini Developer API הוא הדרך המהירה ביותר לבנות אפליקציות מבוססות-Gemini, להעביר אותן לייצור ולהרחיב אותן. רוב המפתחים צריכים להשתמש ב-Gemini Developer API, אלא אם יש צורך באמצעי בקרה ספציפיים ברמת הארגון.
Gemini Enterprise Agent Platform מציעה מערכת אקולוגית מקיפה של תכונות ושירותים שמוכנים לשימוש בארגונים, ליצירה ולפריסה של אפליקציות מבוססות-AI גנרטיבי שמגובות על ידי Google Cloud Platform.
לאחרונה פישטנו את תהליך ההעברה בין השירותים האלה. Gemini Developer API ו-Gemini Enterprise Agent Platform API זמינים עכשיו דרך Google GenAI SDK המאוחד ו-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 API
מומלץ להשתמש ב-API של אינטראקציות בפרויקטים חדשים, אבל עדיין יש תמיכה ב-API של generateContent.
Python
אפשר לגשת גם אל Gemini Developer API וגם אל שירותי Gemini Enterprise Agent Platform דרך ספריית google-genai. הוראות להתקנה של google-genai מופיעות בדף libraries (ספריות).
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 (אותו פרויקט שבו השתמשתם כדי ליצור את מפתח ה-API) או ליצור פרויקט חדש ב-Google Cloud.
יכול להיות שהאזורים הנתמכים שונים בין Gemini Developer API לבין Gemini Enterprise Agent Platform API. במהלך תקופת הטרום-השקה, Interactions API ב-Gemini Enterprise Agent Platform תומך רק בנקודת הקצה
global(location="global"). אפשר לעיין ברשימת האזורים הנתמכים ל-AI גנרטיבי ב-Google Cloud.צריך לאמן מחדש ב-Gemini Enterprise Agent Platform את כל המודלים שיצרתם ב-Google AI Studio.
אם אתם לא צריכים יותר להשתמש במפתח Gemini API עבור Gemini Developer API, מומלץ למחוק אותו בהתאם לשיטות המומלצות לאבטחה.
כדי למחוק מפתח API:
פותחים את הדף Google Cloud API Credentials.
מאתרים את מפתח ה-API שרוצים למחוק ולוחצים על סמל הפעולות.
בוחרים באפשרות מחיקת מפתח API.
בחלון מחיקת פרטי כניסה, לוחצים על מחיקה.
תהליך המחיקה של מפתח API יכול להימשך כמה דקות. אחרי שההפצה מסתיימת, כל התנועה שמשתמשת במפתח ה-API שנמחק נדחית.
השלבים הבאים
- מומלץ לעיין במדריך למפתחים בנושא Interactions API ב-Gemini Enterprise Agent Platform.
- במאמר סקירה כללית על AI גנרטיבי ב-Gemini Enterprise Agent Platform אפשר לקרוא מידע נוסף על פתרונות AI גנרטיבי ב-Gemini Enterprise Agent Platform.