Notion2api
Description
将 Notion AI 接口转换为 OpenAI/Anthropic 兼容格式的代理服务。提供 Claude Code 支持。
Installation
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open the source below and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
README
Notion2API
将 Notion AI 封装为 OpenAI 兼容 API 的本地代理服务
Notion2API 通过逆向 Notion 内置 AI 接口,将其包装为标准的 OpenAI 兼容 API,让你无需付费订阅任何 AI 服务,即可在 Cherry Studio、Zotero、Claude Code 等主流客户端中直接使用 Claude、GPT、Gemini 等顶级模型。
功能特性
- OpenAI 兼容 — 标准
/v1/chat/completions接口,无缝接入主流客户端 - Anthropic 兼容 — 额外支持
/v1/messages,可供 Claude Code 等原生 SDK 直接使用 - 流式响应(SSE) — 实时逐字输出,体验流畅
- Thinking 面板 — 支持所有模型展示推理过程
- 网络搜索 — 支持展示 AI 的 Web 搜索来源
- 多账号池 — 多账号轮询负载均衡,自动故障转移
- 三种运行模式 — Lite / Standard / Heavy,按需选择
三种模式对比
| 特性 | Lite | Standard | Heavy |
|---|---|---|---|
| 记忆管理 | ❌ 无 | ✅ 客户端管理 | ✅ 服务端 SQLite |
| 数据库 | ❌ 不需要 | ❌ 不需要 | ✅ SQLite |
| Thinking 面板 | ❌ | ✅ | ✅ |
| 搜索结果 | ❌ | ✅ | ✅ |
| 速率限制 | 30次/分 | 25次/分 | 20次/分 |
| 适用场景 | 简单问答 | 中短期对话 | 长期记忆对话 |
修改 `.env` 中的 `APP_MODE` 变量即可切换模式,**推荐日常使用 `standard`**。
快速开始
第一步:获取 Notion 凭据
你需要一个已订阅 Notion AI 的账号(或处于 AI 试用期的账号)。
- 打开浏览器,访问 https://www.notion.so/ai 并登录
- 按
F12打开开发者工具
**获取 `token_v2`:**
- 切换到 Application(应用程序)标签
- 左侧展开 Storage → Cookies → https://www.notion.so
- 找到名为
token_v2的条目,复制其 Value(值)
**获取其他字段(space_id、user_id 等):**
- 切换到 Console(控制台)标签
- 将
scripts/extract_notion_info.js文件中的代码完整粘贴进去,回车运行 - 脚本会自动输出一段 JSON,将其中的
YOUR_TOKEN_V2_HERE替换为上一步复制的token_v2值 - 复制完整输出,备用
第二步:配置 `.env` 文件
打开项目根目录的 `.env` 文件,填入你的凭据:
# 将上一步获取的 JSON 粘贴到这里(保留外侧的单引号)
NOTION_ACCOUNTS='[{"token_v2":"你的token","space_id":"你的space_id","user_id":"你的user_id","space_view_id":"你的space_view_id","user_name":"你的名字","user_email":"你的邮箱"}]'
# 运行模式,推荐 standard
APP_MODE=standard
**如果使用 Heavy 模式**,还需额外配置(用于对早期对话进行摘要压缩):
- 前往 https://siliconflow.cn 免费注册,获取 API Key
- 填入
.env:SILICONFLOW_API_KEY=你的SiliconFlow_API_Key APP_MODE=heavy
第三步:安装依赖并启动
# 1. 安装 Python 依赖(首次运行时执行)
pip install -r requirements.txt
# 2. 启动服务
uvicorn app.server:
Related Skills
Agency Agents
A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy inject
AI Firecrawl
🔥 The API to search, scrape, and interact with the web for AI
AI Artifacts Builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web tech
AI CrewAI
Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewA
AI TrendRadar
⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的
AI mem0
| Universal memory layer for AI Agents | 51341 | 221 | 1 |
AI