diff --git a/llm_connect/openrouter.py b/llm_connect/openrouter.py index 46d9aef..9a7c283 100644 --- a/llm_connect/openrouter.py +++ b/llm_connect/openrouter.py @@ -181,12 +181,20 @@ def _merge_model_params(payload: Dict[str, Any], model_params: Dict[str, Any]) - except (ValueError, TypeError): schema = None if isinstance(schema, dict): + # strict=False: OpenAI's strict mode requires additionalProperties + # to be false on every object and every property in the required + # list. Most application-supplied schemas are not written that + # way (the activity-core daily-triage schema, for example, has + # neither). With strict=False, OpenRouter still honours the + # schema as a soft constraint and the model's output remains + # structured. Callers can opt back into strict by including + # `strict: true` themselves in a custom `response_format`. payload["response_format"] = { "type": "json_schema", "json_schema": { "name": "structured_output", "schema": schema, - "strict": True, + "strict": False, }, }