{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreifb6o5ejzgobajzsbkv7fulot2fy4j4ed4guwntcty4t3w3zh4vcy",
"uri": "at://did:plc:lk3jfj3zq4k4wxnk474axylu/app.bsky.feed.post/3mf2xwfkucyf2"
},
"path": "/t/codex-python-sdk-a-tiny-python-wrapper-to-use-codex-without-subprocess-glue/1374459#post_1",
"publishedAt": "2026-02-17T15:21:19.000Z",
"site": "https://community.openai.com",
"tags": [
"https://github.com/spdcoding/codex-python-sdk"
],
"textContent": "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.\n\n**Why I built this**\nI use Codex a lot in automation and quick prototypes, and I kept running into the same pain points when using the CLI from Python:\n\n * `subprocess` + stdout parsing gets messy quickly (errors, retries, structured outputs, tracing)\n\n * I wanted a clean “Python-native” interface that’s easy to embed in scripts / CLIs / notebooks\n\n\n\n\nSo 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.\n\n**Quickstart**\n\n\n from codex_python_sdk import create_client\n\n with create_client() as client:\n result = client.responses_create(prompt=\"Reply with exactly: READY\")\n print(result.session_id)\n print(result.text)\n\n\n\n**Source code:** https://github.com/spdcoding/codex-python-sdk\n\n**Feedback I’d love**\n\n * API ergonomics: naming, method shape, return object design\n\n * What you’d expect next: async support, streaming/events, config patterns, better error types, examples\n\n * Any compatibility edge cases you’ve hit with Codex CLI / local setups\n\n\n\n\nIf you try it and something feels off, please tell me — I’m iterating fast.",
"title": "codex-python-sdk — a tiny Python wrapper to use Codex without subprocess glue"
}