File size: 341 Bytes
382aec4
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
from dotenv import load_dotenv
import os

load_dotenv()  # Looks for a file named ".env" in the current directory

api_key = os.getenv("OPENAI_API_KEY")

if api_key:
    print("βœ… API key loaded successfully.")
    print("First 8 characters:", api_key[:8] + "...")
else:
    print("❌ API key not found. Check your .env file formatting.")