Most AI chat interfaces do the same thing: the user types a message, the LLM generates text, and it appears on screen. But the interesting pattern is when the LLM does something β calls an API, queries a database, runs a command β and then explains what happened. I built this pattern into AbiLens, a tool that lets you chat with any EVM smart contract. But the architecture generalizes to any external API. You can use the same approach to build a chat interface over a REST API, a database, a CLI tool, or any service with a programmatic interface. Here's how it works. The Architecture The flow has four steps: User sends a message LLM decides what API call to make (or responds directly if no call is needed) Your code executes the API call LLM explains the result to the user The key insight: the LLM never calls the API directly. It outputs a structured JSON object describing the call it wants to make. Your code validates and executes it. This keeps the LLM in a sandbox β it can only do what you allow.β¦