npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@magpie-community/middleware-param-override

v0.1.0

Published

New API's param_override (参数覆盖) as magpie gateway middleware: set, delete, move and rewrite any field of what agents send, with conditions

Downloads

306

Readme

@magpie-community/middleware-param-override

New API's 参数覆盖 (a channel's param_override) as magpie gateway middleware. It sets, deletes, moves and rewrites any field of the requests agents send through magpie, whichever provider serves them. The options are New API's JSON as it is, so you can paste a param_override from New API unchanged.

Install it from magpie's Plugins › Discover, or with magpie plugin add @magpie-community/middleware-param-override. Then set its options under Plugins › Installed › Options, or with magpie plugin options param-override '<json>'.

Options

There are two forms, as in New API:

{ "temperature": 0.2, "max_tokens": 8000 }

Each key is set on the body as it is.

{ "operations": [
  { "path": "max_tokens", "mode": "set", "value": 32000,
    "conditions": [{ "path": "max_tokens", "mode": "gt", "value": 32000 }] },
  { "path": "temperature", "mode": "delete",
    "conditions": [{ "path": "model", "mode": "contains", "value": "reasoner" }] },
  { "mode": "return_error", "value": { "message": "opus is not allowed here", "status_code": 403 },
    "conditions": [{ "path": "model", "mode": "contains", "value": "opus" }] }
] }

The operations run in order. Keys set beside operations are applied first.

| Field | | | --- | --- | | path | A gjson path: a.b.0. messages.-1 counts from the end, tools.*.name matches every item, and \. is a dot inside a key. | | mode | set (keep_origin: only when missing), delete, move / copy (from, to), prepend / append (arrays joined, strings joined, objects merged; keep_origin keeps keys already there), trim_prefix, trim_suffix, ensure_prefix, ensure_suffix, trim_space, to_lower, to_upper, replace / regex_replace (from, to; Go's ${1} works), return_error, prune_objects | | value | What to set, join or trim. For return_error, a message or {message, status_code}; the agent gets the error in its own API's shape. For prune_objects, a type or {type, where, conditions, logic, recursive}. | | conditions | [{path, mode, value, invert, pass_missing_key}], where mode is full, prefix, suffix, contains, gt, gte, lt or lte. A path is looked up in the body first, then in the request: model, request_path, protocol (anthropic, chat, responses, gemini), agent, stream. | | logic | OR (New API's default) or AND. |

Some of New API's modes have nothing to act on here and are left out: the header modes (set_header, pass_headers…), sync_fields, and conditions on retries, users and groups. The middleware sees only the body.

Unlike New API, an operation that can't apply is skipped (a move from a missing path, trim_prefix on a number) and the request goes on. If the middleware itself fails, magpie sends the request as it came.

Recipes

  • Cap max_tokens for a provider with a lower limit: the first example above.
  • Drop a parameter a provider refuses: {"path": "tools.*.input_examples", "mode": "delete"}.
  • Strip a vendor prefix from model names: {"path": "model", "mode": "trim_prefix", "value": "openai/"}.
  • Keep an agent off a model: return_error with a model condition.
  • Remove old thinking blocks: {"path": "messages", "mode": "prune_objects", "value": "thinking"}.

中文:New API 的「参数覆盖」,作为 magpie 网关中间件。配置是 New API 的同一份 JSON,可以原样粘贴过来。