AI Engineering · Module 01
AI engineering fundamentals
- Lessons
- 13
- Free
- 5
- Reading
- ~3 h
Your progress
0 / 13 lessons done
Sign in to trackLessons
- Introduction to AI engineeringFreeMost AI features are built by product engineers who call a model someone else trained. Knowing what changes compared with ordinary code shows you where the real work, the real cost and the real risks are.
- The AI application stack: from model to productKnowing which parts of an AI feature you build and which you rent shows you where your work, your bill and your risks are. It also explains why prompts, evals and model upgrades become part of everyday engineering.
- Calling a model API: request, response and costFreeEvery AI feature you build is made of calls like this one. Knowing what each field controls, how to spot a cut-off answer and what a call really costs is what turns a demo into a feature you can run every day.
- Tokens: how models read text and charge for itFreePrices, limits and output ceilings in a model API are all counted in tokens, not words. If your token estimate is wrong, your cost estimate and your limits are wrong with it.
- Choosing a model: capability, cost and speedThe model id is one line of code, but it sets most of a feature’s bill and how long users wait. You choose it at the start of every AI feature, and again whenever models or prices change.
- Hosted and open-weight models: the tradeoffsSooner or later a customer, a lawyer or the finance team asks where your model runs and whether running it yourself would be cheaper. You need an answer with numbers, not a guess.
- Sampling and temperature: controlling randomnessFreeMany tutorials still say “set temperature to 0” for steady output. On the current Claude API that request fails, so you need to know where consistent output comes from instead.
- Context windows: what fits and what gets lostFreeEvery feature that adds documents, history or past conversations to a call decides what goes in its context window. That choice sets the bill on every call, and whether the model notices the one detail that matters.
- Streaming responses: showing output as it arrivesAny feature where a person watches the screen while a model writes, a chat, a draft, an answer, feels slow without streaming. Streaming also moves the stop reason, the token counts and some errors to the end of the response, so the code that reads them has to change.
- Model API errors, rate limits and retriesEvery feature that calls a model API meets 429s, overloaded errors and timeouts on its busiest day. Knowing which failures to wait out and which to fix is the difference between a feature that recovers on its own and one that hides bugs or shows people empty results.
- Estimating the cost and latency of a featureBefore an AI feature launches, someone asks what it will cost each month and how fast it will be. An estimate built from one call can be several times too low, and a latency promise without a budget behind it gets broken in the first week.
- Design: a ticket summary featureMost first AI features look like this one: one model call that turns a long text into a short one. Getting it into production is mostly ordinary engineering around that call, and the decisions you make here, when to call, what to store and what to show when the call fails, come back in every AI feature you build.
- Lab: a command-line chat with streamingMost AI features you will build are conversations: support assistants, coding helpers, agents. Building one by hand shows where the memory really lives and why long conversations cost more with every turn.
Practise with
No tools or paper guides for this module yet.
Terms this module teaches 35
Open glossaryAI application stack
The three layers an AI product sits on: the application layer on top, the model layer in the middle and the infrastructure layer at the bottom.
AI engineering
Building products on top of pretrained models, usually by calling them through an API, including the prompts, checks and product code around each call.
API version (Claude API)
A date sent in the anthropic-version header of every Claude API request. It fixes which request fields and behaviours the API accepts, so a change to the API only reaches code that moves to the new version.
Application layer
The top layer of the AI application stack: everything that turns a model into a product feature, such as the UI, the prompt, output checks, evals and monitoring.
Break-even volume
The amount of work at which a fixed-cost option and a pay-per-use option cost the same: the fixed cost divided by the per-use price.
Content block
One typed item in a model response’s content list, such as thinking, text or a tool request.
Context rot
The drop in how accurately a model finds and uses information as the amount of text in its context grows.
Context window
The most tokens a model can handle in one call, counting the input and the output it writes.
Conversation history
The list of earlier user and assistant turns that an app sends with every call, because the model API remembers nothing between calls.
Environment variable
A named value the shell passes to every program it starts, often used to keep secrets such as API keys out of code.
GPU
A chip built to do many simple calculations at once. Language models are trained and run on large numbers of them.
HTTP status code
A three-digit number at the start of every HTTP response that says how the request went: 2xx succeeded, 4xx means the request was wrong, 5xx means the server failed.
Inference
Running a trained model on an input to produce its output, as opposed to training the model.
Inference provider
A company that runs open-weight models on its own GPUs and sells access to them through a per-token API.
Infrastructure layer
The bottom layer of the AI application stack: the data centres, GPUs and serving software that run a model and answer calls to it.
ML engineering
Training, deploying and running machine learning models for a specific task, usually on a company’s own data.
Model API
An HTTP service that runs a language model on the input you send and returns its output, billed per token.
Model layer
The middle layer of the AI application stack: the trained model itself, which the application reaches through a model API.
Model weights
The numbers a model learned in training. The model file is mostly these numbers, and running the model means computing with them.
Non-deterministic output
Output that can differ between calls even when the input is identical.
Open-weight model
A model whose trained weights are published, so a team can run it on servers it controls instead of calling a provider’s API.
Output speed
How many output tokens a model produces per second once it has started writing. Writing time is output tokens divided by output speed, and thinking tokens count.
Pretrained model
A model already trained on a very large amount of data before you use it, so you can use it for a task without training it yourself.
retry-after header
A response header that tells the client how many seconds to wait before sending the request again. Retries sent earlier are expected to fail.
Retryable error
A failure caused by load or a passing fault, so the same request sent again later can succeed. Errors caused by the request or the account fail the same way every time and must not be retried.
Self-hosting (a model)
Running a model’s weights on servers you control or rent, instead of calling a provider’s API. You pay for the hardware by time and run it yourself.
Spend limit
A cap on how much an organization can spend on a model API in a period, usually a calendar month. Once it is reached, calls fail until the period ends or the limit is raised.
Stop reason
The field in a model response that says why the model stopped, such as finishing its answer or reaching the max_tokens ceiling.
Streaming response
A model API response sent in small pieces while the model writes it, instead of as one body at the end.
Time to first token
The time from sending a model request until the first output token arrives. With hidden thinking, the first visible text comes later.
Token (language models)
A small piece of text, often part of a word, that a language model reads and writes; providers count tokens to set prices and limits.
Tokenizer
The part of a language model system that cuts text into tokens from a fixed list of pieces, its vocabulary, and turns each token into a number. Different models can use different tokenizers, so the same text can have different token counts.
Tokens-per-minute limit
A rate limit on how many tokens an organization may send (input) or receive (output) per minute, set beside the limit on requests per minute. Whichever limit runs out first causes 429 errors.
Usage tier
The level a model provider assigns to an account, which sets its rate limits and spend limits. Accounts usually move up as their usage history grows.
Virtual environment
A folder holding its own copy of Python packages for one project, so they don’t clash with other projects on the same machine.