Place the beans in a colander and rinse thoroughly in cold running water. Allow them to drain while you gather the other ingredients.
In a medium saucepot over high heat, stir together the beans, onions, sugar, chili powder, and garlic powder. Bring to a simmer and reduce the heat to medium-low and continue to simmer for 20 to 25 minutes. If needed, you can add a little water or vegetable broth if the beans start drying out too much.
Taste the beans and season with salt and pepper to your liking.
Stir in the cilantro and remove the pot from the heat.
Serve while warm with lime wedges or use as a dip at room temperature.