Build it in your project
Paste this line into your agent (Claude Code, Codex, Cursor, OpenCode, Cline). It sets up your key, then builds the pipeline in your project:The code
One file per language. Both readRUNCRATE_API_KEY from the environment; nothing secret is in the code.
What the proof run cost
The Python file on Runcrate’s own docs (83 pages, 538 sections) with three questions: two the docs answer and one they do not. Measured on 2026-10-23 againstapi.runcrate.ai; costs are what the account was billed, read from each response’s X-LLM-Cost header or usage.cost.
The TypeScript file: the same 538 sections in 16.9 s for $0.0014, the same citations. Both answered the off-topic question (“What is the capital of France?”) with “the sources do not answer this”.
Scale it
- Keep the index fresh with the nightly embed recipe.
- More than a few thousand sections: move the vectors into a vector database; the embedding calls stay the same.
- Other languages: bge-m3 is multilingual, so the same index answers questions asked in another language.
Gotchas found in the proof run
- Similarity alone does not tell you the docs cover a question: “What is the capital of France?” scored 0.59 because a code sample in the docs uses it as a prompt. The model’s refusal to answer without a source is the guard that worked; the 0.45 floor only catches the obvious misses.
- Strip MDX
importlines and front matter before embedding, or every section starts with the same boilerplate and retrieval gets worse. - Send up to 64 inputs per embeddings request: 538 sections took 9 requests.