lintasan-go

module
v0.29.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2026 License: MIT

README ยถ

๐Ÿ‡ฎ๐Ÿ‡ฉ Lintasan

Go Version License Version Tests Docker

Setiap Koneksi Punya Jalannya โ€” Jalur cerdas yang menghubungkan manusia, AI, dan sistem dalam satu aliran terintegrasi.

โšก 35ร— lebih ringan dari Node.js v1 ยท single binary ~24MB ยท 900+ tests ยท 118+ provider presets ยท Go v2 + SvelteKit Embedded SPA


๐Ÿ‡ฌ๐Ÿ‡ง Lintasan

Every Connection Has Its Path โ€” An intelligent pathway connecting humans, AI, and systems in one integrated flow.

โšก 35ร— lighter than Node.js v1 ยท single ~24MB binary ยท 900+ tests ยท 118+ provider presets ยท Go v2 + SvelteKit Embedded SPA


๐ŸŒ Filosofi / Philosophy

๐Ÿ‡ฎ๐Ÿ‡ฉ Bahasa Indonesia

"Lintasan adalah jalur tempat koneksi, kecerdasan, dan kemungkinan bergerak."

Di dunia modern, AI bukan hanya tentang model. AI adalah tentang bagaimana sistem saling terhubung, bagaimana request menemukan jalur terbaik, dan bagaimana manusia berinteraksi dengan teknologi secara efisien.

Lintasan hadir sebagai jalur cerdas yang menghubungkan manusia, AI, dan sistem dalam satu aliran yang terintegrasi. Satu endpoint untuk semua provider AI โ€” tidak perlu lagi berganti-ganti SDK atau mengelola banyak API key di berbagai tempat.

๐Ÿ‡ฌ๐Ÿ‡ง English

"Lintasan is the path where connections, intelligence, and possibilities move."

In the modern world, AI isn't just about models. It's about how systems connect, how requests find their best path, and how humans interact with technology efficiently.

Lintasan exists as an intelligent pathway connecting humans, AI, and systems in one integrated flow. One endpoint for all AI providers โ€” no more switching SDKs or managing multiple API keys across different places.


๐Ÿ“– Daftar Isi / Table of Contents


โ“ Apa itu Lintasan? / What is Lintasan?

๐Ÿ‡ฎ๐Ÿ‡ฉ Bahasa Indonesia

Lintasan adalah LLM proxy gateway dengan 40+ fitur optimasi. Satu endpoint OpenAI-compatible untuk semua provider AI โ€” routing cerdas, embedded cache, dual-mode CommandCode, plugin system, dan penghematan token otomatis.

Masalah yang diselesaikan:

  • ๐Ÿ”€ Multi-provider complexity โ€” ganti provider = ganti SDK, ganti API key, ganti format
  • ๐Ÿ’ธ No cost visibility โ€” tidak tahu berapa token terpakai per model/provider
  • ๐Ÿ”„ No failover โ€” satu provider down, semua request gagal
  • ๐Ÿ” Key management chaos โ€” API key tersebar di mana-mana
  • ๐Ÿ“Š No observability โ€” tidak bisa lihat usage, latency, error rate

Solusi Lintasan:

  • Satu endpoint โ†’ semua provider (OpenAI, Anthropic, DeepSeek, Gemini, Groq, dll)
  • Satu API key โ†’ autentikasi terpusat
  • Smart routing โ†’ request otomatis ke provider terbaik
  • Circuit breaker โ†’ provider gagal auto-disable
  • Dashboard โ†’ monitoring real-time 17 halaman
  • Plugin system โ†’ extensible tanpa ubah core
๐Ÿ‡ฌ๐Ÿ‡ง English

Lintasan is an LLM proxy gateway with 40+ optimization features. One OpenAI-compatible endpoint for all AI providers โ€” smart routing, embedded cache, dual-mode CommandCode, plugin system, and automatic token savings.

Problems solved:

  • ๐Ÿ”€ Multi-provider complexity โ€” switching providers means switching SDKs, API keys, and formats
  • ๐Ÿ’ธ No cost visibility โ€” can't see token usage per model/provider
  • ๐Ÿ”„ No failover โ€” one provider down, all requests fail
  • ๐Ÿ” Key management chaos โ€” API keys scattered everywhere
  • ๐Ÿ“Š No observability โ€” can't see usage, latency, error rates

Lintasan's solution:

  • One endpoint โ†’ all providers (OpenAI, Anthropic, DeepSeek, Gemini, Groq, etc.)
  • One API key โ†’ centralized authentication
  • Smart routing โ†’ requests automatically go to the best provider
  • Circuit breaker โ†’ failing providers auto-disable
  • Dashboard โ†’ 17-page real-time monitoring
  • Plugin system โ†’ extensible without core changes

๐Ÿ’ช Kenapa Go? / Why Go?

Metric Node.js (legacy) Go (current) Improvement
RAM ~500MB ~14MB 35x lebih hemat
Binary size 513MB (node_modules) 24MB (single file) 21x lebih kecil
Startup 3-5 detik <50ms 60-100x lebih cepat
Concurrent req/s ~10,000 ~50,000+ 5x throughput
Dependencies 800+ npm packages 1 (go-sqlite3) 800x lebih sedikit
Tests Manual 700+ / 35 packages Automated
Provider presets 27 118 4x lebih banyak
Deployment Docker + npm install scp 24MB binary Zero setup

