The short answer is: It depends.
Based on our research, O.K. and o.k. should be avoided. None of the grammar books we reference support the use of this form.
According to Gregg Reference Manual, okay is written without periods. “In sentences, the forms okay, okayed, and okaying look better than OK, OK’d, and OK’ing, but the latter forms may be used.” When used as a verb, spelling okay out is preferred.
OK is the form supported by Merriam-Webster and the AP style guide. If you are writing in AP style, you should only use OK.
The bank hasn’t yet OK’d my loan for a Lamborghini. Is it OK if I borrow your car until then?
Any style other than AP (if you prefer):
The bank hasn’t okayed my loan, so can you spot me the cash? Is it okay if I pay you back in Lamborghini rides instead of money?
There isn’t a steadfast rule for this issue, so each writer must choose between “preferred” forms as opposed to “correct” forms. If you are not writing in AP style, it is up to you or your publisher to decide whether to use OK or okay. At the end of the day, we recommend being consistent throughout. If you’re going to spell it out one time in your work, you should spell it out every time.