Este documento oferece uma visão geral das diferenças entre as versões v1
e v1beta da API Gemini.
v1: versão estável da API. Os recursos na versão estável têm suporte total durante toda a vida útil da versão principal. Se houver mudanças
significativas, a próxima versão principal da API será criada e
a versão atual será descontinuada após um período razoável.
Mudanças não destrutivas podem ser introduzidas na API sem alterar a versão principal.
v1beta: essa versão inclui recursos de acesso antecipado que podem estar em
desenvolvimento e sujeitos a mudanças rápidas e interruptivas. Também não há garantia de que os recursos da versão Beta serão transferidos para a versão estável. Devido a essa instabilidade, considere não lançar aplicativos de produção com essa versão.
Recurso
v1
v1beta
Gerar conteúdo: entrada somente de texto
Gerar conteúdo: entrada de texto e imagem
Gerar conteúdo: saída de texto
Gerar conteúdo: conversas multiturno (chat)
Gerar conteúdo: chamadas de função
Gerar conteúdo: streaming
Incorporar conteúdo: entrada somente de texto
Gerar resposta
Recuperador semântico
: compatível
: nunca será compatível
Configurar a versão da API em um SDK
O padrão do SDK da API Gemini é v1beta, mas você pode usar outras versões
definindo a versão da API, conforme mostrado no exemplo de código a seguir:
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."}] }] }'
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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 }'"]]