Most glue code around a free AI endpoint fails for a very boring reason: the request returned a 200, but the body was not what the downstream code expected. A quota hit can truncate JSON. A proxy restart can return an HTML error page with the same status. A model can send valid JSON that is missing the one field your code reads.

If you are using MonkeyCode's free model access, this is still true. Treat a free endpoint as a third-party API, not as a trusted library call.

Disclosure: This article was prepared as part of MonkeyCode's product outreach.

The fix is not a better model or a longer retry loop. It is a contract probe: a small deterministic request that checks the response shape, size, and error behavior at the boundary before the rest of the system touches it.

Why try/except is not enough