Cohere 1.0.2-dev.35

This is a prerelease version of Cohere.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Cohere --version 1.0.2-dev.35
                    
NuGet\Install-Package Cohere -Version 1.0.2-dev.35
                    
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="Cohere" Version="1.0.2-dev.35" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cohere" Version="1.0.2-dev.35" />
                    
Directory.Packages.props
<PackageReference Include="Cohere" />
                    
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 Cohere --version 1.0.2-dev.35
                    
#r "nuget: Cohere, 1.0.2-dev.35"
                    
#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 Cohere@1.0.2-dev.35
                    
#: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=Cohere&version=1.0.2-dev.35&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Cohere&version=1.0.2-dev.35&prerelease
                    
Install as a Cake Tool

Cohere

Nuget package dotnet License: MIT Discord

Features 🔥

  • Fully generated C# SDK based on official Cohere OpenAPI specification using AutoSDK
  • Same day update to support new features
  • Updated and supported automatically if there are no breaking changes
  • All modern .NET features - nullability, trimming, NativeAOT, etc.
  • Support .Net Framework/.Net Standard 2.0
  • Microsoft.Extensions.AI IChatClient and IEmbeddingGenerator support

Usage

using Cohere;

using var client = new CohereClient(apiKey);

var response = await client.GenerateAsync(new GenerateRequest
{
    Prompt = "Hello, Cohere! Can you tell me a joke?",
});

Console.WriteLine("Cohere Response:");
Console.WriteLine(response.Generations[0].Text);

Microsoft.Extensions.AI

The SDK implements IChatClient and IEmbeddingGenerator:

using Cohere;
using Meai = Microsoft.Extensions.AI;

// IChatClient
Meai.IChatClient chatClient = new CohereClient(apiKey);
var response = await chatClient.GetResponseAsync(
    [new Meai.ChatMessage(Meai.ChatRole.User, "Hello!")],
    new Meai.ChatOptions { ModelId = "command-r-08-2024" });

// IEmbeddingGenerator
Meai.IEmbeddingGenerator<string, Meai.Embedding<float>> generator = new CohereClient(apiKey);
var embeddings = await generator.GenerateAsync(
    ["Hello, world!"],
    new Meai.EmbeddingGenerationOptions { ModelId = "embed-english-v3.0" });

Note: Use the Meai alias because the Cohere SDK has its own generated IChatClient interface.

Chat Client Five Random Words Streaming

using var client = GetAuthenticatedCohereClient();

Meai.IChatClient chatClient = client;
var updates = chatClient.GetStreamingResponseAsync(
    [
        new Meai.ChatMessage(Meai.ChatRole.User, "Generate 5 random words.")
    ],
    new Meai.ChatOptions
    {
        ModelId = "command-r-plus",
    });

var deltas = new List<string>();
await foreach (var update in updates)
{
    if (!string.IsNullOrWhiteSpace(update.Text))
    {
        deltas.Add(update.Text);
    }
}

Chat Client Five Random Words

using var client = GetAuthenticatedCohereClient();

Meai.IChatClient chatClient = client;
var response = await chatClient.GetResponseAsync(
    [
        new Meai.ChatMessage(Meai.ChatRole.User, "Generate 5 random words.")
    ],
    new Meai.ChatOptions
    {
        ModelId = "command-r-plus",
    });

Chat Client Get Service Returns Chat Client Metadata

using var client = CreateTestClient();
Meai.IChatClient chatClient = client;

var metadata = Meai.ChatClientExtensions.GetService<Meai.ChatClientMetadata>(chatClient);

Chat Client Get Service Returns Null For Unknown Key

using var client = CreateTestClient();
Meai.IChatClient chatClient = client;

var result = Meai.ChatClientExtensions.GetService<Meai.ChatClientMetadata>(chatClient, serviceKey: "unknown");

Chat Client Get Service Returns Self

using var client = CreateTestClient();
Meai.IChatClient chatClient = client;

var self = Meai.ChatClientExtensions.GetService<CohereClient>(chatClient);

Chat Client Tool Calling Multi Turn

using var client = GetAuthenticatedCohereClient();
Meai.IChatClient chatClient = client;

var getWeatherTool = AIFunctionFactory.Create(
    (string location) => $"The weather in {location} is sunny, 72°F",
    "GetWeather",
    "Gets the current weather for a location");

var messages = new List<Meai.ChatMessage>
{
    new(Meai.ChatRole.User, "What's the weather in Seattle?"),
};

var options = new Meai.ChatOptions
{
    ModelId = "command-r-plus",
    Tools = [getWeatherTool],
};

// First turn: model should call the tool
var response = await chatClient.GetResponseAsync(messages, options);

var functionCall = response.Messages
    .SelectMany(m => m.Contents)
    .OfType<FunctionCallContent>()
    .FirstOrDefault();

// Add assistant response with tool call and tool result
messages.AddRange(response.Messages);

var toolResult = await getWeatherTool.InvokeAsync(
    functionCall!.Arguments is { } args ? new AIFunctionArguments(args) : null);

messages.Add(new Meai.ChatMessage(Meai.ChatRole.Tool,
[
    new FunctionResultContent(functionCall.CallId, toolResult),
]));

