skillfed

openai-codex

Python SDK for Codex

openai-codex v0.144.4 236.4K downloads/30d#8,984 on PyPI105,971
Permissive license Apache-2.0 Active released

What it is and what it does

OpenAI Codex Python SDK is a client library for building applications that interact with Codex, OpenAI's code generation and understanding model. It provides a context-managed interface to start threads, execute turns (prompts), and retrieve results including final responses and token usage. The SDK handles authentication automatically when credentials are already available, and supports explicit login flows via ChatGPT browser login, device-code flow, or API key.

The package is designed for developers building AI-assisted tools and agents that need to run Codex operations programmatically. It depends on pydantic for data validation and openai-codex-cli-bin for underlying binary support. The SDK is actively maintained, recently released, and carries no known vulnerabilities.

Use it for:

  • Build an automated code review tool that uses Codex to analyze and explain repository structure and code patterns.
  • Create an AI agent that generates or refactors code by running Codex turns in response to user prompts.
  • Integrate Codex into a development IDE or editor plugin to provide inline code explanations and suggestions.
  • Batch-process multiple code repositories to extract summaries, documentation, or architectural insights.
  • Implement multi-turn conversations with Codex where each turn builds on previous context and results.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Python SDK for building applications that interact with OpenAI Codex, enabling thread creation, turn execution, streaming, and workspace access control through a context-managed interface.

Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and is licensed permissively under Apache-2.0. Install it if you need to programmatically interact with OpenAI Codex from Python; the context-managed API and built-in authentication handling make it straightforward to integrate into applications.

Install

openai-codex on PyPI

pip

pip install openai-codex

uv

uv add openai-codex

poetry

poetry add openai-codex

Installing openai-codex

Before you install

Low install friction with only two runtime dependencies (pydantic and openai-codex-cli-bin). Active maintenance with a recent release 28 days ago and ongoing repository activity.

License in practice

Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely as long as you include the license notice.

Quickstart

pip install openai-codex

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)

Requires Python 3.10 or later; existing Codex authentication must be available or you must authenticate via ChatGPT login, device code, or API key before running turns.

Verify before relying

  • Whether openai-codex-cli-bin is a system binary dependency or a Python package that must be installed separately.
  • What 'workspace access control' concretely enables—whether it restricts file/directory scope, user permissions, or something else.
  • Whether the SDK supports streaming responses in real time or only returns final results.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 2 — pydantic, openai-codex-cli-bin
Maintenance actively maintained — 28 days since the last release
Last repo commit
First released
Downloads 236,449/month — #8,984 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: openai_codex-0.144.4-py3-none-any.whl

Keywords: codex, sdk, llm, ai, agents

Development Status :: 5 - Production/StableIntended Audience :: DevelopersTopic :: Software Development :: Libraries :: Python Modules

Tags

openai codex python sdkcodex thread managementllm agent framework pythoncodex authentication sdkai workspace control library
llm-sdkcode-generationai-agents

More Python Modules packages