Remove seeds from chili peppers and chop roughly. If using dried peppers, soak in warm water until soft, then drain.
Add chilies, garlic, salt, and sugar to a blender or food processor.
Process until mixture reaches a smooth consistency.
Transfer the mixture to a medium pot and bring to a gentle simmer.
Cook for 15-20 minutes, stirring occasionally, until mixture thickens.
Add vinegar and simmer for an additional 2-3 minutes.
Remove from heat and let cool completely.
Transfer to sterilized jars or bottles and refrigerate.