Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b90577c
d
Zeeeepa Sep 3, 2025
9f2f5fe
up
Zeeeepa Sep 3, 2025
08a032a
Merge branch 'codegen-sh:develop' into develop
Zeeeepa Sep 5, 2025
bac9125
Integrate graph-sitter SDK with codemods and gsbuild
codegen-sh[bot] Sep 5, 2025
a55b700
feat: Complete graph-sitter SDK integration with dual-package deployment
codegen-sh[bot] Sep 5, 2025
28ffcfe
fix: Resolve type checker warnings for SDK imports
codegen-sh[bot] Sep 5, 2025
e588da7
fix: Apply ruff linting fixes to core module
codegen-sh[bot] Sep 5, 2025
9ebaf29
Merge pull request #149 from Zeeeepa/codegen-bot/complete-graph-sitte…
Zeeeepa Sep 5, 2025
fbb5ca4
Update build.py
Zeeeepa Sep 7, 2025
e5c37be
Add files via upload
Zeeeepa Sep 7, 2025
8252b20
Add files via upload
Zeeeepa Sep 7, 2025
19cc655
Delete test.py
Zeeeepa Sep 7, 2025
cbb0981
Add files via upload
Zeeeepa Sep 7, 2025
7599338
Update README.md
Zeeeepa Sep 7, 2025
673af96
Update README.md
Zeeeepa Sep 7, 2025
6d1e21b
Update README.md
Zeeeepa Sep 7, 2025
b28cf25
Add files via upload
Zeeeepa Sep 10, 2025
1cba256
Add files via upload
Zeeeepa Sep 10, 2025
1ad43db
Add files via upload
Zeeeepa Sep 10, 2025
ca399e7
Add files via upload
Zeeeepa Sep 10, 2025
0269fde
Add files via upload
Zeeeepa Sep 11, 2025
cdc9dfb
Add files via upload
Zeeeepa Sep 11, 2025
704f981
a
Zeeeepa Sep 11, 2025
b81bd7d
aa
Zeeeepa Sep 11, 2025
1b64892
Merge branch 'codegen-sh:develop' into develop
Zeeeepa Sep 12, 2025
84dbc3f
Add comprehensive framework analysis for Wave-based Codegen interface
codegen-sh[bot] Sep 16, 2025
4385a36
feat: Implement AI-Powered API Endpoint Manager
codegen-sh[bot] Sep 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
44 changes: 44 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# AI Endpoint Manager Configuration

# Core Features
AUTO_CREATE_ENDPOINTS=TRUE
AUTO_MANAGE_SERVERS=TRUE
AUTO_TEST_ENDPOINTS=TRUE
AUTO_DISCOVER_INTERFACES=FALSE

# API Keys (optional - can be set per endpoint)
OPENAI_API_KEY=your_openai_api_key_here
GEMINI_API_KEY=your_gemini_api_key_here
DEEPINFRA_API_KEY=your_deepinfra_api_key_here
DEEPSEEK_API_KEY=your_deepseek_api_key_here
CODEGEN_API_KEY=your_codegen_api_key_here

# Proxy Configuration (optional)
USE_PROXY=FALSE
PROXY_ROTATION=TRUE

# Browser Automation
HEADLESS_BROWSER=TRUE
BROWSER_TIMEOUT=30
MAX_CONCURRENT_BROWSERS=5

# Server Configuration
DEFAULT_SERVER_PORT=8000
MAX_CONCURRENT_REQUESTS=100
REQUEST_TIMEOUT=30

# Logging
LOG_LEVEL=INFO
LOG_FILE=ai_endpoint_manager.log

# Database (optional)
DATABASE_URL=sqlite:///endpoints.db

# Security
ENABLE_AUTH=FALSE
JWT_SECRET=your_jwt_secret_here
ALLOWED_ORIGINS=*

