Melt butter in a large stock pot over medium-high heat. Add the onions, garlic, bay leaves, thyme, and salt and pepper and cook until the onions are caramelized (about 15 minutes). Discard bay leaf. Reduce heat down to medium-low. Add the beef broth and 1/4 teaspoon of xanthan gum, bring the soup back to a simmer, and cook for 10 minutes. Add more xanthan gum for thicker soup of desired, adding only a pinch at a time. You can add unflavored collagen at this time as well.
Portion soup into bowls. Before serving, sprinkle each bowl with grated cheese. Broil until golden brown and bubbly.
For a more traditional French onion soup recipe, use a slice of prebaked 4-ingredient keto almond bread in soup. Toast bread well, add to soup, then sprinkle with grated cheese, and broil.