このドキュメントでは、Gemini API の v1
と v1beta バージョンの違いの概要について説明します。
- v1: API の安定版。安定版の機能は、メジャー バージョンのライフサイクル全体にわたって完全にサポートされます。破壊的変更がある場合は、API の新しいメジャー バージョンが作成され、既存のバージョンは妥当な期間後に非推奨になります。
破壊的変更でない場合は、メジャー バージョンを変更せずに API に導入されることがあります。Interactions API とそのコア機能は、
v1で一般提供されています。 - v1beta: このバージョンには、
積極的に開発されている初期の機能が含まれています。
v1betaの機能は、フィードバックに基づいて改良されるため変更される可能性がありますが、安定版に昇格する前に新機能を試すことができます。
機能と機能のサポート
次の表に、v1(GA)
と v1beta(ベータ版)の機能の可用性を示します。特に指定がない限り、コア API の機能とツールは Interactions API と generateContent の両方に適用されます。
- - サポート対象
SDK で API バージョンを構成する
Gemini API SDK はデフォルトで v1beta に設定されていますが、次のコードサンプルに示すように API バージョンを設定することで、バージョンを明示的に指定できます。
Python
from google import genai
client = genai.Client(http_options={'api_version': 'v1'})
interaction = client.interactions.create(
model='gemini-3.7-flash',
input="Explain how AI works",
)
print(interaction.output_text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({
httpOptions: { apiVersion: "v1" },
});
async function main() {
const interaction = await ai.interactions.create({
model: "gemini-3.7-flash",
input: "Explain how AI works",
});
console.log(interaction.output_text);
}
await main();
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import com.google.genai.types.HttpOptions;
Client client = Client.builder()
.httpOptions(HttpOptions.builder().apiVersion("v1").build())
.build();
CreateModelInteraction req = CreateModelInteraction.builder()
.model(Model.of("gemini-3.6-flash"))
.input(InteractionsInput.of("Explain how AI works"))
.build();
var interaction = client.interactions.create(CreateInteractionRequestBody.of(req)).interaction().get();
System.out.println(interaction.outputText().orElse(""));
REST
curl -X POST "https://generativelanguage.googleapis.com/v1/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "gemini-3.7-flash",
"input": "Explain how AI works",
}'