The baby has to be born, then a SAPCR needs to be filed, her to sign waiver of servie, and an order entered giving you custody of the child. If you have someone able to adopt the child with you, you could terminate her rights and adopt outright. Costs depend on the amount of time and the amount of agreement you can come to with your ex. Could be hundreds of dollars, could be thousands.
There are two options, getting custody or terminating rights. Terminating parental rights is tough to do unless the parent agrees to relinquish parental rights AND the court accepts the termination.
Costs are impossible to estimate. You need to address that question to an attorney in your area.