Prompt Buddy logoPrompt Buddy

google ยท Google AI Docs

Gemini API Migrate to the Google GenAI SDK

Provides a structured process and technical guidance for transitioning existing codebases from previous Gemini API implementations to the new Google GenAI SDK.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Gemini API Migrate to the Google GenAI SDK

Provides a structured process and technical guidance for transitioning existing codebases from previous Gemini API implementations to the new Google GenAI SDK.

When To Use

Use when updating existing Gemini API integrations to utilize the Google GenAI SDK or when refactoring code to comply with new SDK standards.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/gemini-api-migrate-to-the-google-genai-sdk-workflow-guide.mdA guide detailing the migration process from the Gemini API to the new Google GenAI SDK across Python, JavaScript, and Go.Questions about a guide detailing the migration process from the Gemini API to the new Google GenAI SDK across Python, JavaScript, an...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen.textThe shell command to install the latest version of the google-generativeai Python library using pip.Exact payloads, commands, or snippets shown in The shell command to install the latest version of the google-generativeai Python library using pip.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-2.textThe npm installation command required to add the Google Generative AI SDK to a project.Exact payloads, commands, or snippets shown in The npm installation command required to add the Google Generative AI SDK to a project.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-3.textThe shell command to install the Google Generative AI SDK for Go using the go get module command.Exact payloads, commands, or snippets shown in The shell command to install the Google Generative AI SDK for Go using the go get module command.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-4.textThe shell command to install the latest version of the google-genai Python SDK using pip.Exact payloads, commands, or snippets shown in The shell command to install the latest version of the google-genai Python SDK using pip.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-5.textThe npm installation command required to add the Google GenAI SDK to a project.Exact payloads, commands, or snippets shown in The npm installation command required to add the Google GenAI SDK to a project.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-go-sdk-ins.textThe shell command to install the Google GenAI SDK for Go using the go get module command.Exact payloads, commands, or snippets shown in The shell command to install the Google GenAI SDK for Go using the go get module command.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-python-gen.textA Python code example demonstrating how to use the google-generativeai SDK to create model objects and generate content.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the google-generativeai SDK to create model objects and generate content.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-6.textA JavaScript code example demonstrating the transition from the Gemini API to the Google GenAI SDK using the @google/generative-ai library.Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating the transition from the Gemini API to the Google GenAI SDK using the @google/...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-golang-sdk.textA Go code example demonstrating how to migrate from the Gemini API to the Google GenAI SDK using the generative-ai-go package.Exact payloads, commands, or snippets shown in A Go code example demonstrating how to migrate from the Gemini API to the Google GenAI SDK using the generative-ai-go...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p.textA text-based comparison showing the syntax changes for initializing the client and calling core methods when migrating to the Google GenAI SDK in Python.Exact payloads, commands, or snippets shown in A text-based comparison showing the syntax changes for initializing the client and calling core methods when migratin...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-n.textA JavaScript code snippet demonstrating how to initialize the Google GenAI SDK and use its client object for content generation, chat, file uploads, and caching.Exact payloads, commands, or snippets shown in A JavaScript code snippet demonstrating how to initialize the Google GenAI SDK and use its client object for content...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-7.textA Go code example demonstrating how to initialize the Google GenAI SDK client and access core services like Models, Chats, Files, and Tunings.Exact payloads, commands, or snippets shown in A Go code example demonstrating how to initialize the Google GenAI SDK client and access core services like Models, C...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-python-sdk.textA Python code snippet demonstrating the initial import and configuration of the google-generativeai library for migrating to the Google GenAI SDK.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating the initial import and configuration of the google-generativeai library for migra...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-8.textA code snippet demonstrating the import statement for the GoogleGenerativeAI class from the @google/generative-ai Node.js library.Exact payloads, commands, or snippets shown in A code snippet demonstrating the import statement for the GoogleGenerativeAI class from the @google/generative-ai Nod...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-to-google-.textA Go code example demonstrating the migration from the Gemini API to the Google GenAI SDK.Exact payloads, commands, or snippets shown in A Go code example demonstrating the migration from the Gemini API to the Google GenAI SDK.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-to-google--2.textA Go code snippet demonstrating how to initialize a new client using the Google GenAI SDK with an API key.Exact payloads, commands, or snippets shown in A Go code snippet demonstrating how to initialize a new client using the Google GenAI SDK with an API key.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-environmen.textA text snippet demonstrating how to export the GEMINI_API_KEY environment variable for the migration process.Exact payloads, commands, or snippets shown in A text snippet demonstrating how to export the GEMINIAPIKEY environment variable for the migration process.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-2.textA Python code snippet demonstrating how to initialize the Google GenAI client using an API key.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to initialize the Google GenAI client using an API key.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-9.textA code snippet demonstrating the import and initialization of the GoogleGenAI class using the @google/genai Node.js library.Exact payloads, commands, or snippets shown in A code snippet demonstrating the import and initialization of the GoogleGenAI class using the @google/genai Node.js l...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-golang-sdk-2.textA text snippet showing the Go import statement for the new Google GenAI SDK.Exact payloads, commands, or snippets shown in A text snippet showing the Go import statement for the new Google GenAI SDK.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-10.textA Go code snippet demonstrating how to initialize a new client using the Google GenAI SDK with the Gemini API backend.Exact payloads, commands, or snippets shown in A Go code snippet demonstrating how to initialize a new client using the Google GenAI SDK with the Gemini API backend.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-3.textA Python code example demonstrating how to use the new Google GenAI SDK to generate content with the gemini-2.0-flash model.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the new Google GenAI SDK to generate content with the gemini-2.0-flash...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-11.textA Node.js code example demonstrating how to initialize the Google Generative AI SDK and generate content using the gemini-2.0-flash model.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to initialize the Google Generative AI SDK and generate content using the ge...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-12.textA Go code example demonstrating how to initialize a client and use the GenerateContent method with the new Google GenAI SDK.Exact payloads, commands, or snippets shown in A Go code example demonstrating how to initialize a client and use the GenerateContent method with the new Google Gen...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-4.textA Python code example demonstrating how to use the Google GenAI SDK to call the generateContent method with a Gemini 2.0 Flash model.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the Google GenAI SDK to call the generateContent method with a Gemini...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-n-2.textA Node.js code example demonstrating how to use the Google GenAI SDK to call the generateContent method.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the Google GenAI SDK to call the generateContent method.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-g.textA Go code example demonstrating how to use the Google GenAI SDK to call the GenerateContent method with a Gemini 2.0 Flash model.Exact payloads, commands, or snippets shown in A Go code example demonstrating how to use the Google GenAI SDK to call the GenerateContent method with a Gemini 2.0...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-python-gen-2.textA Python code example demonstrating the transition from the legacy Gemini API to the new Google GenAI SDK using the generativeai library.Exact payloads, commands, or snippets shown in A Python code example demonstrating the transition from the legacy Gemini API to the new Google GenAI SDK using the g...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-13.textA Node.js code example demonstrating the migration from the legacy Gemini API to the new Google GenAI SDK using the @google/generative-ai library.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating the migration from the legacy Gemini API to the new Google GenAI SDK using the @...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-14.textA Go code example demonstrating how to use the Google GenAI SDK to call the GenerateContent method with an image and text prompt.Exact payloads, commands, or snippets shown in A Go code example demonstrating how to use the Google GenAI SDK to call the GenerateContent method with an image and...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-5.textA Python code example demonstrating how to use the new Google GenAI SDK to generate content from an image using the Gemini 2.0 Flash model.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the new Google GenAI SDK to generate content from an image using the G...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-n-3.textA Node.js code example demonstrating how to use the Google GenAI SDK to upload a file and generate content from an image.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the Google GenAI SDK to upload a file and generate content from an im...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-15.textA Go code example demonstrating how to use the Google GenAI SDK to send a multimodal prompt containing both text and image data.Exact payloads, commands, or snippets shown in A Go code example demonstrating how to use the Google GenAI SDK to send a multimodal prompt containing both text and...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-python-gen-3.textA Python code snippet demonstrating the transition from the legacy Gemini API to the new Google GenAI SDK using the generativeai library.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating the transition from the legacy Gemini API to the new Google GenAI SDK using the g...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-n-4.textA Node.js code example demonstrating how to use the Google GenAI SDK to generate streaming content from a prompt.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the Google GenAI SDK to generate streaming content from a prompt.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-16.textA Go code example demonstrating how to initialize a new client and generate content using the Google GenAI SDK.Exact payloads, commands, or snippets shown in A Go code example demonstrating how to initialize a new client and generate content using the Google GenAI SDK.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-6.textA Python code example demonstrating how to use the Google GenAI SDK to stream content generation from a Gemini model.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the Google GenAI SDK to stream content generation from a Gemini model.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-17.textA Node.js code example demonstrating how to use the Google GenAI SDK to perform a streaming content generation request.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the Google GenAI SDK to perform a streaming content generation request.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-18.textA Go code example demonstrating how to use the GenerateContentStream method with the new Google GenAI SDK.Exact payloads, commands, or snippets shown in A Go code example demonstrating how to use the GenerateContentStream method with the new Google GenAI SDK.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-7.textA Python code snippet demonstrating how to initialize a GenerativeModel and generate content using the new Google GenAI SDK.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to initialize a GenerativeModel and generate content using the new Google Gen...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-n-5.textA Node.js code example demonstrating how to use the Google Generative AI SDK to generate content with a specific model and configuration.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the Google Generative AI SDK to generate content with a specific mode...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-19.textA Go code example demonstrating how to initialize a new client and configure model parameters using the Google GenAI SDK.Exact payloads, commands, or snippets shown in A Go code example demonstrating how to initialize a new client and configure model parameters using the Google GenAI...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-8.textA Python code example demonstrating how to use the new Google GenAI SDK to generate content with specific configuration parameters.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the new Google GenAI SDK to generate content with specific configurati...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-n-6.textA Node.js code snippet demonstrating how to initialize the Google GenAI SDK and call the generateContent method.Exact payloads, commands, or snippets shown in A Node.js code snippet demonstrating how to initialize the Google GenAI SDK and call the generateContent method.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-g-2.textA Go code example demonstrating how to use the new Google GenAI SDK to call the GenerateContent method.Exact payloads, commands, or snippets shown in A Go code example demonstrating how to use the new Google GenAI SDK to call the GenerateContent method.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-20.textA Python code snippet demonstrating the migration from the legacy Gemini API to the new Google GenAI SDK using the GenerativeModel class.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating the migration from the legacy Gemini API to the new Google GenAI SDK using the Ge...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-21.textA Node.js code example demonstrating how to configure safety settings using the Google GenAI SDK during a Gemini API migration.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to configure safety settings using the Google GenAI SDK during a Gemini API...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-9.textA Python code snippet demonstrating how to initialize the Google GenAI SDK client and use the generate_content method with safety settings.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to initialize the Google GenAI SDK client and use the generatecontent method...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-n-7.textA Node.js code example demonstrating how to initialize the Google GenAI SDK and use the generateContent method for content generation.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to initialize the Google GenAI SDK and use the generateContent method for co...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-python-gen-4.textA Python code example demonstrating the transition from the legacy Gemini API to the new Google GenAI SDK using the generativeai library.Exact payloads, commands, or snippets shown in A Python code example demonstrating the transition from the legacy Gemini API to the new Google GenAI SDK using the g...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-10.textA Python code snippet demonstrating how to initialize the Google GenAI client and use the generateContent method for model interaction.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to initialize the Google GenAI client and use the generateContent method for...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-11.textA Python code example demonstrating how to migrate chat session interactions from the legacy Gemini API to the new Google GenAI SDK.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to migrate chat session interactions from the legacy Gemini API to the new Go...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-22.textA Node.js code example demonstrating how to migrate chat session logic from the Gemini API to the Google GenAI SDK.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to migrate chat session logic from the Gemini API to the Google GenAI SDK.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-g-3.textA Go code example demonstrating how to initialize a client and start a chat session using the new Google GenAI SDK.Exact payloads, commands, or snippets shown in A Go code example demonstrating how to initialize a client and start a chat session using the new Google GenAI SDK.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-12.textA Python code example demonstrating how to initialize the Google GenAI SDK client and create a chat session to migrate from the legacy Gemini API.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to initialize the Google GenAI SDK client and create a chat session to migrat...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-n-8.textA Node.js code example demonstrating how to initialize the Google GenAI SDK and create a chat session with message history.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to initialize the Google GenAI SDK and create a chat session with message hi...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-23.textA Go code example demonstrating how to initialize a client and create a chat session using the new Google GenAI SDK.Exact payloads, commands, or snippets shown in A Go code example demonstrating how to initialize a client and create a chat session using the new Google GenAI SDK.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-python-gen-5.textA Python code example demonstrating how to migrate from the Gemini API to the Google GenAI SDK using function calling with a weather tool.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to migrate from the Gemini API to the Google GenAI SDK using function calling...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-13.textA Python code example demonstrating how to use the new Google GenAI SDK to call the generateContent method.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the new Google GenAI SDK to call the generateContent method.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-14.textA Python code example demonstrating how to implement automatic function calling using the Google GenAI SDK for Gemini models.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to implement automatic function calling using the Google GenAI SDK for Gemini...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-15.textA Python code example demonstrating how to migrate function calling implementation from the Gemini API to the new Google GenAI SDK.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to migrate function calling implementation from the Gemini API to the new Goo...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-24.textA Python code example demonstrating how to use the Google GenAI SDK to initialize a model with code execution capabilities.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the Google GenAI SDK to initialize a model with code execution capabil...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-n-9.textA Node.js code snippet demonstrating how to use the Google GenAI SDK to perform code execution with the gemini-2.0-flash model.Exact payloads, commands, or snippets shown in A Node.js code snippet demonstrating how to use the Google GenAI SDK to perform code execution with the gemini-2.0-fl...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-16.textA Python code example demonstrating how to use the new Google GenAI SDK to call the generateContent method with code execution tools.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the new Google GenAI SDK to call the generateContent method with code...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-n-10.textA Node.js code example demonstrating how to use the Google GenAI SDK to call the generateContent method with a model configuration.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the Google GenAI SDK to call the generateContent method with a model...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-25.textA Python code snippet demonstrating how to use the Google GenAI SDK to call the generateContent method with Google Search retrieval tools.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to use the Google GenAI SDK to call the generateContent method with Google Se...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-17.textA Python code snippet demonstrating the migration from the Gemini API to the Google GenAI SDK using the generateContent method with Google Search tool integration.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating the migration from the Gemini API to the Google GenAI SDK using the generateConte...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-python-gen-6.textA Python code example demonstrating the migration from the legacy Gemini API to the new Google GenAI SDK using the generativeai library.Exact payloads, commands, or snippets shown in A Python code example demonstrating the migration from the legacy Gemini API to the new Google GenAI SDK using the ge...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-26.textA Node.js code example demonstrating how to define a structured schema using the Google Generative AI SDK for model responses.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to define a structured schema using the Google Generative AI SDK for model r...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-18.textA Python code example demonstrating how to use the new Google GenAI SDK to generate content with a Pydantic model.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the new Google GenAI SDK to generate content with a Pydantic model.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-n-11.textA Node.js code snippet demonstrating how to initialize the Google GenAI SDK and use the generateContent method with a JSON schema.Exact payloads, commands, or snippets shown in A Node.js code snippet demonstrating how to initialize the Google GenAI SDK and use the generateContent method with a...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-19.textA Python code snippet demonstrating how to download a text file and upload it to the Gemini API using the Google GenAI SDK for content generation.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to download a text file and upload it to the Gemini API using the Google GenA...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-u.textA Python code example demonstrating how to download a text file and upload it using the Google GenAI SDK for content generation.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to download a text file and upload it using the Google GenAI SDK for content...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-python-gen-7.textA Python code snippet demonstrating how to list and retrieve files using the Google GenAI SDK.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to list and retrieve files using the Google GenAI SDK.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-20.textA Python code snippet demonstrating how to use the Google GenAI SDK to list and retrieve files using the genai client.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to use the Google GenAI SDK to list and retrieve files using the genai client.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-m.textA Python code snippet demonstrating how to upload and delete files using the Google GenAI SDK.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to upload and delete files using the Google GenAI SDK.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-u-2.textA Python code example demonstrating how to upload and delete files using the Google GenAI SDK.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to upload and delete files using the Google GenAI SDK.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-python-cac.textA Python code snippet demonstrating how to download a text file, upload it to the Gemini API, and create a cached content object using the Google GenAI SDK.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to download a text file, upload it to the Gemini API, and create a cached con...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-27.textA Node.js code example demonstrating how to use the Google GenAI SDK to upload files and create content caches.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the Google GenAI SDK to upload files and create content caches.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-m-2.textA Python script demonstrating how to use the Google GenAI SDK to list models that support content caching.Exact payloads, commands, or snippets shown in A Python script demonstrating how to use the Google GenAI SDK to list models that support content caching.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-28.textA Node.js code example demonstrating how to upload a file and use the Google GenAI SDK to process it with the Gemini 2.0 Flash model.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to upload a file and use the Google GenAI SDK to process it with the Gemini...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-29.textA Python code snippet demonstrating how to use the countTokens method with the Google GenAI SDK to migrate from the Gemini API.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to use the countTokens method with the Google GenAI SDK to migrate from the G...
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-c.textA Node.js code example demonstrating how to use the Google GenAI SDK to count tokens in a prompt.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the Google GenAI SDK to count tokens in a prompt.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-c-2.textA Python code example demonstrating how to use the Google GenAI SDK to count tokens for a given string.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the Google GenAI SDK to count tokens for a given string.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-c-3.textA Node.js code example demonstrating how to use the Google GenAI SDK to count tokens for a given prompt.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the Google GenAI SDK to count tokens for a given prompt.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-python-imagen-imag.textA Python code snippet demonstrating how to use the Google GenAI SDK to generate images using the Imagen model.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to use the Google GenAI SDK to generate images using the Imagen model.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-21.textA Python code example demonstrating how to use the Google GenAI SDK to generate images using the Gemini 2.5 Flash model.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the Google GenAI SDK to generate images using the Gemini 2.5 Flash model.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-python-embedconten.textA Python code snippet demonstrating the migration of the embedContent operation to the Google GenAI SDK.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating the migration of the embedContent operation to the Google GenAI SDK.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-n-12.textA Node.js code snippet demonstrating how to initialize the Google Generative AI SDK and perform an embedding operation.Exact payloads, commands, or snippets shown in A Node.js code snippet demonstrating how to initialize the Google Generative AI SDK and perform an embedding operation.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-google-genai-sdk-p-22.textA Python code example demonstrating how to use the Google GenAI SDK to call the embedContent method.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the Google GenAI SDK to call the embedContent method.
examples/gemini-api-migrate-to-the-google-genai-sdk-gemini-api-migrate-google-gen-30.textA Node.js code example demonstrating how to use the Google GenAI SDK to perform content embedding operations.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the Google GenAI SDK to perform content embedding operations.

What This Skill Covers

  • Starting with the Gemini 2.0 release in late 2024, we introduced a new set of libraries called the Google GenAI SDK. It offers an improved developer experien...
  • Main sections: Installation, Python, JavaScript, Go, Python.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://ai.google.dev/gemini-api/docs/migrate