Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lekt9/gpt-x-oauth-bridge
https://github.com/lekt9/gpt-x-oauth-bridge
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/lekt9/gpt-x-oauth-bridge
- Owner: lekt9
- Created: 2024-12-20T09:07:50.000Z (22 days ago)
- Default Branch: main
- Last Pushed: 2024-12-20T09:41:59.000Z (22 days ago)
- Last Synced: 2024-12-20T10:32:38.210Z (22 days ago)
- Language: Python
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# X.com API Bridge for GPT Assistants
A lightweight Flask server that provides a simple API key-based authentication bridge between X.com (formerly Twitter) and OpenAI GPT assistants using Tweepy.
## Features
- Simple API key authentication
- Direct Tweepy client integration
- Secure environment variable configuration
- Docker support for easy deployment## Prerequisites
- Python 3.6+
- X.com Developer Account
- API Key and API Key Secret from X.com## Installation
1. Clone the repository:
```bash
git clone https://github.com/yourusername/gpt-bridge.git
cd gpt-bridge
```2. Install dependencies:
```bash
pip install -r requirements.txt
```3. Configure environment variables:
```bash
cp .env.example .env
```Edit `.env` file with your credentials:
```
API_KEY=your_api_key
API_KEY_SECRET=your_api_key_secret
ACCESS_TOKEN=your_access_token
ACCESS_TOKEN_SECRET=your_access_token_secret
```## Usage
### Running Locally
```bash
python app.py
```The server will start on `http://localhost:5000`
### Using Docker
```bash
docker build -t gpt-bridge .
docker run -p 5000:5000 --env-file .env gpt-bridge
```## API Endpoints
### Authenticate
```http
POST /auth
Content-Type: application/json{
"api_key": "your_api_key"
}
```Response:
```json
{
"authenticated": true,
"user": "username"
}
```### Tweet
```http
POST /tweet
Content-Type: application/json
Authorization: Bearer your_api_key{
"text": "Your tweet content"
}
```### Get User Info
```http
GET /user
Authorization: Bearer your_api_key
```## Configuration for OpenAI
In your OpenAI/ChatGPT interface, use these settings:
- Authentication Type: API Key
- API Key: Your X.com API Key
- API Base URL: https://your-domain.com## Security Notes
- API keys are transmitted securely over HTTPS
- Keys are never logged or stored on the server
- All requests are validated against X.com's API