knowledge-model-and-provider-runtime

knowledge-model-and-provider-runtime is a skill for Claude Code, Codex from echoVic/blade-code. It costs 152 tokens per session (1,606 once invoked), scanned A, original, MIT.

A codebase guide for choosing AI models and providers, sending requests, recovering from failures, and recording runtime information.

In plain words
What is it for?
Use it when adding providers or models, configuring credentials, debugging requests and streams, or investigating fallback and reliability behavior.
Why use it?
It helps developers understand the full path from user configuration to an AI request, including fallback models, retries, capacity limits, and cost or cache tracking.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

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 skills/echovic/blade-code/model-and-provider-runtime
Any agent
npx skills add echoVic/blade-code --skill model-and-provider-runtime
Clone the repo
git clone --depth 1 https://github.com/echoVic/blade-code

Made for: Claude Code, Codex.

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 knowledge-model-and-provider-runtime

README.md
[![agentmods](https://agentmods.dev/badge/skills/echovic/blade-code/model-and-provider-runtime.svg)](https://agentmods.dev/skills/echovic/blade-code/model-and-provider-runtime)
Your own site
<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>
Per session 152 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,606 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.1 $0.00152 $0.01606
Opus 5 $0.00076 $0.00803
Sonnet 5 $0.00030 $0.00321
Haiku 4.5 $0.00015 $0.00161

Measured 3d ago against content hash 493d02a3186f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

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.

.trae/knowledges/model-and-provider-runtime/SKILL.md · 60 lines

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() in packages/cli/src/services/pi/resolveModelConfig.ts — 将模型记录、全局配置和能力选择冻结为运行时配置
  • createChatServiceAsync() in packages/cli/src/services/ChatServiceInterface.ts — 合并 Provider 默认请求头并创建唯一聊天实现
  • PiAIChatService.streamChat() in packages/cli/src/services/PiAIChatService.ts — 编排上下文转换、准入、熔断、物理流、重试与 fallback
  • PiModelCatalog in packages/cli/src/services/pi/PiModelCatalog.ts — 维护内置、兼容和自定义 Provider 的模型视图

Gotchas

  • ChatConfig 同时携带可序列化设置和 modelCatalogproviderCircuitRegistryproviderRequestAdmissionScheduler 三个运行时对象;后者明确禁止进入配置、事件或会话持久化 (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

  • 配置链固定为 ModelConfigresolveModelConfig()ChatConfigcreateChatServiceAsync()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)

Read the full file on GitHub · 60 lines

Files

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.

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 · 60 lines · 152 tokens per session scan A 493d02a3186f

Subscribe to this mod's changes

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.

Related

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.

synthetic-sciences/openscience · 77 tokens

data-leakage-detection

Detect sensitive information disclosure via escalating dialogue probes. Covers system prompt extraction, credential/API key leakage, PII, and internal configuration exposure.

Tencent/AI-Infra-Guard · 34 tokens

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.

synthetic-sciences/openscience · 62 tokens

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)…

synthetic-sciences/openscience · 109 tokens

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…

synthetic-sciences/openscience · 78 tokens

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…

synthetic-sciences/openscience · 109 tokens