Skip to main content

codex-pal

codex-pal launches Codex CLI through codex-relay so Codex can use OpenAI-compatible providers that do not natively implement the Responses API.

It is intentionally a small launcher:

  • starts or reuses a local codex-relay sidecar;
  • injects per-invocation Codex config with -c, leaving ~/.codex/config.toml untouched;
  • maps common providers to upstream URLs and API-key environment variables;
  • hands the terminal to codex.

Install

From crates.io:

cargo install codex-pal

From PyPI:

pipx install codex-pal

The PyPI package installs codex-relay as a runtime dependency. codex-pal finds that dependency beside its own executable (including in pipx's private environment) before searching PATH. To expose codex-relay as a standalone shell command too, install with pipx install codex-pal --include-deps.

The Cargo package also declares the codex-relay crate dependency, but Cargo does not install dependency binaries onto PATH when installing a binary crate; if you install with Cargo, install both tools:

cargo install codex-pal codex-relay

Usage

codex-pal has two interfaces:

  • a complete, explicit interface for scripts and debugging;
  • a profile interface for humans.

Human-friendly profiles

export DEEPSEEK_API_KEY=...
codex-pal deepseek

export DASHSCOPE_API_KEY=...
codex-pal qwen

export OPENROUTER_API_KEY=...
codex-pal openrouter

The first run creates a profile under ~/.config/codex-pal/config.toml when the profile name matches a built-in provider. Later runs reuse it.

Configure or modify a profile:

codex-pal deepseek config --model deepseek-v4-pro --port 4555
codex-pal deepseek show
codex-pal profiles
codex-pal providers
codex-pal deepseek status
codex-pal deepseek stop
codex-pal deepseek restart

Custom profile:

export EXAMPLE_API_KEY=...
codex-pal work-llm config \
  --provider custom \
  --upstream https://llm.example.com/v1 \
  --api-key-env EXAMPLE_API_KEY \
  --model vendor/model
codex-pal work-llm

Complete explicit interface

Use run when every setting should be supplied by arguments:

codex-pal run \
  --provider deepseek \
  --model deepseek-v4-pro \
  --port 4444 \
  --approval never \
  --sandbox workspace-write

Custom one-shot launch:

codex-pal run \
  --provider custom \
  --upstream https://llm.example.com/v1 \
  --api-key-env EXAMPLE_API_KEY \
  --model vendor/model

Useful flags:

codex-pal relay status --port 4444
codex-pal relay stop --port 4444
codex-pal relay-config --provider openrouter
codex-pal run --provider deepseek --model deepseek-v4-pro --print-codex-command
codex-pal run --provider deepseek --model deepseek-v4-pro --ask
codex-pal run --provider deepseek --model deepseek-v4-pro --no-sandbox

Use an existing remote codex-relay service instead of starting a local sidecar:

codex-pal run \
  --provider deepseek \
  --model deepseek-v4-pro \
  --relay-url https://relay.example.com

codex-pal deepseek --relay-url https://relay.example.com
codex-pal deepseek config --relay-url https://relay.example.com

--relay-url accepts either the relay root URL or its /v1 base URL. When it is set, codex-pal skips local relay process management and points Codex at the remote relay.

Arguments left after codex-pal consumes its profile or launch options are appended to the codex invocation, so Codex subcommands and flags can be used directly:

codex-pal run --provider deepseek --model deepseek-v4-pro exec --skip-git-repo-check "summarize this repo"
codex-pal deepseek exec --skip-git-repo-check "summarize this repo"
codex-pal deepseek --oss

Use -- when you need to force a later argument to be handled by Codex even if it looks like a codex-pal option:

codex-pal deepseek -- --model gpt-5.5

Python multi-agent API

The PyPI package also includes a small, standard-library-only asyncio wrapper. Each Agent uses an existing codex-pal profile, so the normal CLI and profile configuration remain the source of truth:

See Python Multi-Agent API for profile setup, API details, worktree guidance, and complete parallel and staged orchestration examples.

import asyncio

from codex_pal import Agent, AgentTask, run_parallel


async def main():
    tasks = [
        AgentTask(
            Agent("architect", cwd="/tmp/project-architect", port=4444),
            "Analyze the repository and produce an implementation plan.",
        ),
        AgentTask(
            Agent("reviewer", cwd="/tmp/project-reviewer", port=4445),
            "Review the current implementation and report high-confidence issues.",
        ),
    ]
    results = await run_parallel(tasks)
    for result in results:
        for event in result.events:
            print(result.profile, event)


asyncio.run(main())

Agent.run() invokes the equivalent of codex-pal <profile> exec --json -, sends the prompt over stdin, and returns decoded JSONL events. cwd can point at a separate Git worktree for each writing agent. An explicit port overrides the profile for that run; omit it to use the profile's configured port. Parallel tasks are independent: run_parallel() lets every started Agent finish before surfacing an Agent error, rather than terminating another Agent mid-change.

Configure different local relay ports for profiles that use different providers. Managed relays record their upstream identity, and codex-pal now rejects accidental reuse of a port by a differently configured profile instead of silently sending that profile to the wrong provider.

For relay-backed providers, codex-pal also injects a temporary Codex model_catalog_json file so the in-session /model picker lists models for the selected provider instead of only Codex's bundled OpenAI catalog. If Codex's catalog command is unavailable, launch still continues with the chosen -m model and prints a warning.

Provider Profiles

Provider Upstream API key env
deepseek https://api.deepseek.com/v1 DEEPSEEK_API_KEY
z, zai https://api.z.ai/api/paas/v4 ZAI_API_KEY
kimi, moonshot https://api.moonshot.cn/v1 MOONSHOT_API_KEY
qwen, dashscope https://dashscope.aliyuncs.com/compatible-mode/v1 DASHSCOPE_API_KEY
mistral https://api.mistral.ai/v1 MISTRAL_API_KEY
groq https://api.groq.com/openai/v1 GROQ_API_KEY
xai, grok https://api.x.ai/v1 XAI_API_KEY
openrouter https://openrouter.ai/api/v1 OPENROUTER_API_KEY

Default models:

Provider Default model
openai gpt-5.5
deepseek deepseek-v4-pro
z, zai glm-5.2
kimi, moonshot kimi-k3
qwen, dashscope qwen3.7-max
mistral mistral-medium-3-5+2
groq openai/gpt-oss-120b
xai, grok grok-4.3
openrouter openrouter/auto

Development

cargo test
cargo fmt --check
maturin build

Release

Releases are tag-driven from GitHub Actions.

One-time setup:

  1. Create a GitHub environment named release.
  2. Add an environment secret named CARGO_REGISTRY_TOKEN with a crates.io API token.
  3. On PyPI, create a pending Trusted Publisher for:
    • project: codex-pal
    • owner: MetaFARS
    • repository: codex-pal
    • workflow: release.yml
    • environment: release

Publish:

git tag v0.1.1
git push origin v0.1.1

The release workflow builds all wheels and the sdist, publishes to PyPI via Trusted Publishing, publishes the Rust crate to crates.io, and creates a GitHub Release with the built artifacts.

Download files

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

Source Distribution

codex_pal-0.2.0.tar.gz (54.8 kB view details)

Uploaded Source

Built Distributions

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

codex_pal-0.2.0-py3-none-win_arm64.whl (644.1 kB view details)

Uploaded Python 3Windows ARM64

codex_pal-0.2.0-py3-none-win_amd64.whl (674.0 kB view details)

Uploaded Python 3Windows x86-64

codex_pal-0.2.0-py3-none-musllinux_1_2_x86_64.whl (883.7 kB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

codex_pal-0.2.0-py3-none-musllinux_1_2_aarch64.whl (860.2 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

codex_pal-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (819.8 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

codex_pal-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (801.9 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

codex_pal-0.2.0-py3-none-macosx_11_0_arm64.whl (747.9 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

codex_pal-0.2.0-py3-none-macosx_10_12_x86_64.whl (768.3 kB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file codex_pal-0.2.0.tar.gz.

File metadata

  • Download URL: codex_pal-0.2.0.tar.gz
  • Upload date:
  • Size: 54.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for codex_pal-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f0edec4b3098b8b580df1678e95be23ee24fdaaba942c29d9dcaba36abe1bcec
MD5 f7f6292325e0e1d90cae91ba460d2e32
BLAKE2b-256 fabd8fcf83aa574566e610068dcd0e4fc12190807281207a5d2d5a4e404f8816

See more details on using hashes here.

File details

Details for the file codex_pal-0.2.0-py3-none-win_arm64.whl.

File metadata

  • Download URL: codex_pal-0.2.0-py3-none-win_arm64.whl
  • Upload date:
  • Size: 644.1 kB
  • Tags: Python 3, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for codex_pal-0.2.0-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 73c7379c7095f4487c24f6cc22df8f81f50b8563f485e5fa73c999bb30b80cfd
MD5 7be7ae667b7667b9ecdb836f484e9230
BLAKE2b-256 f49a498bcafe9757b0c1ea622d8e803f8a4ce3f976e1b251826cb22c6bd682a2

See more details on using hashes here.

File details

Details for the file codex_pal-0.2.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: codex_pal-0.2.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 674.0 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for codex_pal-0.2.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 5c1c9a387be8776c0f4a049acc10662267c442488e31b1bdf0533d9349faaf07
MD5 e4276704e58e3a171330fc394d30d69a
BLAKE2b-256 452a7bebc7b043485caecce8bdbbd35fefdfad5b3a7105211e3838b516faec34

See more details on using hashes here.

File details

Details for the file codex_pal-0.2.0-py3-none-musllinux_1_2_x86_64.whl.

File metadata

  • Download URL: codex_pal-0.2.0-py3-none-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 883.7 kB
  • Tags: Python 3, musllinux: musl 1.2+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for codex_pal-0.2.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b8530ca1aba2330a8c378d86343a9ab6791d0106f87d2717123894584312888a
MD5 23659b82bd511236811e054f6709a553
BLAKE2b-256 8304fe9bfe76d2283278f97ab477057faf206819191c8afe8f105f913ae74f38

See more details on using hashes here.

File details

Details for the file codex_pal-0.2.0-py3-none-musllinux_1_2_aarch64.whl.

File metadata

  • Download URL: codex_pal-0.2.0-py3-none-musllinux_1_2_aarch64.whl
  • Upload date:
  • Size: 860.2 kB
  • Tags: Python 3, musllinux: musl 1.2+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for codex_pal-0.2.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 d3d1b40f23f25c01c3ecb0c4cd057fed0bd1486df3bdc145f589671027011904
MD5 caa3a89c000ed6d227fca3e4733d1ecd
BLAKE2b-256 a6a4df6fea7f0b8764a1a688b90f805c702d531dc81f3fcafed9baf4357f7622

See more details on using hashes here.

File details

Details for the file codex_pal-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: codex_pal-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 819.8 kB
  • Tags: Python 3, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for codex_pal-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 501999168af8fe8d1545f693d72d54ad3c31ccd8b15c74444e1ac7a3c209dbc1
MD5 ca025f4f3fef9a28cecd7fd6db7f654e
BLAKE2b-256 09d3f0b3458520da13b2e82ee85e4dc0e5c51abd13cadca9dea75b6883687712

See more details on using hashes here.

File details

Details for the file codex_pal-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: codex_pal-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 801.9 kB
  • Tags: Python 3, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for codex_pal-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5d47a554a7899df66e50336aae0cc321bd185e987bc341efd7fa2dba8d5ad183
MD5 1c9871c73ad0ceef7bd9a8bf0667e16c
BLAKE2b-256 c450380dffba8246702e34c6a84908deb943d14b0153e9c3ffb3a5e15162825b

See more details on using hashes here.

File details

Details for the file codex_pal-0.2.0-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: codex_pal-0.2.0-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 747.9 kB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for codex_pal-0.2.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c3e31a081e338b1c501f93aa7fae1d18e938620bb26df9d573963547dd95d030
MD5 31a4a98e7712629e6fe54b43f1131487
BLAKE2b-256 ed3a2d118be725c9e458979319138168fdf605df1472464bae0ac507143e2948

See more details on using hashes here.

File details

Details for the file codex_pal-0.2.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: codex_pal-0.2.0-py3-none-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 768.3 kB
  • Tags: Python 3, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for codex_pal-0.2.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2b7e743fb96e806b5001ab8d0ff590024c2e625ad8c1b668b8c4a35696c9bd75
MD5 8a7344c3059dc68c275718beb9b308e7
BLAKE2b-256 61abf29c013593a890878ec54ae6f791c8954ca1685e5e5874df061f63343fc5

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.1

9 files

This release

0.2.0 This release

9 files

0.1.6

9 files

0.1.5

9 files

0.1.4

9 files

0.1.3

16 files

0.1.2

16 files

0.1.1

16 files

0.1.0

16 files

Supported by

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