Heat 1/2 cup oil in medium flame. You can use any flavorless oil.
Add 1 small bayleaf, 1 star anise, 1/2 teaspoon schezwan pepper, 1 one inch cinnamon. Give a quick mix. You can even add 4 small onion or shallots if you prefer. If you are adding garlic to the oil then add it as a clove around 4 cloves of garlic - do not chop or mince it.
Simmer for 10 minutes. Do not let the spices burn, it you feel it gets darkened then switch off then on it. Remove the pan periodically to avoid burning of spices. The flame should be in lowest flame as possible. As you can see only small bubbles should be coming. To be more accurate the oil temperature should be between 110 deg C - 120 deg C not more than that.
Switch off.
Now to a mixing bowl add 1 and 1/2 tablespoon chili flakes, 1 tablespoon chili powder, 2 tablespoon garlic finely chopped, 1 teaspoon brown sugar, 2 tablespoon sesame seeds, 1 teaspoon salt.
Mix this well first.
Now strain and add the infused oil. Make sure oil is not smoking hot, the resting time while mixing the ingredients is just enough.
It should slowly bubble up like this only then it will not burn the spices.
Mix it well. Homemade chili oil is ready.