Skip to main content

Python SDK for Codex

Project description

OpenAI Codex Python SDK (Beta)

Build Python applications that start Codex threads, run turns, stream progress, and control workspace access.

[!NOTE] openai-codex is in beta. Public APIs may change before 1.0.

Install

Install the SDK:

pip install openai-codex

For reproducible environments, install this release exactly:

pip install openai-codex==0.1.0b1

The SDK requires Python >=3.10 and installs its compatible Codex runtime dependency automatically. While beta releases are the only published SDK releases, the normal install command selects the latest beta. After a stable release exists, use pip install --pre openai-codex to explicitly select a newer prerelease.

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.

Project details


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.1.0b1.tar.gz (57.9 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.1.0b1-py3-none-any.whl (64.5 kB view details)

Uploaded Python 3

File details

Details for the file openai_codex-0.1.0b1.tar.gz.

File metadata

  • Download URL: openai_codex-0.1.0b1.tar.gz
  • Upload date:
  • Size: 57.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for openai_codex-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 1449d8fba01dc7c9cd74e8ece8f9379fa5bd698e7ff38f3427b67c61db60a744
MD5 cc6b1bcb15de17b053948e5f3a06cfb5
BLAKE2b-256 e865bcd5da57219d2ee72b44a36a765c450ead820b0df9667800149c05fdf309

See more details on using hashes here.

Provenance

The following attestation bundles were made for openai_codex-0.1.0b1.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.1.0b1-py3-none-any.whl.

File metadata

  • Download URL: openai_codex-0.1.0b1-py3-none-any.whl
  • Upload date:
  • Size: 64.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for openai_codex-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 986b72fe816754f66374940ec7bce52bfbcac97d80dcc125db55cb47c201ab0a
MD5 5d2c68029849d6c058f58ce6fa340907
BLAKE2b-256 6d27805bda8f9cb8e20e9c696c8618a40a8a5d04ccea65689ca184151f2aadd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for openai_codex-0.1.0b1-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.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page