Optimize travel costs by exploring alternative routes, nearby airports, and different accommodation neighborhoods. Compare flying direct vs connecting, staying central vs outskirts, and multi-city options. Use when user wants cheapest total trip cost, flexible routing options, or cost-saving alternatives to direct routes.
Find the cheapest way to get there and stay there — even if it's not the obvious way.
python3 scripts/optimize_price.py \
--origin SIN \
--destination BKK \
--city Bangkok \
--depart 2025-05-15 \
--return 2025-05-20 \
--passengers 2 \
--optimize total
| Flag | Description | Example |
|---|---|---|
--origin | Primary origin | SIN, KUL |
--destination | Primary destination | BKK, NRT |
--alt-origins | Nearby airports | JHB,XSP |
--alt-destinations | Nearby airports | DMK,CNX |
--city | Final destination city | Bangkok |
--depart | Departure date | 2025-05-15 |
--return | Return date | 2025-05-20 |
--passengers | Number of travelers | 1, 2 |
--cabin | Class | economy, business |
--optimize | Goal | total, flight, stay, balanced |
--max-ground-cost | Budget for ground transport | 50, 100 (USD) |
--neighborhoods | Areas to compare | all, central, budget |
| Strategy | What it does | Best for |
|---|---|---|
total | Minimize flight + stay + transport | Budget travelers |
flight | Cheapest flight only | Flight price sensitive |
stay | Cheapest accommodation | Long stays |
balanced | Good value at fair price | Most travelers |
time | Minimize total travel time | Business travelers |
Each option shows:
FOR each candidate date range:
1. READ all airport options (primary + alternatives)
2. FETCH flight prices for each route
3. FETCH hotel prices for each neighborhood
4. FETCH ground transport for each airport
5. COMBINE all options → Calculate total cost
6. COMPUTE cost vs duration trade-off
7. RANK → Best value options
OUTPUT: Top 5 date/route/neighborhood combinations
Called by SmartTripClaw for each candidate window:
# For each calendar window found
for window in calendar_windows:
# Find best route/neighborhood for these dates
best_option = PriceRouteOptimizer.optimize(
dates=window,
origin="SIN",
destination="BKK"
)
window['route'] = best_option
references/alternative_airports.md — Secondary airports by regionreferences/ground_transport.md — Airport transfer costs/timesreferences/neighborhood_prices.md — Hotel price maps by city