Melt the butter in a saucepot. Add the onions and garlic, and saute until the onions are translucent. Add the chili powder, smoked paprika, dry mustard, garlic powder, onion powder and cayenne. Cook for 2 to 3 minutes to toast the spices. Add the brown sugar and molasses; stir until the sugar is dissolved.
Add the ketchup, Dijon mustard, Worcestershire sauce and cider vinegar, and bring to a simmer. Cook the sauce for 30 to 45 minutes and then puree with an immersion blender. Season with salt and pepper.