← Back to PRs

#6683: feat(config): add supportsStrictMode compat option for model definitions

by long-pham open 2026-02-01 23:13 View on GitHub →
## Summary Some OpenAI-compatible endpoints reject requests that include the `strict: true` parameter in tool/function definitions. This parameter was added by OpenAI for structured outputs but isn't universally supported. This PR adds a `supportsStrictMode` option to the `compat` field in model definitions, allowing providers to be configured to omit the strict parameter when making API calls. **Changes:** - Added `supportsStrictMode?: boolean` to `ModelCompatSchema` in `zod-schema.core.ts` - Added `supportsStrictMode?: boolean` to `ModelCompatConfig` type in `types.models.ts` - Added unit tests for the new schema option ## Example Config ```json { "models": { "providers": { "routellm": { "baseUrl": "https://routellm.abacus.ai/v1", "api": "openai-completions", "models": [{ "id": "route-llm", "name": "RouteLLM", "compat": { "supportsStrictMode": false } }] } } } } ``` ## Note This PR adds the config option on the openclaw side. The `@mariozechner/pi-ai` library will need a corresponding update to read this compat option and conditionally omit the strict parameter from tool definitions when building API requests. ## Test Plan - [x] Added unit tests for `ModelCompatSchema` with `supportsStrictMode` - [x] Existing model-related tests pass - [ ] Integration testing pending pi-ai library support Closes #6674 --- Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> Adds a new optional `compat.supportsStrictMode` flag to the model config surface (both the `ModelCompatConfig` TS type and the `ModelCompatSchema` zod schema) so providers that reject OpenAI’s `strict: true` tool/function metadata can be configured to omit it. Includes unit tests validating `supportsStrictMode` is accepted both on the compat object itself and when nested under a model definition. This fits alongside the existing `compat` toggles (`supportsDeveloperRole`, `supportsReasoningEffort`, etc.) that let OpenClaw adapt request shaping per-provider without forking model definitions. <h3>Confidence Score: 4/5</h3> - This PR is low risk and primarily extends config schemas/types with tests. - Changes are additive (new optional boolean) and localized to config typing/validation. No runtime behavior changes are introduced in this repo, and tests are straightforward; however, I couldn’t execute the test suite in this environment (npm unavailable), so confidence isn’t maxed. - src/config/zod-schema.model-compat.test.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs