Skip to content
ReadMe Daily

Search articles, problems, patterns and every cheat sheet topic.

ChatGPT Cheat Sheet

9 groups · 38 topics · Updated

ChatGPT is OpenAI's AI assistant, and the same models can be called from code through the OpenAI API. This is an independent guide, checked against OpenAI's developer documentation in November 2026. Model names and prices change often, so confirm them on the official pages linked at the end.

1

Models

Which model to choose, and what it costs.

Current models

Model ID Use it for
GPT-6 Astra gpt-6-astra The most demanding work
GPT-6.1 Sol gpt-6.1-sol Complex work at a lower cost
GPT-6.1 Terra gpt-6.1-terra Fast work: images, writing, computer use
GPT-6 Luna gpt-6-luna High volume, focused tasks
  • In the app you pick a model from a menu. In code you pass the ID.
  • Start with Sol. Move up for difficulty, down for speed and cost.

Prices

US dollars per million tokens, for prompts up to 272K tokens.

Model Input Cached input Output
Astra $10 $1 $50
Sol $2 $0.10 $10
Terra $1 $0.05 $5
Luna $0.10 $0.01 $0.50
  • Output costs five times as much as input.
  • These are API prices. The ChatGPT app is a separate subscription.

Limits

Limit Size
Context window 1.05M tokens
Longest reply 128K tokens
  • The context window is everything the model can see at once: instructions, history, tools and its own reply.
  • A token is a chunk of text, often part of a word.

Other models

For ID
Making and editing images gpt-image-2.6-sunburst
Live voice conversation gpt-live-1
Speech to text gpt-transcribe

App or API

ChatGPT app OpenAI API
Used by People, in a chat window Programs, in code
Paid by Subscription Tokens used
Remembers the chat Yes Only what you send or link
Sign up at chatgpt.com platform.openai.com

A ChatGPT subscription does not include API credit.

2

Prompting

How to ask so that the first answer is usable.

A good prompt

  • Task. What you want done, in one sentence.
  • Purpose. What the result is for.
  • Audience. Who will read it, and what they already know.
  • Material. The text, data or code to work on.
  • Format. Length, layout and tone.
  • Limits. What to leave out.
Write a 100-word product update for
customers who are not technical.
Explain the new export button below.
Friendly tone, no jargon, no emoji.

Separate the material

Mark where pasted text starts and ends, so it is not read as an instruction.

Summarise the email between the
markers in three bullet points.
 
"""
...paste the email here...
"""
  • Triple quotes, tags or a heading all work. Use one style throughout.

Show an example

Rewrite each line as a short heading.
 
Input: we fixed the bug in login
Output: Login bug fixed
 
Input: you can now export to csv
Output:
  • One to three examples is enough.
  • An example shows format and tone better than a description does.

Follow up

A chat is a conversation. Improve the answer instead of starting again.

Say To get
"Shorter. Keep the first point." A tighter version
"As a table." A different layout
"For a ten-year-old." A simpler explanation
"What did you assume?" Hidden guesses
"Give me three other options." Alternatives
"What is the weakest part?" A critique

Fix a weak answer

Problem Try
Too long State a length: "under 100 words"
Too generic Add the audience and the purpose
Wrong format Show the format with an example
Makes things up Paste the source and say "use only this"
Out of date Turn on search, or paste recent facts
Lost the thread Start a new chat with a summary

Check the answer

  • It can be confidently wrong. Check facts, numbers, quotes and links.
  • Ask for sources, then open them.
  • Run any code it writes before you rely on it.
  • For anything medical, legal or financial, treat it as a starting point, not advice.
3

The ChatGPT app

Features of the chat app, and how to use it safely.

Features

Feature Does
Custom instructions Standing rules about you and how to answer, used in every chat
Memory Keeps useful facts from earlier chats
Projects Groups chats, files and instructions for one piece of work
GPTs Saved assistants with their own instructions and files
Temporary chat A chat that is kept out of your history and memory
Search Looks things up on the web and cites sources
Deep research Researches a topic at length and writes a report
Canvas A side panel for editing a document or code together
Voice Talk and listen instead of typing
Files and images Upload a document, spreadsheet or picture to work on

