mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-12-05 16:04:03 +00:00
* feat(plugins): add provider plugins, request plugins and a community marketplace - Provider plugins turn an upstream vendor into a channel type: routes, protocol conversion, models, static keys, sign-in flows with token refresh, balance queries, per-channel config and a scheduled hook. - Request plugins run on requests and replies (ingress, request, outbound, egress, reply, report), with instances by scope, model ranges, dry runs and per-log records. Built-ins: request filter, request redaction, parameter override, auto reasoning effort, image compression and content moderation. Sensitive words move into a request filter instance on first start. - Node sync: a system_sync_topics table lets every node reload settings, channels, plugins and other data within seconds, and the system info page shows each node's state. - Marketplace: a community source next to the official one, lookup by plugin code for official and community plugins, key rules for community plugins, install counts and takedown warnings. * docs(plugins): name request protocols and host-only members in the plugin API - Protocol names: ctx.format and samples use relaykit's protocol names. The spec lists the client paths and body of each name, so every host passes the same names to plugins. - Host-specific members: channel, group, user, token, channelTypes, channelOther and utils.paramOverride exist only on new-api. The types mark them optional. - Relay routes: the spec now writes out the route keys and the converters each incoming path accepts. The schema lists the converter names. * feat(plugins): show recommended plugins from the official list too The site now marks official plugins as recommended in its index. The built-in official and community lists both get a Recommended group; lists added by the administrator still cannot recommend plugins. * feat(plugins): fall back to www.newapi.pro when www.newapi.ai does not answer Plugin lists, plugin files and logos from www.newapi.ai are downloaded from www.newapi.pro, the mainland China site, when newapi.ai gives no answer within 10 seconds; the browser remembers this for a day. The marketplace toolbar has a download site picker: Auto, or Mainland China to always use www.newapi.pro. Saved source addresses stay on newapi.ai, and every file is still checked against its sha256. Community install counts go to newapi.ai first and to newapi.pro when newapi.ai cannot be reached. * fix(plugins): leaving the page does not switch the plugin site to www.newapi.pro Reloading or leaving the marketplace cancels requests still running. That was read as www.newapi.ai not answering, so the browser moved to www.newapi.pro for a day although newapi.ai was reachable. Requests cut off by leaving the page are no longer counted. * feat(plugins): choose the plugin download site by hand The marketplace no longer switches between plugin sites by itself. The toolbar menu lists the main site www.newapi.ai, the backup site www.newapi.pro and the other plugin lists; picking an entry is the only thing that changes where plugins are downloaded from, and the main site can always be picked again. A browser that the earlier automatic switch had moved to www.newapi.pro opens on the main site again. The download site, the source choice and managing sources now share one menu in the list header. * feat(plugins): show plugin usage guides and require README and changelog Every marketplace plugin version now ships a usage guide, README.md, and a changelog, CHANGELOG.md, next to plugin.js. The install dialog shows the guide in the reader's language when a translation is listed, falls back to English, and links to the source file. A guide or changelog that breaks the format is reported with its file, line and rule instead of being shown. The plugin API document describes both formats, the translations they may list, and the checks the community marketplace runs before it accepts a version: readme_missing, readme_invalid, changelog_missing and changelog_invalid. Versions accepted before these checks are not checked again. * fix(plugins): address review findings on plugin parts, limits and access - Only the root user reads request plugin instance configs; an admin who may bind instances to channels gets them without configs. - Outbound hooks that grow the body are held to MAX_REQUEST_BODY_MB, as ingress hooks are, and answer 413 without a retry. - An admin who cannot read plugin options keeps the balance and model list actions on plugin channels; the server answers whether they work. - Reading the parts of a plugin source gives up when the source does not parse or code elsewhere refers to meta, as the meta preview does. * fix(plugins): address review findings on request processing, documents and node sync - PDF checks resolve indirect parameters and bound every value the parser allocates or loops on: predictor columns, object stream counts, nested object streams, cross-reference streams and ToUnicode ranges. Font and CMap work checks the deadline. - A WebP frame must match its declared canvas, and keyword search stops at its match limit. - Request processing treats a body as JSON whenever the gateway parses it as JSON, keeps Gemini reply parts in place, scopes instances by the settled auto group, hides channel header overrides from plugin param overrides, and captures replies only for report instances in scope. - Request processing no longer follows the plugin master switch, which now covers plugin tasks and channels only. - json.patch copies stop at MAX_REQUEST_BODY_MB, and provider prepareRequest effects past it answer 413. - Image billing reads the count from the final upstream body, including the count members of SiliconFlow, Imagen and Replicate and the Imagen default. - Automatic channel status changes no longer reload every node's channel cache. A credential refresh holds no channel lock while it waits on the vendor. A key that needs login is disabled and the request can retry. - Balance requests must go to the channel host or allowedHosts, and provider stream events a plugin drops keep the stream alive. - Node sync: OAuth provider writes bump inside their transaction, a failed startup load is retried, and each node is judged by its own topics. - request-filter checks the text the old sensitive-word check did, request-redact and content-moderation handle large inputs, and image-compress lossless mode leaves JPEG and WebP alone. * fix(plugins): address the second review on balances, egress and routes - Channel other_info writes (status changes, balance queries and manual multi-key actions) only land while other_info is still the value read, and retry otherwise, so a write on one node no longer overwrites another node's balance or status reason. They write only their own columns. - On the Responses path egress reads the body after the channel finalizes it, which is the body sent upstream. - The Vertex AI plugin picks the region by the model the client asked for, as the built-in Vertex AI channel does. - /request-processing and /security are reserved route namespaces, and a test checks that every console page is reserved. - The plugin API docs say what egress reads on a provider plugin channel. * feat(channels): run the balance update as a system task with progress "Update all balances" now queues a channel_balance system task instead of starting a goroutine guarded by an in-process flag. The task row holds the progress (enabled channels queried of total), so any node can answer it, and its active key keeps one run at a time across nodes. The CHANNEL_UPDATE_FREQUENCY schedule becomes the same task's schedule, so manual and scheduled runs no longer overlap. GET /api/channel/update_balance answers with the task id, and with the running one when a run is already queued. GET /api/channel/update_balance/task/:task_id, under the same channel permission, returns the status, progress and failure of balance update tasks only. The channel list follows the task, reloads as more channels are queried and once more at the end, and reports how the run ended. * feat(system): sync nodes through system tasks and clean up task history Node sync no longer needs its own table. A write to synced data adds a pending sync_<topic> system task. Every node polls the newest task of each topic it keeps every 3 s and reloads when that task is newer than the one it applied. Custom OAuth providers still add their task inside the write transaction, and lock the newest task of the topic first, so tasks commit in id order. The master marks a sync task succeeded once every online node that keeps the topic has applied it. Until then the task shows how many nodes have applied it and why the others have not. The system_sync_topics table is gone. A composite (type, id) index answers the newest task of a type from the index. The latest-per-type and earliest-pending queries now read ids first, because MySQL 5.7 scanned the whole table for them. A daily system_task_cleanup task deletes finished system tasks older than system_task_setting.retention_days (default 30, at least 1), in batches. It never deletes active tasks or the newest task of any type. The retention is set under Operations > Log maintenance.
298 lines
26 KiB
JSON
298 lines
26 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://github.com/QuantumNous/new-api/docs/plugin-api/v1.schema.json",
|
|
"title": "new-api Task Plugin v1 manifest",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["apiVersion", "key", "name", "version", "author"],
|
|
"properties": {
|
|
"sortPriority": {"type": "integer", "minimum": -2147483648, "maximum": 2147483647, "default": 0},
|
|
"website": {"oneOf": [{"const": ""}, {"type": "string", "format": "uri", "pattern": "^[Hh][Tt][Tt][Pp][Ss]://[^/@?#\\s]+(?:[/?#]|$)"}], "description": "Absolute HTTPS URL with a valid ASCII hostname (use punycode for internationalized domains) and no credentials; validated by the host."},
|
|
"apiVersion": {"const": 1}, "key": {"type": "string"}, "name": {"allOf": [{"$ref": "#/$defs/localizedText"}, {"if": {"type": "object"}, "then": {"additionalProperties": {"maxLength": 128}}}]}, "icon": {"type": "string", "maxLength": 128}, "description": {"$ref": "#/$defs/localizedText"}, "version": {"type": "string"},
|
|
"author": {"type": "object", "required": ["name"], "additionalProperties": false, "properties": {"name": {"type": "string"}, "url": {"type": "string", "format": "uri"}}},
|
|
"baseUrl": {"type": "string", "format": "uri", "pattern": "^https?://", "maxLength": 191},
|
|
"channelTypes": {"type": "array", "uniqueItems": true, "items": {"type": "integer", "minimum": 1}, "description": "new-api built-in channel type numbers; other hosts ignore them."}, "models": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}},
|
|
"fetchMode": {"enum": ["per_task", "batch"]}, "allowedHosts": {"type": "array", "uniqueItems": true, "items": {"type": "string"}},
|
|
"upstreams": {"type": "array", "uniqueItems": true, "items": {"$ref": "#/$defs/upstreamKind"}, "description": "Upstream kinds the driver addresses. vendor is implied; new_api makes the plugin bindable to type-60 New API channels."},
|
|
"protocols": {"type": "array", "uniqueItems": true, "items": {"oneOf": [
|
|
{"enum": ["openai_video", "openai_image"]},
|
|
{"type": "object", "additionalProperties": false, "required": ["name", "supports"], "properties": {"name": {"const": "openai_responses"}, "supports": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"enum": ["stream", "sync", "background"]}}, "models": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}}},
|
|
{"type": "object", "additionalProperties": false, "required": ["name"], "properties": {"name": {"enum": ["openai_video", "openai_image"]}, "models": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}}}
|
|
]}},
|
|
"submitResponseTypes": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"enum": ["json", "sse"]}},
|
|
"requiredCapabilities": {"type": "array", "uniqueItems": true, "items": {"enum": ["json-clone@1", "submit-sse-delta@1", "json-order@1", "duration-auto@1"]}},
|
|
"routes": {"type": "array", "items": {"$ref": "#/$defs/route"}}, "usageSchema": {"type": "object", "additionalProperties": {"$ref": "#/$defs/usageField"}}, "usageExamples": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["label", "facts"], "properties": {"label": {"type": "string"}, "facts": {"type": "object"}}}}, "usageProfiles": {"type": "array", "items": {"$ref": "#/$defs/usageProfile"}}, "auth": {},
|
|
"relay": {"type": "array", "items": {"$ref": "#/$defs/relayRoute"}, "description": "The provider part: routes a type-61 channel bound to the plugin relays. A plugin without an exported buildSubmitRequest needs it or an exported stage hook, and must not declare the task fields; the host checks this at load."},
|
|
"configSchema": {"$ref": "#/$defs/configSchema"},
|
|
"channelConfig": {"$ref": "#/$defs/configSchema", "description": "The settings of each type-61 channel bound to the plugin, in the configSchema format: stored in the channel settings as plugin_config and read by the hooks as ctx.config with the defaults applied. A format url field is an upstream address (absolute http(s), ASCII host, no credentials, query or fragment, trailing slash stripped) that a relay upstream_path can start with as {config.<name>}; an object field may hold a value per model in additionalProperties. Only a plugin with a task part or relay routes may declare it; the host checks this at load."},
|
|
"keyHint": {"allOf": [{"$ref": "#/$defs/localizedText"}, {"if": {"type": "string"}, "then": {"maxLength": 256}, "else": {"additionalProperties": {"maxLength": 256}}}], "description": "The hint and example of the channel key field, such as AccessKey|SecretKey. Only a plugin with a task part or relay routes may declare it."},
|
|
"optional": {"type": "boolean", "description": "A request skips a failed instance of the plugin instead of stopping with 500 request_plugin_failed. Only a plugin with a request processing part may declare it; the host checks this at load, as for configSchema."},
|
|
"samples": {"type": "array", "maxItems": 8, "items": {"$ref": "#/$defs/sample"}, "description": "Requests the request plugin settings offer to try the plugin with, text only. At most 3 with the same lang; those without lang count as one value. Only a plugin with a request processing part may declare it. The host also refuses media and links in body and reply at load: see Samples in v1.md."}
|
|
},
|
|
"anyOf": [
|
|
{"required": ["models", "fetchMode"]},
|
|
{"required": ["relay"], "properties": {"relay": {"minItems": 1}}},
|
|
{"not": {"anyOf": [{"required": ["fetchMode"]}, {"required": ["relay"]}]}, "description": "A request processing part alone, which the host reads from the exported stage hooks."}
|
|
],
|
|
"allOf": [{"if": {"required": ["requiredCapabilities"], "properties": {"requiredCapabilities": {"contains": {"const": "submit-sse-delta@1"}}}}, "then": {"required": ["submitResponseTypes"], "properties": {"submitResponseTypes": {"contains": {"const": "sse"}}}}}],
|
|
"$defs": {
|
|
"sample": {
|
|
"type": "object", "additionalProperties": false, "required": ["name", "format", "body"],
|
|
"properties": {
|
|
"name": {"allOf": [{"$ref": "#/$defs/localizedText"}, {"if": {"type": "object"}, "then": {"additionalProperties": {"maxLength": 64}}, "else": {"maxLength": 64}}]},
|
|
"lang": {"type": "string", "pattern": "^[a-z]{2,3}$", "description": "Base language of the text, such as en or zh; absent for any language."},
|
|
"format": {"enum": ["openai", "openai_responses", "claude", "gemini"], "description": "A protocol name; see Protocol names in v1.md."},
|
|
"body": {"type": "object", "description": "A request body in format, at most 16 KB as JSON. \"[sample-image]\" as a whole element of a content or parts array stands for an image the settings supply."},
|
|
"reply": {"type": "string", "minLength": 1, "description": "An answer text of at most 4 KB, for trying a reply hook."}
|
|
}
|
|
},
|
|
"configSchema": {
|
|
"type": "object", "additionalProperties": false, "required": ["type", "properties"],
|
|
"properties": {
|
|
"type": {"const": "object"},
|
|
"properties": {"type": "object", "additionalProperties": {"$ref": "#/$defs/configField"}},
|
|
"required": {"type": "array", "uniqueItems": true, "items": {"type": "string"}}
|
|
},
|
|
"description": "The schema of a request processing instance's config. The host also requires an exported stage hook, nesting of at most 4 levels, members that apply to each field's type, and valid defaults and examples."
|
|
},
|
|
"configField": {
|
|
"type": "object", "additionalProperties": false, "required": ["type", "title"],
|
|
"properties": {
|
|
"type": {"enum": ["string", "number", "integer", "boolean", "array", "object"]},
|
|
"title": {"$ref": "#/$defs/usageLabel"},
|
|
"description": {"allOf": [{"$ref": "#/$defs/localizedText"}, {"if": {"type": "string"}, "then": {"maxLength": 512}, "else": {"additionalProperties": {"maxLength": 512}}}]},
|
|
"default": true,
|
|
"examples": {"type": "array"},
|
|
"enum": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": ["string", "number"]}},
|
|
"enumTitles": {"type": "array", "items": {"$ref": "#/$defs/usageLabel"}},
|
|
"minimum": {"type": "number"}, "maximum": {"type": "number"},
|
|
"unit": {"enum": ["byte", "pixel", "character", "second"], "description": "A form hint for a number or integer field: byte values get a KB/MB choice (1000-based, stored in bytes), the others a suffix."},
|
|
"minLength": {"type": "integer", "minimum": 0}, "maxLength": {"type": "integer", "minimum": 0},
|
|
"pattern": {"type": "string", "description": "An RE2 regular expression."},
|
|
"format": {"enum": ["textarea", "regex", "url", "password", "keywords", "json"], "description": "textarea, regex, url, password and keywords for a string, json for an object. All are form hints except url and keywords: a non-empty url value must be an absolute http(s) URL without credentials or fragment, and its host is one utils.fetch may address in ingress, egress, reply and report. password marks a secret the form hides. keywords, on a property of the schema itself only, is a list with one keyword per line that hooks read as {count, longest} and match with utils.keywords."},
|
|
"items": {"$ref": "#/$defs/configField"},
|
|
"minItems": {"type": "integer", "minimum": 0}, "maxItems": {"type": "integer", "minimum": 0}, "uniqueItems": {"type": "boolean"},
|
|
"properties": {"type": "object", "additionalProperties": {"$ref": "#/$defs/configField"}},
|
|
"required": {"type": "array", "uniqueItems": true, "items": {"type": "string"}},
|
|
"additionalProperties": {"$ref": "#/$defs/configField", "description": "meta.channelConfig only, on an object field without properties: a value per model, keyed by model name. The host also requires a string, number, integer or boolean field without default or visibleWhen."},
|
|
"visibleWhen": {
|
|
"type": "object", "minProperties": 1,
|
|
"additionalProperties": {"oneOf": [{"type": ["string", "number", "boolean"]}, {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": ["string", "number", "boolean"]}}]},
|
|
"description": "A form hint on a property, not on the schema or an items field: the form shows the property while every named sibling holds one of the listed values. The host also requires each key to name another property of the same object, of type string, number, integer or boolean, and each value to be valid for it; API responses always write lists."
|
|
}
|
|
},
|
|
"allOf": [{"if": {"required": ["enumTitles"]}, "then": {"required": ["enum"]}}, {"if": {"required": ["unit"]}, "then": {"properties": {"type": {"enum": ["number", "integer"]}}}}],
|
|
"description": "One field of an instance config. unit, visibleWhen and every format but url are form hints that never change the check, the defaults or the config. The form shows a slider for an integer field whose minimum and maximum are both set and at most 100 apart."
|
|
},
|
|
"jsonChange": {
|
|
"type": "object", "additionalProperties": false, "required": ["op", "path", "value"],
|
|
"properties": {
|
|
"op": {"enum": ["set", "append", "appendText"]},
|
|
"path": {"type": "array", "maxItems": 32, "items": {"oneOf": [{"type": "string"}, {"type": "integer", "minimum": 0}]}},
|
|
"value": true
|
|
},
|
|
"allOf": [{"if": {"properties": {"op": {"const": "appendText"}}}, "then": {"properties": {"value": {"type": "string"}}}}]
|
|
},
|
|
"submitEventDeltaResult": {
|
|
"type": "object", "additionalProperties": false, "required": ["changes", "state", "done"],
|
|
"properties": {
|
|
"changes": {"type": "array", "maxItems": 256, "items": {"$ref": "#/$defs/jsonChange"}},
|
|
"state": true,
|
|
"done": {"type": "boolean"}
|
|
}
|
|
},
|
|
"usageProfile": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["models", "schema"],
|
|
"properties": {
|
|
"models": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}},
|
|
"schema": {"type": "object", "additionalProperties": {"$ref": "#/$defs/usageField"}},
|
|
"examples": {"type": "array", "maxItems": 16, "items": {"$ref": "#/properties/usageExamples/items"}}
|
|
},
|
|
"description": "Complete usage metadata for declared models. The host validates model membership, unique profile ownership and examples, including required token-unit examples."
|
|
},
|
|
"usageField": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"type": {"enum": ["number", "boolean"]},
|
|
"unit": {"enum": ["second", "count", "token", "credit"]},
|
|
"unitLabel": {"$ref": "#/$defs/usageLabel", "description": "Optional localized display unit for number fields with count unit. Does not change usage quantities or billing."},
|
|
"enum": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string"}},
|
|
"description": {"$ref": "#/$defs/usageLabel"},
|
|
"enumLabels": {
|
|
"type": "object",
|
|
"additionalProperties": {"$ref": "#/$defs/usageLabel"},
|
|
"description": "Optional display names keyed by declared enum values; the host validates membership. Missing entries display the original value."
|
|
}
|
|
},
|
|
"allOf": [{"if": {"required": ["unitLabel"]}, "then": {"required": ["type", "unit"], "properties": {"type": {"const": "number"}, "unit": {"const": "count"}}}}],
|
|
"oneOf": [
|
|
{"required": ["enum"], "not": {"anyOf": [{"required": ["type"]}, {"required": ["unit"]}]}},
|
|
{"required": ["type", "unit"], "properties": {"type": {"const": "number"}}, "not": {"anyOf": [{"required": ["enum"]}, {"required": ["enumLabels"]}]}},
|
|
{"required": ["type"], "properties": {"type": {"const": "boolean"}}, "not": {"anyOf": [{"required": ["unit"]}, {"required": ["enum"]}, {"required": ["enumLabels"]}]}}
|
|
]
|
|
},
|
|
"usageLabel": {
|
|
"allOf": [
|
|
{"$ref": "#/$defs/localizedText"},
|
|
{"if": {"type": "string"}, "then": {"maxLength": 256}, "else": {"additionalProperties": {"maxLength": 256}}}
|
|
]
|
|
},
|
|
"localizedText": {
|
|
"oneOf": [
|
|
{"type": "string", "minLength": 1},
|
|
{
|
|
"type": "object",
|
|
"required": ["en"],
|
|
"maxProperties": 16,
|
|
"propertyNames": {"pattern": "^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,8})*$"},
|
|
"additionalProperties": {"type": "string", "minLength": 1}
|
|
}
|
|
]
|
|
},
|
|
"filePlaceholder": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["__fileRef", "encoding"],
|
|
"properties": {
|
|
"__fileRef": {"type": "string", "minLength": 1},
|
|
"encoding": {"enum": ["base64", "dataUrl"]},
|
|
"mimeType": {"type": "string", "minLength": 1},
|
|
"maxBytes": {"type": "integer", "exclusiveMinimum": 0}
|
|
}
|
|
},
|
|
"route": {"type": "object", "additionalProperties": false, "required": ["method", "path", "type", "render"], "properties": {"method": {"enum": ["GET", "POST", "PUT", "PATCH", "DELETE"]}, "path": {"type": "string", "pattern": "^/"}, "type": {"enum": ["submit", "query", "dynamic"]}, "action": {"type": "string"}, "taskIdParam": {"type": "string"}, "retainResult": {"type": "boolean"}, "decode": {"type": "string"}, "render": {"type": "string"}, "models": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}}, "allOf": [{"if": {"properties": {"type": {"const": "query"}}}, "then": {"allOf": [{"not": {"required": ["decode"]}}, {"not": {"required": ["models"]}}, {"not": {"required": ["retainResult"]}}]}}, {"if": {"properties": {"type": {"enum": ["submit", "dynamic"]}}}, "then": {"required": ["decode"]}}]},
|
|
"relayRoute": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["incoming_path", "upstream_path"],
|
|
"properties": {
|
|
"incoming_path": {"type": "string", "pattern": "^/"},
|
|
"upstream_path": {"type": "string", "minLength": 1},
|
|
"converter": {"enum": ["none", "openai_chat_completions_to_anthropic_messages", "openai_chat_completions_to_openai_responses", "openai_chat_completions_to_gemini_generate_content", "openai_responses_to_openai_chat_completions", "openai_responses_to_gemini_generate_content", "anthropic_messages_to_openai_chat_completions", "claude_messages_to_openai_responses", "gemini_generate_content_to_openai_chat_completions", "gemini_generate_content_to_openai_responses", "jina_rerank_to_sglang", "plugin", "openai_chat_completions_to_anthropic_messages+plugin", "openai_chat_completions_to_openai_responses+plugin", "openai_chat_completions_to_gemini_generate_content+plugin", "openai_responses_to_openai_chat_completions+plugin", "openai_responses_to_gemini_generate_content+plugin", "anthropic_messages_to_openai_chat_completions+plugin", "claude_messages_to_openai_responses+plugin", "gemini_generate_content_to_openai_chat_completions+plugin", "gemini_generate_content_to_openai_responses+plugin", "jina_rerank_to_sglang+plugin"], "description": "none (default), a relaykit converter ID, plugin for the plugin's convert hooks, or <converter>+plugin for that converter's upstream protocol converted by the hooks. See Relay routes in v1.md for the incoming_path each converter accepts."},
|
|
"models": {"type": "array", "items": {"type": "string"}},
|
|
"auth": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["type"],
|
|
"properties": {"type": {"enum": ["none", "header", "query"]}, "name": {"type": "string"}, "value": {"type": "string"}}
|
|
},
|
|
"pass_through_body_enabled": {"type": "boolean"}
|
|
},
|
|
"description": "The keys of an Advanced Custom channel route; the host applies the same validation rules."
|
|
},
|
|
"upstreamKind": {"enum": ["vendor", "new_api"]},
|
|
"upstreamContext": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["kind"],
|
|
"properties": {"kind": {"$ref": "#/$defs/upstreamKind"}},
|
|
"description": "Host-injected on every driver hook context; new_api means the executing channel is a type-60 New API channel with Bearer credentials already applied."
|
|
},
|
|
"taskQueryContext": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["taskId", "publicTaskId", "action", "model", "upstreamModel", "baseUrl", "authHeader", "upstream", "data", "state"],
|
|
"properties": {
|
|
"taskId": {"type": "string"},
|
|
"publicTaskId": {"type": "string"},
|
|
"action": {"type": "string"},
|
|
"model": {"type": "string"},
|
|
"upstreamModel": {"type": "string"},
|
|
"baseUrl": {"type": "string"},
|
|
"apiKey": {"type": "string"},
|
|
"authHeader": {"type": "string"},
|
|
"auth": true,
|
|
"credential": true,
|
|
"upstream": {"$ref": "#/$defs/upstreamContext"},
|
|
"data": true,
|
|
"state": true
|
|
}
|
|
},
|
|
"batchQueryContext": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["baseUrl", "authHeader", "upstream", "tasks"],
|
|
"properties": {
|
|
"baseUrl": {"type": "string"},
|
|
"apiKey": {"type": "string"},
|
|
"authHeader": {"type": "string"},
|
|
"auth": true,
|
|
"credential": true,
|
|
"upstream": {"$ref": "#/$defs/upstreamContext"},
|
|
"tasks": {"type": "array", "items": {"$ref": "#/$defs/taskQueryContext"}}
|
|
}
|
|
},
|
|
"hookHTTPResponse": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["status", "headers"],
|
|
"properties": {
|
|
"status": {"type": "integer"},
|
|
"headers": {"type": "object", "additionalProperties": {"type": "string"}}
|
|
}
|
|
},
|
|
"transformResult": {
|
|
"oneOf": [
|
|
{"type": "object", "additionalProperties": false, "required": ["action"], "properties": {
|
|
"action": {"const": "continue"},
|
|
"effects": {"type": "array", "maxItems": 32, "items": {"$ref": "#/$defs/transformEffect"}},
|
|
"findings": {"type": "array", "maxItems": 64, "items": {"type": "object", "additionalProperties": false, "required": ["rule", "count"], "properties": {"rule": {"type": "string", "minLength": 1, "maxLength": 256}, "category": {"type": "string", "maxLength": 256}, "path": {"type": "string", "maxLength": 256}, "count": {"type": "integer", "minimum": 0}}}},
|
|
"notice": {"$ref": "#/$defs/transformNotice"}
|
|
}},
|
|
{"type": "object", "additionalProperties": false, "required": ["action", "code"], "properties": {
|
|
"action": {"const": "reject"},
|
|
"code": {"type": "string", "pattern": "^[a-z0-9_.-]{1,64}$"},
|
|
"message": {"type": "string", "maxLength": 256},
|
|
"ruleId": {"type": "string", "maxLength": 256},
|
|
"findings": {"type": "array", "maxItems": 64, "items": {"type": "object", "additionalProperties": false, "required": ["rule", "count"], "properties": {"rule": {"type": "string", "minLength": 1, "maxLength": 256}, "category": {"type": "string", "maxLength": 256}, "path": {"type": "string", "maxLength": 256}, "count": {"type": "integer", "minimum": 0}}}},
|
|
"notice": {"$ref": "#/$defs/transformNotice"}
|
|
}}
|
|
],
|
|
"description": "The result of a stage hook (ingress, request, outbound, egress)."
|
|
},
|
|
"replyResult": {
|
|
"oneOf": [
|
|
{"type": "object", "additionalProperties": false, "required": ["action"], "properties": {
|
|
"action": {"const": "continue"},
|
|
"mask": {"type": "array", "maxItems": 1024, "items": {"type": "object", "additionalProperties": false, "required": ["index", "start", "end"], "properties": {"index": {"type": "integer"}, "start": {"type": "integer", "minimum": 0}, "end": {"type": "integer", "minimum": 1}, "category": {"type": "string", "maxLength": 256}}}},
|
|
"hold": {"type": "integer", "minimum": 0, "maximum": 8192, "default": 0},
|
|
"findings": {"type": "array", "maxItems": 64, "items": {"type": "object", "additionalProperties": false, "required": ["rule", "count"], "properties": {"rule": {"type": "string", "minLength": 1, "maxLength": 256}, "category": {"type": "string", "maxLength": 256}, "path": {"type": "string", "maxLength": 256}, "count": {"type": "integer", "minimum": 0}}}},
|
|
"notice": {"$ref": "#/$defs/transformNotice"}
|
|
}},
|
|
{"type": "object", "additionalProperties": false, "required": ["action"], "properties": {
|
|
"action": {"const": "pass"}
|
|
}},
|
|
{"type": "object", "additionalProperties": false, "required": ["action", "code"], "properties": {
|
|
"action": {"const": "stop"},
|
|
"code": {"type": "string", "pattern": "^[a-z0-9_.-]{1,64}$"},
|
|
"message": {"type": "string", "maxLength": 256},
|
|
"findings": {"type": "array", "maxItems": 64, "items": {"type": "object", "additionalProperties": false, "required": ["rule", "count"], "properties": {"rule": {"type": "string", "minLength": 1, "maxLength": 256}, "category": {"type": "string", "maxLength": 256}, "path": {"type": "string", "maxLength": 256}, "count": {"type": "integer", "minimum": 0}}}},
|
|
"notice": {"$ref": "#/$defs/transformNotice"}
|
|
}}
|
|
],
|
|
"description": "The result of the reply hook. A mask names an output of the call and a span of its text in UTF-16 code units, start < end <= text.length; each span becomes ***. The host checks the spans at the call. pass lets the rest of the answer through without further calls."
|
|
},
|
|
"transformNotice": {
|
|
"oneOf": [
|
|
{"type": "string", "minLength": 1, "maxLength": 200},
|
|
{"type": "object", "required": ["en"], "maxProperties": 8, "additionalProperties": {"type": "string", "minLength": 1, "maxLength": 200}}
|
|
],
|
|
"description": "Plain explanation for the user of what the plugin did; the user's log shows it as it is."
|
|
},
|
|
"transformEffect": {
|
|
"oneOf": [
|
|
{"type": "object", "additionalProperties": false, "required": ["type", "ops"], "description": "On a form body (req.form true), only replace operations that set an existing text field to a string.", "properties": {"type": {"const": "json.patch"}, "ops": {"type": "array", "items": {"type": "object", "required": ["op", "path"], "properties": {"op": {"enum": ["add", "remove", "replace", "move", "copy", "test"]}, "path": {"type": "string"}, "from": {"type": "string"}, "value": true}}}}},
|
|
{"type": "object", "additionalProperties": false, "required": ["type"], "properties": {"type": {"const": "header.patch"}, "set": {"type": "object", "additionalProperties": {"type": "string"}}, "remove": {"type": "array", "items": {"type": "string"}}}},
|
|
{"type": "object", "additionalProperties": false, "required": ["type", "effort"], "properties": {"type": {"const": "reasoning.set"}, "effort": {"enum": ["none", "minimal", "low", "medium", "high", "xhigh", "max"]}, "override": {"type": "boolean"}}},
|
|
{"type": "object", "additionalProperties": false, "required": ["type", "media", "format"], "properties": {"type": {"const": "media.reencode"}, "media": {"type": "integer", "minimum": 0}, "format": {"enum": ["auto", "jpeg", "png", "webp"]}, "quality": {"type": "integer", "minimum": 1, "maximum": 100}, "maxSide": {"type": "integer", "minimum": 16, "maximum": 16384}},
|
|
"if": {"properties": {"format": {"const": "webp"}}}, "then": {"not": {"required": ["quality"]}}},
|
|
{"type": "object", "additionalProperties": false, "required": ["type", "media", "text"], "description": "Replaces the text of a rewritable text file; on any other file of the call, or a text file read in part, it changes nothing.", "properties": {"type": {"const": "media.text"}, "media": {"type": "integer", "minimum": 0}, "text": {"type": "string"}}}
|
|
],
|
|
"description": "ingress: json.patch, keeping model and stream, and media.text. request: reasoning.set. outbound: json.patch (keeping the billing members), header.patch, media.reencode (webp is lossless WebP) and media.text. egress: none."
|
|
}
|
|
}
|
|
}
|