Slice onions thinly. In a large pot, melt the butter with the olive oil over medium heat.
Add the onions and stir to coat them evenly with the butter. Cook for 30-40 minutes, stirring frequently, until the onions are golden brown and deeply caramelized.

Once the onions are caramelized, sprinkle the flour over the onions and stir for 1-2 minutes to cook out the raw taste. Pour in the white wine (or apple cider vinegar) to deglaze the pot, scraping up any browned bits from the bottom. Let it simmer for 2-3 minutes to cook off the alcohol.

Add the beef broth (or vegetable broth for a vegetarian version), thyme, and bay leaf. Bring the soup to a gentle simmer and cook for an additional 15-20 minutes to allow the flavors to meld. Season with salt and pepper to taste. For an optional flavor boost, add 1 tablespoon of cognac or brandy at this stage.

While the soup is simmering, toast baguette slices until crisp. If you want, lightly brush them with olive oil before toasting. When toasted, rub each slice with a cut garlic clove for extra flavor.

Preheat the broiler. Ladle the soup into oven-safe bowls. Top each with 2-3 toasted baguette slices and a generous handful of grated Gruyère or Swiss cheese.

Place the bowls under the broiler for 2-3 minutes, until the cheese is melted, bubbly, and slightly golden. Serve immediately with more toasted bread if desired.