What you get depends on your plan and country.

Useful requests

To Ask
Summarise "Summarise this in five bullet points."
Rewrite "Rewrite this to be clearer and half as long."
Explain "Explain this code line by line."
Compare "Compare these two options in a table."
Extract "List every date and amount in this text."
Plan "Break this goal into steps for one week."
Review "What is unclear or missing in this draft?"

Custom instructions

About me: I am a web developer.
I use JavaScript and British spelling.
 
How to answer: be brief. Give code
first, then one line of explanation.
No apologies, no filler.
  • Find them in Settings, under Personalisation.
  • Keep them short. They apply to every chat.

Shortcuts on the web

Keys Does
Shift + Enter New line without sending
Ctrl or ⌘ + Shift + O New chat
Ctrl or ⌘ + Shift + S Show or hide the sidebar
Ctrl or ⌘ + Shift + C Copy the last code block
Ctrl or ⌘ + / Show all shortcuts

Privacy

  • Do not paste passwords, API keys or other people's personal data.
  • Check Settings, Data controls, to see whether your chats are used to improve the models.
  • Use a temporary chat for anything you do not want kept.
  • At work, follow your company's rules on what may be shared.
4

Responses API

Calling the models from JavaScript.

Set up

npm install openai
export OPENAI_API_KEY="your-key"
import OpenAI from "openai";
 
// reads OPENAI_API_KEY
const client = new OpenAI();
  • Keep the key on the server. Never ship it in browser code or commit it.

First request

const res = await client.responses.create({
  model: "gpt-6.1-sol",
  instructions: "You are a maths tutor.",
  input: "What is pi?",
});
 
res.output_text;
Field Meaning
model Which model to use
input The question, or a list of messages
instructions The role and rules for this request

Read the reply

res.output_text; // all the text, joined
res.status;      // → "completed"
res.id;          // to continue later
res.output;      // every item, in order
res.usage;       // tokens in and out
  • output is a list of items: messages, reasoning and tool calls.
  • output_text is the shortcut for the text alone.

A conversation

const next = await client.responses.create({
  model: "gpt-6.1-sol",
  previous_response_id: res.id,
  input: "Explain it more simply.",
});

Or send the history yourself:

input: [
  { role: "user", content: "I am Asha." },
  { role: "assistant", content: "Hi Asha!" },
  { role: "user", content: "Who am I?" },
],

Images

input: [
  {
    role: "user",
    content: [
      {
        type: "input_text",
        text: "What is in this image?",
      },
      {
        type: "input_image",
        image_url: imageUrl,
      },
    ],
  },
],

Two APIs

Responses Chat Completions
Status The main API: use for new code Older, still supported
Call client.responses.create client.chat.completions.create
Send input messages
Read res.output_text res.choices[0].message.content
5

Shaping the reply

Streaming, reasoning effort, length and structured output.

Streaming

const stream =
  await client.responses.create({
    model: "gpt-6.1-sol",
    input: "Tell me a story.",
    stream: true,
  });
 
const delta = "response.output_text.delta";
 
for await (const event of stream) {
  if (event.type === delta) {
    process.stdout.write(event.delta);
  }
}
Event Means
response.created The reply has started
response.output_text.delta A piece of text arrived
response.completed The reply is finished
error Something went wrong

Reasoning effort

reasoning: { effort: "low" },
Level Use it for
none, minimal The fastest replies. Not every model accepts them
low Quick, simple tasks
medium The usual default
high, xhigh Hard problems
max When being right matters more than cost
  • Higher effort means more thinking, more tokens and a slower reply.
  • Each model accepts only some levels. An unsupported one is a 400 error.

Reply length

max_output_tokens: 25000,
if (res.status === "incomplete") {
  res.incomplete_details.reason;
  // → "max_output_tokens"
}
  • The limit covers reasoning as well as the visible reply. Set it too low and the reply can be empty.

JSON output

import { z } from "zod";
import { zodTextFormat }
  from "openai/helpers/zod";
 
const Person = z.object({
  name: z.string(),
  email: z.string(),
});
 
