detect

A Mac command that finds locally running large-language-model inference engines, which are programs that run AI models.

In plain words
What is it for?
It detects engines through saved configuration, port scans, or process checks, and can scan specific URLs.
Why use it?
It saves you from checking configuration files, network ports, and running processes manually to find available engines.

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
Clone the repo
git clone --depth 1 https://github.com/druide67/asiai
Per session 25 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 544 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found 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.00025 $0.00544
Opus 5 $0.00013 $0.00272
Sonnet 5 $0.00005 $0.00109
Haiku 4.5 $0.00003 $0.00054

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

Security

Grade A, and why

detect 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 3d 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.

docs/commands/detect.md · 74 lines

What it actually says

asiai detect

Auto-detect running inference engines using a 3-layer cascade.

Usage

asiai detect                      # Auto-detect (3-layer cascade)
asiai detect --url http://host:port  # Scan specific URL(s) only

Output

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

How it works: 3-layer detection

asiai uses a cascade of three detection layers, from fastest to most thorough:

Layer 1: Config (fastest, ~100ms)

Reads ~/.config/asiai/engines.json — engines discovered in previous runs. This catches engines on non-standard ports (e.g., oMLX on 8800) without rescanning.

Layer 2: Port scan (~200ms)

Scans default ports plus an extended range:

Port Engine
11434 Ollama
1234 LM Studio
8080 mlx-lm or llama.cpp
8000-8009 oMLX or vllm-mlx
52415 Exo

Layer 3: Process detection (fallback)

Uses ps and lsof to find engine processes listening on any port. Catches engines running on completely unexpected ports.

Auto-persist

Any engine discovered in Layer 2 or 3 is automatically saved to the config file (Layer 1) for faster detection next time. Auto-discovered entries are pruned after 7 days of inactivity.

When multiple engines share a port (e.g., mlx-lm and llama.cpp on 8080), asiai uses API endpoint probing to identify the correct engine.

Explicit URLs

When using --url, only the specified URLs are scanned. No config is read or written — useful for one-off checks.

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

See also

  • config — Manage persistent engine configuration
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. 3d ago First seen · 74 lines · 25 tokens per session scan A 1dcfafb255d7

Subscribe to this mod's changes

detect is a command published in the GitHub repository druide67/asiai (11 stars, last pushed 3d ago), licensed Apache-2.0. It adds 25 tokens to every session and 544 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.