An LLM API Call, in 4 GIFs

TL;DR AI
2 min readKey summary
A tutorial explains the basic structure of an LLM API request and response, from API key and system prompt to the messages array.
It highlights that chat APIs are stateless, so every request must include the context needed to continue the conversation.
The post breaks down tokenization, input vs. output token pricing, and how to estimate or control cost.
It also shows why production apps should log fields like stop_reason and usage to catch truncation and track spend.
The examples, including a Node.js agent and tool schemas, give developers a practical model for building reliable LLM apps.
