Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt 3.1.1

dotnet add package Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt --version 3.1.1
                    
NuGet\Install-Package Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt -Version 3.1.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="Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt" Version="3.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt" Version="3.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt" />
                    
Project file
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 Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt --version 3.1.1
                    
#r "nuget: Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt, 3.1.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.
#:package Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt@3.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt&version=3.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt&version=3.1.1
                    
Install as a Cake Tool

Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt

An IModel adapter for the ChatGPT Responses backend. This is not the OpenAI Platform Responses API; use Universal.Operative.Sdk.Discrete.OpenAI for that API and its broader surface.

dotnet add package Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt

Authentication

Use an access token directly when token storage and refresh are handled elsewhere:

using var client = new ChatGptResponsesClient(accessToken, accountId);

Use an auth.json file for persisted credentials and automatic refresh:

using var httpClient = new HttpClient();
using var credentials = new AuthenticationFileCredentialProvider(authFilePath, httpClient);
using var client = new ChatGptResponsesClient(httpClient, credentials);

Use OAuthClient to create and complete a browser authorization session:

var oauth = new OAuthClient(httpClient);
var authorization = oauth.CreateAuthorizationSession();

string code = oauth.ReadAuthorizationCode(callbackUri, authorization);
OAuthResponse response = await oauth.ExchangeCodeAsync(code, authorization);
credentials.Save(response);
using Universal.OpenAI.ChatGpt.Client;
using Universal.OpenAI.ChatGpt.Client.Responses;
using Universal.Operative.Sdk;
using Universal.Operative.Sdk.Discrete;
using Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt;

using var httpClient = new HttpClient();
using var credentials = new AuthenticationFileCredentialProvider(authFilePath, httpClient);
using var client = new ChatGptResponsesClient(httpClient, credentials);

IModel model = new ResponsesModel(client, new ResponsesModel.Options
{
    ModelId = Models.Gpt56Luna,
    ReasoningEffort = ReasoningEfforts.Medium,
});

Message response = await model.CompleteAsync(new Conversation
{
    Messages =
    {
        new Message
        {
            Role = MessageRoles.User,
            Content = { new TextBlock("Explain this code.") },
        },
    },
});

StreamAsync preserves the Responses SSE lifecycle as universal indexed block events. Text, reasoning summaries, refusals, and function-call arguments are emitted incrementally when the backend supplies deltas; completed output items remain the fallback for content the backend only supplies at settlement.

Persisted conversations can move between providers. Before serialization, the adapter converts provider-hosted tool activity into bounded text context, omits unsupported provider-specific blocks, and removes unmatched historical tool calls/results that ChatGPT cannot replay safely.

Prompt caching

Native namespace and freeform-format hints live in ToolDefinition.Extensions["openai"]; the kernel contract remains the dispatch name and Parameters schema. This adapter uses ordinary functions (strict: false) and stable wire aliases for names outside the provider's identifier rules. It restores the original name before dispatch, with the same mapping for forced choice and history replay. Freeform tools must accept their advertised JSON fallback; the Codex toolset accepts { "input": "raw text" }. Native grammar constraints are not enforced by this transport. Native string calls replay through that same JSON fallback when migrating an OpenAI Responses conversation. Tool exposure and forced choice carry forward from the last message that supplied each setting.

The adapter sends the full conversation history on each turn. By default it uses the stable Conversation.Id as prompt_cache_key; the underlying client sends the matching session-id header for ChatGPT cache affinity. PromptCacheKey overrides that default, and PromptCacheKeySelector can choose a key per conversation. Preserve the conversation ID and earlier messages across turns to reuse a prompt prefix. The ChatGPT backend rejected prompt_cache_options in a live GPT-5.6 Sol request, so this adapter does not expose retention or explicit breakpoint settings.

When the backend reports them, Usage.Extensions["openai"] includes cachedTokens, cacheWriteTokens, and reasoningTokens. A zero value remains distinguishable from an omitted field.

License

Free for noncommercial use under the Universal.Operative Noncommercial License. Commercial use requires a separate license from Andrew Ong.

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.  net10.0 is compatible.  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.

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
3.1.1 100 10/2/2026
3.1.0 93 10/1/2026
3.0.1 92 9/28/2026
3.0.0 134 9/7/2026
1.0.4 116 9/2/2026
1.0.3 107 9/1/2026
1.0.2 103 9/1/2026
1.0.1 104 9/1/2026
1.0.0 98 9/1/2026

Preserve tool exposure and choice across turns, namespaced dispatch identities, and migrated freeform tool-call replay.