There are a few options you can try, but we’re thinking that you’re going to have to give that machine to Apple for service, as it sounds like there might be a problem with the keyboard interface inside the machine. If you’re looking for software fixes, it might have something to do with a program or process that loads automatically on login. If you hold down the SHIFT key as you’re logging in that will bypass all the startup options. If that lets you login and the keyboard is still working, then go to System Preferences, Users & Groups, and find the login items. We’d recommend disabling them all until you figure out which one is the culprit. It is also recommended that when weird hardware issues strike, you reset the SMC (system management controller) and PRAM (parameter RAM, pronounced pee-RAM). These store information about your computer’s hardware configuration and when things are acting weird for no reason, they can often be the problem. The instructions for resetting the SMC and PRAM are rather complex, so you can read about how to do it here. If bypassing the login items and resetting the SMC and PRAM don’t work, you could try the ultimate software fix and reinstall OS X. If you hold down the Command and R keys as you are booting up your MacBook Air, you will enter the recovery console, where you can reinstall OS X. If your computer lacks the recovery partition, try holding down Option-Command-R to load it over the Internet. Remember that reinstalling OS X will erase all the data on your computer, so be sure you have important files backed up. If you try all these things, reformatting is optional--feel free to skip that, and it still doesn’t work, then it’s time to call Apple and have the machine serviced at the hardware level.