Google.GenAI 0.1.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Google.GenAI --version 0.1.0
                    
NuGet\Install-Package Google.GenAI -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Google.GenAI" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Google.GenAI" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Google.GenAI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Google.GenAI --version 0.1.0
                    
#r "nuget: Google.GenAI, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Google.GenAI@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Google.GenAI&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Google.GenAI&version=0.1.0
                    
Install as a Cake Tool

Google Gen AI .Net SDK provides an interface for developers to integrate Google's generative models into their .Net applications. It supports the Gemini Developer API and Vertex AI APIs.

Install

dotnet add package Google.GenAI

Imports

using Google.GenAI;
using Google.GenAI.Types;

Create a client

Please run one of the following code blocks to create a client for different services (Gemini Developer API or Vertex AI).

using Google.GenAI;

//  Only run this block for Gemini Developer API
var client = new Client(apiKey: apiKey);
using Google.GenAI;

// only run this block for Vertex AI API
client = new Client(
    project: project, location: location, vertexAI: true
)

(Optional) Using environment variables:

You can create a client by configuring the necessary environment variables. Configuration setup instructions depends on whether you're using the Gemini Developer API or the Gemini API in Vertex AI.

Gemini Developer API: Set the GOOGLE_API_KEY. It will automatically be picked up by the client.

export GEMINI_API_KEY='your-api-key'

Gemini API on Vertex AI: Set GOOGLE_GENAI_USE_VERTEXAI, GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION, as shown below:

export GOOGLE_GENAI_USE_VERTEXAI=true
export GOOGLE_CLOUD_PROJECT='your-project-id'
export GOOGLE_CLOUD_LOCATION='us-central1'
using Google.GenAI;

client = new Client();

Types

Parameter types are specified in the Google.GenAI.Types namespace.

Models

The client.Models module exposes model inferencing. See Create a client section above to initialize a client.

Generate Content

With simple text content
var response = await client.Models.GenerateContentAsync(
        model: "gemini-2.0-flash", contents: "why is the sky blue?"
    );
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Google.GenAI:

Package Downloads
Microsoft.SemanticKernel.Connectors.Google

Semantic Kernel connectors for Google generation platforms (GoogleAI/VertexAI). Contains generation and embedding services.

DotSee.Discipline

A package enabing you to automatically create nodes / put restrictions on the number of nodes created / hide URL segments / hide not created nodes from the Umbraco back office

AgentFrameworkToolkit.Google

An opinionated C# Toolkit targeting Google for Microsoft Agent Framework that makes life eaisier

NovaCore.AgentKit.Providers.Google

Google Gemini provider for NovaCore.AgentKit with Vertex AI support

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.14.0 0 1/30/2026
0.13.1 3,553 1/22/2026
0.13.0 1,374 1/22/2026
0.12.0 7,516 1/15/2026
0.11.0 7,018 1/14/2026
0.10.0 21,026 1/7/2026
0.9.0 27,822 12/11/2025
0.8.0 4,262 12/8/2025
0.7.0 6,424 12/4/2025
0.6.0 50,174 11/18/2025
0.5.0 1,545 11/14/2025
0.4.0 8,409 11/5/2025
0.3.0 8,509 10/24/2025
0.2.0 5,278 10/3/2025
0.1.0 349 10/1/2025