Skip to main content

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.

Metadata

Release files for openai-codex 0.158.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openai-codex 0.158.0
File Size Uploaded
openai_codex-0.158.0.tar.gz 88.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openai-codex 0.158.0
File Interpreter ABI Platform
openai_codex-0.158.0-py3-none-any.whl Python 3 none any Details

Total release size: 185.6 kB

Release files / openai_codex-0.158.0.tar.gz

Download URL openai_codex-0.158.0.tar.gz
Size 88.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0b60e5109263a27e965df0db9cf98706b5b37e27dfcbdd7cc269f7e2618fabb2
BLAKE2b-256 checksum
How to use checksums
2aef11b5d7ab86b6c7f16bda35247b60f6db1713b9de161a8d8c81be8c8e9a16
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 28, 2026.

Transparency log

Release files / openai_codex-0.158.0-py3-none-any.whl

Download URL openai_codex-0.158.0-py3-none-any.whl
Size 96.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
32f8b58e7461f794d08387ba97f72a91267e5161b54ba2305a4d5cd6ad80d7f3
BLAKE2b-256 checksum
How to use checksums
d2bf793f6daec87bcf5bdbaf676c5219f96a54d85bf2aa4f16a30a2835bb39ed
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 28, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page