From what you have described and the time frame, what would be wrong with the grandparents getting temporary custody now?
You can always petition the court later to ask for custody. It sounds like you have some work to do. Sit down with the mother and express your desire to have the child, get your legal parentage set up and be able to show the court that you have the ways and means to support this child. You will have to prove that you are the father, too; not just her saying you are. All that takes time.