I'm Gopi Gugan, a software engineer building AI features with FastAPI, Postgres/pgvector, and React/TypeScript β and if you want to see more of my work, it's at gopigugan.ca . The first time I built a chat feature on top of an LLM, I sent the whole conversation history with every request. It worked beautifully for five messages. Then a user had a long session, the token count crept up, the API rejected the request for exceeding the context window, and the chat just stopped. That's when I learned that managing context is a real engineering problem β not something the model handles for you.
The context window is a budget, not a feature
Every model has a hard limit on how much text it can take in one request, and every token you send costs money and latency. I treat the context window like a budget:
The system prompt is non-negotiable. It's the first thing in every request, and I never drop it to save space.
Recent messages matter most.β¦