Lesson 4.2

Managing cost and latency

Cost is prompt design, model choice, and how often you call. Measure per-request tokens before you try to optimise anything.

Duration
13m
Level
Intermediate
Students
13k students

Overview

Cost is prompt design, model choice, and how often you call. Measure per-request tokens before you try to optimise anything.

In this lesson you will:

  • Attribute spend to specific calls and prompts
  • Trim prompts and route by difficulty
  • Set timeouts and fall back gracefully

Resources

Claude API documentation

The official reference for the tools used in this lesson.