GeminiSharp SDK

Empower Your .NET Applications with the Google Gemini API

About GeminiSharp

GeminiSharp is a user-friendly C# SDK for .NET developers looking to seamlessly integrate with Google's cutting-edge Gemini API. Whether you aim to generate creative text, produce stunning images, or create structured data outputs, GeminiSharp provides a clean, efficient, and robust interface to unlock the power of Gemini within your .NET projects.

Key Features

Current Status & Roadmap

Structured Output Fully Functional
Image Generation Fully Functional
Logging Support Fully Functional
Retry Configuration Fully Functional
📷 Vision Support Coming Soon
🎧 Audio Understanding Coming Soon

Installation

To integrate GeminiSharp into your .NET project, install the NuGet package:

dotnet add package GeminiSharp

GeminiSharp officially supports .NET versions 6, 7, and 8.

Quick Start Guide

Get started generating text in just a few lines of code:

using GeminiSharp.Client;

var apiKey = "YOUR_GEMINI_API_KEY"; // Replace with your actual API key
using var httpClient = new HttpClient();
var geminiClient = new GeminiClient(httpClient, apiKey);

var response = await geminiClient.GenerateContentAsync("gemini-2.0", "Hello, Gemini!");
Console.WriteLine(response?.Candidates?[0].Content);

For detailed guidance on image generation, structured output, and advanced configurations, please refer to the complete documentation.

Contribute to GeminiSharp

We warmly welcome contributions! Want to help shape the future of GeminiSharp?

Fork the repository on GitHub, implement your enhancements or fixes, and submit a pull request. Let's build the best Gemini SDK for .NET together!

Learn How to Contribute