diff --git a/.openclaw-sync/source.json b/.openclaw-sync/source.json index 938bdc24a..a27209007 100644 --- a/.openclaw-sync/source.json +++ b/.openclaw-sync/source.json @@ -1,5 +1,5 @@ { "repository": "openclaw/openclaw", - "sha": "b4b21cbc93369a13b8e146d296473106cc037530", - "syncedAt": "2026-04-27T08:59:22.498Z" + "sha": "b74f35ee6f9728b88a33dd4c837f2f51d11920ec", + "syncedAt": "2026-04-27T09:07:30.551Z" } diff --git a/docs/plugins/manifest.md b/docs/plugins/manifest.md index 6db29b575..a560cd171 100644 --- a/docs/plugins/manifest.md +++ b/docs/plugins/manifest.md @@ -78,12 +78,26 @@ or npm install metadata. Those belong in your plugin code and `package.json`. "modelSupport": { "modelPrefixes": ["router-"] }, + "modelIdNormalization": { + "providers": { + "openrouter": { + "prefixWhenBare": "openrouter" + } + } + }, "providerEndpoints": [ { - "endpointClass": "xai-native", - "hosts": ["api.x.ai"] + "endpointClass": "openrouter", + "hostSuffixes": ["openrouter.ai"] } ], + "providerRequest": { + "providers": { + "openrouter": { + "family": "openrouter" + } + } + }, "cliBackends": ["openrouter-cli"], "syntheticAuthRefs": ["openrouter-cli"], "providerAuthEnvVars": { @@ -145,7 +159,9 @@ or npm install metadata. Those belong in your plugin code and `package.json`. | `modelSupport` | No | `object` | Manifest-owned shorthand model-family metadata used to auto-load the plugin before runtime. | | `modelCatalog` | No | `object` | Declarative model catalog metadata for providers owned by this plugin. This is the control-plane contract for future read-only listing, onboarding, model pickers, aliases, and suppression without loading plugin runtime. | | `modelPricing` | No | `object` | Provider-owned external pricing lookup policy. Use it to opt local/self-hosted providers out of remote pricing catalogs or map provider refs to OpenRouter/LiteLLM catalog ids without hardcoding provider ids in core. | +| `modelIdNormalization` | No | `object` | Provider-owned model-id alias/prefix cleanup that must run before provider runtime loads. | | `providerEndpoints` | No | `object[]` | Manifest-owned endpoint host/baseUrl metadata for provider routes that core must classify before provider runtime loads. | +| `providerRequest` | No | `object` | Cheap provider-family and request-compatibility metadata used by generic request policy before provider runtime loads. | | `cliBackends` | No | `string[]` | CLI inference backend ids owned by this plugin. Used for startup auto-activation from explicit config refs. | | `syntheticAuthRefs` | No | `string[]` | Provider or CLI backend refs whose plugin-owned synthetic auth hook should be probed during cold model discovery before runtime loads. | | `nonSecretAuthMarkers` | No | `string[]` | Bundled-plugin-owned placeholder API key values that represent non-secret local, OAuth, or ambient credential state. | @@ -749,6 +765,87 @@ Do not put runtime-only data in `modelCatalog`. If a provider needs account state, an API request, or local process discovery to know the complete model set, declare that provider as `refreshable` or `runtime` in `discovery`. +## modelIdNormalization reference + +Use `modelIdNormalization` for cheap provider-owned model-id cleanup that must +happen before provider runtime loads. This keeps aliases such as short model +names, provider-local legacy ids, and proxy prefix rules in the owning plugin +manifest instead of in core model-selection tables. + +```json +{ + "providers": ["anthropic", "openrouter"], + "modelIdNormalization": { + "providers": { + "anthropic": { + "aliases": { + "sonnet-4.6": "claude-sonnet-4-6" + } + }, + "openrouter": { + "prefixWhenBare": "openrouter" + } + } + } +} +``` + +Provider fields: + +| Field | Type | What it means | +| ------------------------------------ | ----------------------- | ----------------------------------------------------------------------------------------- | +| `aliases` | `Record` | Case-insensitive exact model-id aliases. Values are returned as written. | +| `stripPrefixes` | `string[]` | Prefixes to remove before alias lookup, useful for legacy provider/model duplication. | +| `prefixWhenBare` | `string` | Prefix to add when the normalized model id does not already contain `/`. | +| `prefixWhenBareAfterAliasStartsWith` | `object[]` | Conditional bare-id prefix rules after alias lookup, keyed by `modelPrefix` and `prefix`. | + +## providerEndpoints reference + +Use `providerEndpoints` for endpoint classification that generic request policy +must know before provider runtime loads. Core still owns the meaning of each +`endpointClass`; plugin manifests own the host and base URL metadata. + +Endpoint fields: + +| Field | Type | What it means | +| ------------------------------ | ---------- | ---------------------------------------------------------------------------------------------- | +| `endpointClass` | `string` | Known core endpoint class, such as `openrouter`, `moonshot-native`, or `google-vertex`. | +| `hosts` | `string[]` | Exact hostnames that map to the endpoint class. | +| `hostSuffixes` | `string[]` | Host suffixes that map to the endpoint class. Prefix with `.` for domain suffix-only matching. | +| `baseUrls` | `string[]` | Exact normalized HTTP(S) base URLs that map to the endpoint class. | +| `googleVertexRegion` | `string` | Static Google Vertex region for exact global hosts. | +| `googleVertexRegionHostSuffix` | `string` | Suffix to strip from matching hosts to expose the Google Vertex region prefix. | + +## providerRequest reference + +Use `providerRequest` for cheap request-compatibility metadata that generic +request policy needs without loading provider runtime. Keep behavior-specific +payload rewriting in provider runtime hooks or shared provider-family helpers. + +```json +{ + "providers": ["vllm"], + "providerRequest": { + "providers": { + "vllm": { + "family": "vllm", + "openAICompletions": { + "supportsStreamingUsage": true + } + } + } + } +} +``` + +Provider fields: + +| Field | Type | What it means | +| --------------------- | ------------ | -------------------------------------------------------------------------------------- | +| `family` | `string` | Provider family label used by generic request compatibility decisions and diagnostics. | +| `compatibilityFamily` | `"moonshot"` | Optional provider-family compatibility bucket for shared request helpers. | +| `openAICompletions` | `object` | OpenAI-compatible completions request flags, currently `supportsStreamingUsage`. | + ## modelPricing reference Use `modelPricing` when a provider needs control-plane pricing behavior before