Гайды

От ключа к первому запросу.

Выберите клиент, систему и способ подключения. Ключ остаётся локально и не попадает в URL или историю shell.

1Product
2Client
3Operating system
4Mode
Codex + Codex CLI + macOS

Verified connection path

Responses

Use Codex CLI, App or VS Code with the Responses protocol. Keep your key out of URLs, shell history, process arguments and analytics.

set -eu
umask 077
read -rsp "Model.sale API key: " MODEL_SALE_KEY; echo
mkdir -p "$HOME/.codex" "$HOME/.config/model-sale"
[ ! -e "$HOME/.codex/config.toml" ] || cp -p "$HOME/.codex/config.toml" "$HOME/.codex/config.toml.model-sale-backup"
printf 'export MODEL_SALE_API_KEY=%q\n' "$MODEL_SALE_KEY" > "$HOME/.config/model-sale/env"
chmod 600 "$HOME/.config/model-sale/env"
if ! grep -q '^\[model_providers\.model_sale\]' "$HOME/.codex/config.toml" 2>/dev/null; then
cat >> "$HOME/.codex/config.toml" <<'EOF'

[model_providers.model_sale]
name = "Model.sale"
base_url = "https://api.model.sale/v1"
env_key = "MODEL_SALE_API_KEY"
wire_api = "responses"
EOF
fi
profile="$HOME/.zshrc"; [ -f "$profile" ] || profile="$HOME/.bashrc"
grep -qxF 'source "$HOME/.config/model-sale/env"' "$profile" 2>/dev/null || printf '\nsource "$HOME/.config/model-sale/env"\n' >> "$profile"
unset MODEL_SALE_KEY
echo "Model.sale was added without replacing existing providers. Roll back with the saved config backup."
VerifyRun a minimal request, then check the Usage page for the request and exact charge.RollbackRestore the backed-up config and remove the local secret file.