DeepSeek.NET 1.2.0

dotnet add package DeepSeek.NET --version 1.2.0                
NuGet\Install-Package DeepSeek.NET -Version 1.2.0                
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="DeepSeek.NET" Version="1.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DeepSeek.NET --version 1.2.0                
#r "nuget: DeepSeek.NET, 1.2.0"                
#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.
// Install DeepSeek.NET as a Cake Addin
#addin nuget:?package=DeepSeek.NET&version=1.2.0

// Install DeepSeek.NET as a Cake Tool
#tool nuget:?package=DeepSeek.NET&version=1.2.0                

DeepSeek.NET

NuGet Version
A modern .NET wrapper for the DeepSeek AI API – integrate conversational AI into your applications with ease.

  • Model Discovery: Retrieve available AI models effortlessly.
  • Smart Conversations: Execute both single-turn and streaming multi-turn dialogues.
  • Streaming Support: Real-time response handling for dynamic interactions.
  • Modern .NET Integration: Built with .NET 8 and HttpClient best practices.

📋 Prerequisites

  • DeepSeek API Key: Obtain from DeepSeek Platform
  • .NET 8+: Target framework requirement

📦 Installation

dotnet add package DeepSeek.NET

🛠️ Quick Start

Initialize Client

// Simple initialization
var client = new DeepSeekClient("your_api_key_here");

// Or with custom HttpClient
var httpClient = new HttpClient();
var factoryClient = new DeepSeekClient(httpClient, "your_api_key_here");

Discover Available Models

var models = await client.ListModelsAsync();
if (models?.Data is null)
{
    Console.WriteLine($"Error: {client.ErrorMsg}");
    return;
}

foreach (var model in models.Data)
{
    Console.WriteLine($"- {model.Id}: {model.Capabilities}");
}

Basic Chat Interaction

var chatRequest = new ChatRequest
{
    Messages = new[]
    {
        Message.NewUserMessage("Explain quantum computing in 3 sentences"),
        Message.NewAssistantMessage("..."),
        Message.NewUserMessage("Now simplify it for a 5th grader")
    },
    Model = Models.DeepSeekChat
};

var response = await client.ChatAsync(chatRequest);
Console.WriteLine(response?.Choices.First().Message.Content ?? "No response");

Real-Time Streaming

var streamRequest = new ChatRequest
{
    Messages = new[] { Message.NewUserMessage("Tell a 100-word sci-fi story") },
    Model = Models.DeepSeekChat,
    Stream = true
};

var stream = await client.ChatStreamAsync(streamRequest);
if (stream is null) return;

await foreach (var chunk in stream)
{
    Console.Write(chunk.Delta?.Content);
}

🤝 Contributing

We welcome contributions! Please follow our contribution guidelines when:

  • Reporting issues
  • Suggesting enhancements
  • Submitting pull requests

License

MIT License – See LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
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.2.0 91 1/30/2025
1.1.0 56 1/28/2025
1.0.0 109 1/22/2025

Added ReasoningContent