Deepseek.AspClient
1.0.0
dotnet add package Deepseek.AspClient --version 1.0.0
NuGet\Install-Package Deepseek.AspClient -Version 1.0.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.AspClient" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Deepseek.AspClient" Version="1.0.0" />
<PackageReference Include="Deepseek.AspClient" />
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 Deepseek.AspClient --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Deepseek.AspClient, 1.0.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.
#addin nuget:?package=Deepseek.AspClient&version=1.0.0
#tool nuget:?package=Deepseek.AspClient&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Deepseek.ASPClient
Deepseek.ASPClient is a lightweight ASP.NET wrapper for the Deepseek AI API, designed to simplify AI-driven text processing in .NET applications.
Features
- ✅ Simple and fluent API
- ✅ Supports Dependency Injection
- ✅ Built-in error handling
- ✅ Uses HttpClient best practices
- ✅ Asynchronous and thread-safe
Installation
You can install the package via NuGet:
dotnet add package Deepseek.ASPClient
Usage Example
using Deepseek.ASP.Client;
var client = new DeepseekClient("your-api-key");
var response = await client.GenerateResponseAsync("Hello Deepseek!");
Console.WriteLine(response.Choices[0].Message.Content);
Dependency Injection Example (ASP.NET Core)
// In Program.cs or Startup.cs
services.AddSingleton<IDeepseekClient>(provider =>
new DeepseekClient(Configuration["Deepseek:ApiKey"]));
// In a Controller
public class AiController : Controller
{
private readonly IDeepseekClient _client;
public AiController(IDeepseekClient client)
{
_client = client;
}
public async Task<IActionResult> Generate(string prompt)
{
try
{
var response = await _client.GenerateResponseAsync(prompt);
return Ok(response.Choices.First().Message.Content);
}
catch (DeepseekException ex)
{
return StatusCode((int)ex.StatusCode, ex.Message);
}
}
}
API Methods
Method | Description |
---|---|
Task<DeepseekResponse> GenerateResponseAsync(DeepseekRequest request) |
Generates a response based on a structured request. |
Task<DeepseekResponse> GenerateResponseAsync(string prompt) |
Generates a response from a simple text prompt. |
Exception Handling
All API errors are wrapped inside DeepseekException
. Handle exceptions as follows:
try
{
var response = await client.GenerateResponseAsync("Hello Deepseek!");
Console.WriteLine(response.Choices[0].Message.Content);
}
catch (DeepseekException ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
Contributing
We welcome contributions! To contribute:
- Fork the repository.
- Create a feature branch (
git checkout -b feature-name
). - Commit your changes (
git commit -m "Added new feature"
). - Push to the branch (
git push origin feature-name
). - Open a Pull Request.
Reporting Issues
If you encounter any issues, please create an issue on GitHub: Report an Issue
License
This project is licensed under the MIT License. See LICENSE for details.
Author
Created by Anwar Al-Hitar.
Product | Versions 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.
-
net8.0
- Microsoft.Extensions.Configuration (>= 9.0.1)
- Newtonsoft.Json (>= 13.0.3)
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.0 | 307 | 1/29/2025 |