Leaving strict off makes the schema a suggestion: 5 of 12 dirty arguments get through
Scope: the validation experiment ran on Python 3.12.11 with jsonschema 4.26.0. The 12 payloads were constructed from common model output shapes (4 classes × 3), not sampled from a model, so what is measured is how strong each schema version is as a validator. Token counts use tiktoken 0.14.0 with o200k_base. Official behavior checked 2026-11-30.
Plenty of teams believe that writing tool parameters as a JSON Schema makes them safe. Whether the schema actually holds comes down to two independent things: whether strict mode is on for the model call, and which schema version your application validates against. Both can look done while doing nothing.
The model hands you a string, not arguments
In a function call, the response carries a tool_calls array. Each entry has an id, a name, and arguments — which the docs describe as JSON-encoded arguments: a string, not an object. Your code has to json.loads it, then use the id to write the result back as a role: "tool" message.
Three consequences follow. A response may contain zero, one, or several calls, and the docs advise assuming several. Nothing can be validated before arguments is parsed. And parallel_tool_calls: false only guarantees "exactly zero or one", not that arguments is an object.
So between "the model decides what to call and what to pass" and "your system executes it" sits your own parsing and validation. That layer is application code; a well-behaved model does not replace it.
strict has a different default on each endpoint
This is the part people skip. The function-calling guide is explicit:
- Chat Completions: without
strict, the request stays non-strict — best effort, where the schema is a suggestion the model tries to follow. - Responses: without
strict, the API attempts to normalize your schema into strict mode; if it cannot (a required constraint is missing, say), it falls back to non-strict, and the fallback is silent — the only trace isstrict: falseon the tool item in the response.
One tool definition, two endpoints, two different levels of enforcement. And the fallback raises no error; it leaves a field in the response body. Skip reading that field and you will assume you got hard constraints.
The converse is friendlier: send strict: true with a schema that violates the rules and the request is rejected with details about the missing constraint, rather than silently downgraded.
Three hard requirements
Strict mode turns a schema into an enforceable grammar through three constraints:
| Requirement | How it looks | What happens without it |
|---|---|---|
| Disallow extra properties on every object | additionalProperties: false | The model can add keys you never defined; JSON Schema allows them by default |
Put every field in properties into required | required: [a, b, c], nothing left out | When a field is missing you cannot tell "not filled" from "filled wrong" |
Express optionality through a null union | type: ["string", "null"], with null also added to enum | You get two choices only: all-required, or no strict mode |
The third is the one most often missed. Changing units from string to ["string", "null"] is not enough — if the field also carries an enum, null has to appear among the enum values too, otherwise "null allowed" and "value must be in the enum" contradict each other.
Measured: 12 dirty payloads, 5 versus 1
Take a get_weather-style tool with two schema variants:
- S1 (hand-written, loose):
locationrequired;unitsisstringplus an enum, but there is noadditionalProperties, andunitsis not inrequired. - S2 (strict-compliant): every field in
required,additionalProperties: false, andunitschanged to["string", "null"]withnullin the enum.
Then throw 4 classes of dirty arguments, 3 each, 12 in total, at both validators:
| Dirty payload class | Payloads | S1 passes | S2 passes |
|---|---|---|---|
Extra or misspelled keys (unit, lang, __debug) | 3 | 3 | 0 |
Missing keys (no units, or no location at all) | 3 | 2 | 0 |
null (units: null, location: null) | 3 | 0 | 1 |
Type or enum violations ("C", 123, "CELSIUS") | 3 | 0 | 0 |
| Total | 12 | 5 (41.7%) | 1 (8.3%) |
Two things are worth pausing on.
One: the loose version intercepts nothing among extra keys. In JSON Schema additionalProperties allows extras by default, so {"unit":"celsius"} — units misspelled — is perfectly valid to S1 and flows into your business function as a KeyError or a silent default. The same holds for 2 of the 3 missing-key payloads, simply because units was never in required.
Two: the single payload the strict version passes is the correct one. {"location":"Paris","units":null} is exactly how "the user did not specify units" should be expressed. S2 lets through input that is legal and blocks input that is wrong. That is not a coincidence: modelling optionality explicitly as "may be null" is what gives a validator the ability to tell "not filled" from "filled wrong".
One caveat in plain terms: this table measures validator strength, not model output distribution. The real value of strict mode is on the model side, compressing output into the schema so those 11 payloads never appear. But whenever strict is not in force — omitted, silently downgraded, or the fine-tuned case below — those 5 out of 12 are yours to absorb.
The cost: all-required makes arguments fatter
The price of strict mode is also measurable. Compare a tool with 6 parameters, 5 of them optional:
| Item | Loose | strict-compliant | Delta |
|---|---|---|---|
| Tool definition tokens (sent every request) | 114 | 143 | +29 (+25.4%) |
| Arguments tokens per call (all 3 optionals set to null) | 24 | 43 | +19 |
Those 29 definition tokens ride on every message prefix and mostly come back if you use prompt caching (the first request with a new schema also pays a one-time processing pass, then it is cached). What scales with call volume is the 19 tokens: every optional field now has to say null explicitly. Under 20 extra tokens per call is cheap next to debugging dirty data — but a loop that fires dozens of tool calls per run should account for it in per-task cost.
Three things to harden
- Schema side:
additionalProperties: falseeverywhere, nested objects included; every field inrequired; optionality via anullunion, and putnullin the enum when there is one. Setstrict: truerather than relying on the default. - Application side: do not trust "the schema passed". The structured outputs docs put it plainly — the schema constrains complete, non-refusal output, but the application still has to handle refusals, incomplete responses and API errors, and validate business rules the schema cannot express.
units: nullpassing validation does not mean that unit is valid in your billing model. - Call side: read the
strictfield in the response and confirm there was no silent fallback; turnparallel_tool_callsoff when side effects must run serially. One more easy-to-miss entry point — when a fine-tuned model returns multiple function calls in a single turn, strict mode is disabled for those calls. Enforcement drops silently while the schema looks unchanged.
A dozen lines of validation and one additionalProperties: false replace the worst class of production bug: every argument appears to be there, and the values are simply wrong.