AI Ignores Your Character Limit? Enforce It in Code
An AI model ignores a character limit because it writes in tokens and cannot count characters as it goes, and as of November 2026 none of the three major APIs enforces maxLength while generating: Claude rejects it with a 400 unless an SDK helper moves it into the description, OpenAI strict mode does not support it, and Gemini silently strips it. The limit has to be measured and enforced in your own code, with a retry that states the measured length and a template fallback instead of truncation.
Frequently Asked Questions
SOURCES & CITATIONS
- Structured outputs — Anthropichttps://platform.claude.com/docs/en/build-with-claude/structured-outputs
- Structured model outputs — OpenAIhttps://developers.openai.com/api/docs/guides/structured-outputs
- Structured output — Googlehttps://aistudio.google.com/docs/structured-output
About Alexey Yushkin
Alexey is the founder of GENERAL INFORMATICS LLC. He designs and ships AI and automation systems for businesses and operators across the US.
Related reading
Want this kind of system in your business?
We build practical AI and automation systems for operators. Send us your current workflow and we will show you what to automate first.
