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.5

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.5
File Size Uploaded Provenance Actions
circle_codex-0.154.5.tar.gz 95.9 kB With provenance Details for circle_codex-0.154.5.tar.gz

Built distribution (wheel)

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

Total release size: 199.8 kB

Release files / circle_codex-0.154.5.tar.gz

Download URL circle_codex-0.154.5.tar.gz
Size 95.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2533d9a65da733a41156c692175ae027f4b66fb756ca6bc15e24182d81b44f5e
BLAKE2b-256 checksum
How to use checksums
189f60f2a239480714504b7fb83b3a403c7e2e78b892e233a8b71c533db8d4ce
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 20, 2026.

Transparency log

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

Download URL circle_codex-0.154.5-py3-none-any.whl
Size 103.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97e3bfe49982925a6365baee83581f4bd580f86b52cd3debb4b5822dfabb393f
BLAKE2b-256 checksum
How to use checksums
573bfe8f04f8fce241ddf7a54691ffa3fcf59e0b5544cc5df53e9f041c91f68f
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 20, 2026.

Transparency log

Security for circle-codex 0.154.5

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.5.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 20, 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