Add the whole dried red chilies to a food processor and pulse on high speed until broken down into small chili flakes. Carefully open the food processor, avoiding inhaling the chili dust. Skip this step if using store-bought chili flakes.
Place a large, dry, heatproof bowl made of stainless steel or heat-resistant ceramic on a trivet. Add the freshly ground or store-bought chili flakes, minced garlic, Sichuan pepper powder, and salt. Set aside.
Pour the vegetable oil into a large, heavy-bottomed pot or wok. Heat over medium-low heat until the oil reaches 250°F (121°C), using an instant-read cooking thermometer to check the temperature.
Carefully add the ginger, onion, star anise, bay leaves, cinnamon stick, and cloves to the hot oil. Reduce the heat to low as needed to maintain approximately 250°F (121°C). Let the aromatics gently sizzle in the oil for 20 minutes, stirring occasionally, until fragrant and the onion is lightly golden. Do not let them burn, or the oil may taste bitter.
Turn off the heat. Using a slotted spoon or fine-mesh skimmer, carefully remove and discard all the spices and aromatics from the hot oil, including any remaining small pieces.
Carefully pour the hot oil in a slow, steady stream over the chili mixture in the heatproof bowl, as the mixture may bubble vigorously. Immediately stir with a clean, dry utensil to distribute the heat evenly and prevent the chili flakes from burning.
Let the chili oil cool to room temperature before transferring it to a sterilized, dry, airtight glass jar. Scoop out the amount you want to enjoy using a clean, dry spoon, then promptly refrigerate the remaining chili oil.