mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 13:36:48 +00:00
28ffc814c0
Newer OpenAI models (gpt-5.x) reject max_tokens with a 400 and demand max_completion_tokens, so AI booking import failed and no reservations were created. Send max_tokens first (understood by the classic chat API and every local server), and only on a 400 naming max_completion_tokens resend the whole request with that parameter instead — mirroring the existing json_schema->json_object fallback beside it. Detection is by API response, not a model-name allowlist. Fixes #1760