(EXPERIMENTAL) Run ai models locally and chat with them on Instagram.
- Chat in groups and dm
- Reply to messages
- Fully local
- Image support (in future versions)
- NVIDIA GPU: Any modern one should work. Highly recommended. Make sure to install drivers and toolkit.
- Git: Comes pre-installed on most Linux distributions and MacOS, you need to install on Windows.
- Docker: This streamlines the process, instead of you having to manage everything.
- Python (3.10+): Not needed if running on docker. Download from python.org website.
- Instagram Account: Do NOT use your main account.
🐳 Docker setup is highly recommended on Linux and Windows.
-
(Linux only) Install and switch context to rootless, and allow nvidia toolkit to be accessed in rootless mode. This is typically pre-configured on cloud providers.
-
(Windows only) You need to use Windows Subsystem for Linux.
-
Use
.env.examplefile as a template, and fill out all the values in a.envfile. -
Run
start.shscript:bash ./start.sh
-
Install MongoDB Community Edition and create a new cluster, get the URI, and start the cluster.
-
Replace the existing
MONGO_URIconstant insrc/config.py:MONGO_URI = "your_uri_here"
-
Install Ollama, and run the
model/start.shfile, it will setup everything automatically:bash ./model/start.sh
-
Replace the
OLLAMA_HOSTconstant insrc/config.pywithhttp://127.0.0.1:11434(default url of Ollama):OLLAMA_HOST = "http://127.0.0.1:11434"
-
Download required libraries:
pip install -r requirements.txt # with pip uv sync # with uv
-
Use
.env.examplefile as a template, and fill out all the values in a.envfile. -
Run the main script:
python src/main.py
-
GPU support is limited on MacOS, so you will need to follow the non-docker setup to use Apple Silicon chip.
-
If you need to change the model, you can do it by going to
model/start.shand modifying the urls and names. If you change the name of the file to be downloaded, also modify it inmodel/Modelfile.if [ ! -f /models/model_name.gguf ]; then echo "Downloading 'Name here' model..." curl -L "https://huggingface.co/model/url.gguf" -o /models/model_name.gguf echo "Model 'Name here' download complete." fi
FROM "/models/model_name.gguf"
-
If you need to change the system prompt,
model/ModelfilecontainsSYSTEMkeyword followed by the string where you can put your new prompt. The file also contains other parameters you can tune. Here is a guide to Modelfile.SYSTEM "You are an ai model."
-
I have only tested this script on linux, so if some step is missing, please let me know by creating an issue.
-
If you're getting
ChallengeErrorand not able to login, enable 2FA on your account, runsrc/relogin.pylocally, enter the 2FA code (you will need to be quick here) and wait forsession.jsonfile to be generated. Now you must use this file to login next time (automatically handled in main file). -
Claude has been used to refactor the code and make it readable, all logic was written by me.
-
I've tried to make the setup instructions as simple as possible, if you still encounter a problem, just create an issue, or you can ask ai.
Although this project is meant for fun, and educational purposes, if you still wanna contribute, you're always welcome! :-)
Click to read
This is an experimental project that I built for fun. My friends and I were tired of Meta AI's censorship in Instagram chats where we wanted to troll each other. I took it as a challenge to build an AI system for us that has almost no censorship and would work similar to Meta AI.
Now obviously, Instagram is strict (very strict) about bots running on their platform and often bans such bot accounts very soon. I looked up the internet, and found out about aiograpi library (async version of instagrapi). It is very well maintained, and is very easy and intuitive to use, so all that was left was to piece everything together.
I experimented with the code, and eventually gained enough experience to use this library. In this process, one of my spare accounts got banned 🥲 and I had to create another one.
Instagram locked me out, and blocked my IP from logging into any accounts without browser. I brainstormed, and found an escape route, that was meant for security, but I used it for quite the opposite purpose. It was 2-Factor Authentication.
Instagram gave me access to my spare account after using 2FA code, and then I learnt that aiograpi could somewhat solve my problem. I could just save a session file and I won't have to login again and again.
Then development went smooth, I finally connected everything together, and me and my friends still use the models to have fun.
This project is licensed under MIT License.