<aside> ๐
Date: Monday, September 28, 2026 ยท Week 1, Day 1 ยท Type: Build Day
</aside>
1.1 Environment Isolation โ setting up Python virtual environments (venv), managing .env files, and .gitignore safety.
1.2 Your First LLM API Call โ understanding Request/Response payloads, system prompts vs. user prompts.
1.3 Token Accounting โ tracking prompt tokens, completion tokens, and calculating total cost per call.
Build a standalone Python script that reads a prompt from the terminal, calls an LLM API (OpenAI/Anthropic/Groq), streams the response to the console, and prints a formatted summary box showing token counts and exact fractions of a cent spent.
+-------------+ +-------------------+ +------------------+
| User Input | --> | Python App (.env) | --> | LLM Provider API |
+-------------+ +-------------------+ +------------------+
| |
v v
[Terminal Output] [Token & Cost Logger]
Problem 01. Write a Python function calculate_run_cost(model_name: str, prompt_tokens: int, completion_tokens: int) -> float that takes a model identifier, looks up a pricing matrix dictionary, and returns the total cost formatted to 6 decimal places.
Data Structure: Hash Map / Key-Value Lookup Table.
Mechanics: Direct memory mapping via hashing for O(1) constant-time lookup.
Real-World Production Use: Used by API routing proxies (e.g., LiteLLM) to match model names to pricing, rate limits, and provider configurations in sub-millisecond time.