OpenAI GPT Text and Code Generation

Beginning with TextBuddy v1.4, you can use your OpenAI API key to generate text and source code directly inside TextBuddy.

Interacting with OpenAI is as simple as running any other TextBuddy command. Here’s a quick example video where I ask OpenAI to write a poem about my cat named Ziggy:

You can also use the Generate Source Code command to ask OpenAI to write a block of code for you.

To use OpenAI’s text completion API with TextBuddy, you’ll need to create an OpenAI account and enter your API key into TextBuddy’s Preferences.

The Temperature and Max Tokens settings are advanced options that you can read about in the OpenAI API Reference. Quoting from their documentation…


Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 for ones with a well-defined answer.

Max Tokens:

The maximum number of tokens to generate in the completion. The token count of your prompt plus max_tokens cannot exceed the model’s context length. Most models have a context length of 2048 tokens. A helpful rule of thumb is that one token generally corresponds to ~4 characters of text for common English text. This translates to roughly ¾ of a word (so 100 tokens ~= 75 words).