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.173.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.173.0
File Size Uploaded Provenance Actions
openai_codex-0.173.0.tar.gz 99.1 kB With provenance Details for openai_codex-0.173.0.tar.gz

Built distribution (wheel)

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

Total release size: 204.7 kB

Release files / openai_codex-0.173.0.tar.gz

Download URL openai_codex-0.173.0.tar.gz
Size 99.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fd69a67b4737c01d7bf9b878dba82deb00a09e094253f8a4a89d1ae6e72c3e56
BLAKE2b-256 checksum
How to use checksums
7531fa4c04b4aaba70ed652393b6cd5aea9c9dbf564c46fd8b4f7900f5e0480d
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 Dec 2, 2026.

Transparency log

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

Download URL openai_codex-0.173.0-py3-none-any.whl
Size 105.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf6524a5587a2ebec615b0d52ad4584a3b4233c95a6f92cd832b01f7069ca57c
BLAKE2b-256 checksum
How to use checksums
901408caf6d2312bca671da328cf74c46f107c1d5802924b1a894b6965a16e99
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 Dec 2, 2026.

Transparency log

Security for openai-codex 0.173.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for openai_codex-0.173.0.tar.gz

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 Dec 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.173.0 This release

2 release files Full provenance

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