๐Ÿ›  Tech Stack

Layer Technology Notes
Backend Go 1.22+ HTTP server, routing, proxy, streaming
Database SQLite (go-sqlite3) Embedded, zero config, single-file
Frontend SvelteKit 5 + TypeScript Dashboard SPA, client-rendered, embedded into the Go binary via go:embed
Styling Tailwind CSS v4 + CSS variables Dark/light mode, responsive
CLI Cobra start, setup, mitm, version
Testing Go standard library 581 tests, 39 packages
Deployment Single self-contained binary + systemd UI + API in one executable; no Node.js required. Pure proxy

โœจ Fitur Utama / Key Features

โš ๏ธ Kebijakan Legal & Etika / Legal & Ethics Policy

๐Ÿ‡ฎ๐Ÿ‡ฉ Lintasan didesain untuk menggunakan API resmi yang sah (Legal API). Kami secara tegas tidak melakukan/mendukung Reverse Engineering terhadap endpoint internal IDE komersial. Lintasan berfokus pada integrasi provider API resmi dan Experimental Provider (ACP).

๐Ÿ‡ฌ๐Ÿ‡ง Lintasan is designed to use legitimate, official APIs. We strictly do not support reverse engineering of commercial IDE internal endpoints. Lintasan focuses on official API provider integrations and Experimental Provider pipelines (ACP).

๐Ÿ‡ฎ๐Ÿ‡ฉ Fitur
# Fitur Deskripsi
1 Multi-Provider Proxy Satu endpoint untuk 10+ provider LLM
2 Smart Routing Multi-stage: regex โ†’ header โ†’ model โ†’ fallback
3 113 Provider Presets Semua provider LiteLLM siap pakai
4 Connection Management Add/test/sync/delete connections + auto discovery
5 Model Discovery Auto-fetch models dari provider /models endpoint
6 Provider Test Real-time latency + model count testing
7 Streaming (SSE) Full Server-Sent Events untuk streaming
8 Fallback Chains Multi-level fallback per model
9 Circuit Breaker Auto-disable provider yang gagal
10 Request Logging Complete request/response logging
11 Analytics Real-time metrics: latency, tokens, throughput
12 Combo System Pre-configured model+provider bundles
13 Load Balancer Model-aware weighted load balancing
14 Plugin System Plugin store + auto-registration
15 Vector Memory Pluggable embedder dengan SQLite default
16 Web Search Augment chat dengan live web results
17 OAuth Integration Provider OAuth flow support
18 Image Generation Proxy ke DALL-E / Stable Diffusion
19 Audio (TTS + STT) Speech + transcription via OpenAI API
20 Token Budgeting Per-key daily/monthly limits
21 Cost Tracking Real-time cost tracking per request
22 API Keys Key management + usage tracking
23 Teams & Users Multi-user access control
24 Webhooks Event-driven webhook system
25 Backup & Export Database backup + disaster recovery
26 Dashboard 17-page interactive SvelteKit dashboard
27 Playground Built-in API test console
28 CORS Built-in โ€” use from any browser app
29 Zero Config SQLite embedded โ€” no setup required
30 CLI (Cobra) start, setup, mitm, version
31 MITM Bridge Optional HTTPS bridge untuk LocalAI/LM Studio
32 Experimental Mode Cohort Provider ACP execution environment
33 Vector Search In-memory TF-IDF + auto context injection
34 Credential Vault AES-256-GCM UI Credential Dashboard
35 cURL Import Quick-add connections from cURL commands
36 Metrics Endpoint Exposes /metrics endpoint and Dashboard Observability UI
๐Ÿ‡ฌ๐Ÿ‡ง Features
# Feature Description
1 Multi-Provider Proxy One endpoint for 10+ LLM providers
2 Smart Routing Multi-stage: regex โ†’ header โ†’ model โ†’ fallback
3 113 Provider Presets All LiteLLM providers ready to use
4 Connection Management Add/test/sync/delete connections + auto discovery
5 Model Discovery Auto-fetch models from provider /models endpoint
6 Provider Test Real-time latency + model count testing
7 Streaming (SSE) Full Server-Sent Events for streaming
8 Fallback Chains Multi-level fallback per model
9 Circuit Breaker Auto-disable failing providers
10 Request Logging Complete request/response logging
11 Analytics Real-time metrics: latency, tokens, throughput
12 Combo System Pre-configured model+provider bundles
13 Load Balancer Model-aware weighted load balancing
14 Plugin System Plugin store + auto-registration
15 Vector Memory Pluggable embedder with SQLite default
16 Web Search Augment chat with live web results
17 OAuth Integration Provider OAuth flow support
18 Image Generation Proxy to DALL-E / Stable Diffusion
19 Audio (TTS + STT) Speech + transcription via OpenAI API
20 Token Budgeting Per-key daily/monthly limits
21 Cost Tracking Real-time cost tracking per request
22 API Keys Key management + usage tracking
23 Teams & Users Multi-user access control
24 Webhooks Event-driven webhook system
25 Backup & Export Database backup + disaster recovery
26 Dashboard 17-page interactive SvelteKit dashboard
27 Playground Built-in API test console
28 CORS Built-in โ€” use from any browser app
29 Zero Config SQLite embedded โ€” no setup required
30 CLI (Cobra) start, setup, mitm, version
31 MITM Bridge Optional HTTPS bridge for LocalAI/LM Studio
32 Experimental Mode Cohort Provider ACP execution environment
33 Vector Search In-memory TF-IDF + auto context injection
34 Credential Vault AES-256-GCM UI Credential Dashboard
35 cURL Import Quick-add connections from cURL commands
36 Metrics Endpoint Exposes /metrics endpoint and Dashboard Observability UI

