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

apigather-act

v1.0.1

Published

Apigather API Activator for Claude Code & Codex (configurable verify URL)

Readme

apigather-activator

一个命令行激活器(bin:apigather),功能与 yunyi-activator 类似:验证 API Key 后,根据接口返回的 service_type 自动为 Claude CodeCodex CLI 写入本地配置。

本版本的特点:验证请求地址(verify URL)可配置

激活器逻辑(做了什么)

整体流程:

  1. 交互式输入 API Key(密码输入,不回显)。
  2. 验证 API Key:向 verifyUrl 发起 GET 请求,带 Authorization: Bearer <API Key>,要求返回 JSON。
  3. 解析返回的 service_type
    • claude:激活 Claude Code
    • codex:激活 Codex CLI
  4. 展示 Key 状态/配额/有效期等信息后二次确认。
  5. 写入本地配置并提示重启工具生效。

Claude Code(service_type = "claude"

通过定位 Claude Code 的 @anthropic-ai/claude-code/cli.js,在文件开头(跳过 shebang/注释/空行后)注入一段环境变量设置:

// APIGATHER_INJECTED_START
process.env.ANTHROPIC_BASE_URL="<baseUrl>/claude";
process.env.ANTHROPIC_AUTH_TOKEN="<API Key>";
// APIGATHER_INJECTED_END

如果之前已经注入过,会先移除旧的 APIGATHER_INJECTED_START ~ APIGATHER_INJECTED_END 区块再写入,避免重复。

Codex CLI(service_type = "codex"

写入/更新 Codex 配置目录 ~/.codex/

  • ~/.codex/config.toml:设置 model_provider = "apigather" 并写入 [model_providers.apigather]base_url="<baseUrl>/codex"wire_api="responses"temp_env_key="APIGATHER_API_KEY"model="gpt-5-codex" 等)。
  • ~/.codex/auth.json:写入 OPENAI_API_KEYAPIGATHER_API_KEY(值均为该 API Key)。

同样会清理旧的同名段落/标题与旧 model_provider 行,避免重复配置。

安装/运行

在本目录执行:

npm install
npm run build
node dist/index.js --help

或安装为全局命令(示例):

npm install -g .
apigather --help
# 或
apigather-activator --help

必要参数:verify URL(可配置)

验证地址用于校验 API Key,会发起:

  • GET <verify-url>
  • Header:Authorization: Bearer <API Key>

配置方式(推荐配置文件,之后无需每次输入参数):

  • 命令行:--verify-url https://example.com/user/api/v1/me
  • 构建配置:编辑 apigather.config.json 并重新执行 npm run build(若已全局安装过,需要重新 npm install -g .

apigather.config.json 示例:

{
  "verifyUrl": "https://example.com/user/api/v1/me",
  "baseUrl": "https://example.com"
}

中转 base URL(可选)

默认会从 verify-urlorigin 推导中转地址:

  • Claude:<origin>/claude
  • Codex:<origin>/codex

如需覆盖,可设置:

  • 命令行:--base-url https://example.com
  • 构建配置:apigather.config.json 中设置 baseUrl

参数优先级

运行时参数优先于构建默认值:

  1. 命令行 --verify-url/--base-url
  2. 构建配置 apigather.config.json(需要重新 npm run build 才会反映到 dist/index.js

发布到 npm(维护者)

  • 已配置 prepublishOnly:执行 npm publish 前会自动 npm run build,确保 dist/ 为编译产物。
  • repository/homepage/bugs 等字段需要你在仓库设置好远程地址后补齐(当前本仓库未配置 git remote origin)。