npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

create-codex-config

v1.0.1

Published

Interactive npm CLI for updating local Codex base URL and API key.

Readme

create-codex-config

一个零依赖的 npm 命令行工具,用来修改本机 Codex 的两项关键配置:

  • auth.json 里的 OPENAI_API_KEY
  • config.toml 里的 base_url

现在还额外支持一键测试连通性,检查当前配置是否真的能请求到 Codex,并明确识别:

  • 是否可以正常对话
  • 是否返回 429
  • 是否返回 503

配置文件位置

默认情况下,Codex 配置目录是:

~/.codex

这个工具会修改:

~/.codex/auth.json
~/.codex/config.toml

不同系统下,默认目录通常对应为:

  • Windows: C:\Users\用户名\.codex
  • macOS: /Users/用户名/.codex
  • Linux: /home/用户名/.codex

如果设置了环境变量 CODEX_HOME,工具会优先使用 CODEX_HOME

使用方式

发布到 npm 后,用户可以直接运行:

npm create codex-config@latest

或者:

npx create-codex-config@latest

本地调试

在当前项目目录执行:

npm link

安装后可以直接运行:

codex-config

也可以运行:

create-codex-config

交互菜单

运行后会看到以下功能:

  1. 查看当前配置
  2. 更新 API 地址和 SK 密钥
  3. 仅更新 API 地址
  4. 仅更新 SK 密钥
  5. 测试连通性
  6. 退出

非交互用法

查看当前配置:

codex-config --show

测试当前配置是否能访问 Codex:

codex-config --test

测试结果会明确告诉你:

  • 是否请求成功
  • 是否已经拿到对话响应
  • 是否返回 429
  • 是否返回 503
  • 是否是鉴权失败或网络失败

一次性更新地址和密钥:

codex-config --set --url https://your-api-host --key sk-xxxx

只更新地址:

codex-config --set-url https://your-api-host

只更新密钥:

codex-config --set-key sk-xxxx

连通性测试说明

--test 会读取当前配置中的:

  • base_url
  • OPENAI_API_KEY
  • model

然后向 ${base_url}/responses 发起一次最小请求,验证当前接口是否真的可用。

成功时会显示返回文本;失败时会尽量区分:

  • 429: 请求过多或触发限流
  • 503: 服务暂时不可用
  • 401/403: 鉴权失败
  • network_error: 网络不通或接口地址不可达
  • timeout: 15 秒内未返回

说明

  • 默认读取 CODEX_HOME;如果没有设置,则使用 ~/.codex
  • 写入前会自动备份原始文件到 ~/.codex/backups/codex-config-cli/
  • 如果 config.toml 里不存在 [model_providers.custom],工具会自动补齐
  • 适用于 Windows、macOS 和 Linux

发布到 npm

首次发布前先登录:

npm login

然后发布:

npm publish --access public

发布完成后,用户即可执行:

npm create codex-config@latest

说明:

  • npm create codex-config 实际执行的是 npm 包 create-codex-config
  • 如果包名已被占用,需要改成你自己的唯一名字,例如 create-huaji-codex-config