you can legitimize your child at the Amphur for 30 Baht, but generally that is when they are 7, although it is up to the boss at the Amphur. My kid was able to answer all the questions and sign the books when he was 5 years. Or you can marry the mother. Same outcome.