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

@botaoxyz/akm

v1.2.0

Published

Anthropic Key Management - CLI tool for managing Anthropic API keys and environments

Readme

akm - Anthropic Key Management

           █████
          ░░███
  ██████   ░███ █████ █████████████
 ░░░░░███  ░███░░███ ░░███░░███░░███
  ███████  ░██████░   ░███ ░███ ░███
 ███░░███  ░███░░███  ░███ ░███ ░███
░░████████ ████ █████ █████░███ █████
 ░░░░░░░░ ░░░░ ░░░░░ ░░░░░ ░░░ ░░░░░

一个用于管理 Anthropic API 密钥和环境变量的命令行工具。

简介

akm (Anthropic Key Management) 是一个轻量级的 CLI 工具,用于快速切换不同的 Anthropic 代理配置。它通过管理 ~/.claude/settings.json~/.claude/config.json 文件来设置环境变量和 API 密钥,让你能够轻松地在不同的 API 代理服务之间切换。同时支持 Claude Code 和 Claude Code for VS Code v2.0+ 插件。

特性

  • 🔐 管理多个 Anthropic API 代理配置
  • 🚀 快速切换不同的代理环境
  • 📝 简单易用的命令行界面
  • 🔒 使用文件锁确保配置安全
  • 🌐 支持连接性测试
  • 💻 同时兼容 Claude Code 和 Claude Code for VS Code v2.0+ 插件

安装

npm install -g @xes/akm

使用方法

总览

Usage: akm [options] [command]

Options:
  -v, --version                    display version number
  --verbose                        output extra debugging information
  --debug                          output complete debugging information (includes HTTP requests & response headers)
  --timeout <seconds>              override default timeout for test command (in seconds) (default: "10")
  -h, --help                       display help for command

Commands:
  ls|list                          list all proxy configurations with current marker
  add <name> <base_url> <api_key> [model] [small_model]  add a new proxy configuration
  use <name>                       switch to a specific proxy configuration
  unuse <name>                     stop using a specific proxy configuration
  del|delete <name>                delete a proxy configuration
  rename <name> <new_name>         rename a proxy configuration
  test <name>                      test connectivity to a proxy configuration
  help [command]                   display help for command

Examples:
  akm ls                           # list all configurations
  akm add kimi https://api.moonshot.cn/anthropic sk-xxx  # add new configuration
  akm add kimi https://api.moonshot.cn/anthropic sk-xxx kimi-k2-turbo-preview kimi-k2-turbo-preview  # add with models
  akm use kimi                     # switch to kimi (immediately effective)
  akm unuse kimi                   # stop using any proxy
  akm test kimi                    # test kimi connection
  akm del kimi                     # delete kimi
  akm rename kimi moonshot         # rename configuration

Global Options:
  --verbose                        Show detailed output
  --debug                          Show debug information including HTTP details
  --timeout <sec>                  Set timeout for test command (default: 10s)

添加代理配置

# 添加基本代理配置
akm add kimi https://api.moonshot.cn/anthropic sk-your-api-key

# 添加带模型配置的代理
akm add kimi https://api.moonshot.cn/anthropic sk-your-api-key kimi-k2-turbo-preview kimi-k2-turbo-preview

列出所有配置

akm ls

切换到指定代理

akm use kimi

停止使用当前代理

akm unuse kimi

测试代理连接

akm test kimi

删除代理配置

akm del kimi

重命名代理配置

akm rename kimi moonshot

配置文件

~/.claude/settings.json

Claude CLI 的配置文件,akm 会自动管理其中的环境变量:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.anthropic.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-xxxxx",
    "ANTHROPIC_MODEL": "kimi-k2-turbo-preview",
    "ANTHROPIC_SMALL_FAST_MODEL": "kimi-k2-turbo-preview"
  }
}

注意:ANTHROPIC_MODELANTHROPIC_SMALL_FAST_MODEL 仅在配置中提供了相应的模型参数时才会被设置。

~/.claude/config.json

Claude Code for VS Code 插件的配置文件,akm 会自动管理 API 密钥:

{
  "primaryApiKey": "sk-xxxxx"
}

从 v1.2.0 开始,akm 同时支持 Claude Code 和 Claude Code for VS Code v2.0+ 插件。执行 akm use 命令时会同时更新两个配置文件。

命令详情

