He's only with me for the baby

My boyfriend recently told me the only reason he is still with me is because we are expecting a baby. He said if it wasn't for the baby he wouldn't be with me. This man means the world to me and I can't bring myself to leave him especially when he threatens custody over me (he has secretly recorded me yelling at him during some of our arguments to make me look like some sort of unstable woman). What do I do?