How Does AI Work? From the Moment You Press Enter to the Answer
What happens in the few seconds after you send ChatGPT, Claude or Gemini a question? Meet models, parameters, LLMs, tokens and APIs in plain English.
By: Milad Ebrahimpour5 min read

Key points
- A model is a very large file that was trained by seeing a huge amount of data. The settings inside it are called parameters.
- An LLM does not read the answer from somewhere; it guesses the next word. That is why it is sometimes wrong with complete confidence (hallucination).
- The token is the unit for counting text. Limits and prices are worked out in tokens, and Persian uses more tokens.
- An API is the way apps get your message to the model in the data centre and bring the answer back.
In this article
ChatGPT, Claude, Gemini. You probably talk to one of them every day: you type a question, press Enter, and a few seconds later the answer is in front of you. But what exactly happens in those few seconds? Where does your message go, who reads it, and where does the answer come from?
In this post we follow the path of one simple message, from the moment you press Enter to the moment the answer comes back. Along the way you will meet five ideas that the whole world of AI is built on: models, parameters and training, LLMs, tokens and APIs.
This post is the written version of part one of the “AI Fundamentals” series. If you would rather watch, the full video is here. The video lesson is recorded in Persian, with an English audio track on YouTube.
What does AI actually mean?
Artificial intelligence is a very big name. We call any system AI if it does a job that normally needs human intelligence, from a computer chess player to face recognition on your phone. You can picture it as a set of circles, one inside the other:
- Artificial intelligence (AI): the biggest circle.
- Machine learning: here, nobody tells the computer the rules one by one any more. We show it lots of examples and it finds the patterns itself.
- Deep learning: a part of machine learning that uses multi-layer neural networks, inspired by the brain.
- Generative AI: the newest circle. Models that do not only recognise things but make new ones: text, images, audio and video. ChatGPT, Claude and Gemini sit exactly here.
1. The model: the receiver of your message
You have sent your message. Who receives it? Something called a model. A model is really a very large file, the result of learning from a huge amount of data.
Imagine you have a machine with billions of tiny screws. At first all the screws are set at random and the machine only produces nonsense. Then you start showing it examples. Every time it gets something wrong, the screws move a tiny bit. This is repeated billions of times, until the machine gradually starts to answer correctly.
2. Parameters and training a model
Those screws are called parameters. When you hear that a model has, say, 70 billion parameters, it means 70 billion of those screws. The process of adjusting them is called training.
Training a large model can take months and needs thousands of graphics processors. But once it is finished, the result is a file that can answer your questions.
3. LLMs: guessing the next word
Models that work with language have a special name: LLM, or Large Language Model. There is a simple secret about them: what they fundamentally do is guess what the next word is.
Have you seen how your phone keyboard suggests the next word as you type? An LLM is the same idea, but trained on a huge amount of text from the internet, books and code.
For example, when you write “The capital of Iran…”, the model works out which word is most likely to come next. “Tehran” is very likely, so that is the one it picks. Then, with the new sentence, it guesses the next word again, and again and again. This is why answers appear on the screen word by word: the model really is building the answer piece by piece, right at that moment.
AI hallucination
There is an important point here. Because the model is looking for the most likely continuation, not necessarily the most correct one, it sometimes says something wrong with complete confidence. This is called hallucination. So always check the important things yourself once.
4. Tokens: the unit of everything
We said the model guesses the next word, but to be honest the model does not see “words” at all. Before your message reaches the model, it is broken into smaller pieces called tokens. A token can be a whole word, half a word, or even just a single letter or symbol.
Why does Persian use more tokens?
An interesting point for those of us who speak Persian: Persian text usually uses more tokens than the same text in English, because these models were trained mostly on English text and know the Persian pieces less well.
Why does this matter? Because the token is the unit of everything:
- The model's memory: every model has a “context window”, which is the maximum number of tokens it can keep in view at the same time. Some of today's models can fit up to about one million tokens. When a conversation gets very long and the model forgets what you said at the start, it has usually hit this limit.
- Cost: we will get to that in the next section.
5. APIs: the path from your phone to the data centre
So far your message has been turned into tokens and needs to reach the model. But how? The model sits on very powerful servers in the data centres of companies such as OpenAI, Anthropic and Google. Your message reaches it through something called an API.
Picture a restaurant. You are sitting at a table and the kitchen is somewhere else. You do not walk straight into the kitchen; you give your order to the waiter, the waiter takes it away and brings your food back. An API is that waiter: a standard way for one program to talk to another program.
The appealing part is that the ChatGPT app is not the only one using this waiter. Many of the apps you see these days that say they “have AI” did not build their own model; they connect to these same models through an API. You can too.
Pricing based on tokens
For this service, companies charge by the token: both the tokens you send and the tokens the model sends back. So remember that the token is both the model's memory and its unit of money.
Summary: the whole path in a few seconds
- You type your question and press Enter.
- Your text is turned into tokens.
- It reaches the server through an API.
- There, a large language model, with billions of parameters that were set during training, starts guessing the next token, one after another.
- The answer comes back along the same path token by token and appears on your screen.
Now that you know what goes on behind the scenes, the next step is to learn how to talk to these models better: What is a prompt, and how do you write a good one?


