Aiursoft.GptClient.ChatConsole 9.0.18

dotnet tool install --global Aiursoft.GptClient.ChatConsole --version 9.0.18
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local Aiursoft.GptClient.ChatConsole --version 9.0.18
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Aiursoft.GptClient.ChatConsole&version=9.0.18
                    
nuke :add-package Aiursoft.GptClient.ChatConsole --version 9.0.18
                    

Aiursoft GptClient

MIT licensed Pipeline stat Test Coverage NuGet version (Aiursoft.GptClient) NuGet version (Aiursoft.GptClient.ChatConsole) ManHours

The SDK for ChatGpt. Simple implementation and easy to use.

How to install

First, install Aiursoft.GptClient to your ASP.NET Core project from nuget.org:

dotnet add package Aiursoft.GptClient

Exposed API in ChatClient:

public Task<CompletionData> AskModel(OpenAiModel model);
public Task<CompletionData> AskString(string gptModelType, params string[] content);

Required IConfiguration keys:

{
    "OpenAI:Token": "YourOpenAIKey",
    "OpenAI:CompletionApiUrl": "https://api.openai.com/v1/engines/davinci/completions"
}

For example, you can use the following code to create a simple ChatGpt client:

var model = GptModel.DeepseekR170B;
var services = new ServiceCollection();
services.AddHttpClient();
services.AddLogging(logging =>
{
    logging.SetMinimumLevel(LogLevel.Warning);
});
services.AddGptClient();
var serviceProvider = services.BuildServiceProvider();
var chatClient = serviceProvider.GetRequiredService<ChatClient>();

var history = new OpenAiModel
{
    Model = modelName
};
while (true)
{
    var nextQuestion = AskUser("USER:", null);
    history.Messages.Add(new MessagesItem
    {
        Role = "user",
        Content = nextQuestion
    });

    var result = await chatClient.AskModel(history, endpoint, apiKey);
    Console.WriteLine("AI:");
    Console.WriteLine(result.GetAnswerPart());
    
    history.Messages.Add(new MessagesItem
    {
        Role = "assistant",
        Content = result.GetAnswerPart()
    });
}

Now you have built a simple ChatGpt client.

How to contribute

There are many ways to contribute to the project: logging bugs, submitting pull requests, reporting issues, and creating suggestions.

Even if you with push rights on the repository, you should create a personal fork and create feature branches there when you need them. This keeps the main repository clean and your workflow cruft out of sight.

We're also interested in your feedback on the future of this project. You can submit a suggestion or feature request through the issue tracker. To make this process more effective, we're asking that these include more information to help define them more clearly.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
9.0.18 137 7/9/2025
9.0.17 138 6/25/2025
9.0.15 280 6/11/2025
9.0.14 104 6/1/2025
9.0.13 171 4/9/2025
9.0.12 159 4/8/2025
9.0.11 155 3/31/2025
9.0.10 148 3/31/2025
9.0.9 154 3/31/2025
9.0.8 158 3/12/2025
9.0.7 114 3/3/2025
9.0.6 117 3/3/2025
9.0.5 131 2/23/2025
9.0.4 115 2/12/2025
9.0.3 121 2/2/2025
9.0.2 113 2/2/2025