ChatGPT.API.Framework 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package ChatGPT.API.Framework --version 1.0.1                
NuGet\Install-Package ChatGPT.API.Framework -Version 1.0.1                
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="ChatGPT.API.Framework" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ChatGPT.API.Framework --version 1.0.1                
#r "nuget: ChatGPT.API.Framework, 1.0.1"                
#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 ChatGPT.API.Framework as a Cake Addin
#addin nuget:?package=ChatGPT.API.Framework&version=1.0.1

// Install ChatGPT.API.Framework as a Cake Tool
#tool nuget:?package=ChatGPT.API.Framework&version=1.0.1                

ChatGPT.API.Framework

This is the only .Net Framework ChatGPT API You Can use. 你(目前)唯一能在.Net Framework中的ChatGPT API 中文版本文档

How To Use

Create Client

ChatGPTClient cgc = new ChatGPTClient("YOU-API-KEY");

Just Ask with out System Message

cgc.Ask("Store-History-ID", "Hi ChatGPT").GetMessageContent();

Create A Completions with System Message

cgc.CreateCompletions("Store-History-ID", "System Message");
cgc.Ask("Store-History-ID", "Hi ChatGPT");

Also Can see Demo at ChatGPT.API.Test

Save & Load History

ChatGPTClient cgc = new ChatGPTClient("YOU-API-KEY");
string json = cgc.Save();
cgc = ChatGPTClient.Load(Json);

Other Config

See Completions.cs and ChatGPTClient.cs

cgc.Completions["Store-History-ID"].max_tokens = 20;

如何使用

创建客户端

ChatGPTClient cgc = new ChatGPTClient("你的ChatGPT的APIKEY");

直接问问题

//若库中无对话历史记录,会自动创建对话
cgc.Ask("储存历史用的id", "你好 ChatGPT").GetMessageContent();

创建一个对话并设置初始系统信息

cgc.CreateCompletions("储存历史用的id", "你是个可爱的桌宠,请用可爱的语气和我说话");
cgc.Ask("储存历史用的id", "你好,桌宠");

具体案例可以参见 ChatGPT.API.Test

储存和加载信息

ChatGPTClient cgc = new ChatGPTClient("YOU-API-KEY");
string json = cgc.Save();
cgc = ChatGPTClient.Load(Json);

其他设置

具体见 Completions.csChatGPTClient.cs

cgc.Completions["Store-History-ID"].max_tokens = 20;
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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.1.0 162 7/9/2024
1.0.4 1,574 6/4/2023
1.0.3 379 4/23/2023
1.0.2 414 3/11/2023
1.0.1 193 3/11/2023
1.0.0 185 3/11/2023