LLM workbench lab: a language model API to practise on, with a stand-in model
This lab gives each student a language model API of their own to practise on: the requests a program sends, the answers that come back and what goes wrong. They call it with curl from the terminal and with short Python scripts, and learn messages and roles, system messages, tokens and limits, sampling settings, structured output, streaming, errors and retries, and what a request costs.
The model is a stand-in, and the lab says so everywhere: it answers in the same format as a real model API, but it chooses every reply by fixed rules, so the same question always gets the same answer. That is what makes every result checkable. Nothing is downloaded, no AI service is called and nothing costs money. Every copy has no route to the internet and none to any other student.
What students learn
How a program talks to a language model. They send a request as JSON and read the answer: the reply, why it ended and the tokens it used, 15 in and 10 out for one question. They see a system message change the reply and refuse a question, and find that a model remembers nothing unless the earlier messages are sent again. They count tokens, cut a reply short with max_tokens and work out the cost at made-up prices. They ask for structured output with a forced tool call and check it, watch a reply stream in 14 events, and retry a busy model with a growing pause while never retrying a request that is wrong. It suits a course on software development or applied AI; check your own awarding body's unit for the exact wording, none is quoted here.
Run it in your browser
The lab starts two services. model is the stand-in, answering at http://model:4000/v1 inside the lab. tools is a Python with llm.py, a small client written with Python's standard library, and steps/, short scripts that each show one idea. The terminal beside the lab has curl and no Python, so it calls the model directly and reaches the scripts with docker exec tools.
- Open the Container page. Open Build on the bar and choose Run a container. Anybody may open it, and the Git lab and the SQL lab start with no account. Every other lab needs a free account: create one, sign in, then press Start.
- Find the lab. The Sample labs card lists every sample. Find LLM workbench: a model API to practise on.
- Press Start. Start runs it as it is, in one press. Edit the file first opens the compose file so you can change it before you start.
- Open it. On the lab's page, press Open terminal and type curl -s http://model:4000/v1/models to ask the model its name, which is lab. Then type docker exec tools python3 steps/roles.py to see a system message change the reply.
What to ask students to hand in
A short Python script of their own, run with docker exec tools python3, that calls the model and does one thing the lesson showed: keeps a conversation going, checks a structured answer against its schema, or retries a busy model and gives up in the end. With it, the output it printed and a sentence on what a real model would do differently. Nothing is marked automatically: the sentence shows whether it was understood.
A basic lesson on this lab
LLM API Basics is a small lesson worked in this lab. In it a student sends a request with curl, sets a system message, counts tokens and cost, tries the sampling settings, asks for structured output, streams a reply and retries a busy model.
Free personal accounts have it in the Basics module, which is on Home, and every college can copy it from the Library's Basics folder. It is deliberately small: it shows a teacher what a lesson worked in a lab is, and the lab does the rest. Copy it into a module of your own to change it.
The code on GitHub
The compose file has no Dockerfile: it runs one stock public image, Python 3.12 on Alpine, pinned to an exact tag, twice, each as an unprivileged account with 64 MB of memory. The image is under the PSF licence and is not distributed by us. The file writes the stand-in and the scripts from fixed text when it starts, with Python's standard library alone, so nothing is downloaded. The stand-in's rules are at the top of its own file, and a teacher can add answers of their own there. Nothing is kept when the lab stops, so a student copies their script out first.
Set it as work
Say in the task what to hand in.
- Make the lab. In your module add a task and choose the Container lab card, then In a GitHub repository. Give https://github.com/mitsurutech/lab-llm-workbench with the branch main. The compose file is the default, compose.yaml. Fork the repository first if you want to change it, for example to give the stand-in model answers of your own.
- Publish and try it. Publish pins the commit you were shown, so a later change in the repository does not alter a lab you have already set. Start your own copy first.
- Hand it out. Assign it like any task, with a due date if you want one, and say in the task what to do and what to hand in.
- Mark what is handed in. Open a student’s copy and the work they handed in, mark it, and send it back with a reason if it needs more.
Try this lab, and what it costs
A free personal account can work through the basic lessons in this lab, with enough free credit each month to follow most lessons and no card. For a class, a school or college has its first 365 days free for up to 50 students, then pays per student a year, with every lab included and staff free.
Questions people ask
- Is there a real AI model in this lab?
- No. The model is a stand-in written for the lab, a short Python program that chooses each reply by fixed rules. It answers in the same format as a real model API, so what students learn about requests, tokens, streaming and errors carries over, but its words are not generated. It always gives the same answer to the same question, which is what lets the lesson say what a student will see.
- Why does temperature change nothing?
- A real model picks each next token from the likely ones, and temperature and seed change how it picks. The stand-in always picks the same reply, so it accepts those settings and ignores them. The lesson says so, and asks students what a real model would do instead.
- Does it cost anything or use credits for AI?
- No AI is used, so nothing is charged for it. The lab runs like any other container lab. The prices in the cost step are made up, to practise the arithmetic.
- Why does the terminal use docker exec tools?
- The lab's terminal carries a few clients, curl among them, and no Python. docker exec tools runs a command inside the lab's Python container, where the client and the scripts are.
- Can my students send anything personal to it?
- It goes nowhere: the stand-in runs inside the student's own copy, which has no way out to the internet. It is still a good habit to teach that a real model service receives whatever is typed, so nothing personal or secret belongs in a request.