Universal.DeepSeek.Client 1.0.2

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

Universal.DeepSeek.Client

A typed .NET client for DeepSeek's REST API. It supports chat completions, reasoning, tools, JSON output, SSE streaming, beta FIM completions, model listing, and account balance.

Quick start

using Universal.DeepSeek.Client;
using Universal.DeepSeek.Client.V1.Chat;

using var client = new DeepSeekClient("your-api-key");
var response = await client.V1.Chat.CreateCompletionAsync(new CreateCompletionRequest
{
    Model = Models.DeepSeekV41Flash,
    Messages = new Message[]
    {
        new SystemMessage("You are a helpful assistant."),
        new UserMessage("Hello!")
    },
    Thinking = ThinkingConfiguration.Enabled,
    ReasoningEffort = ReasoningEfforts.High
});

Console.WriteLine(response.Choices[0].Message.Content);

Streaming

await foreach (var chunk in client.V1.Chat.CreateCompletionStreamingAsync(
    new CreateCompletionRequest
    {
        Model = Models.DeepSeekV41Flash,
        Messages = new Message[] { new UserMessage("Explain monads simply.") },
        Stream = true,
        StreamOptions = new StreamOptions { IncludeUsage = true }
    }))
{
    Console.Write(chunk.Choices?[0]?.Delta?.Content);
}

The parser implements SSE framing, ignores DeepSeek keep-alive comments, supports multi-line data events, and stops at [DONE]. Use CreateCompletionStreamingRawAsync when relaying the HTTP stream directly.

Reasoning and tool calls

DeepSeek requires reasoning_content from an assistant tool-call turn to be sent back on subsequent requests in thinking mode. The response deserializes to AssistantMessage, so the same message can be appended directly:

var assistant = response.Choices[0].Message;
var followUp = await client.V1.Chat.CreateCompletionAsync(new CreateCompletionRequest
{
    Model = Models.DeepSeekV41Flash,
    Thinking = ThinkingConfiguration.Enabled,
    Messages = new Message[]
    {
        new UserMessage("What is the weather in Sydney?"),
        assistant,
        new ToolMessage("{\"temperature\":18}", assistant.ToolCalls[0].Id)
    },
    Tools = tools
});

When thinking is enabled, use ToolChoiceOptions.Auto; the live API rejects a forced named function choice in that mode.

Strict tool schemas and chat prefix completion are beta features. Construct a resource client with a beta base URI when using them:

using var betaChat = new ChatClient(new Uri("https://api.deepseek.com/beta/"), "your-api-key");

FIM completion

client.V1.Completions automatically uses https://api.deepseek.com/beta/completions:

var fim = await client.V1.Completions.CreateCompletionAsync(
    new Universal.DeepSeek.Client.V1.Completions.CreateCompletionRequest
    {
        Model = Models.DeepSeekV41Flash,
        Prompt = "def fib(a):",
        Suffix = "\n    return fib(a - 1) + fib(a - 2)"
    });

API failures are surfaced as Universal.Common.Net.Http.HttpException, consistently with the other Universal.* clients.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Universal.DeepSeek.Client:

Package Downloads
Universal.Operative.Sdk.Discrete.DeepSeek

DeepSeek extensions for the Universal.Operative.Sdk.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 62 9/10/2026
1.0.1 65 9/10/2026
1.0.0 217 8/24/2026

Add typed multimodal chat content parts for text, image URLs/data URLs, and Files API references.