AI Tools for Developers: Five Kinds, Tokens, Context and the Shape of a Model Call
An LLM is an engine; chat apps, code assistants, app builders, terminal agents and local models are the vehicles. Sort the tools by where they sit and what they see, then learn tokens, context and the shape of a model call with small runnable Python files.
What you will learn
- Tell the model (the engine) from the tool built around it
- Place AI developer tools in five groups and pick one by the job
- Explain tokens and context in plain words, and why a long chat fills the context
- Read the shape of a model call: messages in, text out, history kept by you
Before you start
- Basic Python functions, lists and dictionaries
- Prompting fundamentals for code
You've already been prompting an AI tool and checking what it gives you. Now let's look at the whole picture, because there are many tools and they don't all do the same job. One rule stays with us throughout: AI writes quickly, and you still read and judge it.
An engine and its vehicles
LLM stands for large language model. It's been trained on a huge amount of text, so it's good at working out which words should come next. Think of it as an engine. An engine on its own won't take you anywhere, so companies build vehicles around it: a chat window, an editor plugin, a Terminal program. The same engine can sit inside different vehicles, which is why you'll see one model offered in several tools.
So there are two separate questions: which model, and which tool. This article is about the tool, because models change all the time. (For what the engine itself can and can't do, see what an LLM can and cannot do.)
Five groups of tools
Chat apps
You type a question and an answer comes back. Most take images and files too (that's called multimodal), many can search the web, and some can run code to analyse data and draw a chart. Perplexity searches the web and answers with its sources; Claude lets you pick which model answers, even on the free plan. Most ask you to sign in, so keep one account per tool. The limit: a chat app can't see your project. You copy code across, paste the answer back, and do that again and again.
Code assistants
That copying is what code assistants remove. They work inside your editor: as you type, a suggestion appears in the line, and you accept or ignore it. You can ask a question beside your code, and the assistant can look at your open files. Cursor is a whole editor built around AI; others plug into the editor you already use. You're still driving, line by line.
App builders
You describe an application in a few prompts and it generates the whole thing: files appear, a page appears, and you can click around quite quickly. Great for a prototype or a first version to show someone, but not the place to keep a large professional app. The usual path is to download the code, open it in your editor, and carry on with a code assistant. And you still have to read that code, because now it's yours.
Terminal agents
You start one in the Terminal, inside your project folder, and give it a whole task, like "add a search option to this app". It reads your files, edits them, runs a command, looks at the result, and goes round again until the task is done. These tools usually ask permission before changing things or running commands, and you decide what to allow. An assistant helps with the line you're on; an agent takes on a task. Agentic coding goes into this properly.
Open source and local models
Here the model itself is published, so you can download it and run it on your own machine. Think of a film file and a media player: the models are the film files, and Ollama is the player, a runtime for local models. People often mix this up, so remember: Ollama isn't a model. Once set up, your question stays on your machine, with no key and no internet. The catch is hardware. On an ordinary laptop a strong model can be slow, and the answers can be weaker than hosted tools. For most people, a hosted tool is the easier start.
Tokens and context
Two words come up with every one of these tools. A model doesn't read whole sentences; it reads small pieces of text called tokens. Here's a rough stand-in:
# A rough stand-in: real tools count tokens
# with their own rules, so treat this as a guide.
text = "Explain Python decorators in plain words"
pieces = text.split()
print(pieces)
print("rough pieces:", len(pieces))
['Explain', 'Python', 'decorators', 'in', 'plain', 'words']
rough pieces: 6
Real tools count with their own rules, and one long word can become several tokens. It matters because limits and usage are measured in tokens, and a longer prompt uses more of them.
Context is everything the model can see at one time, and it has a limit. Think of a desk where only so many papers fit. Here the limit is twelve words, just to keep it small:
# Context: all the model can see at once.
LIMIT = 12
history = ["What is a list?", "An ordered group."]
question = "Show me one with three numbers"
sent = history + [question]
words = 0
for m in sent:
words += len(m.split())
print("words sent:", words)
print("fits:", words <= LIMIT)
words sent: 13
fits: False
Old messages, pasted code and your question all share the same desk. Real limits are far bigger and counted in tokens, but when the desk is full, something has to go. Tokens, context windows and cost follows a real question through all of this with real token counts.
The shape of a model call
We won't use a paid service or a key here. This is a small local stand-in that only copies the shape:
def fake_model(messages):
"""A local stand-in. No network, no key."""
last = messages[-1]["content"]
return "Stand-in reply to: " + last
It takes a list of messages, each a dictionary with a role and some content, and returns a string. There's no intelligence here at all. Now use that shape:
from fake_model import fake_model
def ask(question):
messages = [{"role": "user", "content": question}]
reply = fake_model(messages)
return reply
print(ask("Explain Python decorators"))
print(ask("What is a list?"))
Stand-in reply to: Explain Python decorators
Stand-in reply to: What is a list?
A model call is only a function call: build the messages, send them, read the reply.
Who remembers the chat
Here's something that surprises people. With a plain model call, the model doesn't remember your last message. You keep the memory yourself:
from fake_model import fake_model
messages = []
def say(text):
messages.append({"role": "user",
"content": text})
reply = fake_model(messages)
messages.append({"role": "assistant",
"content": reply})
print("messages sent:", len(messages) - 1)
say("Hi")
say("What is a list?")
say("Show me one")
print("messages kept:", len(messages))
messages sent: 1
messages sent: 3
messages sent: 5
messages kept: 6
Each turn sends the whole conversation again. A chat app seems to remember because it keeps sending it back. That's why a long chat fills the context, and why a fresh chat sometimes gives a better answer.
What a real client call looks like
This one is shape only and not run, because it needs an account, a network and a key:
# Shape only. This file is not run.
# The key is kept in an environment variable,
# never in the code.
from openai import OpenAI
client = OpenAI()
reply = client.chat.completions.create(
model="<model-name>",
messages=[{"role": "user",
"content": "Explain Python decorators"}],
)
print(reply.choices[0].message.content)
Same list of messages, with a role and content. The reply is just wrapped a bit deeper. The model name is a placeholder, because names change. And notice what isn't here: there's no key in the code. Keys go in an environment variable, and the client reads it from there. Never put a key in a file or a prompt. (Setting that up is in Python project setup and API keys.)
When to use which
| Your job | Reach for |
|---|---|
| A question, an idea to understand, research | Chat app |
| Writing or changing code in the file you're in | Code assistant |
| A quick prototype to show someone | App builder |
| A task that touches many files | Terminal agent |
| Private data, or no internet | Local model |
You'll often use more than one in a single day, and that's normal.
You still read and judge
Imagine an assistant handed you this:
# A draft an assistant might hand you.
def average(numbers):
return sum(numbers) / (len(numbers) + 1)
print(average([2, 4, 6]))
print("expected:", 4)
3.0
expected: 4
It looks fine and runs without error, but it divides by the length plus one. Remove the + 1 and it prints 4.0. If you can't explain to a colleague why the code works and what it does, don't ship it.
Four traps to watch for:
- Hallucination: something wrong said with complete confidence, like a function that doesn't exist.
- Security: AI code can have holes, and what you paste into a tool can leave your machine. Keep keys and private data out.
- Outdated code: a model has a knowledge cutoff, so it may suggest an old way of doing things.
- Lazy learning: hand over every problem and you stop building the skill you need to judge the answer.
Checking AI-written Python code turns that last point into a habit.
Recap
An LLM is the engine; the tool is what's built around it. There are five groups (chat apps, code assistants, app builders, terminal agents and local models), and you pick by the job. A token is a small piece of text, context is all the model can see at once, and a model call is messages in, text out.
Try it yourself: ask two different tools the same question and compare what comes back, then read both answers and judge them. Or finish the loop in the lesson's compare_answers.py.
StudyEasy AI Community
Learn AI engineering, share what you build, and connect with other learners.
Free resources: lesson files, notebooks and code
Ask questions and join engineering discussions
Meet real people learning and building with AI
Related course on Udemy
The Python Architect Masterclass: Full Stack to AI Engineer
Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)Related posts
The AI Stack in One Picture: Six Layers Every AI Product Is Built From
Every AI product is built from six layers: data, model, retrieval, orchestration, serving and ops, with evals and security across all of them. A restaurant analogy, one request traced through all six, and what an AI engineer actually builds around the model call.
Tokenization: What an LLM Actually Sees When You Type
A language model never sees letters, only token ids. Use tiktoken to watch strawberry become three ids, see a space or a capital change them, fix the letter-counting problem, and compare English, German and Hindi token counts.
LLM Tokens, Context Windows and Cost: What One Question Really Costs
Follow one four-word help desk question that becomes 911 input tokens. Learn what fills the context window, why chat memory grows every turn, how max_tokens cuts a reply, and how to price a call.
What an LLM Can and Cannot Do: One Prediction Loop, Its Strengths and Its Gaps
A large language model predicts the next token, over and over. That one loop makes it strong at drafting, summarising and classifying, and weak at fresh facts, exact maths, memory and guaranteed truth. See why with a three-line tiktoken script, and learn the fix for each gap.
