Skip to content

OpenAI API Cheat Sheet

This quick reference lists popular OpenAI models, their token limits, and the most common parameters. See the official documentation for full details.

Model Overview

Model Type Max Tokens / Limits Notes
gpt-4 Chat ~8k context window Latest high‑capability chat model
gpt-4-32k Chat ~32k context window Extended version of GPT‑4
gpt-3.5-turbo Chat ~4k context window Fast and cost‑effective
gpt-3.5-turbo-16k Chat ~16k context window Larger context version
text-davinci-003 Completion 4,097 tokens Classic text completion
text-curie-001 Completion 2,049 tokens Balanced capability and speed
text-babbage-001 Completion 2,049 tokens Good for simple tasks
text-ada-001 Completion 2,049 tokens Fast, inexpensive model
text-embedding-ada-002 Embedding 8,191 input tokens Generates text embeddings
whisper-1 Audio ~25MB file size Speech‑to‑text transcription
dall-e Image N/A Image generation

Common Parameters

  • model – Model name from the table above.
  • prompt / messages – Text input or chat message list.
  • max_tokens – Length of generated output. Prompt + result must not exceed the model limit.
  • temperature – Randomness level (0–2). Higher values create more varied results.
  • top_p – Alternative nucleus sampling parameter.
  • n – Number of completions or images to generate.
  • stop – Sequences where generation will halt.
  • stream – If true, responses arrive incrementally.
  • presence_penalty – Penalizes token appearance so far (−2.0 to 2.0).
  • frequency_penalty – Penalizes token frequency (−2.0 to 2.0).
  • logit_bias – Adjusts probability of specified tokens.

Embeddings

  • input – String or array of strings to embed.
  • user – Optional identifier for the end user.

Audio

  • file – Audio file object (mp3, mp4, wav, etc.).
  • response_formatjson, text, srt, or vtt.
  • prompt – Optional text prompt guiding the transcription.

Images

  • prompt – Text description of the desired image.
  • n – Number of images to generate.
  • size256x256, 512x512, or 1024x1024.
  • response_formaturl (default) or b64_json for base64‑encoded output.

Rate Limits and Usage

OpenAI enforces per‑minute and daily rate limits that vary by model and account. If you exceed these limits, the API returns rate limit errors. Check your usage dashboard to monitor quotas.

Token limits listed above apply to the combined length of your prompt and the generated result. Store your API key securely and avoid publishing it in public repositories.