Gemini を使用して生成 AI ソリューションを開発する場合、Google は Gemini Developer API と Gemini Enterprise Agent Platform API の 2 つの API プロダクトを提供しています。
Gemini Developer API は、Gemini を活用したアプリケーションの構築、本番環境への移行、スケーリングを最速で実現します。特定のエンタープライズ コントロールが必要な場合を除き、ほとんどのデベロッパーは Gemini Developer API を使用する必要があります。
Gemini Enterprise Agent Platform は、Google Cloud Platform を基盤とする生成 AI アプリケーションの構築とデプロイのための、エンタープライズ対応の機能とサービスの包括的なエコシステムを提供します。
最近、これらのサービス間の移行を簡素化しました。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
@google/genai ライブラリ(>= 2.3.0)を介して、Gemini Developer API と Gemini Enterprise Agent Platform の両方のサービスにアクセスできます。@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
新しいプロジェクトには Interactions API をおすすめしますが、generateContent API も引き続きサポートされます。
Python
google-genai ライブラリを介して、Gemini Developer API と Gemini Enterprise Agent Platform の両方のサービスにアクセスできます。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
@google/genai ライブラリを介して、Gemini Developer API と Gemini Enterprise Agent Platform の両方のサービスにアクセスできます。@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
google.golang.org/genai ライブラリを介して、Gemini Developer API と Gemini Enterprise Agent Platform の両方のサービスにアクセスできます。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 で異なる場合があります。プレビュー期間中、Gemini Enterprise Agent Platform の Interactions API は
globalエンドポイント(location="global")のみをサポートします。Google Cloud の生成 AI でサポートされているリージョンのリストをご覧ください。Google AI Studio で作成したモデルは、Gemini Enterprise Agent Platform で再トレーニングする必要があります。
Gemini Developer API で Gemini API キーを使用する必要がなくなった場合は、セキュリティのベスト プラクティスに従ってキーを削除します。
API キーを削除するには:
Google Cloud API 認証情報ページを開きます。
削除する API キーを見つけて、[操作] アイコンをクリックします。
[API キーを削除] を選択します。
[認証情報の削除] モーダルで、[削除] を選択します。
API キーの削除が反映されるまでには数分かかることがあります。削除が反映されると、以降その API キーを使ったトラフィックはすべて拒否されます。
次のステップ
- Gemini Enterprise Agent Platform の Interactions API デベロッパー ガイドをご覧ください。
- Gemini Enterprise Agent Platform の生成 AI ソリューションの詳細については、Gemini Enterprise Agent Platform の生成 AI の概要をご覧ください。