Skip to content
Gunpal Jain edited this page Nov 15, 2026 · 11 revisions

Google GenerativeAI .NET SDK — Documentation

The unofficial .NET SDK for Google Gemini (Gemini API / Google AI Studio) and Vertex AI. It is a REST-based, NativeAOT-compatible client covering content generation, multimodal input, structured output, function calling, the Live API, the Interactions API, File Search, batch processing, tuning, RAG and more.

Version 4.0 brings parity with the latest Google APIs. Upgrading from 3.x? Start with the Migration Guide and the Release Notes.

Packages

Package Purpose
Google_GenerativeAI Core SDK: models, clients and types for the Gemini API and Vertex AI.
Google_GenerativeAI.Tools Function calling helpers, source-generated tools and MCP integration.
Google_GenerativeAI.Auth OAuth, service account and Application Default Credentials authenticators.
Google_GenerativeAI.Microsoft Microsoft.Extensions.AI implementations (IChatClient, embeddings, images).
Google_GenerativeAI.Web Dependency injection and configuration for ASP.NET Core.
Google_GenerativeAI.Live Real-time Multimodal Live API and Live Music over WebSockets.

Supported frameworks: .NET 6, 7, 8, 9, 10 and 11, .NET Standard 2.0 and .NET Framework 4.6.2.

Start here

  1. Initialization — create a GoogleAi or VertexAI client and a model.
  2. Authentication — API keys, ADC, service accounts and OAuth.
  3. Generate Content — your first request, then Streaming and Chat Session.
  4. Supported Models — current model constants and their replacements for retired models.

Documentation map

Area Pages
Core Generate Content · Chat Session · Streaming · Multimodal Features · JSON Mode · Function Calling · Embeddings · Context Caching
Gemini APIs Interactions API · Multimodal Live API · File Search · Batch API · Model Tuning · Webhooks · Agent APIs · Image Generation · Video Generation · Speech Generation · Files Client · Model Client
Vertex AI Vertex RAG Engine
Integrations Microsoft.Extensions.AI · Model Context Protocol · ASP.NET Core / Web
Guides Configuration & Error Handling · NativeAOT & Trimming · Migration Guide (v4) · Release Notes (v4)
Legacy Semantic Retrieval (AQA)

Samples

Runnable projects live in the repository's samples folder: MCP integration, two-way audio (WPF, Live API), web application integration, Vertex RAG Q&A, semantic retrieval and a JavaScript code-executor tool.

Contributing and support

Issues and pull requests are welcome on GitHub. The SDK is released under the MIT License.

Clone this wiki locally