Skip to content

codex-sdk-unofficial Documentation

codex-sdk-unofficial is a community-maintained project and is not an official OpenAI SDK.

This site is a full guide for using the SDK in an existing UV-managed project, with an UV-first workflow.

Start Here In 5 Minutes

Prerequisites: - Existing UV-managed Python project - codex CLI available on your machine

What you'll do: - Add the SDK dependency - Install the package - Run your first turn

uv add codex-sdk-unofficial
uv run python -c "from codex_sdk import Codex; print('import-ok')"

The Exact Import

from codex_sdk import Codex

Quick First Script

from codex_sdk import Codex

codex = Codex()
thread = codex.start_thread()
turn = thread.run("Diagnose the test failure and propose a fix")

print(turn.final_response)
print(turn.items)
print(turn.usage)

Run it:

uv run python your_script.py

Expected outcome: - turn.final_response contains the latest assistant message text - turn.items contains completed items emitted during the turn - turn.usage contains token counts when available

Documentation Roadmap

Project Pointers