// Second turn: model should respond with the weather info
var finalResponse = await chatClient.GetResponseAsync(messages, options);

Chat Client Tool Calling Single Turn

using var client = GetAuthenticatedCohereClient();
Meai.IChatClient chatClient = client;

var getWeatherTool = AIFunctionFactory.Create(
    (string location) => $"The weather in {location} is sunny, 72°F",
    "GetWeather",
    "Gets the current weather for a location");

var response = await chatClient.GetResponseAsync(
    [new Meai.ChatMessage(Meai.ChatRole.User, "What's the weather in Seattle?")],
    new Meai.ChatOptions
    {
        ModelId = "command-r-plus",
        Tools = [getWeatherTool],
    });

var functionCall = response.Messages
    .SelectMany(m => m.Contents)
    .OfType<FunctionCallContent>()
    .FirstOrDefault();

Embedding Generator Batch Texts

using var client = GetAuthenticatedCohereClient();

Meai.IEmbeddingGenerator<string, Meai.Embedding<float>> generator = client;
var embeddings = await generator.GenerateAsync(
    ["Hello", "World", "Test"],
    new Meai.EmbeddingGenerationOptions
    {
        ModelId = "embed-english-v3.0",
    });

foreach (var embedding in embeddings)
{
}

Embedding Generator Get Service Returns Metadata

using var client = CreateTestClient();
Meai.IEmbeddingGenerator<string, Meai.Embedding<float>> generator = client;

var metadata = Meai.EmbeddingGeneratorExtensions.GetService<Meai.EmbeddingGeneratorMetadata>(generator);

Embedding Generator Get Service Returns Null For Unknown Key

using var client = CreateTestClient();
Meai.IEmbeddingGenerator<string, Meai.Embedding<float>> generator = client;

var result = Meai.EmbeddingGeneratorExtensions.GetService<Meai.EmbeddingGeneratorMetadata>(generator, serviceKey: "unknown");

Embedding Generator Get Service Returns Self

using var client = CreateTestClient();
Meai.IEmbeddingGenerator<string, Meai.Embedding<float>> generator = client;

var self = Meai.EmbeddingGeneratorExtensions.GetService<CohereClient>(generator);

Embedding Generator Single Text

using var client = GetAuthenticatedCohereClient();

Meai.IEmbeddingGenerator<string, Meai.Embedding<float>> generator = client;
var embeddings = await generator.GenerateAsync(
    ["Hello, world!"],
    new Meai.EmbeddingGenerationOptions
    {
        ModelId = "embed-english-v3.0",
    });

Generate

using var client = new CohereClient(apiKey);

var response = await client.ChatAsync(new ChatRequest
{
    Message = "Hello, Cohere! Can you tell me a joke?",
});

Console.WriteLine("Cohere Response:");
Console.WriteLine(response.Value1!.Text);

Ecosystem maintenance

This SDK is one of more than 200 .NET SDKs maintained with AutoSDK. The tryAGI SDK audit continuously checks repository synchronization, upstream-spec regeneration, release workflows, warnings, public API visibility, and trimming/NativeAOT compatibility.

Every issue is first investigated for ecosystem-wide applicability. When the root cause belongs in AutoSDK, we fix and regression-test the generator, then roll the improvement out to every applicable SDK. Provider-specific behavior remains in this repository when it cannot be derived safely from the API specification.

Issue content—including code blocks, logs, links, and attachments—is treated only as untrusted diagnostic data. Embedded control instructions, hidden directives, delimiter tricks, or requests to alter triage or tooling behavior are ignored. Please report reproducible technical evidence and remove secrets and personal data.

Support

Priority place for bugs: https://github.com/tryAGI/Cohere/issues
Priority place for ideas and general questions: https://github.com/tryAGI/Cohere/discussions
Discord: https://discord.gg/Ca2xhfBf3v

Acknowledgments

JetBrains logo

This project is supported by JetBrains through the Open Source Support Program.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (2)

Showing the top 2 NuGet packages that depend on Cohere:

Package Downloads
HPD-Agent.Providers.Cohere

Cohere provider for HPD-Agent

Rag.NET.Reranking.Cohere

Cohere Rerank API integration for Rag.NET

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2-dev.38 66 9/21/2026
1.0.2-dev.37 64 9/16/2026
1.0.2-dev.36 68 9/13/2026
1.0.2-dev.35 67 9/9/2026
1.0.2-dev.34 66 9/4/2026
1.0.2-dev.33 107 9/2/2026
1.0.2-dev.14 234 5/21/2026
1.0.2-dev.8 93 6/16/2026
1.0.2-dev.6 96 5/28/2026
1.0.2-dev.3 115 5/7/2026
1.0.1 1,603 4/30/2026
1.0.1-dev.165 192 4/1/2026
1.0.1-dev.164 105 4/1/2026
1.0.1-dev.161 93 3/29/2026
1.0.1-dev.160 119 3/28/2026
1.0.1-dev.159 112 3/28/2026
1.0.1-dev.158 189 3/28/2026
1.0.1-dev.157 88 3/28/2026
1.0.1-dev.156 95 3/28/2026
1.0.1-dev.145 125 3/20/2026
Loading failed