CodexSharpSDK banner
managedcode managedcode

CodexSharpSDK

Development community

Description

CLI-first .NET 10 / C# SDK for OpenAI Codex CLI with typed thread API, streamed JSONL events, structured outputs

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

ManagedCode.CodexSharpSDK

[![CI](https://github.com/managedcode/CodexSharpSDK/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/managedcode/CodexSharpSDK/actions/workflows/ci.yml) [![Release](https://github.com/managedcode/CodexSharpSDK/actions/workflows/release.yml/badge.svg?branch=main)](https://github.com/managedcode/CodexSharpSDK/actions/workflows/release.yml) [![CodeQL](https://github.com/managedcode/CodexSharpSDK/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/managedcode/CodexSharpSDK/actions/workflows/codeql.yml) [![NuGet](https://img.shields.io/nuget/v/ManagedCode.CodexSharpSDK.svg)](https://www.nuget.org/packages/ManagedCode.CodexSharpSDK) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/managedcode/CodexSharpSDK/blob/main/LICENSE)

`ManagedCode.CodexSharpSDK` is an open-source .NET SDK for driving the Codex CLI from C#.

It is a CLI-first `.NET 10 / C# 14` SDK aligned with real `codex` runtime behavior, with:

  • thread-based API (start / resume)
  • streamed JSONL events
  • structured output schema support
  • image attachments
  • --config flattening to TOML
  • NativeAOT-friendly implementation and tests on TUnit

All consumer usage examples are documented in this README; this repository intentionally does not keep standalone sample projects.

Installation

dotnet add package ManagedCode.CodexSharpSDK

Prerequisites

Before using this SDK, you must have:

  • codex CLI installed and available in PATH
  • an already authenticated Codex session (codex login)

Quick check:

codex --version
codex login

Quickstart

using ManagedCode.CodexSharpSDK;

using var client = new CodexClient();

var thread = client.StartThread(new ThreadOptions
{
    Model = CodexModels.Gpt54,
    ModelReasoningEffort = ModelReasoningEffort.Medium,
});

var turn = await thread.RunAsync("Diagnose failing tests and propose a fix");

Console.WriteLine(turn.FinalRe