← 返回
未分类 Key

codex-配置技能

Configure OpenAI Codex CLI to work with custom model providers (like MiniMax, OpenAI-compatible APIs). This skill should be used when users want to: use Codex with non-OpenAI models, set up a proxy to convert between Codex Responses API and OpenAI Chat Completions API, troubleshoot Codex connection issues (SSE timeout, model metadata warnings), or configure ~/.codex/config.toml for custom endpoints.
Configure OpenAI Codex CLI to work with custom model providers (like MiniMax, OpenAI-compatible APIs). This skill should be used when users want to: use Codex with non-OpenAI models, set up a proxy to convert between Codex Responses API and OpenAI Chat Completions API, troubleshoot Codex connection issues (SSE timeout, model metadata warnings), or configure ~/.codex/config.toml for custom endpoints.
heartflow
未分类 community v1.0.1 2 版本 100000 Key: 需要
★ 0
Stars
📥 42
下载
💾 0
安装
2
版本
#latest

概述

Codex Custom Model Proxy

Configure OpenAI Codex CLI to work with custom model providers that use OpenAI Chat Completions API format (like MiniMax) by setting up a local SSE proxy server.

When to Use This Skill

  • User wants to use Codex with a custom model provider (not OpenAI)
  • User's model provider uses OpenAI Chat Completions API format (/v1/chat/completions)
  • User sees errors like Stream disconnected before completion or Model metadata not found
  • User needs to convert between Codex Responses API format and OpenAI API format
  • User wants to configure ~/.codex/config.toml for custom endpoints

Overview

Codex CLI uses OpenAI Responses API format (/v1/responses) with SSE streaming, but many custom model providers (like MiniMax) use OpenAI Chat Completions API format (/v1/chat/completions). This skill provides a Python proxy server that:

  1. Listens on http://127.0.0.1:5005 (configurable)
  2. Accepts Codex Responses API requests
  3. Converts to OpenAI Chat Completions API format
  4. Forwards to the upstream provider
  5. Converts streaming responses back to Codex SSE event format
  6. Handles model metadata, UTF-8 encoding, and timeout issues

Quick Start

1. Configure Codex

Edit ~/.codex/config.toml:

[model]
model = "MiniMax-M2.7-highspeed"

[api]
base_url = "http://127.0.0.1:5005/v1"
api_key = "YOUR_API_KEY_HERE"

2. Start the Proxy Server

cd ~/.codex
python3 scripts/sse_proxy.py

Or use the bundled script:

python3 ~/.workbuddy/skills/codex-custom-model-proxy/scripts/sse_proxy.py

3. Run Codex

codex

Proxy Script Usage

The proxy script (scripts/sse_proxy.py) supports configuration via environment variables:

# Custom upstream endpoint
export UPSTREAM_HOST="your-upstream-host.com"
export UPSTREAM_PATH="/v1/chat/completions"
export UPSTREAM_TIMEOUT=180

# Custom listen port
export LISTEN_PORT=5005

# API key
export API_KEY="your-api-key-here"

# Start proxy
python3 scripts/sse_proxy.py

Troubleshooting

"Stream disconnected before completion: idle timeout waiting for SSE"

Cause: Upstream timeout too short, or proxy not converting SSE format correctly.

Fix:

  1. Increase UPSTREAM_TIMEOUT to 180+ seconds
  2. Ensure proxy sends proper SSE events: response.created, response.in_progress, response.output_text.delta, response.output_text.done, response.completed
  3. Check that X-Accel-Buffering: no header is set

"Model metadata for XXX not found"

Cause: Codex can't find model metadata in its model catalog.

Fix (optional, warning only):

  1. Read ~/.codex/model_catalog_gpt55.json
  2. Add model entry with correct schema (see references/model-catalog-schema.md)

Note: This is a warning only, Codex will still work with fallback metadata.

"Skill descriptions were shortened to fit the 2% skills context budget"

Cause: Too many skills enabled, context budget exceeded.

Fix:

  1. Disable unused skills: codex disable
  2. Or increase context budget in config

Advanced Configuration

Custom Model Parameters

Edit the MODEL_META dict in scripts/sse_proxy.py:

MODEL_META = {
    "id": "MiniMax-M2.7-highspeed",
    "context_window": 128000,
    "max_output_tokens": 4096,
    # ... see script for full schema
}

Multiple Models

To support multiple models, modify the /v1/models endpoint in the proxy to return all available models.

HTTPS Upstream

For HTTPS upstream endpoints, ensure SSL certificates are properly configured. The proxy uses requests library which respects system CA bundles.

File Reference

  • scripts/sse_proxy.py - The main proxy server script
  • references/codex-api-format.md - Codex API format documentation
  • references/model-catalog-schema.md - Model catalog JSON schema

版本历史

共 1 个版本

  • v1.0.1 Initial release 当前
    2026-05-29 21:19 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

design-media

gpt-image-2生图技能

user_fdb96f95
gpt-image-2 生图技能:自动发现 OpenAI 兼容 API,验证模型支持,调用生图接口并保存本地文件。
★ 1 📥 1,142
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 683 📥 330,385
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 79 📥 182,770