External Publication
Visit Post

codex-python-sdk — a tiny Python wrapper to use Codex without subprocess glue

OpenAI Developer Community February 17, 2026
Source

Hi folks — I just open-sourced codex-python-sdk , a tiny Python SDK that makes it easy to call Codex from Python with an ergonomic client API.

Why I built this I use Codex a lot in automation and quick prototypes, and I kept running into the same pain points when using the CLI from Python:

  • subprocess + stdout parsing gets messy quickly (errors, retries, structured outputs, tracing)

  • I wanted a clean “Python-native” interface that’s easy to embed in scripts / CLIs / notebooks

So this project focuses on a minimal surface area : create a client, send a prompt, get back the result text + a session_id you can use for tracing/debugging.

Quickstart

from codex_python_sdk import create_client

with create_client() as client:
    result = client.responses_create(prompt="Reply with exactly: READY")
    print(result.session_id)
    print(result.text)

Source code: https://github.com/spdcoding/codex-python-sdk

Feedback I’d love

  • API ergonomics: naming, method shape, return object design

  • What you’d expect next: async support, streaming/events, config patterns, better error types, examples

  • Any compatibility edge cases you’ve hit with Codex CLI / local setups

If you try it and something feels off, please tell me — I’m iterating fast.

Discussion in the ATmosphere

Loading comments...