plugin-inference-middleware

plugin-inference-middleware is a skill for Claude Code, Codex from NVIDIA-NeMo/nemo-helix. It costs 98 tokens per session (3,157 once invoked), scanned A, original, Apache-2.0.

A plugin framework for intercepting inference requests and responses inside IGW, the inference gateway. A plugin can inspect or handle requests and responses and use stored configuration through the platform's entity APIs.

In plain words
What is it for?
Use it to build middleware that processes model requests or responses, validate middleware settings, and expose configuration create, read, update, and delete operations.
Why use it?
It provides the required structure for registering an inference middleware plugin and handling its configuration. This avoids wiring interception and configuration storage from scratch.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it to build middleware that processes model requests or responses, validate middleware settings, and expose configuration create, read, update, and delete operations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nvidia-nemo/nemo-helix/plugin-inference-middleware
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.

Any agent
npx skills add NVIDIA-NeMo/nemo-helix --skill plugin-inference-middleware
Clone the repo
git clone --depth 1 https://github.com/NVIDIA-NeMo/nemo-helix

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 plugin-inference-middleware

README.md
[![agentmods](https://agentmods.dev/badge/skills/nvidia-nemo/nemo-helix/plugin-inference-middleware/github.svg)](https://agentmods.dev/skills/nvidia-nemo/nemo-helix/plugin-inference-middleware)
Your own site
<a href="https://agentmods.dev/skills/nvidia-nemo/nemo-helix/plugin-inference-middleware"><img src="https://agentmods.dev/badge/skills/nvidia-nemo/nemo-helix/plugin-inference-middleware/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for plugin-inference-middleware

Your own site · 80×15
<a href="https://agentmods.dev/skills/nvidia-nemo/nemo-helix/plugin-inference-middleware"><img src="https://agentmods.dev/badge/skills/nvidia-nemo/nemo-helix/plugin-inference-middleware.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 98 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,157 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00098 $0.03157
Opus 5.5 $0.00039 $0.01263
Sonnet 5.5 $0.00020 $0.00631
Haiku 4.5 $0.00010 $0.00316

Measured yesterday against content hash 61d8da10bb29, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

plugin-inference-middleware 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 yesterday.

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.

packages/nemo_helix_plugin/src/nemo_helix_plugin/.agents/skills/plugin-inference-middleware/SKILL.md · 353 lines

How it starts

The opening of the file, as written. The whole thing — 353 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Inference Middleware Plugin

Entry-point registration

# pyproject.toml
[project.entry-points."nemo.inference_middleware"]
"nemo-my-plugin" = "nemo_my_plugin.middleware:MyMiddleware"

The key ("nemo-my-plugin") is the plugin identity — it must match MiddlewareCall.name in VirtualModel configs.


Minimal implementation

from nemo_helix_plugin.inference_middleware import (
    NemoInferenceMiddleware,
    InferenceMiddlewareContext,
    InferenceRequest,
    InferenceResponse,
    RequestResult,
    ResponseResult,
    ImmediateResponse,
    InferenceMiddlewareError,
    InferenceMiddlewareUnavailableError,
    VirtualModel,
)
from nemo_helix_plugin.entities.client import AsyncEntitiesClient
from nemo_helix_plugin.entity_client import NemoEntitiesClient
from pydantic import BaseModel
from typing import Any

class MyConfigData(BaseModel):
    """Lightweight working config — returned from validate_middleware_config."""
    threshold: float = 0.8

class MyMiddleware(NemoInferenceMiddleware):

    def __init__(self) -> None:
        super().__init__()
        self._entity_client = None  # initialised in on_startup

    # ── Lifecycle ──────────────────────────────────────────────────────
    async def on_startup(self) -> None:
        # IGW injects a typed client authenticated as service:<entry-point name>
        # before on_startup(). Derive an entity client from it so
        # get_middleware_config can fetch stored config entities.
        client = self._get_platform_client("on_startup")
        self._entity_client = NemoEntitiesClient(AsyncEntitiesClient.from_client(client))

        entities = self.list_model_entities_for_workspace()  # cache available here
        ...

    async def on_shutdown(self) -> None: ...

    async def on_virtual_model_upserted(self, virtual_model: VirtualModel) -> None: ...
    async def on_virtual_model_destroyed(self, virtual_model: VirtualModel) -> None: ...

    # ── Config resolution (needed only for config_id support) ──────────
    async def get_middleware_config(self, config_type: str, config_id: str) -> Any:
        """Fetch stored config entity from the entity store.

        Called at VirtualModel cache-build time and every polling cycle.
        Never called per-request.
        """
        if config_type != "my_plugin_config":
            raise InferenceMiddlewareError(f"Unknown config_type={config_type!r}", status_code=400)
        ws, name = config_id.split("/", 1)
        return await self._entity_client.get(MyPluginConfig, name=name, workspace=ws)

    async def validate_middleware_config(self, config_type: str, config: Any) -> MyConfigData:
        """Validate and normalise config — called at cache-build time, not per-request."""
        if config_type != "my_plugin_config":
            raise ValueError(f"Unknown config_type={config_type!r}")
        if isinstance(config, MyPluginConfig):
            return MyConfigData(threshold=config.threshold)
        return MyConfigData.model_validate(config)  # inline dict path

    # ── Request hook ───────────────────────────────────────────────────
    async def process_request(
        self,
        ctx: InferenceMiddlewareContext,
        request: InferenceRequest,
        middleware_config: MyConfigData,
    ) -> RequestResult:
        # Mutate body["model"] to route to a different entity:
        request.body["model"] = "default/strong-model"
        return request

        # Or short-circuit (skip backend entirely):
        # return ImmediateResponse(data={"choices": [{"message": {"content": "cached"}}], ...})

        # Or raise a typed error:
        # raise InferenceMiddlewareError("Rate limit exceeded", status_code=429)

    # ── Response hook ──────────────────────────────────────────────────
    async def process_response(
        self,
        ctx: InferenceMiddlewareContext,
        response: InferenceResponse,
        middleware_config: MyConfigData,
    ) -> ResponseResult:
        if isinstance(response.result, dict):
            # Non-streaming — mutate and return
            response.result["choices"][0]["message"]["content"] = redact(...)
            return response.result
        else:
            # Streaming — wrap the async iterator
            async def _filtered(stream):
                async for chunk in stream:
                    yield transform(chunk)
            return _filtered(response.result)

Read the full file on GitHub · 353 lines

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. yesterday First seen · 353 lines · 98 tokens per session scan A 61d8da10bb29

Subscribe to this mod's changes

plugin-inference-middleware is a skill published in the GitHub repository NVIDIA-NeMo/nemo-helix (160 stars, last pushed today), licensed Apache-2.0. It adds 98 tokens to every session and 3,157 once invoked, about $0.0004 per session on Opus 5.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-12-05.

Related

plugin-inference-middleware compared with skills from other repositories

plugin-inference-middleware next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
plugin-inference-middlewareNVIDIA-NeMo/nemo-helixSkill160todayApache-2.0A98Claude Code, Codex
trulens-blocking-guardrailstruera/trulensSkill3.7kyesterdayMITA19Claude Code, Codex
rust-gatewayBerriAI/litellmSkill65ktodaynoneA70Claude Code, Codex
vercel-composition-patternslangfuse/langfuseSkill38ktodaynoneA58Claude Code, Codex
open-sourcebrowser-use/browser-useSkill123ktodayMITA101Claude Code
stripe-projectsNousResearch/hermes-agentSkill269ktodayMITA15Claude Code, Codex
fastapi-patternsaffaan-m/ECCSkill317k4d agoMITA35Claude Code, Kiro