Module 5 · Build and publish a small tool Lesson 14 of 15
Cost, limits and safety in a real tool
A tool that costs money and takes user input needs three things: a cap on how much it can spend, a limit on how often it can be called, and a check on what it sends back.
Worked example
Log the tokens used per request and refuse once a daily budget is crossed, so a loop with a bug cannot drain an account overnight.
Your practice task
Add a request counter and a per-day cap to your script, and log the tokens each call uses.
Do this before moving on. Reading a solution teaches the shape of it; typing it teaches you.
Key takeaway
A tool that costs money and takes user input needs three things: a cap on how much it can spend, a limit on how often it can be called, and a check on what it sends back.
Keep your place in this course
A free account saves which lessons you have finished and unlocks the certificate. The lesson itself stays free to read.
Create free account or sign inCourse complete
You finished every lesson.
Your certificate is ready, and the projects you built are the proof to attach to an application.
Almost there
15 lessons left of 15
Finish every lesson to unlock the certificate. Each one ends in a practice task — do them and the final project brief writes itself.