# LLM

A Large Language Model is a function that takes text in and gives text back. GPT-4o, Claude and Llama are all LLMs.

AI developers · Part 01: LLM basics · Card 1 of 10 · Last updated 2026-10-13

## Analogy

A very clever API endpoint with no database. It has read half the internet, but it can't look anything up, and it has never heard of your users table.

## Code example

`llm.ts`

```typescript
import OpenAI from "openai";
const client = new OpenAI();

const res = await client.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: "Name three JS runtimes." }],
});

console.log(res.choices[0].message.content);
```

## In an agent

The LLM is the brain of every agent. Everything else in this course (tools, memory, retrieval) exists to feed it better text.

## Questions people ask

### Is an LLM the same thing as an AI agent?

No. An LLM is the model itself: text goes in, text comes out, one call at a time. An agent is your code running that model in a loop with tools, so it can look things up and take actions. The LLM is the brain; the agent is the brain plus hands and a plan.

### How do I call an LLM from JavaScript?

Install your provider's official SDK, for example the openai package, and put your API key in an environment variable. Then call client.chat.completions.create with a model name and a messages array. The reply text sits in choices[0].message.content. It is a normal HTTPS request, so it works in any Node backend.

## Related concepts

- [Next-token prediction](https://studyvisually.com/learn/tech/ai-developers/llm-basics/next-token-prediction)
- [Who decides the next step](https://studyvisually.com/learn/tech/ai-developers/llm-basics/ai-levels)
- [Token](https://studyvisually.com/learn/tech/ai-developers/llm-basics/token)
- [Context window](https://studyvisually.com/learn/tech/ai-developers/llm-basics/context-window)

Web page: https://studyvisually.com/learn/tech/ai-developers/llm-basics/llm
Study this card in the app: https://studyvisually.com/app/learn?category=ai-developers&card=llm
