I don't know exactly how it works, but using GPT-3 via https://platform.openai.com/playground/, you can have it assign a likeliness score to each word, given all the previous text. That could act as a good confidence score.
Take this with a grain of salt though, I'm far from an expert, and it's been a while since I've played around with that feature.
Take this with a grain of salt though, I'm far from an expert, and it's been a while since I've played around with that feature.