@coma111/ccapi
v0.1.0
Published
One-click Codex environment setup for NewAPI-compatible channels
Maintainers
Readme
NewAPI Codex Env Installer
这是一个面向 NewAPI 兼容渠道的 Codex 环境一键配置工具。
当前 npm 包名:@coma111/ccapi
当前命令名:ccapi
现在的逻辑
当前版本采用全局直写模式:
- 直接写
~/.codex/config.toml - 直接写
~/.codex/auth.json - 覆盖前自动生成
.bak config.toml使用自定义 providerauth.json写入:
{
"OPENAI_API_KEY": "用户输入的 key"
}当前行为
只做了两处必要参数化:
base_url- 使用用户输入的
Base URL - 自动规范成
.../v1
- 使用用户输入的
provider- 默认使用
newapi - 也支持通过
--provider自定义
- 默认使用
生成的 config.toml 结构
脚本会写成下面这种结构:
cli_auth_credentials_store = "file"
model_provider = "newapi"
model = "gpt-5.4"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"
[model_providers.newapi]
name = "newapi"
base_url = "https://your-newapi.example.com/v1"
wire_api = "responses"
requires_openai_auth = true
[features]
apps = false使用方式
cd installer/codex-env
node cli.js \
--api-key sk-your-newapi-key \
--base-url https://your-newapi.example.com发布到 npm 后可直接这样用:
npx @coma111/ccapi --api-key sk-your-newapi-key --base-url https://your-newapi.example.com可选指定模型:
node cli.js \
--api-key sk-your-newapi-key \
--base-url https://your-newapi.example.com \
--model gpt-5.4可选指定 provider 名:
node cli.js \
--api-key sk-your-newapi-key \
--base-url https://your-newapi.example.com \
--provider my_newapi当前定位
这版是最小可用版,适合先验证:
- 当前
newapi渠道对 Codex 是否能直接跑通 base_url=/v1的兼容性是否正常- 用户本地的 Codex 配置是否能被这种方式稳定接管
如果你后面确认这条路没问题,再往里加:
- 自动安装
@openai/codex - 隐藏输入 API Key
- 交互式 prompts
- Windows 兼容增强