# Monitoring
ENABLE_METRICS=TRUE
METRICS_PORT=9090
265 changes: 265 additions & 0 deletions AI_ENDPOINT_MANAGER_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
# AI Endpoint Manager

πŸš€ **Transform any web chat interface into a scalable API endpoint**

An AI-powered system that converts web chat interfaces (ChatGPT, DeepSeek, Claude, etc.) into REST API endpoints and manages multiple AI services with persistent sessions, fingerprinted browser instances, and intelligent load balancing.

## 🎯 Features

### Core Capabilities
- **Web Chat to API Conversion** - Transform any web chat interface into REST API endpoints
- **Multi-Provider Support** - OpenAI, Gemini, DeepInfra, DeepSeek, Codegen, and custom APIs
- **Dynamic Server Management** - On/off toggleable servers with persistent sessions
- **AI-Assisted Discovery** - Automatically analyze and integrate new web interfaces
- **Sandboxed Execution** - Secure browser automation in isolated containers
- **Session Persistence** - Maintain cookies, fingerprints, and authentication across restarts

### Advanced Features
- **Model Naming System** - `webdeepseek1`, `webdeepseek8` for easy identification
- **Priority Management** - Set provider priorities and load balancing
- **Real-time Monitoring** - Live server status and performance metrics
- **Configuration Management** - Export/import endpoint configurations
- **Proxy Support** - Rotate proxies for different endpoints
- **Interactive Testing** - Built-in chat interface for endpoint validation

## πŸš€ Quick Start

### Installation

```bash
# Clone the repository
git clone https://github.com/your-org/ai-endpoint-manager.git
cd ai-endpoint-manager

# Install dependencies
pip install -r requirements.txt

# Install browser automation tools
playwright install

# Copy environment configuration
cp .env.example .env
```

### Basic Usage

```bash
# Run the interactive manager
python src/ai_endpoint_manager.py
```

### Menu Options

1. **Create New Web Chat Endpoint** - Add ChatGPT, DeepSeek, Claude, etc.
2. **Create New REST API Endpoint** - Add OpenAI, Gemini, DeepInfra APIs
3. **List Active Endpoints** - View all configured endpoints and their status
4. **Start/Stop Servers** - Toggle individual endpoint servers
5. **Test Endpoints** - Send test messages to validate functionality
6. **AI-Assisted Discovery** - Analyze new web interfaces automatically
7. **Manage Server Priorities** - Configure load balancing and priorities
8. **Export/Import Configuration** - Backup and restore endpoint settings
9. **Run All Features** - Automated mode for production use

## πŸ“‹ Configuration

### Web Chat Interface Setup

```python
# Example: Adding DeepSeek web interface
URL: https://chat.deepseek.com
Username: your_username (optional)
Password: your_password (optional)

# CSS Selectors (auto-discovered if left blank)
Text Input: #message-input
Send Button: .send-button
Response Area: .chat-messages
```

### REST API Setup

```python
# Example: Adding OpenAI API
Name: OpenAI GPT-4
URL: https://api.openai.com/v1
API Key: sk-your-api-key-here
```

## πŸ”§ Advanced Configuration

### Environment Variables

```bash
# Core Features
AUTO_CREATE_ENDPOINTS=TRUE
AUTO_MANAGE_SERVERS=TRUE
AUTO_TEST_ENDPOINTS=TRUE

# API Keys
OPENAI_API_KEY=your_key_here
DEEPSEEK_API_KEY=your_key_here
CODEGEN_API_KEY=your_key_here

# Browser Settings
HEADLESS_BROWSER=TRUE
MAX_CONCURRENT_BROWSERS=5
```

### Proxy Configuration

Create `proxy.txt` with your proxy list:
```
http://proxy1:port
socks5://user:pass@proxy2:port
http://proxy3:port
```

## πŸ—οΈ Architecture

