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 🙏

© 2025 – Pkg Stats / Ryan Hefner

aihezu

v2.5.0

Published

AI 开发环境配置工具 - 支持 Claude Code, Codex, Google Gemini 的本地化配置、代理设置与缓存清理

Readme

aihezu - Claude Code CLI 工具集

快速配置或清理 Claude Code / Codex,本地修改 hosts 并提供企业独立域名支持。

功能特性

  • 🔑 一键配置 Claude(默认)或 Codex,支持企业独立域名(--api / --api-url
  • 🧹 一键清理 Claude Code CLI 的所有本地数据
  • 🌐 自动修改 hosts 文件,将 Anthropic 域名指向本地
  • 📦 自动备份配置文件和 hosts 文件(带时间戳)
  • ✅ 安全可靠,不会丢失数据
  • 🚀 支持 npx 直接运行,无需安装
  • 🔄 自动刷新 DNS 缓存

命令列表

  • ccinstall / install:交互式配置 Claude(默认)或 Codex
    • Claude:默认 https://cc.aihezu.dev/api,企业可用 --api / --api-url 指定独立域名
    • Codex:默认 https://cc.aihezu.dev/openai,企业可用 --api / --api-url 指定独立域名;写入 ~/.codex/config.tomlauth.json,使用 AIHEZU_OAI_KEY
  • ccclear:清理 Claude Code 缓存和配置
  • ccusage:查看 Claude Code API 用量统计(读取 ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN

清理内容

该工具会执行以下操作:

1. 修改 hosts 文件

  • statsig.anthropic.com 指向 127.0.0.1
  • api.anthropic.com 指向 127.0.0.1
  • 如果已存在这些域名的解析,会先移除旧记录再添加新记录
  • 自动备份 hosts 文件(带时间戳)
  • 自动刷新 DNS 缓存

2. 清理 Claude Code 配置

  • ~/.claude/ - Claude Code 主数据目录(包括缓存、历史、项目等)
  • ~/.claude.json - Claude Code 全局配置文件

使用方法

⚠️ 重要提示:由于需要修改系统 hosts 文件,必须使用管理员权限运行!

配置 Claude Code(ccinstall / install)

  • 默认域名:
sudo npx aihezu install
  • 企业独立域名(支持传入域名或完整 URL,自动补全为 /api):
sudo npx aihezu install --api https://your-org.aihezu.dev
# 或
sudo npx aihezu install --api your-org.aihezu.dev

也可以全局安装后运行:

npm install -g aihezu
sudo ccinstall --api your-company.aihezu.dev
  • 直接选择 Codex(可在交互中选择,也可用参数指定):
sudo npx aihezu install --provider codex
# Codex 企业独立域名(自动补全为 /openai)
sudo npx aihezu install --provider codex --api your-org.aihezu.dev

清理 Claude Code(ccclear)

  • 使用 npx(推荐):
sudo npx aihezu ccclear
  • 全局安装后运行:
npm install -g aihezu
sudo ccclear

查看 Claude Code 用量(ccusage)

无需管理员权限:

npx aihezu ccusage

运行效果

🧹 Claude Code CLI 清理工具
🌐 Powered by https://aihezu.dev

=== 步骤 1: 修改 hosts 文件 ===

🔧 开始修改 hosts 文件...
📦 已备份 hosts 文件到 /etc/hosts.backup-20250113120000
✅ hosts 文件修改成功!
   已添加/更新以下域名解析:
   - statsig.anthropic.com -> 127.0.0.1
   - api.anthropic.com -> 127.0.0.1
🔄 DNS 缓存已刷新

=== 步骤 2: 清理 Claude Code 配置 ===

📦 备份 ~/.claude 到 .claude-20250113120000
📦 备份 ~/.claude.json 到 .claude.json-20250113120000

✅ Claude Code CLI 配置和缓存已清理完成!
💡 下次启动 Claude Code 时将重新初始化
📁 备份文件保存在 /Users/yourname/ 目录下

=== 全部完成 ===
更多服务请访问 AI 合租官网:https://aihezu.dev

恢复备份

恢复 Claude Code 配置

如需恢复之前的配置,只需将备份文件重命名:

# 恢复目录
mv ~/.claude-20250113120000 ~/.claude

# 恢复配置文件
mv ~/.claude.json-20250113120000 ~/.claude.json

恢复 hosts 文件

# macOS/Linux
sudo mv /etc/hosts.backup-20250113120000 /etc/hosts

# Windows (以管理员身份运行)
move C:\Windows\System32\drivers\etc\hosts.backup-20250113120000 C:\Windows\System32\drivers\etc\hosts

使用场景

  • Claude Code CLI 出现异常需要重置
  • 需要通过本地代理使用 Claude API
  • 清理大量累积的缓存和日志
  • 切换不同的配置环境
  • 重新初始化 Claude Code CLI

工作原理

  1. hosts 文件修改:将 Anthropic 相关域名指向本地 127.0.0.1,配合本地代理使用
  2. 配置清理:备份并清理 Claude Code 的配置和缓存
  3. 安全备份:所有修改前都会创建带时间戳的备份文件

系统要求

  • Node.js >= 14.0.0
  • macOS / Linux / Windows
  • 需要管理员/root 权限(用于修改 hosts 文件)

许可证

MIT

问题反馈

如有问题或建议,欢迎提 Issue。