Expand manhuang collect/UI (tabs, markets, guishi/quote probes), add configs and launchd helpers, ops handbooks, and scripts for channel validation and price/threat enrichment. Keys stay in keys.env.example only.
199 lines
7.7 KiB
Markdown
199 lines
7.7 KiB
Markdown
# 蛮荒 · 渠道目录 + Quote API + 社区价源
|
||
|
||
> 2026-07-12 · 灰市探针 / 社区公开 API / free+MSRP / 本地聚合 / ChangeDetection
|
||
> 总手册:[manhuang-handbook.md](./manhuang-handbook.md)
|
||
> 校验:`python3 scripts/manhuang/validate-channels.py`
|
||
> 全量核实:[manhuang-full-audit-2026-07-12.md](./manhuang-full-audit-2026-07-12.md)
|
||
|
||
## 目标
|
||
|
||
把「店 + 中转 + 接码 + GitHub 周更表 + free 档 + 官方 token 锚」收成**统一缓存**,面板与脚本只读本地/内网 API,不在 browser 里锤外网。
|
||
|
||
## 架构
|
||
|
||
```
|
||
外源(控频、launchd)
|
||
├─ GGSel / FunPay / Plati HTML → probe-ai-account-quotes.py
|
||
├─ awesome-ai-api-proxy JSON → probe-community-prices.py
|
||
├─ OpenRouter /api/v1/models → 同上
|
||
├─ 5sim /v1/guest/prices → 同上(接码主路径 · 免 key)
|
||
├─ mnfst free data.json → 同上 → free-llm-lists.json
|
||
├─ LiteLLM model_prices JSON → 同上 → msrp-litellm.json
|
||
├─ providers.yaml (active) → probe-named-relays.py 动态候选
|
||
├─ named relays HTTP → probe-named-relays.py
|
||
└─ ChangeDetection ai-team → probe-changedetection.py
|
||
│
|
||
▼
|
||
~/.cache/manhuang/{quotes,relays,changedetection}/
|
||
│
|
||
┌─────┴──────┐
|
||
▼ ▼
|
||
collect_manhuang quote-aggregator.py :8877
|
||
│ /v1/quotes · /v1/msrp · /v1/free
|
||
▼
|
||
joy dashboard UI
|
||
```
|
||
|
||
## 本地 Quote API
|
||
|
||
```bash
|
||
cd ~/Projects/joy-cli
|
||
python3 scripts/manhuang/quote-aggregator.py # 127.0.0.1:8877
|
||
curl -s http://127.0.0.1:8877/v1/summary | jq .
|
||
curl -s 'http://127.0.0.1:8877/v1/quotes?demand=1' | jq '.n,.summary.demand_coverage'
|
||
curl -s http://127.0.0.1:8877/v1/community | jq '{overlay_n, free_llm, msrp_keys: (.msrp_anchor|keys)}'
|
||
curl -s http://127.0.0.1:8877/v1/msrp | jq '.anchors|keys'
|
||
curl -s http://127.0.0.1:8877/v1/free | jq '.providers_n // .mnfst.providers_n'
|
||
curl -s http://127.0.0.1:8877/v1/channels | jq '.obscure_notes'
|
||
```
|
||
|
||
| 路径 | 含义 |
|
||
|------|------|
|
||
| `/health` | 探活 |
|
||
| `/v1/summary` | 覆盖率 KPI(demand_with_market_n · free · msrp) |
|
||
| `/v1/quotes?sku=` / `?demand=1` | 归一化货架视图 |
|
||
| `/v1/relays` | 具名中转 + 动态候选探活结果 |
|
||
| `/v1/community` | GitHub/5sim overlay + free/msrp 字段 |
|
||
| `/v1/msrp` | LiteLLM 官方 token 价锚 |
|
||
| `/v1/free` | 永久 free 档目录摘要 |
|
||
| `/v1/changedetection` | CD 状态 |
|
||
| `/v1/channels` | 渠道目录 JSON |
|
||
| `/v1/product-types` | 产品类型 |
|
||
|
||
只读、无密钥、默认真机回环。要给集群:`--host 0.0.0.0` + 防火墙仅内网(**先问用户**)。
|
||
|
||
改脚本后需重启 launchd:
|
||
|
||
```bash
|
||
launchctl kickstart -k gui/$(id -u)/com.feibisi.manhuang-quote-api
|
||
```
|
||
|
||
## 渠道目录
|
||
|
||
- 仓库:`configs/manhuang/channels.json`
|
||
- 可选覆盖:`~/.config/manhuang/channels.json`
|
||
|
||
### 目录块
|
||
|
||
| 块 | 说明 |
|
||
|----|------|
|
||
| `marketplaces` | GGSel/FunPay/… + catalog_only 聚合类 |
|
||
| `sms_apis` | **5sim active**;SMS-Activate **shutdown**;其余 watch_only |
|
||
| `relay_price_feeds` | awesome JSON · OpenRouter · LiteLLM · providers.yaml · bltcy… |
|
||
| `named_relay_stations` | 具名中转(`down` = 核实不可达) |
|
||
| `free_llm_lists` | mnfst 机读 + cheahjs 等 |
|
||
| `demand_sku_ids` | demand-first 白名单 |
|
||
| `obscure_notes` | 给代理的短提示 |
|
||
|
||
### status 与货架
|
||
|
||
见手册 §8。要点:
|
||
|
||
- `shutdown` / `dead` / `exit_scam` → **不进 heishi**
|
||
- `down` → 保留目录但勿当主采购中转
|
||
- SMS-Activate **不是** `needs_key`,是 **已停运**
|
||
|
||
### 接码(务必读)
|
||
|
||
| 源 | 状态 | 用法 |
|
||
|----|------|------|
|
||
| **5sim guest** | active | **唯一主路径** · 免 key 实时价 |
|
||
| **SMS-Activate** | **shutdown**(2025-12 官方停运) | 禁止充值;冒充新站=诈骗;勿接 API key |
|
||
| SMS-Man / Grizzly | watch_only | 仅目录观察 |
|
||
|
||
### GitHub 公开价源
|
||
|
||
| 源 | 用途 | 风险 |
|
||
|----|------|------|
|
||
| [howardpen9/awesome-ai-api-proxy](https://github.com/howardpen9/awesome-ai-api-proxy) `prices.latest.json` | 中转 token 价 ~3000 条 | 中转非官方;周更 |
|
||
| 同 repo `providers.yaml` | 站名单 → relays 动态候选 | 收录≠背书 |
|
||
| **OpenRouter** `/api/v1/models` | 聚合商实时价 | 官方 |
|
||
| **LiteLLM** `model_prices_and_context_window.json` | 官方/主流 token **MSRP 锚** | 社区维护价库 |
|
||
| **5sim** guest prices | 接码实时 | 免 key |
|
||
| [mnfst/awesome-free-llm-apis](https://github.com/mnfst/awesome-free-llm-apis) `data.json` | 永久 free 档 | 辅线接口 |
|
||
| [cheahjs/free-llm-api-resources](https://github.com/cheahjs/free-llm-api-resources) | free/试用目录 | README 级 |
|
||
| zukixa/cool-ai-stuff | 社区列表 | ToS/逆向风险,不进主采购 |
|
||
|
||
**不做主路径**:暗网镜像、量产号工具、不可审计逆向网关、已停运品牌充值。
|
||
|
||
## 社区探针输出
|
||
|
||
| 文件 | 内容 |
|
||
|------|------|
|
||
| `~/.cache/manhuang/quotes/community-prices.json` | overlay + free_llm + msrp_anchor + sources |
|
||
| `~/.cache/manhuang/quotes/msrp-litellm.json` | 锚价明细 |
|
||
| `~/.cache/manhuang/quotes/free-llm-lists.json` | free 目录 |
|
||
| `~/.cache/manhuang/relays/status.json` | 中转探活 |
|
||
| `~/.cache/manhuang/relays/candidates-from-providers.json` | providers.yaml 扩容名单 |
|
||
|
||
`probe-named-relays.py`:static(relays.json)+ 最多 10 条 dynamic(active、非 reverse、非 github 文档站)。
|
||
|
||
## ChangeDetection(ai-team :5000)
|
||
|
||
```bash
|
||
# ~/.config/manhuang/keys.env(不进 git)
|
||
# CHANGEDTECTION_URL=http://10.211.55.107:5000
|
||
# CHANGEDTECTION_API_KEY=...
|
||
|
||
python3 scripts/manhuang/ensure-cd-watches.py --all-guishi
|
||
python3 scripts/manhuang/probe-changedetection.py
|
||
```
|
||
|
||
| 项 | 说明 |
|
||
|----|------|
|
||
| 密钥 | CD datastore `settings.application.api_access_token` |
|
||
| 代理坑 | Mac Python **不认 NO_PROXY CIDR**;脚本对 `10.x` 强制直连 |
|
||
| 稳定性 | `NUMBER_OF_WORKERS=2` + healthcheck |
|
||
| watches | 价/货架 + 鬼市浅水 + shops + **GitHub raw**(prices/providers/litellm/mnfst/cheahjs) |
|
||
|
||
自建栈说明:[manhuang-selfhost-catalog.md](./manhuang-selfhost-catalog.md) · **不要**在 Mac/scout 再起一份 CD。
|
||
|
||
## Quote API launchd
|
||
|
||
```bash
|
||
cp configs/launchd/com.feibisi.manhuang-quote-api.plist ~/Library/LaunchAgents/
|
||
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.feibisi.manhuang-quote-api.plist
|
||
curl -s http://127.0.0.1:8877/v1/summary | jq .demand_coverage
|
||
```
|
||
|
||
Label:`com.feibisi.manhuang-quote-api` · 仅 `127.0.0.1:8877` · KeepAlive
|
||
|
||
## 价旗标
|
||
|
||
| 值 | 条件 | UI |
|
||
|----|------|-----|
|
||
| `possible_bundle` | 灰市 ≥ MSRP×1.5 | 「可能捆绑」 |
|
||
| `suspiciously_cheap` | 灰市 ≤ MSRP×0.15 且 MSRP≥10 | 「过低·慎」 |
|
||
|
||
## 定时
|
||
|
||
`com.feibisi.manhuang-quotes` → `run-quote-probe.sh` 大致顺序:
|
||
|
||
1. 智能 quotes(demand-first / rotate / skip)
|
||
2. named-relays(含 providers 动态)
|
||
3. community-prices + merge
|
||
4. changedetection / ensure-cd
|
||
5. scout 鬼市(ssh)
|
||
6. tab-caches
|
||
7. notify-chain / brand
|
||
8. `pipeline-last.json`
|
||
|
||
## KPI
|
||
|
||
- `demand_coverage` = demand SKU 中有 marketplace 实价的比例
|
||
- `community_overlay_n` · `msrp_anchor_n` · `free_providers_n`
|
||
- `relays` ok/down/static/dynamic
|
||
- 面板:总览社区卡 · 数据源管线表 · 交易平台卡
|
||
|
||
## 手动全量刷新
|
||
|
||
```bash
|
||
python3 scripts/manhuang/probe-community-prices.py
|
||
python3 scripts/manhuang/probe-ai-account-quotes.py --demand-first --force
|
||
python3 scripts/manhuang/probe-named-relays.py
|
||
python3 scripts/manhuang/ensure-cd-watches.py --all-guishi
|
||
python3 scripts/manhuang/probe-changedetection.py
|
||
python3 scripts/manhuang/build-tab-caches.py
|
||
python3 scripts/manhuang/validate-channels.py
|
||
curl -s http://127.0.0.1:8877/v1/summary | jq .
|
||
```
|