Prep your pan and air fryer. Use a 6- to 7-inch round cake pan (or a loaf pan that fits your basket). Line the bottom with parchment and lightly coat the sides with nonstick spray.
Preheat your air fryer to 320°F (160°C) for 3–5 minutes.
Mix dry ingredients. In a medium bowl, whisk 1 cup (120 g) all-purpose flour, 1 teaspoon baking powder, 1/2 teaspoon baking soda, 1/2 teaspoon fine salt, 1 teaspoon ground cinnamon, and a pinch of nutmeg.
Whisk wet ingredients. In a large bowl, whisk 2 large eggs, 1/2 cup (100 g) granulated sugar, 1/2 cup (100 g) packed brown sugar, 1/2 cup (120 ml) neutral oil, and 1 teaspoon vanilla until smooth and slightly thickened.
Add carrots and extras. Fold in 1 1/2 cups finely grated carrots (about 2 medium). If using, add 1/4 cup well-drained crushed pineapple, 1/4 cup chopped nuts, and 2 tablespoons raisins. Don’t overdo the mix-ins or the cake can get dense.
Combine wet and dry. Sprinkle the dry mix over the wet and fold gently just until no flour streaks remain. The batter should be thick but spreadable.
Fill and smooth. Scrape the batter into the prepared pan and smooth the top.
Tap the pan lightly on the counter to release air bubbles.
Air fry. Place the pan in the air fryer basket. Cook at 320°F (160°C) for 28–35 minutes, or until the top is set and a toothpick comes out with a few moist crumbs. If the top browns too fast, tent loosely with foil during the last 5–10 minutes.
Cool completely. Let the cake cool in the pan for 10 minutes, then lift it out using the parchment and transfer to a rack to cool fully. Don’t frost warm cake or the frosting will melt.
Make the frosting. Beat 6 ounces (170 g) softened cream cheese with 3 tablespoons softened unsalted butter until smooth and fluffy, 1–2 minutes.
Add 1 cup (120 g) powdered sugar, 1/2 teaspoon vanilla, and 1 teaspoon lemon juice or a pinch of salt. Beat until creamy. For thicker frosting, add up to 1/4 cup more powdered sugar.
Frost and finish. Spread the frosting over the cooled cake.
Sprinkle with chopped nuts if you like. Slice and serve.