我构建了一个 API,让 LLM 能够即时访问 1000 个库的文档。

1作者: riskofcollision7 个月前
嗨 HN, 我构建了 CodeContext API (https://codecontext-api-production.up.railway.app) 来解决我在构建 AI 编程助手时反复遇到的一个问题:知识截止。 我的助手们总是会凭空捏造 LangChain 或 Next.js 等库的 API,因为它们的训练数据已经过时了。每次请求都手动抓取文档网站既慢又贵(token 会累积!)。 CodeContext API 是一个针对 1000 多个流行库的文档的语义搜索层。 输入:{"query": "react hooks"} 输出:包含最相关代码片段和解释的干净 JSON。 延迟:亚秒级(针对 RAG 优化)。 为什么要使用它? 节省 Token:不要将整个手册都塞进上下文。只获取您需要的内容。 准确性:为您的助手提供来自最新版本的实际文档。 速度:无需构建/维护您自己的抓取器。 主页上有一个实时演示(无需注册),如果您想测试延迟,可以试试。 我很乐意听取您对 API 结构的反馈,以及您希望看到索引的其他库!
查看原文
Hey HN,<p>I built CodeContext API (https:&#x2F;&#x2F;codecontext-api-production.up.railway.app) to solve a problem I kept hitting while building AI coding agents: The Knowledge Cutoff.<p>My agents kept hallucinating APIs for libraries like LangChain or Next.js because their training data was stale. Scraping documentation sites manually for every request was slow and expensive (tokens add up!).<p>CodeContext API is a semantic search layer over the documentation of 1000+ popular libraries.<p>Input: {&quot;query&quot;: &quot;react hooks&quot;} Output: Clean JSON with the most relevant code snippets and explanations. Latency: Sub-second (optimized for RAG). Why use this?<p>Save Tokens: Don&#x27;t dump the whole manual into the context. Fetch only what you need. Accuracy: Give your agent the actual docs from the latest version. Speed: No need to build&#x2F;maintain your own scrapers. There is a Live Demo on the homepage (no signup required) if you want to test the latency.<p>I&#x27;d love your feedback on the API structure and what other libraries you&#x27;d like to see indexed!