DeepSeek.ApiClient 1.0.6

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

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

publish to nuget DeepSeek.ApiClient on NuGet NuGet License paypal

DeepSeek API Client

Api for DeepSeek

Overview

DeepSeek.ApiClient is a .NET library for interacting with the DeepSeek API, enabling developers to send and receive messages from DeepSeek�s AI models with ease.

Features

  • Supports DeepSeek models dynamically via an enum.
  • Uses Dependency Injection (DI) for seamless integration.
  • Allows customizable system messages.
  • Handles API calls using HttpClient with built-in serialization.

Installation

You can install the package via NuGet:

 dotnet add package DeepSeek.ApiClient

Configuration

To integrate the DeepSeek.ApiClient into your .NET application, add the client to your dependency injection container:

var services = new ServiceCollection();
services.AddDeepSeekClient("your-api-key");
var serviceProvider = services.BuildServiceProvider();

Usage

Basic Example

using System;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;

namespace DeepSeekExample
{
  class Program
  {
    static async Task Main(string[] args)
    {
      Console.WriteLine("Application is started.");
      var services = new ServiceCollection();
      services.AddDeepSeekClient(AppConstants.API_KEY);

      var serviceProvider = services.BuildServiceProvider();
      var deepSeekClient = serviceProvider.GetRequiredService<IDeepSeekClient>();

      Console.WriteLine("Send message is started.");
      var request = new DeepSeekRequestBuilder()
        .SetModel(DeepSeekModel.V3)
        .SetStream(false)
        .SetTemperature(0)
        .SetSystemMessage("You are a professional technical assistant.")
        .AddUserMessage("How can I improve my C# skills?");

      string response = await deepSeekClient.SendMessageAsync(request.Build());
      Console.WriteLine("Response: " + response);
    }
  }
}

Using Enum for Model Selection

string response = await deepSeekClient.SendMessageAsync("Explain SOLID principles", DeepSeekModel.DeepSeekV3);

Handling Multiple Messages in a Conversation

var messages = new List<string>
{
    "How can I improve my C# skills?",
    "What are the best design patterns in C#?",
    "Explain SOLID principles with examples."
};

foreach (var message in messages)
{
    string response = await deepSeekClient.SendMessageAsync(message);
    Console.WriteLine($"User: {message}\nAssistant: {response}\n");
}

API Response Handling

The DeepSeek API returns structured responses. The library deserializes these responses into a DeepSeekResponse class, which includes:

  • Choices: Contains the AI-generated message.
  • Usage: Provides token usage details.
  • Model: Identifies the DeepSeek model used.

License

This package is released under the MIT License. See LICENSE for details.

Contribution

Feel free to open issues or pull requests.

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.0.6 140 2/6/2025
1.0.5 66 2/6/2025
1.0.4 63 2/6/2025
1.0.3 64 2/6/2025
1.0.2 70 2/5/2025
1.0.1 64 2/5/2025
1.0.0 72 2/5/2025

Added support for DeepSeek API and .NET 8.