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
<PackageReference Include="Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt" Version="3.1.1" />
<PackageVersion Include="Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt" Version="3.1.1" />
<PackageReference Include="Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt" />
paket add Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt --version 3.1.1
#r "nuget: Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt, 3.1.1"
#:package Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt@3.1.1
#addin nuget:?package=Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt&version=3.1.1
#tool nuget:?package=Universal.Operative.Sdk.Discrete.OpenAI.ChatGpt&version=3.1.1
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 | 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. 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. |
-
net10.0
- Universal.OpenAI.ChatGpt.Client (>= 1.0.6)
- Universal.Operative.Sdk (>= 6.1.3)
- Universal.Operative.Sdk.Discrete (>= 3.1.1)
-
net8.0
- Universal.OpenAI.ChatGpt.Client (>= 1.0.6)
- Universal.Operative.Sdk (>= 6.1.3)
- Universal.Operative.Sdk.Discrete (>= 3.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Preserve tool exposure and choice across turns, namespaced dispatch identities, and migrated freeform tool-call replay.