Ask a single query with CHAT GPT

Screen Recording 2023-01-27 at 11 20 43 PM

Open chat-gpt-simple in Script Kit


  1. Get an API KEY from
  2. Paste that API key inside your .kenv/.env file as OPENAI_API_KEY=<YOUR_OPEN_API_SECRET>
  3. Running the script will work as expected.

Script snippet

// Name: Chat with CHAT GPT
// Description: Ask CHAT GPT Anything
import "@johnlindquist/kit";
const { Configuration, OpenAIApi } = await npm("openai");
// Use below line for better TS hints
// import { Configuration, OpenAIApi } from "openai";
const configuration = new Configuration({
apiKey: await env("OPENAI_API_KEY")
const openAI = new OpenAIApi(configuration);
const prompt = await editor("");
const completion = await openAI.createCompletion({
model: "text-davinci-003",
temperature: 0,
max_tokens: 4069
const choices =;
const response = choices[0].text;
// Uncomment if you want your computer to speak the response
// say(response);
const containerClassName =
"flex justify-center items-center text-2xl h-full p-10";
await div(response, containerClassName);