Module 00 · Building with LLMs

Before you start

Pick your route through the course, set up Python, get an API key for a large language model, and make your first call.

Lessons

  1. 01
    How to take this course

    The course has two parts, "building with LLMs" and "understanding LLMs from scratch". Pick a route for your goal, learn how each lesson is laid out, and what to do when you hit an error.

    15 min · Beginner
  2. 02
    Setting up your environment and API key

    Set up a Python project with uv, get a DeepSeek API key and store it in environment variables, and confirm everything works with one script. Also covers switching to Qwen, Kimi or a local Ollama.

    30 min · Beginner
  3. 03
    Your first call to an LLM

    Write a program of a dozen lines that calls DeepSeek, and read the request and response field by field: message roles, finish reason, token usage and cost. Then use curl to see it's just an HTTP request.

    30 min · Beginner

This module is only preparation, but don't skip lesson 3. Every lesson after it builds on what actually happens in one API call: what the messages in the request are, how the usage in the response turns into money, and what it means when finish_reason is length. Getting these clear now saves a lot of time later.

You're done when

  • Running python check_env.py in a terminal prints "一切正常" (all good).
  • Without looking at the lesson, you can say what the system, user and assistant roles in a chat request are each for.
  • Given the usage in a response, you can work out what the call cost.
  • You know why a key must never be written into code or committed to git.

Code for this module

Code and program output are shown exactly as they ran, so comments and printed output are in Chinese.