Use AI with APIs and documentation without hallucinated methods
Hallucinated functions are the classic AI coding bug.
What to do
- Paste the relevant section of official docs into the prompt.
- Pin the library version.
- Ask the bot to cite which doc section each call comes from.
- Run it; type checkers and linters catch many invented methods.
Copy this prompt
Using ONLY the documentation pasted below (version [x]), write code to [task]. If the docs don't cover something, say so instead of guessing.
Docs:
[paste]Check the bot's work
Check every method name in the official reference.
Questions
Can I trust the bot on apis and docs?
Use it to plan and explain, then verify. Check every method name in the official reference.
Which bot works best?
Grok Bot, ChatGPT, Claude and Gemini all handle this prompt. Paste the same prompt into two and compare; disagreements show where to check a source.
Where these facts come from
- OWASP Top 10
- CISA: Secure by Design
- GitHub Docs: Secret scanning
- W3C: WCAG overview
- Open Source Initiative: Licenses
- NIST SP 800-218: Secure Software Development Framework
Tools, features and prices change often. We don't list prices; check each vendor's official pricing page. Never paste secrets into a prompt. Checked Oct 30, 2026.
Coding with bots · Agents, tools and setup: all lessons → Next: Data analysis code →