Course contentsShow
← AI Engineering
Lesson 85 of 1,8863. API-First AI EngineeringFree lesson

OpenAI API: Models and Endpoints Overview

Understand OpenAI's GPT models, available endpoints (chat, completion), and key parameters for text generation.

OpenAI API: Models and Endpoints Overview

You'll learn: How OpenAI organizes its GPT models and the API endpoints you use to interact with them for text generation.

The Core Idea

OpenAI provides access to its GPT models through a web API—you send requests over the internet instead of running models locally. Think of it like ordering food delivery: you don't need the kitchen (GPU hardware) at home, you just send your order (API request) and receive the result.

Available Models

OpenAI offers several GPT model families:

  • GPT-4 models (e.g., gpt-4, gpt-4-turbo): Most capable, higher cost
  • GPT-3.5 models (e.g., gpt-3.5-turbo): Faster, more affordable
  • Each model has different pricing, speed, and capability trade-offs

Main Endpoints

Chat Completions (/v1/chat/completions): The modern, recommended endpoint. You send a conversation history (messages with roles like "user" and "assistant"), and the model continues the conversation.

Completions (/v1/completions): Legacy endpoint for simple text continuation. You provide a prompt, the model completes it. Mostly replaced by chat completions.

Key Parameters

When making requests, you control behavior through parameters:

  • model: Which GPT version to use
  • temperature: Randomness (0 = deterministic, higher = more creative)
  • max_tokens: Maximum length of the response
  • messages (chat) or prompt (completion): Your input text

Key Takeaway: OpenAI's API abstracts away infrastructure complexity—you choose a model and endpoint, configure generation parameters, and let OpenAI handle the hardware and optimization. This API-first approach prioritizes convenience over control, perfect for rapid development.