| 命令 | 描述 | 示例 | | --- | --- | --- | | add <name> <url> <key> [model] [small_model] | 添加新的代理配置,可选择指定模型 | akm add proxy1 https://api.example.com sk-key model_id small_model_id | | ls | 列出所有配置,标记当前使用的 | akm ls | | use <name> | 切换到指定代理 | akm use proxy1 | | unuse <name> | 停止使用当前代理 | akm unuse proxy1 | | test [name] | 测试代理连接(默认测试当前代理) | akm test proxy1 | | del <name> | 删除指定配置 | akm del proxy1 | | rename <old> <new> | 重命名配置 | akm rename proxy1 proxy2 |

开发

环境要求

  • Node.js >= 18.0.0
  • pnpm(推荐)或 npm

开发命令

# 安装依赖
pnpm install

# 开发模式(监视文件变化)
pnpm dev

# 构建项目
pnpm build

# 运行测试
pnpm test

# 运行带覆盖率的测试
pnpm test:coverage

# 类型检查
pnpm typecheck

# 代码检查
pnpm lint

# 修复代码格式
pnpm lint:fix

# 格式化代码
pnpm format

项目结构

src/
├── index.ts        # CLI 入口,使用 commander 定义命令
├── actions.ts      # 所有命令的具体实现逻辑
├── config.ts       # ConfigManager - 管理 ~/.akmrc 配置文件
├── shell.ts        # ClaudeSettingsManager - 管理 ~/.claude/settings.json
├── services.ts     # API 服务,用于 akm test 命令
├── logger.ts       # 日志工具,基于 chalk
├── constants.ts    # 常量定义
└── types.ts        # TypeScript 类型定义

技术栈

  • 运行时: Node.js ≥ 18, TypeScript
  • CLI 框架: commander
  • 配置解析: ini
  • 终端样式: chalk
  • 文件锁定: proper-lockfile
  • 测试框架: vitest
  • 构建工具: tsdown
  • 代码检查: ESLint 9, typescript-eslint 8

错误处理

项目使用自定义的 AkmError 类统一处理错误,包含明确的退出码:

  • 0: 成功
  • 1: 参数错误/重名冲突
  • 2: 网络失败/API 失败
  • 3: 配置不存在
  • 4: 文件写入失败
  • 5: 未知异常

CHANGELOG

[1.2.0] - 2025-10-09

Added

  • 支持 Claude Code for VS Code v2.0+ 插件兼容性
  • 新增对 ~/.claude/config.json 文件的自动管理
  • 执行 akm use 命令时会同时更新 settings.jsonconfig.json 文件
  • config.json 中设置 primaryApiKey 字段,确保 VS Code 插件正常工作

Updated

  • 优化了 ClaudeSettingsManager 类,新增 updatePrimaryApiKey() 方法
  • 更新了 onUse() 命令逻辑,同时管理两个配置文件
  • 完善了文档说明,添加了 VS Code 插件兼容性的相关信息

[1.1.0] - 2025-08-25

Added

  • 支持可选的模型参数:akm add 命令现在接受可选的 [model][small_model] 参数
  • 新增环境变量 ANTHROPIC_MODELANTHROPIC_SMALL_FAST_MODEL 的自动管理
  • 模型配置会保存到 ~/.akmrc 配置文件中,并在使用时自动设置相应的环境变量
  • 向后兼容:现有配置不受影响,模型参数完全可选

Updated

  • 更新了所有相关文档,包括 README.md、设计文档和产品需求文档
  • 优化了代码结构以支持可选的模型配置
  • 更新了示例和帮助信息

[1.0.2] - 2025-07-24

Changed

  • 从 package.json 动态读取版本号,确保版本一致性
  • 优化版本管理机制

[1.0.1] - 2025-07-24

Changed

  • 将环境变量名称从 ANTHROPIC_API_KEY 更改为 ANTHROPIC_AUTH_TOKEN
  • 更新所有文档和代码中的环境变量引用
  • 添加向后兼容性处理,自动清理旧的 ANTHROPIC_API_KEY 配置

Updated Files

  • 源代码:constants.ts, shell.ts
  • 文档:README.md, CLAUDE.md, prd.md, design-doc.md

[1.0.0] - 2025-07-15

Added

  • 初始版本发布
  • 支持管理多个 Anthropic API 代理配置
  • 提供完整的 CLI 命令:add, use, unuse, del, rename, test, ls
  • 自动管理 ~/.claude/settings.json 文件
  • 支持连接性测试功能
  • 完整的文档和开发指南

许可证

MIT License