GPT (Generative Pre-trained Transformer) is OpenAI's flagship large language model line โ the model family behind ChatGPT and the default engine powering a huge share of AI features built into other products. It's the single most-used AI model line in the world today, with roughly 81.4% usage share across developer and product integrations, far ahead of any competitor. GPT models (GPT-4o, GPT-5 and their successors) are known for broad general-purpose capability across chat, coding, reasoning, and multimodal input, making them the go-to default choice for most developers building AI-powered apps.
The GPT API is called through OpenAI's official Python SDK. This sends a prompt to gpt-4o using the Chat Completions API and prints the reply.
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY")
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "user", "content": "Explain what a REST API is in two sentences."}
]
)
print(response.choices[0].message.content)
Create an OpenAI platform account, generate an API key, install the SDK, then make your first call.
# 1. Create an account and API key at platform.openai.com/api-keys
# 2. install the SDK
pip install openai
# 3. set your key as an environment variable
export OPENAI_API_KEY="your-key-here"