What is an LLM illustration: stones enter a hand loom one by one, and the woven band passes through a wooden window on the loom.
Blog

What Is an LLM? How Large Language Models Work and What an LLM API Is

We explain tokens, transformers and the context window, list the current models of the three major providers and show a first API call in Python.

15 min readBy Engin Deniz Alpman

In short: In AI, an LLM is a large language model. A large language model is trained on huge amounts of text, writes by predicting small pieces of text called tokens, and runs behind products such as ChatGPT, Claude and Gemini. An LLM API is the interface that lets your own software call that model, and it is billed per token.

When you chat with ChatGPT, Claude or Gemini, an LLM behind the product writes the answer. A handful of concepts, such as tokens, transformers and the context window, is enough to understand how these models work. The same concepts explain why the bill is counted in tokens once you connect a model to your own software through an API.

What is an LLM?

#

In AI, LLM is short for "large language model". By the definition in the Google Machine Learning Crash Course, a language model estimates the probability of a token or sequence of tokens occurring within a longer sequence of text. Large language models predict sequences of tokens, sometimes whole paragraphs. Google gives two reasons large models predict better: they contain far more parameters, and they look at a much wider context when they answer.

In practice, an LLM is the engine behind writing, summarizing, translation, question answering, classification and coding. You type a question, and the model generates the most likely answer as a continuation of it, one token at a time.

How do AI, machine learning and LLMs relate?

#

Artificial intelligence is the widest umbrella. Machine learning is the name for methods that learn from data. An LLM is one kind of model, trained with machine learning and specialized in language. So every LLM is an AI model, but not every AI model is an LLM. Models that classify images or score credit risk are AI too.

How do LLMs work?

#

Five concepts explain how an LLM works: tokens, the transformer, parameters, training and the context window.

What is a token?

#

A token is the smallest unit a language model processes. According to Google, a token can be a word, part of a word or a single character, and most modern language models split text into subwords. How text is split into tokens depends on the language, so the number of characters per token differs from language to language. Google says that in English a token is about 4 characters, and 400 tokens come to about 300 words. The Gemini API token guide puts 100 tokens at about 60 to 80 English words. There is no single ratio for Turkish, because the result changes from model to model. The reliable way is to measure your own text with the provider's token counter. We measured how many more tokens the Turkish version of the same text takes on different tokenizers in What is a token in AI?

Tokens matter because both the amount of text a model can see at once and the API bill are counted in them.

What are the transformer and self-attention?

#

Most of today's LLMs are built on the transformer architecture. It was introduced in Attention Is All You Need, the paper Vaswani and colleagues published on 12 June 2017. The paper proposed dropping recurrent and convolutional networks for a design based only on the attention mechanism.

Self-attention sits at the center of the transformer. In Google's explanation of transformers and LLMs, self-attention asks, for every token in the input, how much each of the other tokens affects that token's meaning. That is how a model can work out from context which word the pronoun "it" refers to. Decoder-only models are usually good at generating text, and they work by appending new tokens to the text generated so far.

What are parameters?

#

Parameters are the numerical weights a model learns during training. Google's course page says transformer-based models can contain hundreds of billions or even trillions of parameters, and that models with more parameters consistently outperform those with fewer. More parameters also mean more compute and higher cost. That is why companies use smaller models alongside the large ones.

How are LLMs trained?

#

Training is usually described in two stages.

  1. Pretraining: the model is trained on a very large, partly filtered body of text. In Google's example, some tokens are deliberately hidden and the model tries to predict them. After a great many examples, the model learns the patterns of language and the relationships between words.
  2. Instruction tuning and human feedback: a pretrained model is good at continuing text but can be poor at following instructions. Training language models to follow instructions with human feedback, the paper Ouyang and colleagues published on 4 March 2022 to describe InstructGPT, showed that making a model larger does not by itself make it better aligned with what the user wants. The authors improved that alignment by fine-tuning the model first on example answers and then with reinforcement learning from human feedback (RLHF). The models in today's chat products go through this kind of extra training.

Customizing a model with your own data is a separate topic. We cover when you need fine-tuning and when you need RAG in RAG vs fine-tuning. RuneLab's Large Language Model (LLM) Fundamentals course follows the same order: it starts with pretraining, instruction tuning and RLHF, and ends with a decision tree for choosing between prompting, RAG and fine-tuning.

What is a context window?

#

The context window is all the text a model can look at while it produces an answer. By the definition in Anthropic's context windows guide, it includes the answer the model generates, and unlike the data the model was trained on, it works like a kind of "working memory". The window is measured in tokens. As of 2 November 2026, Anthropic's four current Claude models and Google's Gemini 4 Argon are listed with a context window of 1 million tokens.