### Core Components

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Web Management UI β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚
β”‚ β”‚ Endpoint Managerβ”‚ β”‚ Server Control β”‚ β”‚ Test Interface β”‚β”‚
β”‚ β”‚ (Create/Config) β”‚ β”‚ (Start/Stop) β”‚ β”‚ (Validation) β”‚β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ AI Endpoint Manager Core β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚
β”‚ β”‚ Session Manager β”‚ β”‚ Proxy Manager β”‚ β”‚ Config Manager β”‚β”‚
β”‚ β”‚ (Persistence) β”‚ β”‚ (Rotation) β”‚ β”‚ (Import/Export) β”‚β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Web Chat β”‚ β”‚ REST API β”‚ β”‚ Custom β”‚
β”‚ Interceptor β”‚ β”‚ Proxy β”‚ β”‚ Endpoints β”‚
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β€’ Browser Auto β”‚ β”‚ β€’ API Clients β”‚ β”‚ β€’ Plugin System β”‚
β”‚ β€’ Session Mgmt β”‚ β”‚ β€’ Auth Handling β”‚ β”‚ β€’ Custom Logic β”‚
β”‚ β€’ Fingerprintingβ”‚ β”‚ β€’ Rate Limiting β”‚ β”‚ β€’ Extensibility β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

## πŸ” API Endpoints

Once servers are running, each endpoint provides a standardized API:

### Chat Completion
```bash
POST /v1/chat/completions
Content-Type: application/json

{
"model": "webdeepseek1",
"messages": [
{"role": "user", "content": "Hello, how are you?"}
],
"stream": false
}
```

### List Models
```bash
GET /v1/models

{
"data": [
{
"id": "webdeepseek1",
"object": "model",
"created": 1640995200,
"owned_by": "ai-endpoint-manager"
}
]
}
```

## πŸ“Š Monitoring

### Server Status
- **Online** - Server running and accepting requests
- **Offline** - Server stopped
- **Starting** - Server initializing
- **Stopping** - Server shutting down
- **Error** - Server encountered an error

### Metrics Tracked
- Request count per endpoint
- Response times
- Error rates
- Session persistence status
- Proxy rotation statistics

## πŸ”’ Security Features

- **Sandboxed Execution** - Browser instances run in isolated containers
- **Session Isolation** - Each endpoint maintains separate sessions
- **Fingerprint Management** - Unique browser fingerprints per session
- **Proxy Rotation** - Automatic proxy switching for anonymity
- **Authentication Handling** - Secure credential storage and management

## πŸ› οΈ Development

### Project Structure
```
src/
β”œβ”€β”€ ai_endpoint_manager.py # Main application
β”œβ”€β”€ web_interceptor/ # Web chat interface handlers
β”œβ”€β”€ api_proxy/ # REST API proxy implementations
β”œβ”€β”€ session_manager/ # Session persistence logic
β”œβ”€β”€ browser_automation/ # Playwright/Selenium integration
└── config/ # Configuration management

tests/
β”œβ”€β”€ unit/ # Unit tests
β”œβ”€β”€ integration/ # Integration tests
└── e2e/ # End-to-end tests
```

### Running Tests
```bash
# Unit tests
pytest tests/unit/

# Integration tests
pytest tests/integration/

# All tests
pytest
```

## 🀝 Contributing

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## πŸ“ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## πŸ™ Acknowledgments

- Inspired by cryptocurrency bot patterns for robust session management
- Built on the foundation of modern async Python practices
- Leverages browser automation for seamless web interface integration

## πŸ“ž Support

- πŸ“§ Email: [email protected]
- πŸ’¬ Discord: [Join our community](https://discord.gg/ai-endpoint-manager)
- πŸ“– Documentation: [Full docs](https://docs.ai-endpoint-manager.com)
- πŸ› Issues: [GitHub Issues](https://github.com/your-org/ai-endpoint-manager/issues)

---

**Transform any AI chat interface into a scalable API endpoint with AI Endpoint Manager!** πŸš€
Loading