Mafdet AI Help Center中文

Codex CLI setup

Codex CLI (OpenAI's terminal coding agent) supports custom OpenAI-compatible providers via ~/.codex/config.toml.

Configuration

Save as ~/.codex/config.toml:

model = "deepseek-v4-pro"
model_provider = "mafdet"

[model_providers.mafdet]
name = "Mafdet AI"
base_url = "https://api.mafdet.ai/v1"
env_key = "MAFDET_API_KEY"
wire_api = "chat"

Then export your key in the shell that runs codex:

export MAFDET_API_KEY="sk-mafdet-xxxxxxxxxxxxxxxx"
  • env_key names the environment variable holding your key — the config file itself never contains a secret
  • wire_api = "chat" keeps Codex on the Chat Completions protocol, which the gateway serves
  • model is a Mafdet AI model ID (see Models overview)

You can also generate this file pre-filled with your model from Console → API Keys → Developer Tools.

Common errors

SymptomMeaningFix
401MAFDET_API_KEY not exportedExport it in the same shell that runs codex
429Rate limited (RPM/TPM)Coding agents need a key with a high TPM limit
model not foundWrong model IDCheck Models overview

Next steps