Incursa.OpenAI.Codex 2.2.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Incursa.OpenAI.Codex --version 2.2.0
                    
NuGet\Install-Package Incursa.OpenAI.Codex -Version 2.2.0
                    
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="Incursa.OpenAI.Codex" Version="2.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Incursa.OpenAI.Codex" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Incursa.OpenAI.Codex" />
                    
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 Incursa.OpenAI.Codex --version 2.2.0
                    
#r "nuget: Incursa.OpenAI.Codex, 2.2.0"
                    
#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 Incursa.OpenAI.Codex@2.2.0
                    
#: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=Incursa.OpenAI.Codex&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Incursa.OpenAI.Codex&version=2.2.0
                    
Install as a Cake Tool

Incursa.OpenAI.Codex

Async-only Codex runtime for .NET. It wraps the local codex executable and starts it as a subprocess, so the machine running your app must already have Codex installed and authenticated. Any ApiKey or BaseUrl settings are forwarded to that subprocess; they do not replace the local Codex installation requirement.

This package is DI-agnostic and exposes the runtime API:

When To Use This Package

Use this package when you want a .NET wrapper around the local Codex CLI for prompt/response flows, stateful threads, or turn-level control.

  • Use the OpenAI SDK when you want direct API access from .NET.
  • Use ChatKit when you want a hosted chat UI surface.
  • Use the Agents SDK when you want higher-level agent orchestration.
  • Use this package when you specifically want Codex-backed workflows driven from a local Codex install.
  • If you want a no-throw preflight for the local executable, call await client.IsCodexAvailableAsync() before InitializeAsync() or any turn operation.

Hello World

The smallest useful call starts a thread, sends one prompt, and prints the final response:

using Incursa.OpenAI.Codex;

await using var client = new CodexClient();

CodexThread thread = await client.StartThreadAsync(new CodexThreadOptions
{
    SkipGitRepoCheck = true,
});

CodexRunResult result = await thread.RunAsync("Say hello from Codex in one sentence.");
Console.WriteLine(result.FinalResponse);

CodexRunResult.FinalResponse can be null when a turn completes with commentary only and never produces a final-answer or phase-less assistant message.

CodexClient is async-only. Dispose it with await using.

If you need DI registration, use Incursa.OpenAI.Codex.Extensions and call AddCodex(...).

Backend Modes

The API supports both backend modes:

  • AppServer (codex app-server --listen stdio://) for the full JSON-RPC surface, thread lifecycle operations, thread goals, model listing, account rate-limit reads, and turn steering or interruption
  • Exec (codex exec --experimental-json) for the CLI-backed run and stream flow

Use AppServer when you need long-lived conversations, CodexThread management, or turn control. Use Exec when you only need prompt-in, response-out behavior.

Major API Surfaces

Use CodexTurn.StreamNormalizedAsync(), CodexTurn.ObserveNormalizedEventsAsync(), or CodexTurn.RunToResultAsync() for UI clients that must distinguish Codex completion from transport or delivery behavior. ObserveEventsAsync() and ObserveNormalizedEventsAsync() expose turn-scoped observable streams that fan out from one underlying Codex reader and replay observed events to later subscribers. The detailed result exposes TerminalEventSeen, TerminalEventType, TerminalState, FinalResponseText, FinalResponseSource, and assistant output character counts so callers do not need to infer completion from silence.

Sample

The runnable sample under samples/Incursa.OpenAI.Codex.Sample shows quickstart, streaming, structured output, image input, error handling, and turn controls.

License

Apache 2.0. See the repository root 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.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Incursa.OpenAI.Codex:

Package Downloads
Incursa.OpenAI.Codex.Extensions

Optional dependency-injection and host integration extensions for Incursa.OpenAI.Codex, including IServiceCollection registration and configuration binding.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.3.0 64 5/25/2026
2.2.0 49 5/25/2026
2.1.0 117 5/23/2026
2.0.0 130 5/13/2026
1.3.0 197 5/12/2026
1.2.2 516 5/10/2026
1.2.1 216 5/10/2026
1.2.0 107 5/10/2026
1.1.0 791 5/6/2026
1.0.20 208 4/22/2026
1.0.19 112 4/16/2026
1.0.18 256 3/25/2026
1.0.17 108 3/24/2026