Regarding that common colloquial affirmative:
People, it’s spelled either “okay” or “OK.” It is not spelled “ok” in lower-case. “O.K.” with periods in it is defensible, but only just.
My own preference, when I get a chance to enforce it, is for “okay.” This is in part aesthetic, in that I just plain think it looks better than “OK”, and in part a reflection of my considered belief that the etymologies deriving the term either from the humorously-misspelled “Oll Korrect” or the tip-of-the-hat-to-Martin-Van-Buren “Old Kinderhook” are, to put it mildly, full of it. I go with the theory that the origin of the term is in a borrowing from either Choctaw or one of the West African languages, or possibly from both. (And I certainly would never put forward the conjecture that resistance to that etymology comes from an unwillingness on the part of some scholars, back in the day, to admit that American English might have borrowed such a useful word from anything other than a lily-white source.)
As for when writers of fiction should use “okay” and when they should avoid it (personal opinion alert here): Writers of contemporary mainstream and literary fiction have free rein to do as they choose. Ditto for contemporary mystery and romance. It’s the writers of historical fiction, science fiction, and fantasy who have the tough decisions to make.
Historical fiction – still, of course, strictly in my opinion – should avoid “okay’’ except for eras when it was in use. To do otherwise risks breaking the illusion being created for the reader by the introduction of a glaringly contemporary item into a careful arrangement of past details. The same principle holds for created-world fantasy written in the high style, or created-world fantasy that strives for a non-modern sense of time and place. Created-world fantasy written in a vernacular style, or urban fantasy, or fantasy set in the contemporary era or in some time and place closely resembling it, can use “okay” at will. Science fiction is also an “okay”-okay zone.
Edge cases, as always, remain edgy. Consult with your artistic conscience and use your best judgment and hope for good luck.
Because in the long run, it’s always the writer’s book, and you’re entitled to do whatever you think you can get away with.