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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openai_codex-0.154.0.tar.gz (86.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openai_codex-0.154.0-py3-none-any.whl (94.9 kB view details)

Uploaded Python 3

File details

Details for the file openai_codex-0.154.0.tar.gz.

File metadata

  • Download URL: openai_codex-0.154.0.tar.gz
  • Upload date:
  • Size: 86.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for openai_codex-0.154.0.tar.gz
Algorithm Hash digest
SHA256 55a2675ab92ad3f900bc6572ab9d7da857d089da4e2008ce3fa8539154e1c2c3
MD5 548af259c16a2951737fb3d4fbc37068
BLAKE2b-256 0198525a9ecbc927cb71f716e53b5e6840986a2a7ad1dabe8766bcaab6e5c4c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for openai_codex-0.154.0.tar.gz:

Publisher: python-sdk-release.yml on openai/codex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openai_codex-0.154.0-py3-none-any.whl.

File metadata

  • Download URL: openai_codex-0.154.0-py3-none-any.whl
  • Upload date:
  • Size: 94.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for openai_codex-0.154.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5f354e1280621d0f5e28313ecf6974d2a98bcf0b088dbe791dc6df5044d2214
MD5 49ccd725672505897e6e1d3b134e92e9
BLAKE2b-256 a466bdadb71a855aebc965f21b721239cf4a265aa7c78cfcd0ab87ae4a44b68e

See more details on using hashes here.

Provenance

The following attestation bundles were made for openai_codex-0.154.0-py3-none-any.whl:

Publisher: python-sdk-release.yml on openai/codex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.154.0 This release

2 files

0.147.0

2 files

0.144.4

2 files

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