In a small saucepan, mix together the sake, mirin, sugar and water and bring to a simmer. In a small bowl, mix the miso with a couple of tablespoons of the simmered liquid to loosen it, then whisk back in the miso and ground sesame seeds until smooth. Stir in the onions and simmer for a minute or two to let the flavours mix. Taste and add the vinegar if desired. Remove from heat and set aside – warm the sauce again before serving.