What Actually Happens When Your Code Talks to an AI Model
A plain-language walkthrough of the request loop, what you pay for, why keys matter, how tokens and context work, and what common settings like temperature actually change.

A plain-language walkthrough of the request loop, what you pay for, why keys matter, how tokens and context work, and what common settings like temperature actually change.

An AI call is a standard HTTPS request: your code sends JSON with text and a key, the model replies with JSON and a receipt that lists token usage and cost.
API keys are both identity and payment: anyone who holds a valid key can spend your account balance, so store keys in secrets managers, rotate them, and use spending limits for experiments.
One model billed 497 output tokens for 283 characters of visible text, because 445 of those tokens were invisible reasoning. The same question cost 170x more on the priciest model than the cheapest, in the same minute. Temperature changes how surprising the wording is, not how smart the answer is, and a caching layer can make it look like it does nothing at all.
That gap is worth closing, because almost every decision you will make later depends on it. The model lives on someone else's hardware, and you are renting a few seconds of its attention. Four things in that loop are worth understanding properly, because they are the four things that will confuse you later: the key, the tokens, the context window, and the settings.
Context window is working memory for one request, not knowledge. Go over it and you get a hard error, not a polite summary. Ends with: you making one call yourself and reading the receipt.

How does ChatGPT search the web when the model can't open a connection? Tool calling explained: the model asks, the application runs the search.

A language model cannot check your disk usage or query your database on its own. Function calling is the mechanism that changes that, and it takes about forty lines of Python to build.
When teams first integrate large language models (LLMs) into their software platforms, the initial experience often feels surprisingly simple. A developer writes a few lines of code, sends a prompt to a model API, and receives a response that looks intelligent, contextual, and almost magical. A prototype can be built i

When an agentic AI system hands a task from a small model to a larger one — or back down again — it pays a steep tax: the receiving model has to recompute the entire conversation from scratch, driving up compute costs and latency. This is a major bottleneck for enterprises building long-horizon, multi-LLM workflows. To

Part 2 of a series on building an AI-native platform. This one is about the thing that actually determines output quality — and a feature we shipped because of it. The determinism gap Code is deterministic. Same input, same output, every time. That property is the whole reason we can test it, cache it, and reason about

A chatbot is a loop that resends the entire conversation on every turn. Build one in stages and every design decision, every cost, and every strange behaviour you have met makes immediate sense.
Loading more related stories...
Open the app view to save this story, compare related coverage, and continue from the same source.