Close

AI Basics - Working With LLM: Prompt, Tokens, Context

[Last Updated: Jan 6, 2026]

1. Prompt

The prompt is what you tell the AI. It's like giving instructions or asking a question.

Example: "Write a function that sorts a list" is a prompt.

Think of it as: Your input to the AI.

2. Tokens

Tokens are chunks of words the AI understands. They can be whole words, parts of words, or even punctuation.

Example: "Hello, world!" might be 3 tokens: ["Hello", ",", " world!"]

Important because: AI pricing and limits are often measured in tokens.

3. Context

Context is how much the AI can remember at once. It's like a limited working memory.

Example: If context = 4,000 tokens, the AI can only "see" about 3,000 words at a time.

Why it matters: If your conversation gets too long, the AI "forgets" the beginning.

Simple Analogy

Imagine you're telling a story to a friend:

  • Prompt = Your question: "Tell me a story about a cat"
  • Tokens = The individual words your friend uses to tell the story
  • Context = How much of the story your friend can remember while telling it

For Developers

  • Craft good prompts to get better code
  • Watch token usage to control costs
  • Stay within context limits so the AI doesn't "forget" important instructions

See Also