<aside> ๐Ÿ“…

Date: Monday, September 28, 2026 ยท Week 1, Day 1 ยท Type: Build Day

</aside>

Learning Manual

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.

The Daily Build

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.

Architecture Diagram

+-------------+     +-------------------+     +------------------+
| User Input  | --> | Python App (.env) | --> | LLM Provider API |
+-------------+     +-------------------+     +------------------+
                             |                         |
                             v                         v
                    [Terminal Output]       [Token & Cost Logger]

Interview Questions

  1. What is the functional difference between a System Prompt, a User Prompt, and an Assistant Prompt in chat-completion APIs?
  2. Why are API keys stored in environment variables rather than hardcoded in application configuration files?
  3. Why do model providers charge more for output (completion) tokens than input (prompt) tokens?

Problem Statement

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.

AI-DSA Primitive

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.

Software Design Pattern