gmgn-minicpm runs a 1B model on your own machine as a read-only GMGN crypto research agent: no cloud LLM, no API cost, offline-capable. Most people wiring GMGN into an agent point it at Claude or GPT; this project points it at MiniCPM5-1B, a ~1B on-device model with native tool calling, running locally. The project itself is a thin, dependency-free TypeScript bridge that turns the model's tool_calls into safe gmgn-cli commands and feeds the JSON back.
"what's smart money buying on sol right now?"
│
▼
MiniCPM5-1B ──(OpenAI-style tool_calls)──► gmgn-local bridge
(local, SGLang) │
▲ ▼ (execFile, no shell)
└────────────(JSON result)────── gmgn-cli track smartmoney --chain sol --raw
│
▼
GMGN OpenAPI
Why
- No API bill: the model runs on your hardware; you only pay GMGN's data quota.
- Low latency / offline: no cloud round trip, which suits always-on watchers.
- Small and auditable: zero runtime dependencies, native Node TypeScript, and every tool is an explicit allowlisted subcommand.
Safety
This is v1: read-only. Only market, token and wallet research tools are exposed. Fund-moving commands (swap, multi-swap, order, cooking) are not registered and are also hard-blocked in the bridge. A 1B model in an automated loop must never be handed the ability to move funds. If swap support lands, it will sit behind explicit human confirmation.
Nothing here is financial advice. It reads data; you make the decisions.
How It Works
src/tools.ts: the read-only tool registry. Each entry is an OpenAI-style function schema plus thegmgn-clisubcommand it maps to; snake_case params become--kebab-caseflags.src/bridge.ts: validates a tool call (required args, drops hallucinated args, blocks fund-moving roots) and builds an argv array.src/gmgnCli.ts: runsgmgn-cliwithexecFile(argv array, no shell, so args cannot be injected), appends--raw, and parses the JSON.src/agent.ts: the model loop — send messages and tools → run returnedtool_calls→ feed results back → repeat until a final answer (bounded byGMGN_LOCAL_MAX_ITERS).
Tools (v1)
token: info · security · pool · holders · tradersmarket: kline · trending · trenches · signal · hot-searchesportfolio: info · holdings · activity · stats · token-balance · created-tokenstrack: follow-tokens · follow-wallet · kol · smartmoney
Running a 1B Model Reliably
A 1B model is not a frontier model, and the repo is shaped around that:
- Cap generation (
GMGN_LOCAL_MAX_TOKENS, default 1024). Small models can spiral on an error and emit runaway tool-call JSON until the context fills, which makes llama.cpp return a hard 500. Capping tokens prevents it. - Truncate tool results (
GMGN_LOCAL_MAX_TOOL_RESULT_CHARS, default 4000). A singletrendingresponse is ~7 KB; a few unbounded results overflow an 8k context. Serve with a roomy-c 32768. - Validate enums in the bridge. The model occasionally invents a
chainlike"5";bridge.tsrejects it withmust be one of: sol, bsc, base, ethso the model can self-correct instead of shelling out garbage.
These are exactly the rough edges a LoRA fine-tune is meant to smooth out.
Quick Start
Requirements:
- Node.js ≥ 24 (runs the TypeScript sources directly via native type stripping, no build step).
gmgn-cliinstalled and configured (npm install -g gmgn-cli, thengmgn-cli config).- A local MiniCPM5-1B server exposing an OpenAI-compatible
/v1/chat/completionswith tool calls:
Verified: Apple M4 Pro / 48 GB, MiniCPM5-1B F16 GGUF on
llama-server, Metal-accelerated at ~90–100 tok/s. The full loop (model → gmgn-cli → answer) has been confirmed on live GMGN data.
git clone https://github.com/dvictor357/gmgn-minicpm
cd gmgn-minicpm
cp .env.example .env
# 1. serve the model (auto-downloads the F16 GGUF from HF on first run)
bash scripts/serve-llamacpp.sh # NVIDIA users: scripts/serve-sglang.sh
# 2. ask something
node src/cli.ts "what is smart money buying on solana right now?"
# or an interactive REPL
node src/cli.ts
Add --verbose to print each tool call the model makes; node src/cli.ts --list-tools lists the tools without a model running.
Roadmap
- LoRA dataset generator:
npm run datasetbuilds a(query → tool_call → gold answer)set from real GMGN data with deterministic gold labels. - LoRA fine-tune and fuse to GGUF (MLX-LM on Apple Silicon) for reliable composite routing, argument selection and concise judgment.
- Gated swap: fund-moving tools behind a mandatory human-confirmation / rule-engine gate, never a raw model decision.
- 24/7 watcher mode (monitor trending/signals → alert).
Links
- GitHub: dvictor357/gmgn-minicpm
