Scan to open on your phone
Point a camera at the QR code - it opens this exact paste, no app needed.
https://codepastes.com/zzgt0yf46m2d21m8untitledPlain Text
import os
from google import genai
# 1. Apna Gemini API Key yahan dalein
# Aap free API key is website se le sakte hain: https://google.com
API_KEY = "YAHAN_APNA_API_KEY_DALEIN"
def start_ai():
# Client ko initialize karein
client = genai.Client(api_key=API_KEY)
print("=============================================")
print("๐ค Aapka AI Assistant Tyar Hai! (Type 'exit' to quit)")
print("=============================================\n")
# Chat session shuru karein taaki AI purani baatein yaad rakhe
chat = client.chats.create(model="gemini-2.5-flash")
while True:
try:
# User se sawal lein
user_input = input("๐ค Aap: ")
# Agar user 'exit' likhe toh program band ho jaye
if user_input.lower() == 'exit':
print("๐ค AI: Khuda Hafiz! Phir milenge.")
break
if not user_input.strip():
continue
# AI se jawab lein
response = chat.send_message(user_input)
# Jawab screen par dikhayein
print(f"๐ค AI: {response.text}\n")
except Exception as e:
print(f"โ Error: {e}")
print("๐ก Tip: Check karein aapka API Key sahi hai ya internet chal raha hai.\n")
if __name__ == "__main__":
start_ai()
1,400 chars ยท codepastes.com