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

lemon-chat

v1.0.0

Published

Interactive CLI chat application powered by OpenAI API with streaming responses

Readme

Lemon Chat

一个简单但功能强大的交互式 CLI AI 聊天应用,支持流式响应和对话历史。

✨ 特性

  • 🚀 流式响应: 实时显示 AI 回复,无需等待完整响应
  • 💬 对话历史: 保持上下文,支持多轮对话
  • 🔧 灵活配置: 支持环境变量和命令行参数
  • 🎯 多 API 兼容: 支持 OpenAI 格式的任何 API 端点
  • 📝 自定义提示词: 可配置系统提示词
  • 简单易用: 安装即用,无需复杂配置

📦 安装

全局安装(推荐)

npm install -g lemon-chat

本地使用

npx lemon-chat

从源码运行

git clone https://github.com/yourusername/lemon-chat.git
cd lemon-chat
npm install
npm start

🚀 快速开始

1. 配置 API 密钥

方法一:环境变量

export OPENAI_API_KEY=your-api-key

方法二:使用 .env 文件

cp .env.example .env
# 编辑 .env 文件,填入你的 API 密钥

方法三:命令行参数

lemon-chat --api-key your-api-key

2. 运行聊天

# 使用环境变量或 .env 文件
lemon-chat

# 使用命令行参数
lemon-chat --api-key your-api-key

# 使用 .env 文件
lemon-chat --env

# 查看帮助
lemon-chat --help

📖 使用说明

基本交互

你: 你好!
助手: 你好!很高兴为你服务。有什么我可以帮助你的吗?

你: 请介绍一下你自己
助手: 我是一个友好的AI助手...

你: exit  # 或 quit
再见!

命令行选项

用法: lemon-chat [选项]

选项:
  --api-key, -k <key>      设置 OpenAI API 密钥
  --base-url, -u <url>     设置 API 基础 URL
  --model, -m <model>      设置使用的模型
  --system-prompt, -s <prompt>  设置系统提示词
  --env                    从 .env 文件加载环境变量
  --help, -h               显示帮助信息

配置示例

使用官方 OpenAI API:

export OPENAI_API_KEY=sk-...
export OPENAI_BASE_URL=https://api.openai.com/v1
export OPENAI_MODEL=gpt-4
lemon-chat

使用自定义 API 端点:

export OPENAI_API_KEY=your-key
export OPENAI_BASE_URL=https://api.xiaomimimo.com/v1
export OPENAI_MODEL=mimo-v2-flash
lemon-chat

自定义系统提示词:

lemon-chat -k your-key -s "你是一个专业的编程助手,专注于解答技术问题"

🔧 开发

项目结构

lemon-chat/
├── bin/
│   └── cli.js           # CLI 入口点
├── src/
│   └── chat.js          # 核心聊天逻辑
├── .env.example         # 环境变量示例
├── package.json         # 项目配置
└── README.md           # 说明文档

本地开发

# 安装依赖
npm install

# 测试 CLI
npm start

# 或直接运行
node bin/cli.js --api-key your-key

发布到 npm

# 登录 npm
npm login

# 发布
npm publish

📝 环境变量参考

| 变量名 | 说明 | 默认值 | |--------|------|--------| | OPENAI_API_KEY | API 密钥(必需) | - | | OPENAI_BASE_URL | API 基础 URL | https://api.xiaomimimo.com/v1 | | OPENAI_MODEL | 使用的模型 | mimo-v2-flash | | SYSTEM_PROMPT | 系统提示词 | 友好的AI助手提示 |

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📄 许可证

MIT License - 详见 LICENSE 文件

🔗 相关链接


提示: 请妥善保管你的 API 密钥,不要将其提交到版本控制系统中!