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);
Java
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(""));
Go
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 3.8 Flash 新モデル
Google 史上最もインテリジェントな Flash モデル。長期的なソフトウェア エンジニアリング、自律型エージェント、複雑なエンタープライズ ワークフロー向けに設計されています。
Gemini 3.8 Flash TTS 新モデル
表現力豊かな演技、カスタム音声デザイン、ボイス レプリケーションを備えたスタジオ品質のテキスト読み上げモデル。
Gemini 3.5 Flash-Lite
低レイテンシの高スループット サブエージェント タスク向けに最適化された、大量のトラフィックを処理するコスト重視のモデル。
Gemini 3.1 Pro
Google の最もインテリジェントなモデルであり、マルチモーダル理解において世界最高水準のモデルです。最先端の推論技術を基盤として構築されています。
Nano Banana
最先端の画像生成および編集モデル。
Gemini Omni Flash
Google の最先端の動画生成および編集モデル。
Gemini 3.5 Transcribe 新機能
発話ベースの言語検出、話者ダイアライゼーション、単語のタイムスタンプを備えた低レイテンシの音声文字変換モデル。
Gemini Robotics
Gemini のエージェント機能をロボット工学に導入し、物理世界での高度な推論を可能にする視覚言語モデル(VLM)。
機能を確認する
画像生成
Nano Banana を使用して、コンテキストに沿った画像をネイティブに生成、編集できます。
長いコンテキスト
Gemini モデルに数百万個のトークンを入力し、非構造化画像、動画、ドキュメントから理解を導き出します。
構造化出力
Gemini が JSON で応答するように制約します。JSON は、自動処理に適した構造化データ形式です。
関数呼び出し
Gemini を外部 API やツールに接続して、エージェント ワークフローを構築します。
Veo 3.1 による動画生成
Google の最先端モデルを使用して、テキストや画像のプロンプトから高品質な動画コンテンツを作成できます。
Live API を使用した音声エージェント
Live API を使用して、リアルタイム音声アプリケーションとエージェントを構築します。
ツール
Google 検索、URL コンテキスト、Google マップ、コード実行、コンピュータの使用などの組み込みツールを使用して、Gemini を世界に接続します。
ドキュメントの理解
最大 1,000 ページの PDF ファイルや、その他のテキストベースのファイル形式を、マルチモーダル理解で完全に理解して処理します。
思考
思考能力が複雑なタスクとエージェントの推論をどのように改善するかについて説明します。
エージェントを作成する
Managed Agents を使用すると、Gemini はタスクを独自に計画して完了するためのワークスペースを利用できます。Gemini は、1 つのリクエストでコードの記述と実行、ウェブの検索、ホストされたサンドボックス環境でのファイルの作成を行うことができます。プリビルドの 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);
Java
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(""));
Go
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 年 6 月にデフォルトのインターフェースとなり、今後 Gemini モデルとエージェントを構築する最善の方法となります。新しいプロジェクトを開始する場合は、Interactions API を使用する必要があります。generateContent API は引き続きサポートされますが、現在はレガシーと見なされています。