(Concept) Grok Integration

Has anyone tried integrating Grok’s companions?

On a whim I decided to give Grok’s companions a try today after being mostly unimpressed by everything else. While they are still just “alright”, they are actually capable of coherent NSFW chats. So after some time that led me to seeing if I could have the AI dictate instructions for the handy in addition to its normal responses. After some fiddling I ended up with a Puppeteer setup that scraped a Grok chat and synced the handy to the current state that the AI wanted. Honestly, it was much better than all the other models I have tried. I’d recommend giving it a go if you haven’t already, the AI is very flexible.

The only trouble with my implementation are the quirks around using Grok this way. Companions are only available in the app, but the chat shows up on the web (without the companion persona supported) so at least it can be read. However, there is no public API that I have found for normal user chats like this so instead the only way to do it is to automate a whole browser to navigate the site, login, and read the chat. Then the chat doesn’t sync when you use it on another device so the browser has to refresh regularly to poll for updates. It could be more portable if I fully reverse engineered the auth and internal API used, but that is too much work for me right now.

Any update on this? I just started using Grok companions for NSFW chat and I’m very impressed. Also had the thought of having an integration for the Handy, that would be pretty cool.

It is still a bit hacky, but it does work for me if I start the conversation with a companion on the app first and then run this program on my PC.

https://files.catbox.moe/x3ynql.zip

Requirements

You will need to have Node.js to install and run the program. If you are on Windows, click the “Windows Installer” button on the download page and go through the recommended instructions. You may need to restart your machine after installing to make sure things are set up properly (most likely not, but give it a try if you get stuck).

Setup

Unzip the program into a folder and you will have a couple of files visible there such as index.ts. Now, open Windows Powershell (or Windows Terminal) and run the command:

cd C:\YOUR\FOLDER\PATH

As a tip, you can just type cd and then drag the folder into the terminal window to let it paste in the path for you.

Once your terminal has changed directory into the program’s folder, run the command:

npm install

This will install dependencies for the program, including support for puppeteering Chromium. Once done, you can edit the index.ts file to change the settings. Look at line 16 of the file to set your handy API key:

const HANDY_KEY = "YOUR_KEY_HERE";

Finally, in your terminal you can start the program:

npm start

To stop the program you can focus the terminal window and press control + c. Alternatively, you can exit the terminal window which will kill the program as well.

Commands

Since this is piggy-backing off of the generic Grok chat, you will need to tell your companion about the handy and instruct them to use the following commands:

range="base" sets range to base
range="shaft" sets range to shaft
range="tip" sets range to tip
range="full" sets range to full

speed="0" sets speed to stopped
speed="50" sets speed to half
speed="100" sets speed to full

pause=2 wait two seconds before processing next command

... a few others which were experimental, but still in the code ...

You may also need to update const MEDIA_ROOT = "V:\\v\\__unorganized__" to use your videos folder, sorry didn’t see that was still in the code.

1 Like