A large window does not make it a good idea to put everything into it. Every token shows up on the bill, and unneeded text can also lower the quality of the answer. For long document archives, RAG is usually the better path. We show how it searches documents in How RAG finds answers.

What are LLMs used for, and where do they struggle?

#

Google's course page says LLMs can produce clear, understandable text for a range of audiences. The most common uses in companies are drafting emails and reports, summarizing long documents, translation, classifying customer messages, writing code and answering questions over an internal knowledge base.

The same source names three weak points: hallucination, very high compute needs and bias inherited from the training data.

What is an LLM hallucination?

#

A hallucination is fluent, convincing but false information produced by a model. Why Language Models Hallucinate, the paper Kalai, Nachum, Vempala and Zhang published on 4 September 2025, compares it to a student guessing on a hard exam. The authors argue that hallucination persists even in the most advanced systems because training and evaluation methods reward guessing over acknowledging uncertainty.

So when LLM output contains numbers, dates, names, regulations or sources, a person needs to check it. Grounding the answer in the company's own documents and asking the model to cite its sources also lowers the risk. The practical answer to the problem the paper points out is instructions that make the model say information is missing instead of guessing when it is unsure. RuneLab's Preventing AI Hallucinations and Source Grounding course practices these abstention rules hands-on, along with catching fabricated quotes against the primary source.

What is the difference between an LLM, ChatGPT, RAG and an AI agent?

#

These terms are often confused. The LLM is the engine itself, and the others are products or methods that use that engine.

LLMs and related terms
Term What it means Example
LLMA large language model that predicts text token by tokenThe OpenAI GPT, Anthropic Claude and Google Gemini model families
Chat productAn app that offers an LLM with an interface, memory and toolsThe ChatGPT, Claude and Gemini apps
LLM APIA way to call the model from your own softwareOpenAI Responses API, Anthropic Messages API, Gemini API
SLM (small language model)A model with fewer parameters that runs cheaper and fasterModels that run on a phone, a laptop or an in-house server
RAGA method that grounds the model's answer in passages found in your documentsAn internal knowledge base assistant
AI agentA system in which the LLM uses tools and carries out work step by stepAn assistant that opens tickets or prepares reports

Is ChatGPT an LLM?

#

Not exactly. ChatGPT is OpenAI's chat product, and OpenAI's GPT models run behind it. The OpenAI models page labels some models directly as the model used in ChatGPT. In short, the LLM is the engine and ChatGPT is the tool that uses it.

What is the difference between an SLM and an LLM?

#

Small language models run with fewer parameters, so they are cheaper and faster, but they can fall behind large models on complex tasks. A small model adapted to one task, though, can clearly beat its base model at that task. RuneLab's 9-billion-parameter Hati Glint SQL was trained to turn Turkish questions into SQL, and according to the Hati Glint SQL model card it raises execution accuracy on the TurSpider test in direct mode from the base model's 64.12% to 73.21%. We looked at enterprise use of small open models in our Liquid AI LFM3 post.

Where do AI agents and MCP come in?

#

On its own, an LLM only produces text. We explain how systems that call tools to get work done operate in What is an AI agent, whether to build those agents alone or as a team in one agent or many, and the standard that connects those tools to applications in What is MCP.

Which LLMs are there?

#

Model names change every few months. The table below summarizes the current models the three major providers show on their own model pages as of 2 November 2026, along with each provider's own recommendation.

Current models of the three major providers (provider model pages, November 2026)
Provider Current models Provider's recommendation
OpenAIGPT-6 Astra, GPT-6.1 Sol, GPT-6.1 Terra, GPT-6 LunaStart with GPT-6 Astra if you are unsure. GPT-6.1 Sol for a balance of intelligence and cost, GPT-6 Luna for cost-sensitive, high-volume work.
AnthropicClaude Fable 5.1, Claude Opus 5.5, Claude Sonnet 5.5, Claude Haiku 5.5Start with Claude Opus 5.5 for most work. Claude Fable 5.1 for demanding reasoning and long-running agent work.
GoogleGemini 4 Argon, Gemini 3.8 Flash, Gemini 3.6 Flash, Gemini 3.5 Flash-LiteGemini 4 Argon is listed as Google's flagship reasoning model.

Sources: the OpenAI models page, the Anthropic models overview and the Gemini models page.

These three are closed models, which means you can use them only through the provider's API or products. There are also open-weight models whose weights you can download. RuneLab publishes open models for Turkish work under the Apache 2.0 license: Hati Glint SQL for text-to-SQL, Vör-LateEmbed-TR for Turkish document search and Kenning Turkish Legal for legal texts. The last two do not generate text: they are embedding models that find the right document in a RAG setup. We review the license terms of open models in open-weight model licenses, and an example of running a large open model in-house in our Mistral Large 4 guide.

