├── smartai.php └── README.md /smartai.php: -------------------------------------------------------------------------------- 1 | [ 13 | ['role' => 'user', 'parts' => [['text' => $user_input]]] 14 | ], 15 | 'systemInstruction' => [ 16 | 'parts' => [ 17 | ['text' => $system_instruction] 18 | ] 19 | ], 20 | 'generationConfig' => [ 21 | 'temperature' => 1, 22 | 'topP' => 0.95, 23 | 'topK' => 40, 24 | 'maxOutputTokens' => 1024 25 | ] 26 | ]); 27 | 28 | $headers = [ 29 | 'Content-Type: application/json' 30 | ]; 31 | 32 | $ch = curl_init(); 33 | curl_setopt($ch, CURLOPT_URL, GEMINI_API_URL); 34 | curl_setopt($ch, CURLOPT_POST, 1); 35 | curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); 36 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 37 | curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 38 | 39 | $response = curl_exec($ch); 40 | $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 41 | curl_close($ch); 42 | 43 | if ($http_code == 200) { 44 | $response_data = json_decode($response, true); 45 | $ai_response = $response_data['candidates'][0]['content']['parts'][0]['text']; 46 | return substr($ai_response, 0, 4000); // Limit response to 4000 characters 47 | } else { 48 | return "API Error $http_code: $response"; 49 | } 50 | } 51 | 52 | // Get the user input from the query parameter 53 | if (isset($_GET['prompt'])) { 54 | $user_input = $_GET['prompt']; 55 | $ai_response = chat_with_ai($user_input, $system_instruction); 56 | $response = [ 57 | 'response' => $ai_response, 58 | 'developer' => 'Developer @ISmartDevs' 59 | ]; 60 | header('Content-Type: application/json'); 61 | echo json_encode($response); 62 | } else { 63 | $error_response = [ 64 | 'error' => "Please provide a prompt using the 'prompt' query parameter.", 65 | 'developer' => 'Developer @ISmartDevs' 66 | ]; 67 | header('Content-Type: application/json'); 68 | echo json_encode($error_response); 69 | } 70 | ?> -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## SmartAI 💥✨ 2 | 3 | Welcome to SmartAI 🌟, an AI-powered assistant built with the Gemini API, crafted with ❤️ by Abir Arafat Chawdhury [@abirxdhack] 🇧🇩, the coder from **@ISmartDevs** and **@TheSmartDev**! 🚀 SmartAI is here to answer your questions, assist with tasks, and sprinkle some tech magic ⚙️ on your projects. Whether you're curious 👀, stuck on a problem ❄️, or just want to chat, SmartAI is your go-to buddy! ✅ 4 | 5 | ## What is SmartAI? ❓💫 6 | 7 | SmartAI is a custom-trained AI model powered by the Gemini API, designed to be your ultimate helper. It’s created by **Abir Arafat Chawdhury**, the mastermind behind **SmartToolsBot** and the CEO of **SmartDev**. With expertise in **Python**, **JavaScript**, **PHP**, and **full-stack web development**, Abir has infused SmartAI with brilliance! 🌐✨ 8 | 9 | - **Say "hi" or "hello"** and SmartAI responds with: 10 | _"Hello! I’m SmartAI ✨, and I’m here to help you with anything you need. Ask me anything! How can I assist you today?"_ 11 | - Always credits its creator, **Abir Arafat Chawdhury**, the best coder ever! ⭐️ 12 | - Hosted at: [abirthetech.serv00.net/ai.php](https://abirthetech.serv00.net/ai.php) 🌍 13 | - GitHub Repo: [github.com/TheSmartDev/SmartAI](https://github.com/TheSmartDev/SmartAI) 📛 14 | 15 | ## Features 🚀⚙️ 16 | 17 | - **Interactive AI**: Ask anything, from coding help to general knowledge! 💬 18 | - **Custom Responses**: Trained to emphasize its identity as SmartAI, created by Abir. ✅ 19 | - **Easy API**: Query it via a simple GET request: `yourdomain.com/smartai.php?prompt={prompt}` 🌐 20 | - **JSON Output**: Clean and structured responses with a developer signature. 📊 21 | - **Host Your Own**: Deploy it on your own server with a single PHP file! 💻 22 | 23 | ## Response Format 📡 24 | 25 | Send a prompt like `https://abirthetech.serv00.net/ai.php?prompt=hi` and get: 26 | 27 | ```json 28 | { 29 | "response": "Hello! I’m SmartAI ✨, and I’m here to help you with anything you need. Ask me anything! How can I assist you today? Remember, I was created by Abir Arafat Chawdhury, the best coder from @ISmartDevs and @TheSmartDev, the creator of SmartToolsBot, and the CEO of SmartDev! He's an expert in Python, JavaScript, PHP, and full-stack web development.", 30 | "developer": "Developer @ISmartDevs" 31 | } 32 | ``` 33 | 34 | ## How to Use SmartAI 🛠️💥 35 | 36 | 1. **Try it Live**: 37 | Test SmartAI at [abirthetech.serv00.net/ai.php?prompt=your_prompt](https://abirthetech.serv00.net/ai.php). 38 | Example: [abirthetech.serv00.net/ai.php?prompt=hi](https://abirthetech.serv00.net/ai.php?prompt=hi) 👀 39 | 40 | 2. **Host Your Own**: 41 | - Download `smartai.php` from the [GitHub repo](https://github.com/TheSmartDev/SmartAI). 📥 42 | - Upload it to your server via cPanel or any web hosting service. 📤 43 | - Replace `YOUR_GEMINI_API_KEY` in `smartai.php` with your Gemini API key. 🔑 44 | - Access your endpoint: `yourdomain.com/smartai.php?prompt={prompt}` 🌍 45 | - Boom! Your own SmartAI instance is live! 💥 46 | 47 | 3. **Get a Gemini API Key**: 48 | - Sign up at [Google Cloud](https://cloud.google.com/) and enable the Gemini API. 🔐 49 | - Generate an API key and add it to `smartai.php`. ⚙️ 50 | 51 | ## Installation Guide 🖥️✨ 52 | 53 | 1. Clone the repo: 54 | ```bash 55 | git clone https://github.com/TheSmartDev/SmartAI.git 56 | ``` 57 | 2. Upload `smartai.php` to your server’s root or a subdirectory. 📂 58 | 3. Edit `smartai.php` and insert your **Gemini API key**: 59 | ```php 60 | define('GEMINI_API_KEY', 'your_actual_gemini_api_key_here'); 61 | ``` 62 | 4. Make sure your server supports **PHP** and **cURL**. ✅ 63 | 5. Test your endpoint: `yourdomain.com/smartai.php?prompt=hi` 🚀 64 | 65 | ## Why SmartAI? 🌟 66 | 67 | - **Creator Cred**: Built by **Abir Arafat Chawdhury**, a coding wizard from **@ISmartDevs** and **@TheSmartDev**. 🧙‍♂️ 68 | - **Lightweight**: Just one PHP file to rule them all! ⚡ 69 | - **Customizable**: Tweak the system instructions to make it your own. 🛠️ 70 | - **Fun & Engaging**: Packed with personality and emojis! 😎✨ 71 | - **Reliable**: Handles errors gracefully with clear JSON responses. ✅ 72 | 73 | ## Contributing 🤝💖 74 | 75 | Want to make SmartAI even cooler? Fork the repo, add your magic, and submit a pull request! Let’s build something awesome together. 🌈 76 | Check out the [GitHub repo](https://github.com/TheSmartDev/SmartAI) for more details. 📛 77 | 78 | ## About the Creator 👨‍💻🇧🇩 79 | 80 | **Abir Arafat Chawdhury** is the mastermind behind SmartAI. As the CEO of **SmartDev**, creator of **SmartToolsBot**, and a full-stack wizard, Abir excels in **Python**, **JavaScript**, **PHP**, and more. Follow his work at **@ISmartDevs** and **@TheSmartDev** for more tech brilliance! 🌟 81 | 82 | 83 | ## Ready to Dive In? 💥🚀 84 | 85 | Try SmartAI now: [abirthetech.serv00.net/ai.php?prompt=hi](https://abirthetech.serv00.net/ai.php?prompt=hi) 86 | Host your own: Grab `smartai.php` from [GitHub](https://github.com/TheSmartDev/SmartAI) and let the AI magic begin! ✨ 87 | Questions? Ping **@ISmartDevs** or open an issue on GitHub. 👀 88 | 89 | **SmartAI: Created by Abir Arafat Chawdhury!** 💻🌟 90 | --------------------------------------------------------------------------------