Aiursoft.GptClient 9.0.37

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:

using Aiursoft.GptClient;
using Aiursoft.GptClient.Services;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

namespace Test
{
    public abstract class Program
    {
        public static async Task Main()
        {
            // Keys
            var apiKey = "";
            var endpoint = "http://localhost:11434/api/chat";
            var model = "qwen3:30b-a3b-thinking-2507-q8_0";

            // Create a simple ChatGpt client.
            var services = new ServiceCollection();
            services.AddHttpClient();
            services.AddLogging(logging => { logging.SetMinimumLevel(LogLevel.Warning); });
            services.AddGptClient();
            var serviceProvider = services.BuildServiceProvider();
            var chatClient = serviceProvider.GetRequiredService<ChatClient>();
            async Task<string> GetAnswer(string[] prompts)
            {
                return (await chatClient.AskString(
                    modelType: model,
                    completionApiUrl: endpoint,
                    token: apiKey,
                    content: prompts,
                    CancellationToken.None)).GetAnswerPart();
            }

            // Example usage
            var answer = await GetAnswer(["Why is the sky blue?"]);
            Console.WriteLine(answer);
        }
    }
}

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.

No packages depend on Aiursoft.GptClient.

Version Last updated
9.0.38 9/10/2025
9.0.37 9/4/2025
9.0.36 8/5/2025
9.0.35 7/9/2025
9.0.34 7/4/2025
9.0.33 7/4/2025
9.0.32 7/4/2025
9.0.31 7/4/2025
9.0.30 7/4/2025
9.0.29 6/25/2025
9.0.27 6/11/2025
9.0.26 6/11/2025
9.0.25 6/1/2025
9.0.24 4/9/2025
9.0.23 4/8/2025
9.0.22 4/7/2025
9.0.21 4/7/2025
9.0.20 3/31/2025
9.0.19 3/31/2025
9.0.18 3/31/2025
9.0.17 3/31/2025
9.0.16 3/31/2025
9.0.15 3/31/2025
9.0.14 3/31/2025
9.0.13 3/31/2025
9.0.12 3/31/2025
9.0.11 3/31/2025
9.0.10 3/31/2025
9.0.9 3/31/2025
9.0.8 3/12/2025
9.0.7 3/12/2025
9.0.6 4/21/2025
9.0.5 4/21/2025
9.0.4 4/21/2025
9.0.3 4/21/2025
9.0.0 4/21/2025