OpenAI Codex Python SDK
Build Python applications that start Codex threads, run turns, stream progress, and control workspace access.
Install
Install the SDK:
pip install openai-codex
Quickstart
The SDK reuses your existing Codex authentication when one is already available:
from openai_codex import Codex
with Codex() as codex:
thread = codex.thread_start()
result = thread.run("Explain this repository in three bullets.")
print(result.final_response)
thread.run(...) returns a TurnResult containing the final response,
collected items, and token usage.
Authentication
Existing Codex authentication is reused automatically. To start ChatGPT browser login explicitly:
from openai_codex import Codex
with Codex() as codex:
login = codex.login_chatgpt()
print(login.auth_url)
print(login.wait().success)
For device-code login:
with Codex() as codex:
login = codex.login_chatgpt_device_code()
print(login.verification_url, login.user_code)
login.wait()
For API-key login:
with Codex() as codex:
codex.login_api_key("sk-...")
Built-In Help
Use Python's standard help(openai_codex), help(Codex), or
python -m pydoc openai_codex documentation tools.
Documentation
The package is licensed under the repository Apache License 2.0.
Release files for openai-codex 0.156.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| openai_codex-0.156.0.tar.gz | 87.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openai_codex-0.156.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 184.0 kB
Release files / openai_codex-0.156.0.tar.gz
| Download URL | openai_codex-0.156.0.tar.gz |
|---|---|
| Size | 87.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d766358edce206325a8ee6ccd5f54250b6743f72ac58ba53c3e0706e2f7caee
|
|
BLAKE2b-256 checksum How to use checksums |
fea2c1d378fef1f1a04b57af6af968bde66dc68849ce1ab91c6beb03782430b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency logRelease files / openai_codex-0.156.0-py3-none-any.whl
| Download URL | openai_codex-0.156.0-py3-none-any.whl |
|---|---|
| Size | 96.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2fbd38e12e79091d2aa1f2ae92d97457289daa6ab9f7c2231deba337e703fe3f
|
|
BLAKE2b-256 checksum How to use checksums |
2c657e1bde4685f3cf3811f3a6b7f56148908104d4030a96c68506a68f423cc0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency log