AiUsageService is responsible for gatekeeping access to Groq/Llama 70b based on subscription entitlements.PlanService::resolveQuotaPlan($user) to find the monthly quota. It handles three states elegantly:Exception.ai_quota_monthly.user->ai_reset_at. If the timestamp is in the past, it automatically resets the generation counter and extends the window by one month.++. It uses a raw UPDATE WHERE query that only succeeds if the condition holds:UPDATE will affect 1 row. The second will affect 0 rows.GroqService.php. It implements Markdown-stripped caching to prevent repeated LLM inference from consuming quota or incurring cost.GroqService::review, the generation is strictly wrapped in Cache::remember():md5 hash of the requested prompt/trip data and asks the Cache.Cache Miss, the quota is consumed atomically inside the remember closure. If quota is exhausted, the request fails.AiController::generate catches it cleanly and falls back to a deterministic procedural generator. It perfectly synthesizes an N-day itinerary using templates and calculated offsets, ensuring the endpoint is always available.AiGeneration)AiController::logGeneration method writes a strict telemetry event to the AiGeneration database table.try/catch swallowed with a Log::warning), ensuring the user's actual itinerary is saved even if the telemetry database is temporarily unavailable. This dataset directly powers the Live Command Center monitoring shell.