docs: clarify provider hook compatibility

This commit is contained in:
Peter Steinberger
2026-04-29 05:01:51 +01:00
parent e5dc0e6d15
commit 34ef403cb2
4 changed files with 67 additions and 65 deletions

View File

@@ -420,6 +420,9 @@ API key auth, and dynamic model resolution.
<Accordion title="All available provider hooks">
OpenClaw calls hooks in this order. Most providers only use 2-3:
Compatibility-only provider fields that OpenClaw no longer calls, such as
`ProviderPlugin.capabilities` and `suppressBuiltInModel`, are not listed
here.
| # | Hook | When to use |
| --- | --- | --- |
@@ -436,37 +439,35 @@ API key auth, and dynamic model resolution.
| 11 | `prepareDynamicModel` | Async metadata fetch before resolving |
| 12 | `normalizeResolvedModel` | Transport rewrites before the runner |
| 13 | `contributeResolvedModelCompat` | Compat flags for vendor models behind another compatible transport |
| 14 | `capabilities` | Legacy static capability bag; compatibility only |
| 15 | `normalizeToolSchemas` | Provider-owned tool-schema cleanup before registration |
| 16 | `inspectToolSchemas` | Provider-owned tool-schema diagnostics |
| 17 | `resolveReasoningOutputMode` | Tagged vs native reasoning-output contract |
| 18 | `prepareExtraParams` | Default request params |
| 19 | `createStreamFn` | Fully custom StreamFn transport |
| 20 | `wrapStreamFn` | Custom headers/body wrappers on the normal stream path |
| 21 | `resolveTransportTurnState` | Native per-turn headers/metadata |
| 22 | `resolveWebSocketSessionPolicy` | Native WS session headers/cool-down |
| 23 | `formatApiKey` | Custom runtime token shape |
| 24 | `refreshOAuth` | Custom OAuth refresh |
| 25 | `buildAuthDoctorHint` | Auth repair guidance |
| 26 | `matchesContextOverflowError` | Provider-owned overflow detection |
| 27 | `classifyFailoverReason` | Provider-owned rate-limit/overload classification |
| 28 | `isCacheTtlEligible` | Prompt cache TTL gating |
| 29 | `buildMissingAuthMessage` | Custom missing-auth hint |
| 30 | `suppressBuiltInModel` | Deprecated. Runtime hook is no longer called; use manifest `modelCatalog.suppressions` |
| 31 | `augmentModelCatalog` | Synthetic forward-compat rows |
| 32 | `resolveThinkingProfile` | Model-specific `/think` option set |
| 33 | `isBinaryThinking` | Binary thinking on/off compatibility |
| 34 | `supportsXHighThinking` | `xhigh` reasoning support compatibility |
| 35 | `resolveDefaultThinkingLevel` | Default `/think` policy compatibility |
| 36 | `isModernModelRef` | Live/smoke model matching |
| 37 | `prepareRuntimeAuth` | Token exchange before inference |
| 38 | `resolveUsageAuth` | Custom usage credential parsing |
| 39 | `fetchUsageSnapshot` | Custom usage endpoint |
| 40 | `createEmbeddingProvider` | Provider-owned embedding adapter for memory/search |
| 41 | `buildReplayPolicy` | Custom transcript replay/compaction policy |
| 42 | `sanitizeReplayHistory` | Provider-specific replay rewrites after generic cleanup |
| 43 | `validateReplayTurns` | Strict replay-turn validation before the embedded runner |
| 44 | `onModelSelected` | Post-selection callback (e.g. telemetry) |
| 14 | `normalizeToolSchemas` | Provider-owned tool-schema cleanup before registration |
| 15 | `inspectToolSchemas` | Provider-owned tool-schema diagnostics |
| 16 | `resolveReasoningOutputMode` | Tagged vs native reasoning-output contract |
| 17 | `prepareExtraParams` | Default request params |
| 18 | `createStreamFn` | Fully custom StreamFn transport |
| 19 | `wrapStreamFn` | Custom headers/body wrappers on the normal stream path |
| 20 | `resolveTransportTurnState` | Native per-turn headers/metadata |
| 21 | `resolveWebSocketSessionPolicy` | Native WS session headers/cool-down |
| 22 | `formatApiKey` | Custom runtime token shape |
| 23 | `refreshOAuth` | Custom OAuth refresh |
| 24 | `buildAuthDoctorHint` | Auth repair guidance |
| 25 | `matchesContextOverflowError` | Provider-owned overflow detection |
| 26 | `classifyFailoverReason` | Provider-owned rate-limit/overload classification |
| 27 | `isCacheTtlEligible` | Prompt cache TTL gating |
| 28 | `buildMissingAuthMessage` | Custom missing-auth hint |
| 29 | `augmentModelCatalog` | Synthetic forward-compat rows |
| 30 | `resolveThinkingProfile` | Model-specific `/think` option set |
| 31 | `isBinaryThinking` | Binary thinking on/off compatibility |
| 32 | `supportsXHighThinking` | `xhigh` reasoning support compatibility |
| 33 | `resolveDefaultThinkingLevel` | Default `/think` policy compatibility |
| 34 | `isModernModelRef` | Live/smoke model matching |
| 35 | `prepareRuntimeAuth` | Token exchange before inference |
| 36 | `resolveUsageAuth` | Custom usage credential parsing |
| 37 | `fetchUsageSnapshot` | Custom usage endpoint |
| 38 | `createEmbeddingProvider` | Provider-owned embedding adapter for memory/search |
| 39 | `buildReplayPolicy` | Custom transcript replay/compaction policy |
| 40 | `sanitizeReplayHistory` | Provider-specific replay rewrites after generic cleanup |
| 41 | `validateReplayTurns` | Strict replay-turn validation before the embedded runner |
| 42 | `onModelSelected` | Post-selection callback (e.g. telemetry) |
Runtime fallback notes: