关于 reddit-api
reddit-api 是面向 Agent 的 Reddit 数据 API,可搜索帖子、社区和用户,并读取动态、评论树及个人资料。它通过按次付费的 HTTP GET 提供数据,也可通过 MCP 调用。
主要功能
- 01跨 subreddit 搜索帖子
- 02搜索 subreddit 和用户
- 03读取社区信息与动态
- 04获取帖子及完整评论树
- 05查看全站动态和用户内容
适用场景
- 01查找多个 subreddit 中某主题的热门帖子
- 02分析单篇帖子的讨论和回复
- 03检查用户资料、帖子与评论
MCP 相关
提供 MCP 端点,客户端可使用 fetch_data 调用数据接口,也可使用 reddit_search_post 快捷工具;支持预付额度或 x402 按次支付。
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ fetcher-sh/ fetcher-skills --skill reddit-api安装后在 Claude Code 中输入/reddit-api确认已加载。
详细介绍
Reddit API
按需获取 Reddit 数据:跨 subreddit 帖子搜索、subreddit 和用户搜索、subreddit 信息和动态、包含完整评论树的单篇帖子、全站最佳/热门/最新/置顶动态,以及用户资料/帖子/评论——每次调用只需发送一个普通 HTTP GET 请求,按量付费。无需注册 OAuth 应用,无需客户端 ID/密钥对,也不受 Reddit API 速率限制等级限制。
基础 URL:https://reddit.fetcher.sh
身份验证
两种付费方式,数据相同——完整机制见 fetcher
技能:
# 1. Prepaid credits (recommended — get a key at https://fetcher.sh/topup
# or via POST /api/credits/topup, see the fetcher skill)
export FETCHER_API_KEY="bby_live_xxxxxxxxxxxx"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://reddit.fetcher.sh/api/search/post?keyword=hello"
# 2. x402 pay-per-call — omit the header; a GET with no payment returns 402
# with machine-readable payment requirements (USDC on Base, Polygon,
# Arbitrum, Monad, or Solana). @x402/fetch signs and retries automatically.
每个响应均为 { "status": number, "message": string, "data": ... };HTTP 状态码与 status 一致。
端点(15 个——全部为 GET,每次调用 $0.002)
| 端点 | 返回内容 |
|---|---|
/api/search/post | 所有 subreddit 中匹配关键词的帖子 |
/api/search/subreddit | 匹配关键词的 subreddit |
/api/search/user | 匹配关键词的用户 |
/api/subreddit/{name} | subreddit 的信息 |
/api/subreddit/{name}/posts | subreddit 的帖子动态 |
/api/post/{id} | 单篇帖子 |
/api/post/{id}/comments | 帖子的评论树 |
/api/post/{id}/comments/{commentId}/replies | 对某条评论的回复 |
/api/posts/hot | 全站热门动态 |
/api/posts/new | 全站最新动态 |
/api/posts/top | 全站置顶动态 |
/api/posts/best | 全站最佳动态 |
/api/user/{username} | 用户资料 |
/api/user/{username}/posts | 用户的帖子 |
/api/user/{username}/comments | 用户的评论 |
{id}/{name}/{username} 是路径参数。可选的 sort/
cursor 用于重新排序和分页;出现 keyword 的地方都必须提供(搜索)。
使用场景
跨所有 subreddit 搜索某个主题的热门帖子:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
--data-urlencode "keyword=ai agents" -G \
--data-urlencode "sort=top" \
"https://reddit.fetcher.sh/api/search/post"
讨论最多(评论数最高):
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
--data-urlencode "keyword=stablecoin payments" -G \
--data-urlencode "sort=comments" \
"https://reddit.fetcher.sh/api/search/post"
按最新顺序排列:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
--data-urlencode "keyword=x402" -G \
--data-urlencode "sort=new" \
"https://reddit.fetcher.sh/api/search/post"
/api/search/post 的其他 sort 值:relevance、hot。
按关键词搜索 subreddit 或用户:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
--data-urlencode "keyword=machine learning" -G \
"https://reddit.fetcher.sh/api/search/subreddit"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
--data-urlencode "keyword=spez" -G \
"https://reddit.fetcher.sh/api/search/user"
获取 subreddit 信息,然后获取其热门/最新/置顶动态:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://reddit.fetcher.sh/api/subreddit/MachineLearning"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
--data-urlencode "sort=top" -G \
"https://reddit.fetcher.sh/api/subreddit/MachineLearning/posts"
获取单篇帖子、其评论树,以及对某条评论的回复:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://reddit.fetcher.sh/api/post/1abcde2"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
--data-urlencode "sort=top" -G \
"https://reddit.fetcher.sh/api/post/1abcde2/comments"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://reddit.fetcher.sh/api/post/1abcde2/comments/fghij3k/replies"
全站动态:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://reddit.fetcher.sh/api/posts/hot"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://reddit.fetcher.sh/api/posts/best"
获取用户资料、帖子和评论:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://reddit.fetcher.sh/api/user/spez"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
--data-urlencode "sort=new" -G \
"https://reddit.fetcher.sh/api/user/spez/posts"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
--data-urlencode "sort=top" -G \
"https://reddit.fetcher.sh/api/user/spez/comments"
MCP
{
"mcpServers": {
"reddit": {
"url": "https://reddit.fetcher.sh/mcp",
"headers": { "Authorization": "Bearer bby_live_..." }
}
}
}
免费:search_endpoints、describe_endpoint、check_balance。付费:
fetch_data(上方的任意端点)、topup_credits,以及名为 reddit_search_post 的快捷工具。删除 headers 块即可改用 x402 按次付费——完整流程见 fetcher 技能。
错误
400— 缺少或参数无效(消息会指出参数名)401— 密钥未知或已轮换402— 需要付款(x402 challenge)或topup_required(额度已用尽)404— 不是定价路径- 不设速率限制;上游失败不退款(结算先于交付)
参考资料
- 完整的 Agent 设置指南:https://reddit.fetcher.sh/skill.md
- OpenAPI 3.1 合约:https://reddit.fetcher.sh/openapi.json
- 精简目录:https://reddit.fetcher.sh/llms.txt
- 付款、额度和 MCP 深入介绍:
fetcher技能 - 网站:https://reddit.fetcher.sh