
The problem
Fare prediction is the part of travel planning that actually needs a model, and it is usually the part that gets faked. Most "AI travel" tools ask a language model when to book, which produces a confident sentence and no signal.
Approach
Itinerary generation uses LLMs, because that is a language task. Fare forecasting does not. It uses a gradient-boosting regressor trained on over 600,000 Indian flight records, reaching R² ≈ 0.97, which predicts the fare and the best time to book. Live flight and train comparison comes through SerpAPI. The whole thing runs on Cloudflare's edge: Pages Functions for the API, D1 for the database, Prisma as the ORM.
Architecture
In short
- Gradient-boosted fare model trained on 600,414 flight records, reaching R² 0.978 and a mean error of about ₹2,088
- Layered recovery for unreliable model output: structural extraction, regex repair passes, then a conversational self-correction turn
- Full edge deployment on Cloudflare Pages Functions, D1 and Prisma
What I took from it
Splitting the problem by what each tool is actually good at, a language model for language and a regressor for regression, is what makes the price prediction defensible. A number from a gradient-boosting model trained on 600K records can be checked against held-out data. A number a language model produces cannot.
Built with
- Next.js 15
- TypeScript
- Python
- scikit-learn
- Perplexity API
- Cloudflare Pages
- Cloudflare D1
- Prisma