#!/usr/bin/env python3
from openai import OpenAI
from dotenv import load_dotenv

load_dotenv()
client = OpenAI()

response = client.responses.create(
  model = "gpt-5-mini",
  input = "How do I use list comprehension in Python?"
)
print(response.output_text)

# optional: show additional response data
print(f"Input tokens:  {response.usage.input_tokens}")
print(f"Output tokens: {response.usage.output_tokens}")
print(f"Total tokens:  {response.usage.total_tokens}")

# cached tokens if using prompt caching
if response.usage.input_tokens_details.cached_tokens > 0:
    print(f"Cached tokens: {response.usage.input_tokens_details.cached_tokens}")
