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

codex-endpoint-switcher

v1.6.4

Published

用于切换 Codex URL 和 Key 的本地网页控制台与 npm CLI

Readme

Codex Endpoint Switcher

用于切换 Codex 的 URLKey 和连接备注。

切换时只会更新:

  • ~/.codex/config.toml 中当前 model_provider 对应段落的 base_url
  • ~/.codex/auth.json 中的 OPENAI_API_KEY

其它 Codex 配置保持不变。

使用方式

1. 临时运行

如果这个包已经发布到 npm,可以直接:

npx codex-endpoint-switcher open

2. 全局安装

npm install -g codex-endpoint-switcher
codex-switcher open

3. 本地打包后安装

先在项目目录执行:

npm run pack:npm

然后安装生成的 .tgz

npm install -g .\codex-endpoint-switcher-1.0.0.tgz
codex-switcher open

CLI 命令

codex-switcher open
codex-switcher start
codex-switcher status
codex-switcher restart
codex-switcher stop
codex-switcher check-update
codex-switcher self-update
codex-switcher sync-server
codex-switcher install-access
codex-switcher remove-access

说明:

  • open:启动本地网页服务并打开浏览器
  • start:仅在后台启动本地网页服务
  • status:查看当前服务状态
  • restart:重启本地网页服务
  • stop:关闭本地网页服务
  • check-update:检查 npm 是否有新版本
  • self-update:自动更新 npm 包并自动重启控制台
  • sync-server:启动账号同步服务,服务端使用 SQLite 单文件数据库
  • install-access:创建桌面快捷方式和开机启动项
  • remove-access:移除桌面快捷方式和开机启动项
  • 启动器现在会优先记录并复用自己的 PID 文件,关闭和重启比之前更稳

网页地址

默认地址:

http://localhost:3186

说明:

  • 本地控制台和热更新代理默认只监听 127.0.0.1
  • 不再暴露到局域网,避免其他设备直接访问你的本地 Key 管理接口

账号配置同步

网页控制台现在支持“账号 + 密码”的同步方式。

1. 启动同步服务

在准备当服务端的机器上执行:

codex-switcher sync-server

或者:

npm run start:sync-server

默认会监听:

http://127.0.0.1:3190

默认数据库文件:

~/.codex-cloud-sync/cloud-sync.db

如果你要让局域网或公网机器访问,可以先设置:

set SYNC_SERVER_HOST=0.0.0.0
set SYNC_SERVER_PORT=3190
codex-switcher sync-server

2. 在网页控制台登录同步账号

在客户端网页控制台里填写:

  • 账号
  • 密码

然后:

  • 第一次使用点 注册账号
  • 后续使用点 登录账号

3. 推送和拉取

  • 推送当前连接:把本机保存的 URL / Key / 备注 上传到账号空间
  • 合并拉取:把账号空间里的连接合并到本机
  • 覆盖拉取:直接用账号空间里的连接替换本机连接列表

说明:

  • 拉取前会自动备份本机 ~/.codex/endpoint-presets.json~/.codex/endpoint-switcher-state.json
  • 服务端数据库是 SQLite,部署只需要一个 Node 进程和一个 .db 文件
  • /api/auth/register/api/auth/login 已内置限流与失败冻结,默认会在连续错误后短时封禁
  • Windows 客户端会优先用 DPAPI 加密本地同步令牌,不再把登录 token 明文写进 ~/.codex/cloud-sync-config.json

版本更新提示

  • 控制台打开后会自动检查 npm 最新版本
  • 如果你发布了新版本,其他用户打开控制台后会看到“发现新版本”的提示
  • 用户可以直接点 立即更新,程序会自动关闭、更新并重新打开
  • 也可以继续使用“复制升级命令”手动更新
  • 自动更新成功记录只会提示一次,失败记录会保留,方便排查问题

也可以用 CLI 手动检查:

codex-switcher check-update

或者直接自动更新:

codex-switcher self-update

更新 npm 包

先进入项目目录:

cd C:\Users\33825\Desktop\codex-profile-desktop

发布前先检查这次会打进 npm 包里的文件:

npm run release:check

如果只是小修复,直接发补丁版本:

npm run release:patch

如果是新增功能但兼容旧版:

npm run release:minor

如果有破坏性改动:

npm run release:major

说明:

  • release:patch 会自动把版本从 1.0.0 升到 1.0.1 这一类补丁版本,然后执行 npm publish
  • release:minor 会自动把版本从 1.0.0 升到 1.1.0 这一类功能版本,然后执行 npm publish
  • release:major 会自动把版本从 1.0.0 升到 2.0.0 这一类大版本,然后执行 npm publish
  • 如果 npm 开启了 2FA,发布时仍然会要求输入验证码