b3-dict

中文文档
0.7.3发布于 2026/11/03ISCES Module

AI-first dictionary for the terminal: freeform EN/VI questions about words, answered in Vietnamese

原始使用文档
文档目录6 节
  1. Getting Started
  2. Seeing Fireworks costs in Langfuse
  3. Development
  4. Architecture
  5. Documentation
  6. License

B3 Dict

An AI-first dictionary for the terminal. Ask about English words, idioms, or usage in mixed Vietnamese/English; the answer comes back in Vietnamese. Freeform questions, not a bilingual lookup table: "is draggable a real word?", "take for granted nghĩa là gì?", or paste a joke and ask how to read it.

Getting Started

Needs Node 22 or newer and an API key from OpenRouter, OpenAI or Fireworks.

npm install
cp .env.example .env       # then paste your key into .env
npm run build
npm link                   # puts `b3dict` on your PATH

b3dict                     # interactive: type a question, press enter
b3dict "take for granted"  # one-shot: print the answer and exit
b3dict "Is draggable an English word?"
b3dict "they are your to decide if they are good to go"   # check a sentence you wrote
b3dict "Agreed or Agree? Approved or Approve?"            # which one to use
b3dict "take for granted" --fresh    # skip the stored answer, ask again
b3dict "draggable" --json            # raw answer envelope

Answers are stored in data/b3-dict.db, so asking the same thing twice costs nothing the second time. .env and data/ live in this folder no matter where you run b3dict from. settings.json sits next to .env once you pick a model in the TUI. Installed from npm instead of a checkout, they move to ~/.local/share/b3-dict (or $XDG_DATA_HOME/b3-dict); set B3_DICT_HOME to put them anywhere else.

Want to see what each call cost and how long it took? Put your own LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY and LANGFUSE_BASE_URL in .env and every model call shows up in your Langfuse project, question and answer included. b3dict ships no keys of its own, so without yours it sends nothing.

In the interactive screen, paste works for multiline questions. Once an answer is up: r asks again, s saves it to the wordbook, esc goes back, q quits. Press ↓ from the question box to reach History (everything you've asked) and Wordbook (what you starred); enter reopens a stored answer without calling the model, s stars or unstars the row. The same menu has Model, where you pick which model answers, and which provider when both keys are in .env (remembered next time, unless B3_DICT_PROVIDER or B3_DICT_MODEL is set), and Help, which lists the keys and where your files are. From the empty question box, esc or ctrl+c quits.

Seeing Fireworks costs in Langfuse

Traces arrive with token counts but an empty cost column for Fireworks models. Langfuse has no built-in price for them, so you add one yourself under Settings → Models in your Langfuse project. Two things go wrong easily:

  • Match the full model id. b3dict sends accounts/fireworks/models/minimax-m3, not minimax-m3. A pattern of (?i)^(minimax-m3)$ matches nothing and the cost stays empty.
  • Prices are per token, not per million. 0.3 means $0.30 for every token, which turns a tenth-of-a-cent lookup into hundreds of dollars.

For minimax-m3 at $0.30 in and $1.20 out per million tokens:

FieldValue
Match pattern(?i)^(accounts/fireworks/models/minimax-m3)$
input price0.0000003
output price0.0000012

Fireworks also reports cached prompt tokens under the usage key input_cached_tokens. Without a price row for that key those tokens count as free, so add one with Fireworks' cached rate for your model. Every other Fireworks model needs its own definition the same way; take the rates from the Fireworks pricing page.

A definition only prices traces that arrive after you save it. Older ones keep their empty cost.

Development

npm run typecheck          # Typecheck
npm run lint               # Lint
npm test                   # Run tests
npm run dev -- "<query>"   # Run from source without building
npm run typecheck && npm run lint && npm test && npm run build   # Before creating a PR

Architecture

useReducer-based Model → Update → View. State in a single reducer, components dispatch actions, side effects in useEffect. Mirrors Bubbletea's discipline in a React idiom.

Documentation

License

ISC

版本与发布记录

b3-dict 共发布 12 个版本,首次发布于 2026/10/07;过去 12 个月发布了 12 个版本。

版本发布日期距今
0.7.3latest2026/11/03今天
0.7.22026/11/021 天前
0.7.02026/10/2311 天前
0.6.02026/10/2311 天前
0.5.02026/10/1915 天前
0.4.22026/10/1221 天前

关于 b3-dict 的常见问题

b3-dict 是什么?

AI-first终端词典:自由格式的EN/VI单词问题,以越南语回答

如何安装 b3-dict?

在项目目录运行 npm install b3-dict,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 b3dict,可以用 npx b3dict 直接运行。

b3-dict 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/b3-dict 是否存在。

b3-dict 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

b3-dict 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

b3-dict 可以商用吗?

b3-dict 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

b3-dict 还在维护吗?

最新版本 0.7.3 发布于 2026/11/03(今天);至今共发布 12 个版本,其中过去 12 个月发布了 12 个;首次发布于 2026/10/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。