Google.GenAI
0.1.0
Prefix Reserved
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
<PackageReference Include="Google.GenAI" Version="0.1.0" />
<PackageVersion Include="Google.GenAI" Version="0.1.0" />
<PackageReference Include="Google.GenAI" />
paket add Google.GenAI --version 0.1.0
#r "nuget: Google.GenAI, 0.1.0"
#:package Google.GenAI@0.1.0
#addin nuget:?package=Google.GenAI&version=0.1.0
#tool nuget:?package=Google.GenAI&version=0.1.0
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 | Versions 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. |
-
net8.0
- Google.Apis.Auth (>= 1.69.0)
- System.Net.WebSockets.Client (>= 4.3.2)
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 |