This little word gets lots of different spelling treatments, some with punctuation and others with different combinations of capital and lowercase letters. The two you use in your question – OK and okay – are the forms most often supported. You will find them in dictionaries and style guides. When choosing between them, defer to the style guide you typically use, as they vary on this issue. If you don’t need to adhere to a specific style, you can choose between the two. Make sure to stay consistent in your usage, however. All of this also applies to past tense. The past tense of OK is OK’d. (Note the apostrophe as recommended by the AP Stylebook.) Okay simply becomes okayed.
Use this casual language with care. It’s certainly appropriate in many situations, particularly in creative writing, and you might use it to construct a colloquial voice, create informality, and work toward authenticity of character. Still, don’t let it sneak into writing situations where a more formal voice is appropriate, which might include some characters’ voices or more formal articles.
—Brandi Reissenweber teaches fiction writing and reading fiction at Gotham Writers Workshop.