Skip to content
/ XAI Public

AI assisted chrome reply extension for X (Twitter)

Notifications You must be signed in to change notification settings

tmedanovic/XAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

XAI

XAI is an X (Twitter) power tool which includes chrome extension and local REST service written in NodeJs for generating tweets using ChatGTP and Twitter API. It offers preset buttons that you can define yourself so you can reply or post tweets quickly. It also includes Google Image Search API integration.

Getting started

Prerequisites

  • Use paid ChatGPT account - it's only way to use ChatGPT API.
    • It works best with ChatGPT Plus subscription (20$/mo) where you can use chat-gpt-4 model
    • You can also use pay-as-you go model (pay per request but you are limited to ChatGPT 3.5) and it's not really good (don't do it)
  • Create ChatGPT API key

  • Apply for X Developer account
  • Setup project on X Dashboard
    • Edit authentication settings
      • Change permissions to Read and Write
      • Set type of app to "Web app.."
      • Set required fields to https://localhost (doesn't matter but it's required)

    • Under project Keys and tokens:
      • Generate API key and secret
      • Generate Access token and secret

Optional

If you want to use Image search feature:

Running the project

  • Clone the project
  • Run npm install in xai-nodejs-backend and xai-chrome-ext folders
  • Create .env file in xai-nodejs-backend folder:
    NODE_ENV=development
    X_API_KEY=<Twitter API key you generated in previous step>
    X_API_SECRET=<Twitter API secret you generated in previous step>
    X_ACCESS_TOKEN=<Twitter access token you generated in previous step>
    X_ACCESS_SECRET=<Twitter access secret you generated in previous step>
    
  • Create .env file in xai-chrome-ext folder:
    CHAT_GPT_API_KEY=<ChatGPT API key you generated in previous step>
    CHAT_GPT_MODEL=gpt-4
    XAI_SERVICE_URL=http://localhost:5000
    GOOGLE_IMAGE_SEARCH_API_KEY=<Google API key you generated in previous step>
    GOOGLE_IMAGE_SEARCH_API_CX=<Google cx generated in previous step>
    
  • Start xai-nodejs-backend service using npm run dev
  • Build xai-chrome-ext using npm run start for development mode, npm run build for production build
  • Add the extension to Chrome:
    1. Go to chrome://extensions/
    2. Enable the Developer mode
    3. Click on Load unpacked
    4. Choose the dist directory inside of xai-chrome-ext folder