As long as it takes. If you want to be safe, then drop the fire and use akasha to balance your soul. The danger with specific elements lies in the backslashes, but not everyone experiences them.
To fully work with invocations of elements for the purpose you described, one should of course focus on the kumbhaka (retention) stage and do not breath out the element during the exhale.
Don't fall for who suggests you to use elemental mantras, as invocations with mantras are already advanced. Using mantras is beyond that and it doesn't work much better, sometimes even being weaker, if you are not on advanced levels. In general, one who is on an advanced level, is beyond the balancing of elements in the soul, as having the elements balanced and being fully clean in all areas of the soul are signs of advancement.
I'm currently experimenting with specific methods that revolve around focus the balancing on specific areas of the soul where the elements are stored, but it's still too early to suggest other people to do it, because I'm still determining if it works better or not.