const res = await client.responses.parse({
  model: "gpt-6.1-sol",
  input: "Asha, asha@example.com",
  text: {
    format: zodTextFormat(Person, "person"),
  },
});
 
res.output_parsed.name;
  • The reply is made to match the schema.
  • If the model refuses, there is no parsed result. Check before using it.
6

Tools

Letting the model call your code.

Define a function

const tools = [
  {
    type: "function",
    name: "get_weather",
    description: "Weather in a city now",
    parameters: {
      type: "object",
      properties: {
        city: { type: "string" },
      },
      required: ["city"],
      additionalProperties: false,
    },
    strict: true,
  },
];
  • The model never runs it. It asks, your code runs it, and you send back the result.
  • strict: true makes the arguments match the schema exactly.

The tool loop

  1. Send the request with tools.
  2. Look in res.output for items of type function_call.
  3. Parse arguments, which is a JSON string, and run your function.
  4. Add the model's output items to input, then a function_call_output for each call.
  5. Send again with the same tools. Repeat until there are no more calls.

Send a result back

import { toResponseInputItems } from
  "openai/lib/responses/ResponseInputItems";
 
input.push(
  ...toResponseInputItems(res.output),
);
 
for (const item of res.output) {
  if (item.type !== "function_call") {
    continue;
  }
  const args = JSON.parse(item.arguments);
 
  input.push({
    type: "function_call_output",
    call_id: item.call_id,
    output: "18°C, cloudy",
  });
}
  • call_id must match the call being answered.
  • output must be a string. Use JSON.stringify for an object.
  • Keep every output item, not only the messages. Dropping reasoning or tool items makes the next request fail.

Built-in tools

These run on OpenAI's servers. There is no loop to write.

Tool type
Web search web_search
Search your uploaded files file_search
Connect to an MCP server mcp
tools: [{ type: "web_search" }],
7

Cost and speed

Paying less and waiting less.

Prompt caching

  • It is automatic. There is nothing to turn on.
  • It applies to prompts of 1,024 tokens or more.
  • The start of the prompt must be identical to an earlier request.
  • Put what stays the same first: instructions, tools, reference text. Put what changes last.
  • Cached input costs about a tenth of the normal price, or less.
res.usage.input_tokens_details.cached_tokens;

If that stays at 0, something near the start of the prompt changes every time, such as a date.

Usage

res.usage.input_tokens;
res.usage.output_tokens;
res.usage.total_tokens;

Spend less

Situation Use
Same long prompt each time Keep the start identical, for caching
The answer can wait Batch API: half price
A simple task Luna or Terra, or lower effort
Replies too long Ask for a length in the prompt
History keeps growing Start again from a summary
8

Errors

What went wrong, and whether to try again.

Status codes

Code SDK class Retry?
400 BadRequestError No
401 AuthenticationError No
403 PermissionDeniedError No
404 NotFoundError No
409 ConflictError Yes
422 UnprocessableEntityError No
429 RateLimitError Yes
500 and up InternalServerError Yes
None APIConnectionError Yes

Catch errors

const { RateLimitError, APIError } = OpenAI;
 
try {
  await client.responses.create(params);
} catch (err) {
  if (err instanceof RateLimitError) {
    // wait, then try again
  } else if (err instanceof APIError) {
    console.error(err.status);
    console.error(err.requestID);
  } else {
    throw err;
  }
}
  • Check the most specific class first.
  • Quote requestID when you ask for support.

Retries and timeouts

const client = new OpenAI({
  maxRetries: 2,    // the default
  timeout: 600_000, // 10 min, in ms
});
  • The SDK already retries connection errors, 408, 409, 429 and 5xx.
  • The timeout is in milliseconds.

Common causes

Error Usually means
401 The key is missing, mistyped or revoked
404 The model ID is wrong, or your account cannot use it
429 Too many requests, or the account is out of credit
400 A field is missing, misnamed or not allowed for this model
9

More help

The official pages this sheet was checked against.

Official documentation

Topic Page
Models Models
Prices Pricing
Tools Function calling
JSON output Structured outputs
Reasoning Reasoning
Caching Prompt caching
JavaScript SDK openai-node on GitHub
The app OpenAI Help Center