Gemini API
Google の最新の AI モデルを使用して構築とスケーリングを行うためのデベロッパー プラットフォーム。数分で開始できます。
Python
from google import genai
client = genai.Client()
response = client.models.generate_content(
model="gemini-2.5-flash",
contents="Explain how AI works in a few words",
)
print(response.text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({});
async function main() {
const response = await ai.models.generateContent({
model: "gemini-2.5-flash",
contents: "Explain how AI works in a few words",
});
console.log(response.text);
}
await main();
Go
package main
import (
"context"
"fmt"
"log"
"google.golang.org/genai"
)
func main() {
ctx := context.Background()
client, err := genai.NewClient(ctx, nil)
if err != nil {
log.Fatal(err)
}
result, err := client.Models.GenerateContent(
ctx,
"gemini-2.5-flash",
genai.Text("Explain how AI works in a few words"),
nil,
)
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Text())
}
Java
package com.example;
import com.google.genai.Client;
import com.google.genai.types.GenerateContentResponse;
public class GenerateTextFromTextInput {
public static void main(String[] args) {
Client client = new Client();
GenerateContentResponse response =
client.models.generateContent(
"gemini-2.5-flash",
"Explain how AI works in a few words",
null);
System.out.println(response.text());
}
}
C#
using System.Threading.Tasks;
using Google.GenAI;
using Google.GenAI.Types;
public class GenerateContentSimpleText {
public static async Task main() {
var client = new Client();
var response = await client.Models.GenerateContentAsync(
model: "gemini-2.5-flash", contents: "Explain how AI works in a few words"
);
Console.WriteLine(response.Candidates[0].Content.Parts[0].Text);
}
}
REST
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"contents": [
{
"parts": [
{
"text": "Explain how AI works in a few words"
}
]
}
]
}'
クイックスタート ガイドに沿って、API キーを取得し、最初の API 呼び出しを数分で行います。
ほとんどのモデルでは、請求先アカウントを設定しなくても無料枠から始めることができます。
各モデルについて
Gemini 3 Pro
Google 史上最もインテリジェントなモデル。最先端の推論に基づいて構築された、マルチモーダルな理解に最適なモデルです。
Gemini 2.5 Pro
コーディングと複雑な推論タスクに優れた、強力な推論モデル。
Gemini 2.5 Flash
最もバランスの取れたモデル。100 万トークンのコンテキスト ウィンドウなどを備えています。
Gemini 2.5 Flash-Lite
高頻度のタスクで優れたパフォーマンスを発揮する、最も高速で費用対効果の高いマルチモーダル モデル。
Veo 3.1
Google の最先端の動画生成モデル(ネイティブ音声付き)。
Gemini 2.5 Flash Image(Nano Banana)
最先端の画像生成および編集モデル
機能を確認する
ネイティブ画像生成(Nano Banana)
Gemini 2.5 Flash Image を使用して、コンテキストを高度に認識した画像をネイティブに生成、編集します。
長いコンテキスト
Gemini モデルに数百万個のトークンを入力し、非構造化画像、動画、ドキュメントから理解を導き出します。
構造化出力
Gemini が JSON(自動処理に適した構造化データ形式)で応答するように制約します。
関数呼び出し
Gemini を外部の API やツールに接続して、エージェント ワークフローを構築します。
Veo 3.1 による動画生成
Google の最先端モデルを使用して、テキストや画像のプロンプトから高品質の動画コンテンツを作成できます。
Live API を使用した音声エージェント
Live API を使用して、リアルタイム音声アプリケーションとエージェントを構築します。
ツール
Google 検索、URL コンテキスト、Google マップ、コード実行、コンピュータの使用などの組み込みツールを使用して、Gemini を世界に接続します。
ドキュメントの理解
最大 1,000 ページの PDF ファイルを処理します。
思考
思考能力が複雑なタスクやエージェントの推論をどのように改善するかについて説明します。