| title | Sample Modes |
|---|
The runnable sample in samples/Incursa.OpenAI.Codex.Sample is a single console app with mode-based scenarios. It still expects Codex to be installed locally and authenticated on the machine running the sample.
The quickstart mode shows the shortest end-to-end prompt flow:
dotnet run --project samples/Incursa.OpenAI.Codex.Sample/Incursa.OpenAI.Codex.Sample.csproj -- --mode quickstart --prompt "Summarize this repository."Use this when you want the smallest end-to-end path: create a CodexClient, start a CodexThread, run one prompt, and print the final response.
Shows the event stream as it arrives:
dotnet run --project samples/Incursa.OpenAI.Codex.Sample/Incursa.OpenAI.Codex.Sample.csproj -- --mode streaming --prompt "List three files likely to contain option models."Use this when you want to build a UI or log pipeline around incremental CodexThreadEvent data.
Shows the CodexTurnOptions.OutputSchema setting with a JSON schema:
dotnet run --project samples/Incursa.OpenAI.Codex.Sample/Incursa.OpenAI.Codex.Sample.csproj -- --mode structured-output --prompt "Return JSON with answer and confidence."Use this when you need a predictable JSON-shaped result instead of free-form text.
Shows local and remote image inputs:
dotnet run --project samples/Incursa.OpenAI.Codex.Sample/Incursa.OpenAI.Codex.Sample.csproj -- --mode image-input --image C:\path\to\image.png --prompt "Describe the image."Use --image-url instead of --image to provide a remote image input such as CodexImageInput.
Shows capability gating and typed exceptions:
dotnet run --project samples/Incursa.OpenAI.Codex.Sample/Incursa.OpenAI.Codex.Sample.csproj -- --mode error-handling --backend exec --prompt "Explain capability differences."Use this when you want to see how the SDK behaves when a backend cannot support a request.
Shows explicit turn steering and interruption:
dotnet run --project samples/Incursa.OpenAI.Codex.Sample/Incursa.OpenAI.Codex.Sample.csproj -- --mode turn-controls --prompt "Draft a short release note." --interruptThis mode is the clearest demonstration of why AppServer exists: it lets you steer or interrupt a turn after it has started.
Add --use-di to build the client through Incursa.OpenAI.Codex.Extensions:
dotnet run --project samples/Incursa.OpenAI.Codex.Sample/Incursa.OpenAI.Codex.Sample.csproj -- --mode quickstart --use-diAppServeris the default in the current package and supports the full thread and turn-control surfaceExecis the CLI-backed path for simpler run and stream flows- Both modes still run against the local Codex executable;
ApiKeyandBaseUrlare forwarded to that subprocess, not used by the sample directly