melchat 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2025 Melvin Carvalho
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,131 @@
1
+ # melchat
2
+
3
+ > **100+ AI models. One command. Zero backend.**
4
+
5
+ ```bash
6
+ npx melchat
7
+ ```
8
+
9
+ That's it. Open your browser and start chatting with GPT-4, Claude, Gemini, Llama, Qwen, DeepSeek, and 100+ more models.
10
+
11
+ ---
12
+
13
+ ## Why melchat?
14
+
15
+ | Feature | melchat | Others |
16
+ |---------|---------|--------|
17
+ | Models supported | **100+** | 1-5 |
18
+ | File size | **69KB** | 10MB+ |
19
+ | Backend required | **No** | Usually |
20
+ | Install time | **3 seconds** | Minutes |
21
+ | Free models | **Yes** | Rarely |
22
+
23
+ ## Quick Start
24
+
25
+ ```bash
26
+ # Run instantly (no install needed)
27
+ npx melchat
28
+
29
+ # Or install globally
30
+ npm install -g melchat
31
+ melchat
32
+ ```
33
+
34
+ ## Supported Models
35
+
36
+ ### Free Tier (No API key needed via OpenRouter)
37
+ - Gemma 2 9B
38
+ - Llama 3.1 8B
39
+ - Phi-3 Medium
40
+ - Qwen 2 7B
41
+ - MiMo V2
42
+
43
+ ### Frontier Models
44
+ - **OpenAI**: GPT-4o, GPT-4 Turbo, GPT-3.5
45
+ - **Anthropic**: Claude 3.5 Sonnet, Claude 3 Opus
46
+ - **Google**: Gemini Pro, Gemini Flash
47
+ - **Meta**: Llama 3.3 70B, Llama 3.1 405B
48
+ - **DeepSeek**: V3, R1
49
+ - **Qwen**: 2.5 72B, QwQ 32B
50
+
51
+ ### Image & Video Generation
52
+ - Flux.1 (text-to-image)
53
+ - Kling 2.6 Pro (text-to-video)
54
+ - Z-Image Turbo (fal.ai)
55
+
56
+ ### Local Models
57
+ - Ollama endpoints
58
+ - RunPod
59
+ - vLLM
60
+ - Any OpenAI-compatible API
61
+
62
+ ## Features
63
+
64
+ - **Streaming responses** - Real-time token streaming
65
+ - **Conversation history** - Saved locally in browser
66
+ - **Token counter** - Track usage and costs
67
+ - **Code highlighting** - Syntax highlighting for 100+ languages
68
+ - **Mobile responsive** - Works on any device
69
+ - **Export chats** - Markdown, JSON, or plain text
70
+ - **System prompts** - Customize AI behavior
71
+ - **Multi-language UI** - EN, DE, FR, CS, UK, RU
72
+
73
+ ## CLI Options
74
+
75
+ ```bash
76
+ melchat [options]
77
+
78
+ Options:
79
+ -p, --port <port> Port to run on (default: 3000)
80
+ --no-open Don't auto-open browser
81
+ -h, --help Show help
82
+ ```
83
+
84
+ ## Configuration
85
+
86
+ 1. Get a free API key from [OpenRouter](https://openrouter.ai/)
87
+ 2. Run `npx melchat`
88
+ 3. Click the gear icon and paste your key
89
+ 4. Start chatting!
90
+
91
+ For local models, enter your endpoint URL (e.g., `http://localhost:11434/v1` for Ollama).
92
+
93
+ ## Deploy Anywhere
94
+
95
+ melchat is a single HTML file. Deploy it anywhere:
96
+
97
+ ```bash
98
+ # GitHub Pages (already configured)
99
+ # Netlify (drag & drop)
100
+ # Vercel (one click)
101
+ # Any static host
102
+ ```
103
+
104
+ Or just open `dist/index.html` directly in your browser.
105
+
106
+ ## Tech Stack
107
+
108
+ - Vanilla JavaScript (no framework)
109
+ - Zero runtime dependencies
110
+ - marked.js for Markdown
111
+ - highlight.js for code
112
+
113
+ ## Contributing
114
+
115
+ PRs welcome! This is a single-file app at `dist/index.html`.
116
+
117
+ ```bash
118
+ git clone https://github.com/melvincarvalho/melchat
119
+ cd melchat
120
+ npx melchat
121
+ ```
122
+
123
+ ## License
124
+
125
+ MIT
126
+
127
+ ---
128
+
129
+ **Star this repo** if you find it useful!
130
+
131
+ [GitHub](https://github.com/melvincarvalho/melchat) | [Issues](https://github.com/melvincarvalho/melchat/issues) | [OpenRouter](https://openrouter.ai/)
package/bin/melchat.js ADDED
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env node
2
+
3
+ const http = require('http');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { exec } = require('child_process');
7
+
8
+ // Parse CLI arguments
9
+ const args = process.argv.slice(2);
10
+ const flags = {
11
+ port: 3000,
12
+ open: true,
13
+ help: false
14
+ };
15
+
16
+ for (let i = 0; i < args.length; i++) {
17
+ const arg = args[i];
18
+ if (arg === '-p' || arg === '--port') {
19
+ flags.port = parseInt(args[++i], 10) || 3000;
20
+ } else if (arg === '--no-open') {
21
+ flags.open = false;
22
+ } else if (arg === '-h' || arg === '--help') {
23
+ flags.help = true;
24
+ }
25
+ }
26
+
27
+ if (flags.help) {
28
+ console.log(`
29
+ melchat - 100+ AI models in one chat interface
30
+
31
+ Usage:
32
+ melchat [options]
33
+ npx melchat [options]
34
+
35
+ Options:
36
+ -p, --port <port> Port to run server on (default: 3000)
37
+ --no-open Don't auto-open browser
38
+ -h, --help Show this help message
39
+
40
+ Examples:
41
+ melchat Start on port 3000 and open browser
42
+ melchat -p 8080 Start on port 8080
43
+ melchat --no-open Start without opening browser
44
+
45
+ More info: https://github.com/melvincarvalho/melchat
46
+ `);
47
+ process.exit(0);
48
+ }
49
+
50
+ // Find the dist/index.html file
51
+ const distPath = path.join(__dirname, '..', 'dist', 'index.html');
52
+
53
+ if (!fs.existsSync(distPath)) {
54
+ console.error('Error: dist/index.html not found');
55
+ console.error('Expected at:', distPath);
56
+ process.exit(1);
57
+ }
58
+
59
+ const htmlContent = fs.readFileSync(distPath, 'utf8');
60
+
61
+ // Create server
62
+ const server = http.createServer((req, res) => {
63
+ // Serve index.html for all routes (SPA)
64
+ res.writeHead(200, {
65
+ 'Content-Type': 'text/html; charset=utf-8',
66
+ 'Cache-Control': 'no-cache'
67
+ });
68
+ res.end(htmlContent);
69
+ });
70
+
71
+ // Start server
72
+ server.listen(flags.port, () => {
73
+ const url = `http://localhost:${flags.port}`;
74
+
75
+ console.log(`
76
+ ╔═══════════════════════════════════════════════════╗
77
+ ║ ║
78
+ ║ 🤖 melchat v0.0.1 ║
79
+ ║ 100+ AI models in one interface ║
80
+ ║ ║
81
+ ║ Running at: ${url.padEnd(31)}║
82
+ ║ ║
83
+ ║ Press Ctrl+C to stop ║
84
+ ║ ║
85
+ ╚═══════════════════════════════════════════════════╝
86
+ `);
87
+
88
+ // Auto-open browser
89
+ if (flags.open) {
90
+ const platform = process.platform;
91
+ let cmd;
92
+
93
+ if (platform === 'darwin') {
94
+ cmd = `open ${url}`;
95
+ } else if (platform === 'win32') {
96
+ cmd = `start ${url}`;
97
+ } else {
98
+ cmd = `xdg-open ${url}`;
99
+ }
100
+
101
+ exec(cmd, (err) => {
102
+ if (err) {
103
+ console.log(` Open ${url} in your browser\n`);
104
+ }
105
+ });
106
+ }
107
+ });
108
+
109
+ // Handle graceful shutdown
110
+ process.on('SIGINT', () => {
111
+ console.log('\n Shutting down melchat...\n');
112
+ server.close();
113
+ process.exit(0);
114
+ });