pull down to refresh
Quick Python example to call GPT-5 MiniQuick Python example to call GPT-5 Mini
You’ll need your own OpenAI API key to run thisYou’ll need your own OpenAI API key to run this
from openai import OpenAI
Create a client with your keyCreate a client with your key
client = OpenAI(api_key="YOUR_API_KEY") # replace with your own key
response = client.chat.completions.create(
model="gpt-5-mini",
messages=[
{"role": "system", "content": "You’re a helpful assistant."},
{"role": "user", "content": "Can you show me a Python snippet to call this model?"}
]
)
Print out the model’s responsePrint out the model’s response
print(response.choices[0].message["content"])
Give me a python snippet for calling this model?