Codex

OpenAI’s coding agent, in the terminal or in VS Code, with any MafiaLLM model.

Codex speaks OpenAI’s Responses API, which MafiaLLM serves at https://api.mafiallm.com/v1/responses. Every model works through it, not only GPT ones.

Setup

Add MafiaLLM as a provider in ~/.codex/config.toml, and make it the default:

~/.codex/config.toml:

model = "glm-5.3"
model_provider = "mafiallm"
# The model's "context" from the model list; Codex assumes 272,000 otherwise.
model_context_window = 1000000

[model_providers.mafiallm]
name = "MafiaLLM"
base_url = "https://api.mafiallm.com/v1"
env_key = "MAFIA_KEY"

shell:

export MAFIA_KEY="sk-mf-…"
codex

Several models

Switch with /model during a session, or codex -m kimi-k3 at start. To keep ready-made setups, write a profile per model: since Codex 0.134, a profile is its own file, ~/.codex/<name>.config.toml.

~/.codex/claude.config.toml:

model = "claude-sonnet-5-5"
model_provider = "mafiallm"
model_context_window = 1000000

shell:

codex --profile claude

Good to know