๐Ÿ— Arsitektur / Architecture

Client (App / Agent / curl / IDE)
        โ”‚
    โ–ผ             โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Nginx (SSL Termination) โ€” lintasan.sans.biz.id      โ”‚
โ”‚   * All traffic proxies to Go:20180                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚ Go Backend :20180 (lintasan start)โ”‚
         โ”‚ โ”€โ”€ Serves BOTH API & UI โ”€โ”€        โ”‚
         โ”‚ โ€ข Embedded SPA UI (go:embed)      โ”‚
         โ”‚ โ€ข OpenAI-compatible LLM proxy     โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚
     โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
     โ”‚  โ”‚  API Gateway            โ”‚
     โ”‚  โ”‚  /v1/chat/completions   โ”‚
     โ”‚  โ”‚  /api/connections/import-curl โ”‚
     โ”‚  โ”‚  /v1/embeddings         โ”‚
     โ”‚  โ”‚  /v1/images/generations โ”‚
     โ”‚  โ”‚  /v1/audio/*            โ”‚
     โ”‚  โ”‚  /metrics               โ”‚
     โ”‚  โ”‚  /v1/models             โ”‚
     โ”‚  โ”‚  /v1/memory/*           โ”‚
     โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚             โ”‚
     โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
     โ”‚  โ”‚  Smart Router           โ”‚
     โ”‚  โ”‚  1. Header-based        โ”‚
     โ”‚  โ”‚  2. Model name match    โ”‚
     โ”‚  โ”‚  3. Load-balanced pick  โ”‚
     โ”‚  โ”‚  4. Priority sort       โ”‚
     โ”‚  โ”‚  5. Fallback chain      โ”‚
     โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚             โ”‚
     โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
     โ”‚  โ”‚  Optimization Pipeline  โ”‚
     โ”‚  โ”‚  โ€ข Circuit Breaker      โ”‚
     โ”‚  โ”‚  โ€ข Settings Cache (5s)  โ”‚
     โ”‚  โ”‚  โ€ข Request Logging      โ”‚
     โ”‚  โ”‚  โ€ข Cost Tracking        โ”‚
     โ”‚  โ”‚  โ€ข Vector Context Injectโ”‚
     โ”‚  โ”‚  โ€ข RTK Compressor       โ”‚
     โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚             โ”‚
     โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
     โ”‚  โ”‚  Provider Dispatcher    โ”‚
     โ”‚  โ”‚  + HTTP/1.1 keep-alive  โ”‚
     โ”‚  โ”‚  + Connection pooling   โ”‚
     โ”‚  โ”‚  + Request translation  โ”‚
     โ”‚  โ”‚  + SSE streaming        โ”‚
     โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚             โ”‚
     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
                   โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ–ผ         โ–ผ         โ–ผ          โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ OpenAI โ”‚ โ”‚Geminiโ”‚ โ”‚Groq  โ”‚ โ”‚Sumopod   โ”‚ ...118 providers
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Quick Start

โฑ Prefer a step-by-step walkthrough? See QUICKSTART.md โ€” from zero to first LLM request in <5 minutes.

The dashboard UI is embedded inside the binary, so one executable serves the full app (UI + API) on :20180 โ€” no Node, no nginx.

# Download the pre-built binary and run
curl -L -o lintasan https://github.com/sanhaji182/lintasan/releases/latest/download/lintasan-linux-amd64
chmod +x lintasan
./lintasan start

# Dashboard โ†’ http://localhost:20180/dashboard
# API       โ†’ http://localhost:20180/v1/chat/completions

๐ŸŽฅ Setup demo coming soon โ€” GIF showing Lintasan from download to first chat request.


๐Ÿ“ฆ Instalasi / Installation

Full guide: INSTALL.md โ€” pre-built binary, build from source, Docker, systemd, nginx.

3 methods โ€” pick one:

๐Ÿ‡ฎ๐Ÿ‡ฉ 3 Cara Install

Satu binary, dashboard sudah termasuk di dalamnya.

curl -L -o lintasan https://github.com/sanhaji182/lintasan/releases/latest/download/lintasan-linux-amd64
chmod +x lintasan
./lintasan start
Opsi 2: Build dari Source

Butuh Go 1.22+ dan Node 20+ (untuk build dashboard). make build meng-compile frontend SvelteKit jadi SPA statis, meng-embed-nya ke binary Go, lalu compile binary tunggal.

git clone https://github.com/sanhaji182/lintasan.git
cd lintasan
make build       # frontend โ†’ embed โ†’ ./lintasan
./lintasan start

Tanpa Node? go build -o lintasan ./cmd/lintasan tetap jalan, tapi menghasilkan server API-only (tanpa UI dashboard).

Opsi 3: Docker (single container)
git clone https://github.com/sanhaji182/lintasan.git
cd lintasan
LINTASAN_MASTER_KEY=$(openssl rand -hex 32) docker compose up --build
# UI + API โ†’ http://localhost:20180
CLI Commands
./lintasan start      # Start server (UI + API, default :20180)
./lintasan setup      # Initialize database
./lintasan mitm start # Start MITM HTTPS bridge (optional)
./lintasan version    # Show version
./lintasan help       # All commands

# Custom port
PORT=8080 ./lintasan start
๐Ÿ‡ฌ๐Ÿ‡ง 3 Installation Methods

One binary, dashboard included.

curl -L -o lintasan https://github.com/sanhaji182/lintasan/releases/latest/download/lintasan-linux-amd64
chmod +x lintasan
./lintasan start
Option 2: Build from Source

Requires Go 1.22+ and Node 20+ (to build the dashboard). make build compiles the SvelteKit frontend into a static SPA, embeds it into the Go binary, and compiles a single executable.

git clone https://github.com/sanhaji182/lintasan.git
cd lintasan
make build       # frontend โ†’ embed โ†’ ./lintasan
./lintasan start

No Node? go build -o lintasan ./cmd/lintasan still works but produces an API-only server (no dashboard UI).

Option 3: Docker (single container)
git clone https://github.com/sanhaji182/lintasan.git
cd lintasan
LINTASAN_MASTER_KEY=$(openssl rand -hex 32) docker compose up --build
# UI + API โ†’ http://localhost:20180
CLI Commands
./lintasan start      # Start server (UI + API, default :20180)
./lintasan setup      # Initialize database
./lintasan mitm start # Start MITM HTTPS bridge (optional)
./lintasan version    # Show version
./lintasan help       # All commands

# Custom port
PORT=8080 ./lintasan start

โš™ Konfigurasi / Configuration

Full guide: CONFIGURATION.md โ€” env vars, dashboard settings, connection setup, routing, security.

Quick env reference:

๐Ÿ‡ฎ๐Ÿ‡ฉ Environment Variables
Variable Default Keterangan
PORT 20180 Port server utama
LINTASAN_DATA_DIR ./data Direktori data (DB, logs)
LINTASAN_MASTER_KEY auto-generated Master API key
LINTASAN_OAUTH_IDE_ENABLED false Fallback jika setting dashboard belum disimpan; prefer Settings โ†’ Experimental โ†’ OAuth IDE
LINTASAN_OAUTH_PUBLIC_BASE_URL โ€” Public origin for OAuth redirect when IDE OAuth is enabled
MITM_PORT 8443 MITM bridge port

Tidak perlu .env file โ€” set env vars atau gunakan default. Database auto-create saat pertama run.

๐Ÿ‡ฌ๐Ÿ‡ง Environment Variables
Variable Default Description
PORT 20180 Main server port
LINTASAN_DATA_DIR ./data Data directory (DB, logs)
LINTASAN_MASTER_KEY auto-generated Master API key
LINTASAN_OAUTH_IDE_ENABLED false Fallback jika setting dashboard belum disimpan; prefer Settings โ†’ Experimental โ†’ OAuth IDE
LINTASAN_OAUTH_PUBLIC_BASE_URL โ€” Public origin for OAuth redirect when IDE OAuth is enabled
MITM_PORT 8443 MITM bridge port

No .env file needed โ€” just set env vars or use defaults. Database auto-creates on first run.


๐Ÿ“ก API Usage

# Chat completion (OpenAI-compatible)
curl http://localhost:20180/v1/chat/completions \
  -H "Authorization: Bearer YOUR_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [{"role": "user", "content": "Hello!"}],
    "stream": true
  }'

# List models
curl http://localhost:20180/v1/models \
  -H "Authorization: Bearer YOUR_MASTER_KEY"

# Embeddings
curl http://localhost:20180/v1/embeddings \
  -H "Authorization: Bearer YOUR_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "text-embedding-3-small", "input": "Hello world"}'

# Image generation
curl http://localhost:20180/v1/images/generations \
  -H "Authorization: Bearer YOUR_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "dall-e-3", "prompt": "A sunset over mountains"}'

# Text-to-speech
curl http://localhost:20180/v1/audio/speech \
  -H "Authorization: Bearer YOUR_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "tts-1", "input": "Hello world", "voice": "alloy"}'

# Speech-to-text
curl http://localhost:20180/v1/audio/transcriptions \
  -H "Authorization: Bearer YOUR_MASTER_KEY" \
  -F "file=@audio.mp3" -F "model=whisper-1"

# Provider presets
curl http://localhost:20180/api/providers/presets

# Connection test
curl -X POST http://localhost:20180/api/connections/test \
  -H "Content-Type: application/json" \
  -d '{"base_url": "https://api.openai.com/v1", "api_key": "sk-..."}'

# Vector memory search
curl "http://localhost:20180/v1/memory/search?q=hello&limit=5" \
  -H "Authorization: Bearer ***
  
# Import curl via API Connection Creation
curl -X POST "http://localhost:20180/api/connections/import-curl" \
  -H "Authorization: Bearer ***

# Web search augmented chat
curl http://localhost:20180/v1/web/search \
  -H "Authorization: Bearer YOUR_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-4o", "query": "latest AI news"}'

๐Ÿ‡ฎ๐Ÿ‡ฉ Drop-in replacement untuk OpenAI API โ€” ganti base URL, semua SDK (openai-python, langchain, llama-index, dll) langsung kompatibel.

๐Ÿ‡ฌ๐Ÿ‡ง Drop-in replacement for OpenAI API โ€” change the base URL and all SDKs work immediately.


๐Ÿ“Š Dashboard

๐Ÿ‡ฎ๐Ÿ‡ฉ 17 Halaman Dashboard

Lintasan dilengkapi dashboard interaktif berbasis SvelteKit 5 + Tailwind v4 untuk monitoring dan konfigurasi real-time.

|| Halaman | Fungsi | ||---------|--------| || Overview | Statistik global โ€” requests, tokens, cache hit rate, latency | || Accounts | Kelola koneksi provider (add/test/sync/delete) | || Providers | 118+ provider presets, one-click add | || Experimental | Laboratorium fitur eksperimental | || Discover | Auto-discover free & public provider API | || OAuth IDE | OAuth flow untuk IDE agents (LAB) | || Routing | Konfigurasi combo + load balancer + aliases | || Fallback | Multi-level fallback chain per model/connection | || Logs | Real-time request log dengan filter & search | || Usage | Token usage + cost per provider/model | || Observability | Exportable /metrics + Real-time Grafana-like panels | || Analytics | Metrics dashboard โ€” latency, throughput, savings | || Memory | Vector memory untuk RAG (SQLite/Redis) | || API Keys | Generate, copy, revoke API keys | || Teams | Team-based access control | || Users | User management + role assignment | || Webhooks | Event-driven webhook setup & testing | || Backup | Database backup, restore, export | || Settings | Global configuration โ€” port, keys, limits | || Plugins | Plugin store + management + AI generator | || Playground | Interactive chat console untuk testing API | || MCP Server | Model Context Protocol server (14+ tools) | || Cost Savings | Breakdown penghematan token & cache | || Format Translator | Terjemahan format API lintas provider | || Docs | Dokumentasi API built-in |

Akses: http://localhost:20180/dashboard โ€” embedded di binary Go (tanpa Node.js terpisah).

๐Ÿ‡ฌ๐Ÿ‡ง 17 Dashboard Pages

Lintasan comes with an interactive dashboard built with SvelteKit 5 + Tailwind v4 for real-time monitoring and configuration.

|| Page | Function | ||------|----------| || Overview | Global stats โ€” requests, tokens, cache hit rate, latency | || Accounts | Manage provider connections (add/test/sync/delete) | || Providers | 118+ provider presets, one-click add | || Experimental | Experimental features lab | || Discover | Auto-discover free & public provider APIs | || OAuth IDE | OAuth flow for IDE agents (LAB) | || Routing | Smart-route configs: combo, load balancer, aliases | || Fallback | Multi-level fallback chains per model/connection | || Logs | Real-time request log with filter & search | || Usage | Token usage & cost per provider/model | || Observability | Exportable /metrics + real-time Grafana-like panels | || Analytics | Metrics dashboard โ€” latency, throughput, savings | || Memory | Vector memory for RAG (SQLite/Redis) | || API Keys | Generate, copy, revoke API keys | || Teams | Team-based access control | || Users | User management + role assignment | || Webhooks | Event-driven webhook setup & testing | || Backup | Database backup, restore, export | || Settings | Global configuration โ€” port, keys, limits | || Plugins | Plugin store + management + AI generator | || Playground | Interactive chat console for API testing | || MCP Server | Model Context Protocol server (14+ tools) | || Cost Savings | Token compression & cache savings breakdown | || Format Translator | Cross-format API translation tool | || Docs | Built-in API documentation |

Access: http://localhost:20180/dashboard โ€” embedded in the Go binary (no separate Node process).


๐Ÿ”Œ Provider Presets (118 Ready)

๐Ÿ‡ฎ๐Ÿ‡ฉ Daftar Provider
Major Providers (4)

OpenAI ยท Anthropic ยท DeepSeek ยท Google Gemini

Top-Tier (6)

xAI (Grok) ยท Mistral AI ยท Azure OpenAI ยท Azure AI Foundry ยท Google Vertex AI ยท AWS Bedrock

AI Coding (4)

Codestral API ยท GitHub Copilot API ยท Pydantic AI Agents ยท Meta Llama API

Aggregators (8)

OpenRouter ยท Replicate ยท HuggingFace Inference ยท Vercel AI Gateway ยท AIML API ยท Poe by Quora ยท CometAPI ยท NanoGPT

High-Speed Inference (11)

Groq ยท Together AI ยท Fireworks AI ยท Cerebras ยท NVIDIA NIM ยท Cloudflare Workers AI ยท Hyperbolic ยท Lambda AI ยท FriendliAI ยท Anyscale Endpoints ยท SambaNova

GPU Cloud (12)

Baseten ยท OctoAI ยท Lepton AI ยท Featherless AI ยท Crusoe Cloud ยท nscale AI ยท PublicAI ยท Galadriel ยท Chutes ยท GMI Cloud ยท Heroku AI ยท Novita AI

CommandCode (2)

CommandCode (API Key) ยท CommandCode (Alpha)

Chinese Providers (10)

GLM / Zhipu AI ยท Kimi / Moonshot ยท MiniMax ยท Qwen / Alibaba ยท SiliconFlow ยท Xiaomi MiMo ยท Volcano Engine (ByteDance) ยท Z.AI ยท DeepSeek ยท Baidu Qianfan

Indonesia Providers (2)

Sumopod ยท Apertis AI (Stima API)

Enterprise & Cloud (8)

Snowflake Cortex AI ยท Oracle Cloud (OCI) ยท SAP AI Core ยท IBM watsonx ยท Gradient AI ยท NLP Cloud ยท Petals ยท Clarifai

Specialized (19)

Perplexity ยท Cohere ยท DeepInfra ยท Nebius AI ยท Aleph Alpha ยท AI21 Labs ยท Reka AI ยท Voyage AI ยท Deepgram ยท Black Forest Labs ยท Stability AI ยท Runway ML ยท Recraft AI ยท fal.ai ยท Helicone ยท Lemonade AI ยท Bytez ยท Sarvam AI ยท MorphDB

Self-Hosted (3)

Ollama ยท vLLM ยท LM Studio

Other (24)

AWS SageMaker ยท GigaChat ยท Predibase ยท OpenPipe ยท Scale AI ยท Titan ML ยท OctoML ยท Monster API ยท GooseAI ยท Forefront ยท Custom


๐Ÿ“‚ Struktur Project / Project Structure

lintasan/
โ”œโ”€โ”€ cmd/lintasan/              # CLI entry point (Cobra)
โ”œโ”€โ”€ internal/
โ”‚   โ”œโ”€โ”€ auth/                  # OAuth + API key auth
โ”‚   โ”œโ”€โ”€ config/                # Environment & DB config
โ”‚   โ”œโ”€โ”€ dashboard/             # (deprecated, moved to frontend/)
โ”‚   โ”œโ”€โ”€ db/                    # SQLite database layer
โ”‚   โ”œโ”€โ”€ discover/              # Model auto-discovery
โ”‚   โ”œโ”€โ”€ freeproviders/         # Free provider scanner (118+ presets)
โ”‚   โ”œโ”€โ”€ expprovider/           # AES-256-GCM Credentials
โ”‚   โ”œโ”€โ”€ memory/                # Vector memory (pluggable embedder)
โ”‚   โ”œโ”€โ”€ mitm/                  # MITM HTTPS bridge
โ”‚   โ”œโ”€โ”€ mlrouter/              # ML-based routing
โ”‚   โ”œโ”€โ”€ plugin/                # JS plugin engine
โ”‚   โ”œโ”€โ”€ rtk/                   # RTK token compressor
โ”‚   โ”œโ”€โ”€ server/                # HTTP server + all handlers
โ”‚   โ”‚   โ”œโ”€โ”€ server.go          # Core server + middleware
โ”‚   โ”‚   โ”œโ”€โ”€ proxy.go           # Provider proxy + streaming
โ”‚   โ”‚   โ”œโ”€โ”€ router.go          # Smart routing logic
โ”‚   โ”‚   โ”œโ”€โ”€ cache.go           # Settings cache
โ”‚   โ”‚   โ”œโ”€โ”€ handlers_*.go      # API handlers (dashboard, parity, etc.)
โ”‚   โ”‚   โ””โ”€โ”€ middleware_*.go    # CORS, auth middleware
โ”‚   โ””โ”€โ”€ websearch/             # Web search engine
โ”œโ”€โ”€ frontend/                  # SvelteKit dashboard (Go+Svelte stack)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ routes/            # 17 page routes
โ”‚   โ”‚   โ”œโ”€โ”€ lib/               # Components, stores, utils
โ”‚   โ”‚   โ””โ”€โ”€ app.html           # Root HTML template
โ”‚   โ”œโ”€โ”€ static/                # Static assets
โ”‚   โ”œโ”€โ”€ svelte.config.js       # SvelteKit config (adapter-node)
โ”‚   โ”œโ”€โ”€ vite.config.ts         # Vite config
โ”‚   โ””โ”€โ”€ package.json           # Frontend dependencies
โ”œโ”€โ”€ data/                      # Runtime data DB (auto-created)
โ”œโ”€โ”€ docs/                      # Documentation
โ”‚   โ”œโ”€โ”€ api-reference.md       # Full API reference (deprecated, read AGENTS.md)
โ”‚   โ””โ”€โ”€ design-system.md       # UI design system
โ”œโ”€โ”€ .env.example               # Example environment file
โ”œโ”€โ”€ Dockerfile                 # Docker build
โ”œโ”€โ”€ docker-compose.yml         # Docker compose
โ”œโ”€โ”€ go.mod / go.sum            # Go dependencies
โ”œโ”€โ”€ Makefile                   # Build automation
โ”œโ”€โ”€ LICENSE                    # MIT
โ””โ”€โ”€ README.md                  # This file

๐Ÿ’ป Development

# Clone
git clone https://github.com/sanhaji182/lintasan.git
cd lintasan

# Backend
go run ./cmd/lintasan start        # Run server (hot-reload with air if installed)

# Frontend
cd frontend
npm run dev -- --port 5173        # Dev UI + Vite server with HMR (Requires GO RUNNING)

# Build all
make build                         # go build + npm run build

# Run tests
go test ./...                      # 700+ tests
cd frontend && npm run check       # SvelteKit type-check

๐Ÿงช Testing

# All backend tests
go test ./...                      # 700+ passed, 0 failed, 39 packages

# With coverage
go test -cover ./...

# Specific package
go test -v ./internal/server/...

# Frontend
cd frontend && npm run check       # SvelteKit type-check + lint

๐Ÿšข Deployment

๐Ÿ‡ฎ๐Ÿ‡ฉ Production Deployment
# Build statically linked production binary
cd lintasan
go build -ldflags="-s -w" -o lintasan ./cmd/lintasan

# Build frontend inside go executable
cd frontend && npm install && npm run build && cd ..

# Copy to server
scp lintasan user@server:/opt/lintasan/
scp -r frontend/build user@server:/opt/lintasan/frontend-build/

# Systemd service
sudo tee /etc/systemd/system/lintasan.service << 'EOF'
[Unit]
Description=Lintasan LLM Proxy Gateway
Documentation=https://github.com/sanhaji182/lintasan
After=network.target

[Service]
Type=simple
User=lintasan
WorkingDirectory=/opt/lintasan
ExecStart=/opt/lintasan/lintasan start
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl enable --now lintasan
Nginx Reverse Proxy
server {
    listen 443 ssl;
    server_name your-domain.com;

    # API โ†’ Go backend
    location /api/ { proxy_pass http://127.0.0.1:20180; }
    location /v1/  { proxy_pass http://127.0.0.1:20180; }


๐Ÿ† Benchmark

Duel head-to-head melawan 9Router โ€” backend sama (CommandCode + deepseek-v4-pro).

Head-to-head duel against 9Router โ€” same backend (CommandCode + deepseek-v4-pro).

Task Lintasan 9Router Winner
LRU Cache implementation 11.2s 11.6s Lintasan
Code review merge_sorted 7.2s 10.9s Lintasan
TypeScript deep-merge generic 14.7s 15.4s Lintasan
Optimistic vs pessimistic locking 11.1s 15.3s Lintasan
Docker exits code 0 12.9s 6.3s 9Router
GitHub Actions workflow 8.0s 3.7s 9Router
Rate limiting middleware 6.0s 4.1s 9Router
REST vs GraphQL vs gRPC 11.5s 15.4s Lintasan

Results: Cold avg 10.3s vs 10.3s (parity) ยท Lintasan 5 โ€” 9Router 3 ยท Thinking leaked: Lintasan 1/8 vs 9Router 3/8


๐Ÿ”„ Migration dari Node.js v1

๐Ÿ‡ฎ๐Ÿ‡ฉ Panduan Migrasi

Lintasan Go menggunakan database schema yang berbeda dari Node.js v1 โ€” tidak backward-compatible.

  1. Export settings dari Node v1 dashboard
  2. Install Lintasan Go (lihat Instalasi)
  3. Re-create connections di Go v2 dashboard atau via API
  4. Sync models โ€” auto-discovered saat pertama connect
  5. Verifikasi โ€” test lewat Playground

โš ๏ธ Repo Node.js v1 sudah di-archive di sanhaji182/lintasan

๐Ÿ‡ฌ๐Ÿ‡ง Migration Guide

Lintasan Go uses a different database schema from Node.js v1 โ€” not backward-compatible.

  1. Export settings from Node v1 dashboard
  2. Install Lintasan Go (see Installation)
  3. Re-create connections in Go v2 dashboard or via API
  4. Sync models โ€” auto-discovered on first connection
  5. Verify โ€” test via Playground

โš ๏ธ Node.js v1 repo is archived at sanhaji182/lintasan


๐Ÿค Contributing

๐Ÿ‡ฎ๐Ÿ‡ฉ Kontribusi

Kontribusi sangat diterima! Buka issue untuk bug report atau feature request.

  1. Fork repo
  2. Buat branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'feat: amazing feature')
  4. Push ke branch (git push origin feature/amazing-feature)
  5. Buka Pull Request

Pastikan tests tetap passing:

go test ./...     # Harus 0 failures
๐Ÿ‡ฌ๐Ÿ‡ง Contributing

Contributions welcome! Open an issue for bug reports or feature requests.

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

Make sure tests still pass:

go test ./...     # Must be 0 failures

๐Ÿ“„ Lisensi / License

MIT


๐Ÿค– Built with AI

๐Ÿ‡ฎ๐Ÿ‡ฉ

Project ini dibangun dengan AI sebagai development partner. Arsitektur, keputusan teknis, dan quality control tetap di tangan manusia โ€” AI mengeksekusi.

Lintasan Go adalah rewrite total dari Node.js v1 โ€” mempertahankan semua fitur dengan footprint 35x lebih ringan. Dibuat untuk komunitas AI Indonesia yang percaya bahwa masa depan development adalah orkestrasi, bukan sekadar coding manual.

๐Ÿ‡ฌ๐Ÿ‡ง

This project was built with AI as a development partner. Architecture, technical decisions, and quality control remain in human hands โ€” AI executes.

Lintasan Go is a complete rewrite of Node.js v1 โ€” retaining all features with 35x lighter footprint. Made for the AI community that believes the future of development is orchestration, not just manual coding.

Orchestrator: Sanhaji ยท Programmer ยท AI-assisted development advocate


๐Ÿ‡ฎ๐Ÿ‡ฉ Lintasan Go (v2) โ€” Setiap Koneksi Punya Jalannya
๐Ÿ‡ฌ๐Ÿ‡ง Lintasan Go (v2) โ€” Every Connection Has Its Path

Dibangun dengan ๐Ÿค– AI ยท Diorkestrasi oleh ๐Ÿ‘จโ€๐Ÿ’ป Sanhaji

Directories ยถ

Path Synopsis
cmd
compress-bench command
lintasan command
internal
circuit
Package circuit provides a 3-state circuit breaker for protecting downstream services.
Package circuit provides a 3-state circuit breaker for protecting downstream services.
compress
Package compress provides context compression for LLM conversation histories.
Package compress provides context compression for LLM conversation histories.
db
errfmt
Package errfmt defines the standard error envelope used by Lintasan's API surface (test endpoints, dashboard API, and the /v1/* proxy).
Package errfmt defines the standard error envelope used by Lintasan's API surface (test endpoints, dashboard API, and the /v1/* proxy).
experimental
Package experimental hosts the isolation substrate for the Experimental provider ecosystem (Foundation Phase 3+).
Package experimental hosts the isolation substrate for the Experimental provider ecosystem (Foundation Phase 3+).
expprovider
Package expprovider is the Experimental-provider substrate (G1โ€“G6): the seam that lets an Experimental agent (driven over ACP, isolated by E1) be modeled as a provider.Provider so it is registry-resident and gated by the Phase-2 membrane (Track == Experimental can never be reached by production routing).
Package expprovider is the Experimental-provider substrate (G1โ€“G6): the seam that lets an Experimental agent (driven over ACP, isolated by E1) be modeled as a provider.Provider so it is registry-resident and gated by the Phase-2 membrane (Track == Experimental can never be reached by production routing).
fallback
Package fallback provides a two-tier fallback chain engine (model + connection) with in-memory metrics tracking.
Package fallback provides a two-tier fallback chain engine (model + connection) with in-memory metrics tracking.
freeproviders
Package freeproviders provides local provider discovery by scanning known ports for running LLM inference servers (Ollama, LM Studio, GPT4All, LocalAI, etc.) and auto-registering them as connections.
Package freeproviders provides local provider discovery by scanning known ports for running LLM inference servers (Ollama, LM Studio, GPT4All, LocalAI, etc.) and auto-registering them as connections.
lb
mcp
memory
Package memory provides a pure-Go TF-IDF embedder and pluggable vector store.
Package memory provides a pure-Go TF-IDF embedder and pluggable vector store.
metrics
Package metrics implements a tiny, dependency-free Prometheus metrics registry for Lintasan.
Package metrics implements a tiny, dependency-free Prometheus metrics registry for Lintasan.
mlrouter
Package mlrouter provides ML-based routing for chat completions.
Package mlrouter provides ML-based routing for chat completions.
oauthide
Package oauthide ports 9router OAUTH_PROVIDERS (v0.4.71) into Lintasan Go.
Package oauthide ports 9router OAUTH_PROVIDERS (v0.4.71) into Lintasan Go.
provider
Package provider is the Lintasan Provider SDK v2.4 โ€” FOUNDATION ONLY.
Package provider is the Lintasan Provider SDK v2.4 โ€” FOUNDATION ONLY.
quality
Package quality scores LLM responses on multiple dimensions and decides whether to reroute to a fallback model when quality is low.
Package quality scores LLM responses on multiple dimensions and decides whether to reroute to a fallback model when quality is low.
ratelimit
Package ratelimit provides a sliding window rate limiter with burst mode.
Package ratelimit provides a sliding window rate limiter with burst mode.
retry
Package retry provides exponential backoff with jitter for retrying operations.
Package retry provides exponential backoff with jitter for retrying operations.
rtk
Package rtk provides RTK (Rust Token Killer) integration for compressing tool output before it's sent to the LLM.
Package rtk provides RTK (Rust Token Killer) integration for compressing tool output before it's sent to the LLM.
tokencount
Package tokencount provides a real BPE token counter (tiktoken cl100k_base) with a safe char/4 fallback.
Package tokencount provides a real BPE token counter (tiktoken cl100k_base) with a safe char/4 fallback.
version
Package version is the single source of truth for the Lintasan build version.
Package version is the single source of truth for the Lintasan build version.
web
Package web embeds the built SvelteKit dashboard (static SPA) into the Go binary so `lintasan start` serves the full UI from a single executable โ€” no separate Node process required.
Package web embeds the built SvelteKit dashboard (static SPA) into the Go binary so `lintasan start` serves the full UI from a single executable โ€” no separate Node process required.
websearch
Package websearch provides web search integration via DuckDuckGo Instant Answer API (zero auth) and optionally SerpAPI.
Package websearch provides web search integration via DuckDuckGo Instant Answer API (zero auth) and optionally SerpAPI.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL