|
|
6 bulan lalu | |
|---|---|---|
| .gitignore | 6 bulan lalu | |
| LICENSE | 6 bulan lalu | |
| README.md | 6 bulan lalu | |
| chat.go | 6 bulan lalu | |
| dns.go | 6 bulan lalu | |
| go.mod | 6 bulan lalu | |
| go.sum | 6 bulan lalu | |
| http.go | 6 bulan lalu | |
| openai.go | 6 bulan lalu | |
| ssh.go | 6 bulan lalu | |
| util.go | 6 bulan lalu |
Minimalist LLM chat accessible through HTTP, SSH, DNS, and API. One binary, no JavaScript, no tracking.
# Web (no JavaScript)
open https://ch.at
# Terminal
curl ch.at/?q=hello
ssh ch.at
# DNS tunneling
dig what-is-2+2.ch.at TXT
# API (OpenAI-compatible)
curl ch.at:8080/v1/chat/completions
We take a "can't be evil" approach:
⚠️ PRIVACY WARNING: Your queries are sent to LLM providers (OpenAI, Anthropic, etc.) who may log and store them according to their policies. While ch.at doesn't log anything, the upstream providers might. Never send passwords, API keys, or sensitive information.
Current Production Model: OpenAI's GPT-4o. We plan to expand model access in the future.
Create llm.go (gitignored):
// llm.go - Create this file (it's gitignored)
package main
import (
"bufio"
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"strings"
)
func getLLMResponse(ctx context.Context, prompt string) (string, error) {
var response strings.Builder
stream, err := getLLMResponseStream(ctx, prompt)
if err != nil {
return "", err
}
for chunk := range stream {
response.WriteString(chunk)
}
return response.String(), nil
}
func getLLMResponseStream(ctx context.Context, prompt string) (<-chan string, error) {
endpoint := "https://api.openai.com/v1/chat/completions"
key := "YOUR-OPENAI-API-KEY-HERE" // Replace with your key
payload := map[string]interface{}{
"model": "gpt-4o",
"messages": []map[string]string{
{"role": "user", "content": prompt},
},
"stream": true,
}
// ... rest of implementation
}
Then build:
go build -o chat .
sudo ./chat # Needs root for ports 80/443/53/22
# Optional: build selftest tool
go build -o selftest ./cmd/selftest
To run on high ports, edit the constants in chat.go and rebuild:
const (
HTTP_PORT = 8080 // Instead of 80
HTTPS_PORT = 0 // Disabled
SSH_PORT = 2222 // Instead of 22
DNS_PORT = 0 // Disabled
OPENAI_PORT = 8080 // Same as HTTP
)
Then:
go build -o chat .
./chat # No sudo needed for high ports
# Test the service
./selftest http://localhost:8080
Edit constants in source files:
chat.go (set to 0 to disable)util.goMIT License - see LICENSE file
Before adding features: