PinkRooster.OpenAI.Reasoning 0.4.0-preview.1

This is a prerelease version of PinkRooster.OpenAI.Reasoning.
dotnet add package PinkRooster.OpenAI.Reasoning --version 0.4.0-preview.1
                    
NuGet\Install-Package PinkRooster.OpenAI.Reasoning -Version 0.4.0-preview.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="PinkRooster.OpenAI.Reasoning" Version="0.4.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PinkRooster.OpenAI.Reasoning" Version="0.4.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="PinkRooster.OpenAI.Reasoning" />
                    
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 PinkRooster.OpenAI.Reasoning --version 0.4.0-preview.1
                    
#r "nuget: PinkRooster.OpenAI.Reasoning, 0.4.0-preview.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 PinkRooster.OpenAI.Reasoning@0.4.0-preview.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=PinkRooster.OpenAI.Reasoning&version=0.4.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PinkRooster.OpenAI.Reasoning&version=0.4.0-preview.1&prerelease
                    
Install as a Cake Tool

PinkRooster.OpenAI.Reasoning

Brings back the model's reasoning when you talk to an OpenAI-compatible server through Microsoft.Extensions.AI.OpenAI.

dotnet add package PinkRooster.OpenAI.Reasoning --prerelease

Needs the .NET 10 SDK and an OpenAI-compatible server, such as Ollama with the model pulled (ollama pull gpt-oss:20b for the example below). The package brings Microsoft.Extensions.AI.OpenAI with it.

Ollama and Groq send a reasoning model's thoughts in a reasoning field. The OpenAI adapter reads only reasoning_content, so the thoughts are dropped. ReasoningFieldChatClient wraps any IChatClient and adds the field back as TextReasoningContent, in both full and streamed responses. It adds nothing to a response that already carries reasoning, so an adapter that reads the field itself is not doubled.

using System.ClientModel;
using Microsoft.Extensions.AI;
using OpenAI;
using PinkRooster.OpenAI.Reasoning;

IChatClient chatClient = new ReasoningFieldChatClient(
    new OpenAIClient(new ApiKeyCredential("ollama"), new OpenAIClientOptions { Endpoint = new Uri("http://localhost:11434/v1") })
        .GetChatClient("gpt-oss:20b")
        .AsIChatClient());

Read the reasoning from a response (chatClient is the client above):

using Microsoft.Extensions.AI;

ChatResponse response = await chatClient.GetResponseAsync("A bat and a ball cost $1.10 together. The bat costs $1 more than the ball. What does the ball cost?");
foreach (TextReasoningContent thought in response.Messages.SelectMany(message => message.Contents).OfType<TextReasoningContent>())
{
    Console.WriteLine(thought.Text);
}

With PinkRooster.Agents, the reasoning arrives as ReasoningDelta and ReasoningCompleted events. The package depends only on Microsoft.Extensions.AI.OpenAI. It reads the SDK's experimental JsonPatch (SCME0001), which is the SDK's only way to read a field it has no property for, so a new SDK version may need a new release of this package.

Feedback and license

Report a bug or ask a question on GitHub Issues. The package is released under the MIT license.

Product Compatible and additional computed target framework versions.
.NET 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
0.4.0-preview.1 62 10/9/2026