Skip to content

OpenAI (GPT)

All OpenAI functions share the same shape: a prompt, an optional system prompt and an optional ignore_cache flag. They need an OpenAI API key once you are licensed. Get one at platform.openai.com/api-keys and add it via Set API Keys → Insert OpenAI API Key.

Functions

FunctionModelGood for
=GPT(prompt, [system_prompt], [ignore_cache])gpt-6.1-terrathe default: fast, strong at writing, good value
=GPT6(prompt, [system_prompt], [ignore_cache])gpt-6-astrathe most capable model, hardest reasoning tasks
=GPT61(prompt, [system_prompt], [ignore_cache])gpt-6.1-solnear-Astra quality at a lower price
=GPT61mini(prompt, [system_prompt], [ignore_cache])gpt-6.1-terrasame model as =GPT()
=GPT6mini(prompt, [system_prompt], [ignore_cache])gpt-6-lunacheapest current-generation model, classification and extraction
=GPT56(prompt, [system_prompt], [ignore_cache])gpt-5.6-solGPT-5.6 flagship
=GPT56mini(prompt, [system_prompt], [ignore_cache])gpt-5.6-terrabalanced quality and cost
=OpenAI(prompt, [system_prompt], [model_name], [ignore_cache])anypick any model by name

Parameters

  • prompt (required): the text sent as the user message. Reference a cell, a literal string, or a combination: "Summarize: " & A2.
  • system_prompt (optional): instructions that shape the answer. Defaults to “You are a helpful assistant.” Pass "" to skip it when you need the next argument.
  • model_name (=OpenAI() only, optional): any OpenAI chat model ID, for example "gpt-6-astra". Retired IDs are mapped to their replacement automatically.
  • ignore_cache (optional): TRUE forces a fresh API call. Default FALSE. See Caching.

Examples

=GPT("Write a two-sentence product description for " & A2)
=GPT6("Find the logical flaw in this argument: " & B2, "You are a rigorous editor. Be brief.")
=GPT6mini(A2, "Reply with the industry of this company in two words max")
=OpenAI("Explain photosynthesis to a 10-year-old", "", "gpt-6.1-sol")
=GPT("What changed in the news today?", "", TRUE)

Legacy function names

Older sheets keep working. These names run on current models:

Legacy functionNow runs on
=GPT4o(), =GPT41()gpt-6-luna
=GPT5(), =O1(), =O1PRO(), =O3(), =O3MINI()gpt-5.6-sol
=GPT5mini(), =O4MINI()gpt-5.6-terra

Legacy model names in =OpenAI()

If you pass a retired model ID as model_name, it is replaced with the model OpenAI recommends:

You passRuns on
gpt-3.5-turbo, gpt-4o, gpt-4o-mini, gpt-4.1, gpt-4.1-minigpt-6-luna
gpt-4, gpt-4-turbo, chatgpt-4o-latest, gpt-5, gpt-5-pro, gpt-5-chat-latest, gpt-5.1/5.2/5.3-chat-latest, o1, o1-pro, o1-preview, o3, o3-mini, o3-progpt-5.6-sol
gpt-5-mini, o1-mini, o4-minigpt-5.6-terra
gpt-4.1-nano, gpt-5-nanogpt-5.6-luna

Errors

Errors are returned as text in the cell so a single bad row does not break the sheet.

Cell showsMeaning
Error: Free trial for OpenAI used up (10/10) ...Activate your license and add your own key.
Error: OpenAI API key not set ...Add your key via Set API Keys → Insert OpenAI API Key.
Error calling OpenAI API: OpenAI API returned 401 ...The key was rejected. Re-copy it from OpenAI.
... returned 429 ...Rate limit or no credit on your OpenAI account.
... returned 404 ...The model name does not exist or was retired. Use one from the table above.
No prompt providedThe prompt cell is empty.

More in Troubleshooting.