Skip to main content

circle-codex

Unofficial fork of the OpenAI Codex Python SDK. It bundles a Codex CLI build that adds a built-in xAI (Grok) model provider.

This project is not affiliated with, endorsed by, or supported by OpenAI or xAI. It is built from https://github.com/ashish447344/codex, a fork of https://github.com/openai/codex.

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

Install

Install the SDK:

pip install circle-codex

Prebuilt runtime wheels (circle-codex-cli-bin) are published for macOS (Apple silicon and Intel) and Linux (x86_64 and aarch64, glibc and musl). Windows is not supported.

The import package keeps the upstream name openai_codex, so do not install this package into the same environment as the official openai-codex.

Quickstart with xAI

Set XAI_API_KEY in your environment, then select the xAI provider:

from openai_codex import Codex, CodexConfig, Sandbox

config = CodexConfig(
    config_overrides=('model_provider="xai"', 'model="grok-4.7"'),
)

with Codex(config) as codex:
    thread = codex.thread_start(sandbox=Sandbox.workspace_write)
    result = thread.run("Explain this repository in three bullets.")
    print(result.final_response)

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 SDK API is the same as upstream, so the upstream guides apply:

Where those guides say pip install openai-codex, use pip install circle-codex.

The package is licensed under the Apache License 2.0, the same license as upstream. See the repository NOTICE for attribution.

Metadata

Release files for circle-codex 0.154.3

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

Source distribution (sdist)

Source distribution for circle-codex 0.154.3
File Size Uploaded Provenance Actions
circle_codex-0.154.3.tar.gz 95.2 kB With provenance Details for circle_codex-0.154.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for circle-codex 0.154.3
File Interpreter ABI Platform Actions
circle_codex-0.154.3-py3-none-any.whl Python 3 none any Details for circle_codex-0.154.3-py3-none-any.whl

Total release size: 198.4 kB

Release files / circle_codex-0.154.3.tar.gz

Download URL circle_codex-0.154.3.tar.gz
Size 95.2 kB
Tags Source
SHA-256 checksum
How to use checksums
62e972a112dc3020c0d35ce42081273c0ff2a6cc692d5672d7eabc6d0f5baa54
BLAKE2b-256 checksum
How to use checksums
b6a4ba6bfdd84eb2c66216d280b067157744e5a3a784c98c170557242a2547d8
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 Nov 17, 2026.

Transparency log

Release files / circle_codex-0.154.3-py3-none-any.whl

Download URL circle_codex-0.154.3-py3-none-any.whl
Size 103.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0a587087da984339abe0a33948344ef553cfbc4ab31b9292568526403ff97e0
BLAKE2b-256 checksum
How to use checksums
172df0bafbb14712217cdad78e5f072d81fd249c63933e35b7bf03b160ec96bc
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 Nov 17, 2026.

Transparency log

Security for circle-codex 0.154.3

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 circle_codex-0.154.3.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 Nov 17, 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.

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