Ten dokument zawiera ogólne omówienie różnic między wersjami v1 i v1beta interfejsu Gemini API.
v1: stabilna wersja interfejsu API. Funkcje w wersji stabilnej są w pełni obsługiwane przez cały okres istnienia wersji głównej. Jeśli wystąpią jakiekolwiek zmiany powodujące niezgodność wsteczną, utworzymy kolejną główną wersję interfejsu API, a dotychczasowa wersja zostanie wycofana po upływie odpowiedniego czasu.
W interfejsie API mogą zostać wprowadzone zmiany, które nie powodują problemów, bez zmiany głównej wersji.
v1beta: ta wersja zawiera funkcje w ramach wczesnego dostępu, które mogą być w trakcie opracowywania i mogą ulec szybkim zmianom powodującym niezgodność. Nie ma też gwarancji, że funkcje w wersji beta zostaną przeniesione do wersji stabilnej. Z powodu tej niestabilności nie zalecamy uruchamiania aplikacji produkcyjnych w tej wersji.
Funkcja
v1
v1beta
Generowanie treści – dane wejściowe tylko w formie tekstu
Generowanie treści – dane wejściowe w postaci tekstu i obrazu
Generowanie treści – dane wyjściowe w postaci tekstu
Generowanie treści – rozmowy wieloetapowe (czat)
Generowanie treści – wywołania funkcji
Generowanie treści – streaming
Umieszczanie treści – wprowadzanie tylko tekstu
Wygeneruj odpowiedź
Wyszukiwarka semantyczna
– obsługiwane
– nigdy nie będzie obsługiwana
Konfigurowanie wersji interfejsu API w pakiecie SDK
Domyślna wersja pakietu SDK interfejsu Gemini API to v1beta, ale możesz używać innych wersji, ustawiając wersję interfejsu API w sposób pokazany w poniższym przykładowym kodzie:
Python
fromgoogleimportgenaiclient=genai.Client(http_options={'api_version':'v1alpha'})response=client.models.generate_content(model='gemini-2.0-flash',contents="Explain how AI works",)print(response.text)
JavaScript
import{GoogleGenAI}from"@google/genai";constai=newGoogleGenAI({httpOptions:{apiVersion:"v1alpha"},});asyncfunctionmain(){constresponse=awaitai.models.generateContent({model:"gemini-2.0-flash",contents:"Explain how AI works",});console.log(response.text);}awaitmain();
REST
curl"https://generativelanguage.googleapis.com/v1/models/gemini-1.5-flash:generateContent"\
-H"x-goog-api-key: $GEMINI_API_KEY"\
-H'Content-Type: application/json'\
-XPOST\
-d'{ "contents": [{ "parts":[{"text": "Explain how AI works."}] }] }'
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-08-22 UTC."],[],[],null,["# API versions explained\n\nThis document provides a high-level overview of the differences between the `v1`\nand `v1beta` versions of the Gemini API.\n\n- **v1**: Stable version of the API. Features in the stable version are fully-supported over the lifetime of the major version. If there are any breaking changes, then the next major version of the API will be created and the existing version will be deprecated after a reasonable period of time. Non-breaking changes may be introduced to the API without changing the major version.\n- **v1beta**: This version includes early-access features that may be under development and is subject to rapid and breaking changes. There is also no guarantee that the features in the Beta version will move to the stable version. Due to this instability, you should consider not launching production applications with this version.\n\n| Feature | v1 | v1beta |\n|----------------------------------------------------|----|--------|\n| Generate Content - Text-only input | | |\n| Generate Content - Text-and-image input | | |\n| Generate Content - Text output | | |\n| Generate Content - Multi-turn conversations (chat) | | |\n| Generate Content - Function calls | | |\n| Generate Content - Streaming | | |\n| Embed Content - Text-only input | | |\n| Generate Answer | | |\n| Semantic retriever | | |\n\n- - Supported\n- - Will never be supported\n\nConfigure API version in an SDK\n-------------------------------\n\nThe Gemini API SDK's default to `v1beta`, but you can opt to use other versions\nby setting the API version as shown in the following code sample: \n\n### Python\n\n from google import genai\n\n client = genai.Client(http_options={'api_version': 'v1alpha'})\n\n response = client.models.generate_content(\n model='gemini-2.0-flash',\n contents=\"Explain how AI works\",\n )\n\n print(response.text)\n\n### JavaScript\n\n import { GoogleGenAI } from \"@google/genai\";\n\n const ai = new GoogleGenAI({\n httpOptions: { apiVersion: \"v1alpha\" },\n });\n\n async function main() {\n const response = await ai.models.generateContent({\n model: \"gemini-2.0-flash\",\n contents: \"Explain how AI works\",\n });\n console.log(response.text);\n }\n\n await main();\n\n### REST\n\n curl \"https://generativelanguage.googleapis.com/v1/models/gemini-1.5-flash:generateContent\" \\\n -H \"x-goog-api-key: $GEMINI_API_KEY\" \\\n -H 'Content-Type: application/json' \\\n -X POST \\\n -d '{\n \"contents\": [{\n \"parts\":[{\"text\": \"Explain how AI works.\"}]\n }]\n }'"]]