# Introducing Google Cloud VertexAI Extensions for .NET

Author: [Mete Atamel](https://atamel.dev/) | Published: 2026-01-30 | Topics: GenAI, DotNet, Google Cloud Platform | Canonical: https://cloud.google.com/blog/topics/developers-practitioners/introducing-google-cloud-vertex-ai-extensions-for-net


![Hero image](/img/2026/introducing_vertexai_extensions_msft.png)

In October 2024, Microsoft
[announced](https://devblogs.microsoft.com/dotnet/introducing-microsoft-extensions-ai-preview/) the
[Microsoft.Extensions.AI.Abstractions](https://www.nuget.org/packages/Microsoft.Extensions.AI.Abstractions/) and
[Microsoft.Extensions.AI](https://www.nuget.org/packages/Microsoft.Extensions.AI) libraries for .NET. These libraries
provide the .NET ecosystem with essential abstractions for integrating AI services into .NET applications from various
providers such as Open AI, Azure, Google.

Today, we’re happy to announce the
[Google.Cloud.VertexAI.Extensions](https://www.nuget.org/packages/Google.Cloud.VertexAI.Extensions) library. This is the
Vertex AI implementation of **Microsoft.Extensions.AI**. It enables .NET developers to integrate Google Gemini models on Vertex
AI via the **Microsoft.Extensions.AI** abstractions.

Let’s take a look at the details.

> [!NOTE] This library is currently in pre-release/beta pending user feedback. Please reach out with any feedback you might have.

## What’s the Microsoft.Extension.AI library?

**Microsoft.Extensions.AI** is a set of core .NET libraries that provide a unified layer of C# abstractions for
interacting with AI services from different providers such as OpenAI, Azure AI Inference, Ollama.

### Core benefits

* **Unified API**: Delivers a consistent set of APIs and conventions for integrating AI services into .NET applications.
* **Flexibility**: Allows .NET library authors to use AI services without being tied to a specific provider, making it
  adaptable to any provider.
* **Ease of Use**: Enables .NET developers to experiment with different packages using the same underlying abstractions,
  maintaining a single API throughout their application.

### APIs and functionality

There are three core interfaces:

* The `IChatClient` interface defines a client abstraction responsible for interacting with AI services that provide chat
  capabilities.
* The `IEmbeddingGenerator` interface represents a generic generator of embeddings.
* The `IImageGenerator` interface (experimental) represents a generator for creating images from text prompts or other
  input.

## What’s the Google.Cloud.VertexAI.Extensions library?

**Microsoft.Extensions.AI** supports providers like OpenAI, Azure, and Ollama. The
[Google.Cloud.VertexAI.Extensions](https://www.nuget.org/packages/Google.Cloud.VertexAI.Extensions) library is the
Vertex AI implementation of **Microsoft.Extensions.AI**. It enables .NET developers to integrate with Google’s Gemini on
Vertex AI via the **Microsoft.Extensions.AI** abstractions.

## What about the Google Gen AI .NET SDK?

At this point, you might be wondering: **Doesn’t Google already have a .NET SDK for Gemini?**

You’re right. There’s the [Google Gen AI .NET SDK](https://github.com/googleapis/dotnet-genai/) that we
[announced](https://cloud.google.com/blog/topics/developers-practitioners/introducing-google-gen-ai-net-sdk) back in
October 2025\. Developers building applications that will only use Google as an AI provider should continue to use the
**Google Gen AI .NET SDK**. Developers building applications that may use different AI providers (Google, OpenAI, Azure
...) will benefit from the **Google.Cloud.VertexAI.Extensions** library.

## Samples

Now that we understand the context, let’s take a look at some samples.

### Microsoft.Extensions.AI with Ollama

Before we look into **Google.Cloud.VertexAI.Extensions**, let’s actually look at the hello world chat sample with
Ollama.

```csharp
using Microsoft.Extensions.AI;
using OllamaSharp;

IChatClient client = new OllamaApiClient(
    new Uri("http://localhost:11434/"), "gemma3:270m");

var response = await client.GetResponseAsync("Why is sky blue?");
Console.WriteLine(response.Text);
```

This is Ollama using a Gemma3 model. That was easy enough!

### Getting started with Google.Cloud.VertexAI.Extensions

To use **Google.Cloud.VertexAI.Extensions**, first, you need to add the package to your project. It’s currently in
preview, so make sure to check for the latest beta version.

```sh
dotnet add package Google.Cloud.VertexAI.Extensions --prerelease
```

You will also need the **Microsoft.Extensions.AI** package:

```sh
dotnet add package Microsoft.Extensions.AI
```

### Chat

To use the IChatClient interface, first you need to initialize the client with Vertex AI specific initialization:

```csharp
using Google.Cloud.AIPlatform.V1;
using Google.Cloud.VertexAI.Extensions;
using Microsoft.Extensions.AI;

IChatClient client = await new PredictionServiceClientBuilder()
    .BuildIChatClientAsync(EndpointName.FormatProjectLocationPublisherModel(projectId, location, "google",
        "gemini-3-flash-preview"));
```

Then, you can start asking questions to the model:

```csharp
var response = await client.GetResponseAsync("Why is the sky blue?");
Console.WriteLine(response.Text);
```

Note that this sample is identical to the Ollama one and samples are the same across different providers. That’s the
beauty of abstractions! The only unique part for Vertex AI is how the client is initialized.

You can also get back streaming responses:

```csharp
await foreach (ChatResponseUpdate update in client.GetStreamingResponseAsync("Why is the sky blue?"))
{
    Console.Write(update.Text);
}
```

You can also keep track of the chat history and send it along:

```csharp
List<ChatMessage> history = [];
while (true)
{
    Console.Write("User: ");
    history.Add(new(ChatRole.User, Console.ReadLine()));

    var response = await client.GetResponseAsync(history);
    Console.WriteLine($"AI: {response}");

    history.AddMessages(response);
}
```

### Embeddings

For embeddings, create an embedding generator:

```csharp
IEmbeddingGenerator<string, Embedding<float>> generator = await new PredictionServiceClientBuilder()
    .BuildIEmbeddingGeneratorAsync(EndpointName.FormatProjectLocationPublisherModel(projectId, location,
        "google", "gemini-embedding-001"));
```

Generate embeddings for several inputs:

```csharp
GeneratedEmbeddings<Embedding<float>> embeddings = await generator.GenerateAsync(["Hello", "World"]);
foreach (Embedding<float> embedding in embeddings)
{
    Console.WriteLine(string.Join(",", embedding.Vector.ToArray()));
}
```

### Image Generation

Image generation follows the same pattern.

Create an image generator for Vertex AI:

```csharp
IImageGenerator generator = await new PredictionServiceClientBuilder()
    .BuildIImageGeneratorAsync(EndpointName.FormatProjectLocationPublisherModel(projectId, location, "google",
        "imagen-4.0-fast-generate-001"));
```

Generate an image:

```csharp
ImageGenerationResponse response = await generator.GenerateImagesAsync("A cute baby sea otter");

foreach (var image in response.Contents.OfType<DataContent>())
{
    string path = $"{Path.GetRandomFileName()}.png";
    File.WriteAllBytes(path, image.Data.Span);
    Console.WriteLine($"Image saved to {path}");
    Process.Start(new ProcessStartInfo(path) { UseShellExecute = true });
}
```

And you should see a cute baby sea otter 🙂

![Baby sea otter](/img/2026/otter.png)

The source code for all the samples is in my [Google.Cloud.VertexAI.Extensions
samples](https://github.com/meteatamel/genai-samples/blob/main/vertexai/Google.Cloud.VertexAI.Extensions.Samples/) repo
on GitHub.

## Conclusion

In this blog post, we explored the [Google.Cloud.VertexAI.Extensions
library](https://www.nuget.org/packages/Google.Cloud.VertexAI.Extensions) to enable .NET developers to Google’s Gemini
models via the [Microsoft.Extension.AI library](https://www.nuget.org/packages/Microsoft.Extensions.AI). If you have any
questions or feedback about the library, please reach out to me on X [@meteatamel](https://twitter.com/meteatamel) or
LinkedIn [meteatamel](https://www.linkedin.com/in/meteatamel).

Here are some links to explore more:

* [Introducing Microsoft.Extensions.AI Preview – Unified AI Building Blocks for
  .NET](https://devblogs.microsoft.com/dotnet/introducing-microsoft-extensions-ai-preview/)
* [Microsoft.Extensions.AI libraries documentation](https://learn.microsoft.com/en-us/dotnet/ai/microsoft-extensions-ai)
* [Microsoft.Extension.AI library](https://www.nuget.org/packages/Microsoft.Extensions.AI)
* [Google.Cloud.VertexAI.Extensions library](https://www.nuget.org/packages/Google.Cloud.VertexAI.Extensions)
* [Google.Cloud.VertexAI.Extensions source
  code](https://github.com/googleapis/google-cloud-dotnet/tree/main/apis/Google.Cloud.VertexAI.Extensions)
* [Google.Cloud.VertexAI.Extensions
  samples](https://github.com/meteatamel/genai-samples/blob/main/vertexai/Google.Cloud.VertexAI.Extensions.Samples/)



---
*Read the full article at [https://cloud.google.com/blog/topics/developers-practitioners/introducing-google-cloud-vertex-ai-extensions-for-net](https://cloud.google.com/blog/topics/developers-practitioners/introducing-google-cloud-vertex-ai-extensions-for-net)*
