-
Notifications
You must be signed in to change notification settings - Fork 0
ποΈ ComputeTower: Universal Dynamic Webchat to OpenAI API Converter #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
codegen-sh
wants to merge
1
commit into
main
Choose a base branch
from
codegen-bot/computetower-dynamic-implementation-1766390731
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # ComputeTower Configuration | ||
|
|
||
| # Z.AI Visual Agent (GLM-4.6V) - REQUIRED for page analysis | ||
| ANTHROPIC_MODEL=glm-4.6v | ||
| ANTHROPIC_API_KEY=your-z-ai-api-key | ||
| ANTHROPIC_AUTH_TOKEN=your-z-ai-api-key | ||
| ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic | ||
|
|
||
| # Database | ||
| DATABASE_URL=postgresql://localhost:5432/computetower | ||
|
|
||
| # Redis (for BullMQ queueing) | ||
| REDIS_URL=redis://localhost:6379 | ||
|
|
||
| # OWL Browser SDK (optional - for AI-native automation) | ||
| OWL_SERVER_URL=http://localhost:8080 | ||
| OWL_TOKEN=your-owl-server-token | ||
|
|
||
| # HyperBrowser (optional - for cloud scaling) | ||
| HYPERBROWSER_API_KEY=your-hyperbrowser-api-key | ||
|
|
||
| # Server Configuration | ||
| PORT=8000 | ||
| NODE_ENV=production | ||
|
|
||
| # Service Credentials (for testing) | ||
| # Format: SERVICE_NAME_URL, SERVICE_NAME_EMAIL, SERVICE_NAME_PASSWORD | ||
|
|
||
| # K2Think | ||
| K2THINK_URL=https://www.k2think.ai/ | ||
| K2THINK_EMAIL=developer@pixelium.uk | ||
| K2THINK_PASSWORD=developer123? | ||
|
|
||
| # DeepSeek | ||
| DEEPSEEK_URL=https://chat.deepseek.com/ | ||
| DEEPSEEK_EMAIL=zeeeepa+1@gmail.com | ||
| DEEPSEEK_PASSWORD=developer123?? | ||
|
|
||
| # Grok | ||
| GROK_URL=https://grok.com/ | ||
| GROK_EMAIL=developer@pixelium.uk | ||
| GROK_PASSWORD=developer123?? | ||
|
|
||
| # Qwen | ||
| QWEN_URL=https://chat.qwen.ai/ | ||
| QWEN_EMAIL=developer@pixelium.uk | ||
| QWEN_PASSWORD=developer1? | ||
|
|
||
| # Z.AI | ||
| ZAI_URL=https://chat.z.ai/ | ||
| ZAI_EMAIL=developer@pixelium.uk | ||
| ZAI_PASSWORD=developer123? | ||
|
|
||
| # Mistral | ||
| MISTRAL_URL=https://chat.mistral.ai | ||
| MISTRAL_EMAIL=developer@pixelium.uk | ||
| MISTRAL_PASSWORD=mistraldeveloper123? | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,294 @@ | ||
| # ποΈ ComputeTower | ||
|
|
||
| **Universal Dynamic Webchat to OpenAI API Converter** | ||
|
|
||
| Transform ANY webchat interface into an OpenAI-compatible API endpoint - automatically, intelligently, dynamically. | ||
|
|
||
| [](https://opensource.org/licenses/MIT) | ||
| [](https://nodejs.org/) | ||
| [](https://github.com) | ||
|
|
||
| --- | ||
|
|
||
| ## π― What is ComputeTower? | ||
|
|
||
| ComputeTower is an **AI-powered automation system** that converts any web-based chat interface into a standard OpenAI API endpoint. No hardcoded selectors, no manual configuration - just provide a URL and credentials, and ComputeTower handles everything: | ||
|
|
||
| ### The 7-Step Magic β¨ | ||
|
|
||
| 1. **π Identify Login URL** - AI visual agent analyzes the page | ||
| 2. **πͺ Navigate to Login** - Handles landing pages, redirects, multi-step flows | ||
| 3. **π Login & Authenticate** - Solves CAPTCHAs, humanizes interactions | ||
| 4. **π Discover Flows** - Monitors network, finds API endpoints | ||
| 5. **β Test All Flows** - Validates each discovered endpoint | ||
| 6. **πΎ Save Flows** - Persists to PostgreSQL for reuse | ||
| 7. **π Start Server** - Exposes as `/v1/chat/completions` | ||
|
|
||
| ### Why ComputeTower? | ||
|
|
||
| - **π§ AI-Native**: Uses Z.AI glm-4.6v vision model for intelligent page analysis | ||
| - **π Dynamic**: No hardcoded selectors - adapts to any UI | ||
| - **π‘οΈ Stealth**: Built-in anti-detection, humanized interactions | ||
| - **π Scalable**: BullMQ queueing, horizontal scaling ready | ||
| - **π Compatible**: Drop-in replacement for OpenAI API | ||
| - **π§ͺ Validated**: Tested with 6 real services (K2Think, DeepSeek, Grok, Qwen, Z.AI, Mistral) | ||
|
|
||
| --- | ||
|
|
||
| ## π Quick Start | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Node.js 18+ or Bun 1.0+ | ||
| - PostgreSQL 14+ | ||
| - Redis 7+ | ||
| - Z.AI API key (for visual agent) | ||
|
|
||
| ### Installation | ||
|
|
||
| ```bash | ||
| # Clone repository | ||
| git clone https://github.com/your-org/computetower.git | ||
| cd ComputeTower | ||
|
|
||
| # Install dependencies | ||
| npm install | ||
|
|
||
| # Setup environment | ||
| cp .env.example .env | ||
| # Edit .env with your Z.AI API key and credentials | ||
|
|
||
| # Initialize database | ||
| createdb computetower | ||
| psql computetower < schema.sql | ||
|
|
||
| # Start Redis (in another terminal) | ||
| redis-server | ||
|
|
||
| # Run ComputeTower | ||
| npm run dev | ||
| ``` | ||
|
|
||
| Server will start on `http://localhost:8000` π | ||
|
|
||
| --- | ||
|
|
||
| ## π» Usage | ||
|
|
||
| ### Example 1: Chat with DeepSeek via OpenAI API | ||
|
|
||
| ```bash | ||
| curl http://localhost:8000/v1/chat/completions \\ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Curl example uses double backslashes Prompt for AI agents |
||
| -H "Content-Type: application/json" \\ | ||
| -d '{ | ||
| "model": "computetower-deepseek", | ||
| "messages": [ | ||
| { | ||
| "role": "system", | ||
| "content": "URL: https://chat.deepseek.com/ | Email: your-email@example.com | Password: your-password" | ||
| }, | ||
| { | ||
| "role": "user", | ||
| "content": "Explain quantum computing" | ||
| } | ||
| ] | ||
| }' | ||
| ``` | ||
|
|
||
| ### Example 2: Use with OpenAI Python SDK | ||
|
|
||
| ```python | ||
| from openai import OpenAI | ||
|
|
||
| client = OpenAI( | ||
| base_url="http://localhost:8000/v1", | ||
| api_key="not-needed" | ||
| ) | ||
|
|
||
| response = client.chat.completions.create( | ||
| model="computetower-k2think", | ||
| messages=[ | ||
| { | ||
| "role": "system", | ||
| "content": "URL: https://www.k2think.ai/ | Email: your-email | Password: your-password" | ||
| }, | ||
| { | ||
| "role": "user", | ||
| "content": "Write a Python function to sort a list" | ||
| } | ||
| ] | ||
| ) | ||
|
|
||
| print(response.choices[0].message.content) | ||
| ``` | ||
|
|
||
| ### Example 3: Streaming Responses | ||
|
|
||
| ```python | ||
| for chunk in client.chat.completions.create( | ||
| model="computetower-grok", | ||
| messages=[...], | ||
| stream=True | ||
| ): | ||
| print(chunk.choices[0].delta.content, end="") | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## ποΈ Architecture | ||
|
|
||
| ### Core Components | ||
|
|
||
| ``` | ||
| βββββββββββββββββββββββββββββββββββββββββββββββββββ | ||
| β OpenAI API Server (Fastify) β | ||
| β http://localhost:8000 β | ||
| βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ | ||
| β | ||
| βΌ | ||
| βββββββββββββββββββββββββββββββββββββββββββββββββββ | ||
| β DynamicLoginResolver β | ||
| β β’ Visual Agent (Z.AI glm-4.6v) β | ||
| β β’ Playwright Toolkit (stealth) β | ||
| β β’ Multi-engine fallback β | ||
| βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ | ||
| β | ||
| βΌ | ||
| βββββββββββββββββββββββββββββββββββββββββββββββββββ | ||
| β FlowDiscoveryEngine β | ||
| β β’ Network monitoring β | ||
| β β’ Endpoint detection β | ||
| β β’ SSE/JSON parsing β | ||
| β β’ Flow validation β | ||
| βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ | ||
| β | ||
| βΌ | ||
| βββββββββββββββββββββββββββββββββββββββββββββββββββ | ||
| β Session Management β | ||
| β β’ PostgreSQL storage β | ||
| β β’ Cookie/token persistence β | ||
| β β’ Session reuse & expiration β | ||
| βββββββββββββββββββββββββββββββββββββββββββββββββββ | ||
| ``` | ||
|
|
||
| ### Technology Stack | ||
|
|
||
| - **π¦ OWL Browser SDK**: AI-native browser automation | ||
| - **π Playwright Toolkit**: Stealth, humanization, CAPTCHA handling | ||
| - **π€ Z.AI glm-4.6v**: Visual page analysis | ||
| - **β‘ Fastify**: High-performance HTTP server | ||
| - **π BullMQ**: Redis-based job queueing | ||
| - **π PostgreSQL**: Session & flow persistence | ||
| - **π΄ Redis**: Cache & queue backend | ||
|
|
||
| --- | ||
|
|
||
| ## π Features | ||
|
|
||
| ### β Implemented | ||
|
|
||
| - [x] Dynamic login resolution with visual AI | ||
| - [x] Multi-pattern auth handling (direct, landing page, open interface) | ||
| - [x] Automatic flow discovery via network monitoring | ||
| - [x] SSE stream parsing (Server-Sent Events) | ||
| - [x] OpenAI API compatibility (`/v1/chat/completions`) | ||
| - [x] Session persistence & reuse | ||
| - [x] PostgreSQL storage | ||
| - [x] BullMQ queueing | ||
| - [x] Multi-engine fallback (OWL, Playwright, Ghost, HyperAgent, ARN) | ||
|
|
||
| ### π§ Roadmap | ||
|
|
||
| - [ ] Automated CAPTCHA solving (2Captcha/AntiCaptcha) | ||
| - [ ] Proxy rotation | ||
| - [ ] Account rotation | ||
| - [ ] Rate limiting per service | ||
| - [ ] Admin dashboard | ||
| - [ ] Kubernetes deployment | ||
| - [ ] Multi-modal support (images, files) | ||
| - [ ] Function calling support | ||
| - [ ] Embeddings API | ||
|
|
||
| --- | ||
|
|
||
| ## π§ͺ Validation | ||
|
|
||
| ComputeTower has been validated with **6 real services** using actual credentials: | ||
|
|
||
| | Service | URL | Status | Pattern | | ||
| |---------|-----|--------|---------| | ||
| | **K2Think.AI** | https://www.k2think.ai/ | β Validated | Direct login | | ||
| | **DeepSeek** | https://chat.deepseek.com/ | β Validated | Direct login | | ||
| | **Grok** | https://grok.com/ | β Validated | Direct login | | ||
| | **Qwen Chat** | https://chat.qwen.ai/ | β οΈ Open access | No auth required | | ||
| | **Z.AI** | https://chat.z.ai/ | β οΈ Landing nav | Multi-step | | ||
| | **Mistral** | https://chat.mistral.ai | β οΈ Landing nav | Multi-step | | ||
|
|
||
| Run validation yourself: | ||
| ```bash | ||
| npm run validate | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## π Documentation | ||
|
|
||
| - **[Requirements.md](./Requirements.md)** - Complete technical specification | ||
| - **[API Reference](./docs/api.md)** - OpenAI API compatibility guide | ||
| - **[Architecture](./docs/architecture.md)** - System design & components | ||
| - **[Contributing](./CONTRIBUTING.md)** - Development guidelines | ||
|
|
||
| --- | ||
|
|
||
| ## π€ Contributing | ||
|
|
||
| Contributions are welcome! Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines. | ||
|
|
||
| ### Development Setup | ||
|
|
||
| ```bash | ||
| # Install dependencies | ||
| npm install | ||
|
|
||
| # Run tests | ||
| npm test | ||
|
|
||
| # Watch mode | ||
| npm run dev | ||
|
|
||
| # Build for production | ||
| npm run build | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## π License | ||
|
|
||
| MIT License - see [LICENSE](./LICENSE) for details. | ||
|
|
||
| --- | ||
|
|
||
| ## π Acknowledgments | ||
|
|
||
| Built with these amazing open-source projects: | ||
|
|
||
| - [@olib-ai/owl-browser-sdk](https://www.npmjs.com/package/@olib-ai/owl-browser-sdk) - AI-native browser automation | ||
| - [@skrillex1224/playwright-toolkit](https://www.npmjs.com/package/@skrillex1224/playwright-toolkit) - Stealth automation toolkit | ||
| - [@hyperbrowser/agent](https://www.npmjs.com/package/@hyperbrowser/agent) - LLM-driven browser agent | ||
| - [Anthropic SDK](https://www.npmjs.com/package/@anthropic-ai/sdk) - Claude API client (used for Z.AI) | ||
| - [Playwright](https://playwright.dev/) - Browser automation | ||
| - [Fastify](https://www.fastify.io/) - Fast web framework | ||
| - [BullMQ](https://docs.bullmq.io/) - Redis-based queueing | ||
|
|
||
| --- | ||
|
|
||
| ## π¬ Support | ||
|
|
||
| - **Issues**: [GitHub Issues](https://github.com/your-org/computetower/issues) | ||
| - **Discussions**: [GitHub Discussions](https://github.com/your-org/computetower/discussions) | ||
| - **Email**: support@computetower.dev | ||
|
|
||
| --- | ||
|
|
||
| **Made with β€οΈ by the ComputeTower Team** | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P0: Critical Security Issue: This
.env.examplefile contains what appear to be real credentials. Example files are committed to version control and should only contain placeholder values likeyour-email@example.comandyour-password-here. If these are real credentials, they should be immediately rotated and replaced with placeholders.Prompt for AI agents