No description
  • TypeScript 57.8%
  • Go 39.2%
  • CSS 1.5%
  • Shell 1.1%
  • HTML 0.4%
Find a file
2026-06-26 11:59:36 +00:00
backend Initialize 2026-06-26 11:59:36 +00:00
frontend Initialize 2026-06-26 11:59:36 +00:00
.env.example Initialize 2026-06-26 11:59:36 +00:00
.gitignore Initialize 2026-06-26 11:59:36 +00:00
README.md Initialize 2026-06-26 11:59:36 +00:00
run.sh Initialize 2026-06-26 11:59:36 +00:00

OpenMimo — Xiaomi Mimo AI API Proxy

API proxy untuk Xiaomi Mimo dengan manajemen API key, usage tracking, dan dashboard.

Fitur

  • v1/chat/completions — OpenAI SDK compatible (support streaming SSE)
  • v1/models — List model yang tersedia
  • API Key Management — Add, bulk add, enable/disable, delete Mimo API key
  • Application Key — Sistem auth untuk akses dashboard
  • Dashboard — Token usage stats (input, output, cache hit/write), daily & per-key breakdown
  • Credit overview — Per-key usage summary

Model Tersedia

  • mimo-v2.5-pro
  • mimo-v2.5
  • mimo-v2.5-pro-ultraspeed

Semua support streaming, tool calling, dan thinking mode.

Tech Stack

  • Backend: Go + SQLite + Chi router
  • Frontend: Vite + React + TypeScript + Tailwind CSS
  • Auth: JWT untuk dashboard access

Quick Start

cd /mnt/arc/Project/OpenMimo

# Build frontend (first time)
cd frontend && npm install && npm run build && cd ..

# Run
./run.sh

Server berjalan di http://localhost:8080.

First Run

Saat pertama kali dijalankan, sistem akan membuat default application key secara otomatis. Key ini ditampilkan di log startup dan disimpan di database.

Gunakan key tersebut untuk login ke dashboard.

Environment Variables

Variable Default Deskripsi
PORT 8080 Server port
DB_PATH data/openmimo.db SQLite database path
JWT_SECRET openmimo-secret-change-me JWT signing secret
MIMO_BASE_URL https://api.xiaomimimo.com/v1 Mimo API base URL
CORS_ORIGINS * CORS allowed origins
FRONTEND_DIR auto-detect Path ke frontend dist directory

Menggunakan Proxy

OpenAI SDK (Python)

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8080/v1",
    api_key="not-needed"  # Proxy manages its own keys
)

response = client.chat.completions.create(
    model="mimo-v2.5-pro",
    messages=[{"role": "user", "content": "Hello!"}],
    stream=True
)

for chunk in response:
    print(chunk.choices[0].delta.content or "", end="")

cURL

curl http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mimo-v2.5-pro",
    "messages": [{"role": "user", "content": "Hello!"}],
    "stream": true
  }'

Dashboard

Buka http://localhost:8080 di browser, login dengan application key.

Halaman:

  • Dashboard — Token usage stats, daily chart, per-key breakdown
  • API Keys — Manajemen Mimo API key (add, bulk add, toggle, delete)
  • App Keys — Manajemen application key untuk akses dashboard
  • Settings — API endpoint info, contoh penggunaan

API Endpoints

Public

Method Path Deskripsi
POST /v1/chat/completions Chat completions (OpenAI format)
GET /v1/models List models
POST /api/auth/login Login dengan app key
GET /health Health check

Protected (JWT required)

Method Path Deskripsi
GET /api/keys List Mimo keys
POST /api/keys Add Mimo key
POST /api/keys/bulk Bulk add Mimo keys
DELETE /api/keys/:id Delete Mimo key
PUT /api/keys/:id/toggle Enable/disable Mimo key
GET /api/admin/keys List app keys
POST /api/admin/keys Create app key
DELETE /api/admin/keys/:id Delete app key
GET /api/dashboard/stats Token usage stats
GET /api/dashboard/credits Credit/usage summary

Struktur Project

OpenMimo/
├── run.sh                    # Run script
├── backend/
│   ├── cmd/server/main.go    # Entry point
│   ├── internal/
│   │   ├── config/           # Config (env vars)
│   │   ├── db/               # SQLite + models
│   │   ├── handlers/         # HTTP handlers
│   │   ├── middleware/       # CORS, JWT, logging
│   │   └── proxy/            # Mimo API proxy logic
│   └── data/                 # SQLite DB (auto-created)
└── frontend/
    ├── src/
    │   ├── pages/            # Dashboard, Keys, Login, Settings
    │   ├── components/       # Layout, Sidebar, Modal, Toast
    │   ├── hooks/            # Auth, Toast contexts
    │   └── lib/              # API client
    └── dist/                 # Built frontend

Membangun Ulang

# Backend
cd backend && go build -o server ./cmd/server/

# Frontend
cd frontend && npm run build

Key Selection Strategy

Proxy menggunakan round-robin di antara semua Mimo API key yang enabled. Key dipilih secara bergantian untuk mendistribusikan beban secara merata.

API key format:

  • sk-* = standard key
  • tp-* = token plan key

Keduanya otomatis dideteksi saat bulk add.