4 month old baby has a bad cough. I've tried hot steamy bathroom, humidifier, saline nasal spray. How long will it take to go away?

It depends. If saline & suctioning isn't helping and you've tried steam and cool mist, it souns like it's time to see the doctor. There are so many causes for cough, each needing different management, that there's no way to know how long it'll last without examining him. I hope he feels better soon!
Other symptoms? If there's no fever, vomiting, diarrhea, there's probably no urgency. If runny nose is present, that may be the cause. Try bulb suctioning. Acid reflux may also play a rôle. If work up is negative, a trial of acid reducer like zantac, (ranitidine) may be considered. Allergies/asthma is another consideration. I'd recommend referral to physician in this case.