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

@tokencode/tokencode

v0.1.5

Published

Configure TokenCode for Claude Code, Codex, OpenCode, Hermes, and other AI coding tools.

Readme

@tokencode/tokencode

一键把 TokenCode 配置到 Claude Code、Codex、OpenCode、Hermes 等 AI 编程工具。

https://tokencode.dev

安装 / 运行

推荐直接用 npx 临时运行,无需全局安装:

npx --yes @tokencode/tokencode@latest

如果希望之后直接使用 tokencodetcdtkc 命令,可全局安装:

npm install -g @tokencode/tokencode
tokencode

界面预览

TokenCode CLI 启动界面

命令

| 命令 | 说明 | |------|------| | tokencode / tcd / tkc | 交互主菜单 | | tokencode --help / -h | 帮助 | | tokencode --lang en | 临时使用英文 |


语言设置

CLI 会按以下优先级决定显示语言:

  1. 命令行参数:--lang zh-CN / --lang en
  2. 环境变量:TOKENCODE_LANG=zh-CN / TOKENCODE_LANG=en
  3. 交互式主菜单中的 Language / 语言 设置
  4. 系统语言;无法判断时默认中文

只想临时切换语言时,可直接在命令里加参数:

tokencode --lang en --help
tokencode cc --lang en --show
TOKENCODE_LANG=en tokencode

如果希望以后默认使用某个语言,运行 tokencode 进入主菜单,选择 Language / 语言。该偏好会保存到 ~/.tokencode/config.json


已支持的应用与配置文件

本 CLI 会为不同工具写入对应配置文件(路径均在用户目录下)。

| 应用 | 子命令(别名) | 配置文件 | |------|----------------|----------| | Claude Code | ccclaude | ~/.claude/settings.json(环境变量:ANTHROPIC_AUTH_TOKENANTHROPIC_BASE_URLANTHROPIC_MODEL) | | Atomcode | atomcodeac | ~/.atomcode/config.toml | | OpenClaw | openclawoc | ~/.openclaw/openclaw.json(合并写入 TokenCode:models.providers.tokencodeagents.defaults.model.primary 等) | | Hermes | hermeshm | ~/.hermes/config.yamlmodel.providermodel.base_urlmodel.default)与 ~/.hermes/.envTOKENCODE_API_KEY) | | OpenCode | opencodeod | ~/.config/opencode/opencode.json(合并写入 TokenCode:provider.tokencode) | | Codex | codexcx | ~/.codex/config.tomlmodel_providermodel_providers.tokencodewire_api = "responses")与 ~/.codex/auth.jsonOPENAI_API_KEY) |

OpenClaw 会为 tokencode 提供方写入 baseUrlhttps://tokencode.dev/v1)、apiopenai-completions)、apiKeymodels,并把 agents.defaults.model.primary 设为 tokencode/<模型 ID>;其它顶级字段与其它 provider 保留不删(例如已有 channelsgateway)。Windows 下路径为 %USERPROFILE%\.openclaw\openclaw.json

Hermes 使用 TokenCode 时需 provider: custom,且 base_url 须带 /v1 后缀(本工具写入为 https://tokencode.dev/v1);密钥写入 .env 中的 TOKENCODE_API_KEY

OpenCode 会为 tokencode 提供方写入 npm@ai-sdk/anthropic)、baseURLhttps://tokencode.dev/v1,必须带 /v1)、apiKeymodels(自动拉取可用模型列表并生成配置);其它 provider 保留不删。配置文件支持 $schema 字段用于 IDE 提示。

Codex 会为 tokencode 提供方写入 base_url(默认 https://tokencode.dev/v1)与 wire_api = "responses"(不写 env_key)。API Key 写入 ~/.codex/auth.jsonOPENAI_API_KEY,Codex 命令行与 IDE 插件共用,无需再 export 环境变量。


快捷一键配置(非交互)

以下为各应用在命令行直接写入配置的用法。选项可单独或组合使用:--key / -k--url / -u--model / -m

Claude Code

tokencode cc --key   <api_key>
tokencode cc --url   <base_url>
tokencode cc --model <model_id>
tokencode cc -k <api_key> -u <base_url> -m <model_id>

示例:

tokencode cc -k sk-xxx
tokencode cc -k sk-xxx -u https://tokencode.dev -m claude-opus-4-5

Atomcode

tokencode atomcode --key <api_key>
tokencode ac --url <base_url>
tokencode ac --model <model_id>
tokencode ac -k <api_key> -u <base_url> -m <model_id>

OpenClaw

写入(或合并)~/.openclaw/openclaw.json 中的 TokenCode 配置:

tokencode openclaw --key <api_key>
tokencode oc --url <base_url>
tokencode oc --model <model_id>
tokencode oc -k <api_key> -u <base_url> -m <model_id>

Hermes

写入 model.defaultTOKENCODE_API_KEY,并强制 provider: custom 与 TokenCode base_url

tokencode hermes --key <api_key>
tokencode hm --url <base_url>
tokencode hm --model <model_id>
tokencode hm -k <api_key> -u <base_url> -m <model_id>

OpenCode

写入(或合并)~/.config/opencode/opencode.json 中的 TokenCode 配置:

tokencode opencode --key <api_key>
tokencode od --url <base_url>
tokencode od --model <model_id>
tokencode od -k <api_key> -u <base_url> -m <model_id>

提供 API Key 后会自动拉取完整模型列表并写入配置。配置格式兼容 Anthropic API,使用 @ai-sdk/anthropic SDK。

Codex

写入(或合并)~/.codex/config.toml 中的 TokenCode Responses API 配置:

tokencode codex --key <api_key>
tokencode cx --url https://tokencode.dev/v1
tokencode cx --model <model_id>
tokencode cx -k <api_key> -u https://tokencode.dev/v1 -m <model_id>

提供 API Key 后会自动拉取模型并写入 Codex profiles 与 tui.model_availability_nux,同时将 Key 写入 ~/.codex/auth.json

{
  "auth_mode": "apikey",
  "OPENAI_API_KEY": "<api_key>"
}

config.toml 中仍有旧版 env_key 行,请删除以免与 auth.json 冲突。

环境

Node.js >= 14.0.0 · MIT