Onions are higher in carbs than mushrooms, but can still be included in moderation in a keto diet. It is best to choose lower-carb varieties like green onions or shallots, and to use them sparingly in recipes to stay within your daily carb limit.