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.
npx agentmods add skills/echovic/blade-code/model-and-provider-runtimenpx skills add echoVic/blade-code --skill model-and-provider-runtimegit clone --depth 1 https://github.com/echoVic/blade-codeWrote 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.
[](https://agentmods.dev/skills/echovic/blade-code/model-and-provider-runtime)<a href="https://agentmods.dev/skills/echovic/blade-code/model-and-provider-runtime"><img src="https://agentmods.dev/badge/skills/echovic/blade-code/model-and-provider-runtime.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00152 | $0.01606 |
| Opus 5 | $0.00076 | $0.00803 |
| Sonnet 5 | $0.00030 | $0.00321 |
| Haiku 4.5 | $0.00015 | $0.00161 |
Grade A, and why
knowledge-model-and-provider-runtime 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.
How it starts
The opening of the file, as written. The whole thing — 60 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Module Structure
该域把用户配置解析为 Session 绑定的 pi-ai 模型,将 Blade 消息与工具契约适配为 Provider 请求,并在物理流外围统一实施故障恢复、容量保护和运行态观测。
Directory Layout
packages/cli/src/services/ChatServiceInterface.ts— Blade 内部消息、请求、响应和 Provider 生命周期事件契约packages/cli/src/services/PiAIChatService.ts— 统一聊天服务、fallback 与物理请求编排packages/cli/src/services/PiCatalogService.ts— Provider/模型目录查询门面packages/cli/src/services/pi/— pi-ai 目录、上下文、请求、流、重试、熔断、准入和缓存适配packages/cli/src/config/modelIds.ts— 可读模型配置 ID 生成与旧 ID 迁移packages/cli/src/config/modelProviders.ts— 自定义 Provider 通道验证packages/cli/src/config/providerCircuitBreaker.ts— 熔断配置边界packages/cli/src/config/providerRequestAdmission.ts— Provider 准入配置边界packages/cli/src/config/foregroundProviderRecovery.ts— 前台恢复预算边界
Key Entry Points
resolveModelConfig()inpackages/cli/src/services/pi/resolveModelConfig.ts— 将模型记录、全局配置和能力选择冻结为运行时配置createChatServiceAsync()inpackages/cli/src/services/ChatServiceInterface.ts— 合并 Provider 默认请求头并创建唯一聊天实现PiAIChatService.streamChat()inpackages/cli/src/services/PiAIChatService.ts— 编排上下文转换、准入、熔断、物理流、重试与 fallbackPiModelCataloginpackages/cli/src/services/pi/PiModelCatalog.ts— 维护内置、兼容和自定义 Provider 的模型视图
Gotchas
ChatConfig同时携带可序列化设置和modelCatalog、providerCircuitRegistry、providerRequestAdmissionScheduler三个运行时对象;后者明确禁止进入配置、事件或会话持久化 (packages/cli/src/services/ChatServiceInterface.ts)- Session 的模型目录是不可变工作区快照而熔断器和启用后的准入器是进程共享协调器;把三者统一成全局单例会串扰项目 endpoint,把三者都改成 Session 私有又会失去跨 Session 故障与容量协调 (
packages/cli/src/agent/resources/WorkspaceModelResources.ts,packages/cli/src/services/PiAIChatService.ts) - 跨 Provider fallback 不继承主通道的 API key、base URL、headers、service tier 或 verbosity;只有同 Provider 且 fallback 未解析出独立 channel 时才继承主通道字段 (
packages/cli/src/services/PiAIChatService.ts)
Architecture
- 配置链固定为
ModelConfig→resolveModelConfig()→ChatConfig→createChatServiceAsync()→PiAIChatService;模型能力先由 catalog 校验,再由请求适配器映射为各 wire API 的参数 (packages/cli/src/services/pi/resolveModelConfig.ts,packages/cli/src/services/ChatServiceInterface.ts,packages/cli/src/services/pi/requestOptions.ts) chat()不是另一套非流式实现,而是消费streamChat()并聚合正文、reasoning、工具调用、usage 与 finish reason,因此恢复和重放边界只需在流式路径维护 (packages/cli/src/services/PiAIChatService.ts)- 物理请求顺序是 circuit preflight → 可选 admission → 原子 circuit check/probe claim → Provider iterator → circuit outcome → permit/token 释放;重试等待和 fallback 选择发生在 permit 外 (
packages/cli/src/services/PiAIChatService.ts,docs/reference/model-transport-recovery.md)
What ships with it
3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 3d ago First seen · 60 lines · 152 tokens per session scan A 493d02a3186f
knowledge-model-and-provider-runtime is a skill published in the GitHub repository echoVic/blade-code (178 stars, last pushed today), licensed MIT. It adds 152 tokens to every session and 1,606 once invoked, about $0.0008 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-09-03.
Other skills, from other repositories
groq-inference
Ultra-fast LLM inference on custom LPU hardware. OpenAI-compatible API at api.groq.com. Lowest latency in the industry (500-1000+ tok/s). Supports chat completions, vision, audio (Whisper STT + TTS), tool calling, JSON mode, and streaming. Free tier available. Inference only — no training.
data-leakage-detection
Detect sensitive information disclosure via escalating dialogue probes. Covers system prompt extraction, credential/API key leakage, PII, and internal configuration exposure.
histolab
Lightweight WSI tile extraction and preprocessing. Use for basic slide processing tissue detection, tile extraction, stain normalization for H&E images. Best for simple pipelines, dataset preparation, quick tile-based analysis. For advanced spatial proteomics, multiplexed imaging, or deep learning pipelines use pathml.
pyhealth
Comprehensive healthcare AI toolkit for developing, testing, and deploying machine learning models with clinical data. This skill should be used when working with electronic health records (EHR), clinical prediction tasks (mortality, readmission, drug recommendation), medical coding systems (ICD, NDC, ATC)…
deepchem
Molecular ML with diverse featurizers and pre-built datasets. Use for property prediction (ADMET, toxicity) with traditional ML or GNNs when you want extensive featurization options and MoleculeNet benchmarks. Best for quick experiments with pre-trained models, diverse molecular representations. For graph-first…
shap
Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models, analyzing model bias or fairness, comparing…