GeminiAI 1.0.3

dotnet add package GeminiAI --version 1.0.3
                    
NuGet\Install-Package GeminiAI -Version 1.0.3
                    
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="GeminiAI" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GeminiAI" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="GeminiAI" />
                    
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 GeminiAI --version 1.0.3
                    
#r "nuget: GeminiAI, 1.0.3"
                    
#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 GeminiAI@1.0.3
                    
#: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=GeminiAI&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=GeminiAI&version=1.0.3
                    
Install as a Cake Tool

BenScr.AI.GeminiClient

A C# library that simplifies communication between client and the Gemini API

Setup

Follow these steps to get started after cloning the repository.

1. Get a Gemini API Key

Create an API key in Google AI Studio

2. Configure Environment Variables

Create a .env file containing your GEMINI_API_KEY.
The file must be located in the working directory so it can be loaded by DotNetEnv.

Example .env file:

GEMINI_API_KEY=YOUR_API_KEY

How to use

Include

using BenScr.AI.Gemini;

Load Api Key

GeminiApiKey geminiApiKey = GeminiApiKey.LoadFromEnvironment();

Generate Response

GeminiClient client = new GeminiClient(geminiApiKey.Key, "ModelName");
string input = Console.ReadLine();
GenerateContentResponse response = await client.RequestAsync(input);
Console.WriteLine(response.Text);

Example Output

User: Hello
gemini-2.5-flash-lite: Hello! How can I help you today?
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.3 37 3/14/2026
1.0.2 36 3/14/2026
1.0.1 38 3/14/2026
1.0.0 41 3/14/2026