Preheat the oven to 350°F (180°C) and grease a muffin tin or loaf pan.
In a skillet over medium-low heat, melt the butter or warm the olive oil. Add the chopped onion and a pinch of salt, stirring occasionally. Cook for 15 to 20 minutes, until the onion is golden brown and deeply caramelized. Remove from heat and let cool slightly.
In a large bowl, whisk together the eggs, flour, cheeses, olive oil, baking powder, salt, and pepper until well combined. Gently fold in the caramelized onions and any additional mix-ins.
Spoon the batter into the muffin cups or pour it into the prepared loaf pan, smoothing the top.
Bake until golden and set. For muffins, bake for about 30 minutes. For a loaf, bake for 40 to 45 minutes, until a tester inserted in the center comes out clean.
Let cool slightly before serving. These muffins are delicious warm or at room temperature.
Enjoy as a snack, alongside a salad, or as a savory breakfast. They also freeze beautifully—just reheat in the oven for a few minutes before serving.