Melody used to bite when I first got her, but now she never bites.
If you have a new bird, you probably should not try to pet it right away, because that would stress a bird who is brand new to his/her environment. Let them be for a while, because no bird ever trusts a person right away.
After a few days, when your bird does not fly away immediately when you stick your hand in, you should try petting it slowly until the bird eventually trusts you. If you got bit, then immediately leave the bird alone and wait a couple more days. It's actually good you got bit, because the bird is telling you that it would rather be left alone and there is no communication problem.
If you can do that, take the bird out slowly. If you get bit again, immediately put the bird back. When the bird realizes you are not going to harm it and that you are trying to help it, it will trust you and let you take it out. Melody took a day to trust me and she would still not late me take her out with a struggle.
When you get the bird out for many days, then the bird has learned to trust you. From this point, you can teach it tricks and how to speak and such, but go slowly at first. Also, the more time you spend with your bird, the less likely it will bite you.
If you occasionally get bit after this, then that would mean that something you are doing is incorrect and the bird does not like it. It is also good, because you can change that. Stopping the bird's biting habit would be in your power.
All types of birds are generally very kind and sociable animals. They, after trusting you, usually do not bite at all. Melody has been with me for 3 years and now trusts and loves me because I spend a lot of time with her and usually let her do what she wants UNLESS it is dangerous to her. Because of this, and all the time I've had her I didn't do anything bad to her, she will not bite.
Birds that can fly usually won't bite because if they do not like something, they won't bite, they'll just fly away. If they are biting, then you are seriously bothering them and forcing them to do something they do not want. Clipped birds( like Melody) can't do anything to get away or show you they do not like what you are doing, so they have to resort to biting. Therefore, if you have a clipped bird, you are more likely to get bit.