detect.zh

detect.zh is a command for coding agents from druide67/asiai. It costs 30 tokens per session (597 once invoked), scanned A, a copy of detect.ja, Apache-2.0.

A Mac command that finds locally running large-language-model engines, such as Ollama, LM Studio, and oMLX. It checks saved configuration, scans ports, and then inspects running processes.

In plain words
What is it for?
Use it to discover local model servers, check a specific URL, identify running models, and save newly found engines for later checks.
Why use it?
It avoids guessing which local engine is running or which port it uses, including engines on unusual ports.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/druide67/asiai/detect.zh
Clone the repo
git clone --depth 1 https://github.com/druide67/asiai

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for detect.zh

README.md
[![agentmods](https://agentmods.dev/badge/commands/druide67/asiai/detect.zh.svg)](https://agentmods.dev/commands/druide67/asiai/detect.zh)
Your own site
<a href="https://agentmods.dev/commands/druide67/asiai/detect.zh"><img src="https://agentmods.dev/badge/commands/druide67/asiai/detect.zh.svg" alt="Measured on agentmods" height="20"></a>
Per session 30 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 597 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00030 $0.00597
Opus 5 $0.00015 $0.00298
Sonnet 5 $0.00006 $0.00119
Haiku 4.5 $0.00003 $0.00060

Measured 5d ago against content hash 189f596dd71f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

detect.zh scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to detect.ja — 50 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

docs/commands/detect.zh.md · 74 lines

What it actually says

asiai detect

使用 3 层级联自动检测推理引擎。

用法

asiai detect                      # 自动检测(3 层级联)
asiai detect --url http://host:port  # 仅扫描指定 URL

输出

Detected engines:

  ● ollama 0.17.4
    URL: http://localhost:11434

  ● lmstudio 0.4.5
    URL: http://localhost:1234
    Running: 1 model(s)
      - qwen3.5-35b-a3b  MLX

  ● omlx 0.9.2
    URL: http://localhost:8800

工作原理:3 层检测

asiai 使用三层检测级联,从最快到最彻底:

第 1 层:配置(最快,~100ms)

读取 ~/.config/asiai/engines.json——之前运行中发现的引擎。无需重新扫描即可找到非标准端口的引擎(如 oMLX 在 8800)。

第 2 层:端口扫描(~200ms)

扫描默认端口加扩展范围:

端口 引擎
11434 Ollama
1234 LM Studio
8080 mlx-lm 或 llama.cpp
8000-8009 oMLX 或 vllm-mlx
52415 Exo

第 3 层:进程检测(兜底)

使用 pslsof 查找监听任意端口的引擎进程。能发现运行在完全意外端口上的引擎。

自动持久化

第 2 层或第 3 层发现的引擎自动保存到配置文件(第 1 层),加快下次检测。自动发现的条目在 7 天不活跃后清理。

多个引擎共享端口时(如 mlx-lm 和 llama.cpp 共用 8080),asiai 使用 API 端点探测来识别正确的引擎。

显式 URL

使用 --url 时仅扫描指定 URL。不读写配置——适用于一次性检查。

asiai detect --url http://192.0.2.10:11434,http://localhost:8800

另见

  • config — 管理持久化引擎配置
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 74 lines · 30 tokens per session scan A 189f596dd71f

Subscribe to this mod's changes

detect.zh is a command published in the GitHub repository druide67/asiai (11 stars, last pushed 5d ago), licensed Apache-2.0. It adds 30 tokens to every session and 597 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to detect.ja, differing in 50 lines, and is treated as a copy.