What is an LLM API?

#

An LLM API is the programming interface that lets you call a large language model from your own software instead of a chat window. Your application sends a request to the provider's server, the model generates the answer and sends it back. Teams use an API to add automatic summaries to a customer support system, to classify thousands of documents or to build their own assistant.

How does an LLM API work?

#

The flow is the same in all three providers' quickstart guides.

  1. You get an API key from the provider's developer console.
  2. You store the key in an environment variable (OPENAI_API_KEY for OpenAI, ANTHROPIC_API_KEY for Anthropic).
  3. You send a request with the official SDK that contains the model name and your message.
  4. The answer text comes back along with how many tokens were used.

Here is the Python example from the OpenAI quickstart, with a Turkish prompt in place of the question (it asks for a three-point summary of a meeting note).

from openai import OpenAI

client = OpenAI()

response = client.responses.create(
    model="gpt-6-astra",
    input="Bu toplantı notunu üç maddede özetle.",
)

print(response.output_text)

On Anthropic the same job is done with the Messages API, and on Google with the Gemini API. The logic stays the same, and only the library and parameter names differ. That is why putting the three APIs behind one shared interface, falling back to another model on errors and timeouts, and logging tokens and cost are the main topics of the Building Applications with LLM APIs course.

How is an LLM API priced?

#

All three providers quote prices per token, in units of 1 million tokens. Input tokens you send to the model and output tokens the model generates are priced separately, and output costs more. Prices vary widely from model to model. A few extra rules apply.

  • Prompt caching: according to the Claude API pricing page, when you send the same long prompt again, the part read from the cache is billed at no more than one tenth of the base input price.
  • Thinking tokens: the Gemini API pricing page states that for Gemini 4 Argon every token is billed, thinking tokens included.
  • Free tier: the same page shows a free tier for some Gemini models, but Gemini 4 Argon is not in it.

For current figures, check the providers' official pricing pages. We explain the difference between a subscription and API credits in the ChatGPT Business and API credits guide, and Claude's plans in Claude pricing.

What should you watch for when sending data to an API?

#

Every piece of text you send to an API goes to the provider's server. Read the provider's data usage terms before you send personal or confidential data. If you do not want data to leave your company, you can run an open-weight model on your own server. We walk through the steps in our offline AI and local LLM setup guide.

Which path should you choose?

#
Ways to use an LLM, by need
Your need Path
Your team wants a ready interface for writing, summaries and researchAn enterprise plan of a chat product such as ChatGPT, Claude or Gemini
You want to connect the model to your own application, CRM or workflowLLM API
Data must not leave the company, or you need to work offlineA local LLM with an open-weight model
The model must answer based on your company's current documentsRAG
The model's tone or output format must stay consistentA good prompt first, fine-tuning if that is not enough
The model must use tools and carry out a multi-step task on its ownAI agent
You want to use several cloud and local models through one endpoint, with team budgets and loggingAn LLM gateway such as RuneGate

We cover the choice between a chat product and a local LLM in detail in Local LLM vs ChatGPT.

Frequently asked questions

#

What does LLM stand for?

#

LLM stands for large language model. It is an AI model trained on very large amounts of text that generates text by predicting it one token at a time.

What does LLM mean in law?

#

In law, LL.M. stands for Master of Laws, a postgraduate law degree. Apart from the name, it has nothing to do with the LLM in artificial intelligence.

Is ChatGPT an LLM?

#

ChatGPT is not an LLM itself but a chat product that uses one. OpenAI's GPT models run behind it. The same is true of the Claude and Gemini apps.

What is a token in an LLM?

#

A token is the smallest piece of text a model processes. It can be a word, part of a word or a single character. A model's context window and its API price are both measured in tokens.

What are LLM parameters?

#

Parameters are the numerical weights a model learns during training. Large models can contain hundreds of billions of them. More parameters usually give better results but also make the model more expensive to run.

What is an LLM hallucination?

#

A hallucination is fluent but false information produced by a model. Researchers say one cause is that training and evaluation methods reward guessing over admitting uncertainty. Check any output that contains numbers, dates or sources.

What is an LLM API, and is it free?

#

An LLM API is the interface that lets your own software call a large language model. Most usage is billed per token. Google's Gemini API offers a free tier for some models, but its flagship Gemini 4 Argon is not in the free tier.

What is the difference between an LLM and RAG?

#

The LLM is the model that generates the text. RAG is a method that finds relevant passages in your own documents and gives them to the model before it answers. RAG does not change the model, it supplies the right context.

What is the difference between an LLM and an SLM?

#

SLM stands for small language model. With fewer parameters it runs cheaper and faster, and it can run on a laptop or an in-house server. It can fall behind large models on complex tasks.

Sources

#
#