Skip to content

Bug (macOS/DMG): GPT-5.x models fail with HTTP 400 — tinyagents sends max_tokens but these models require max_completion_tokens #5498

Description

@Al629176

Summary

On a fresh macOS DMG install (unmodified), using GPT-5.4-mini or GPT-5.6-Luna as the main model causes every chat turn to fail immediately. The request reaches OpenAI successfully but is rejected with HTTP 400 because tinyagents sends max_tokens — a parameter these GPT-5.x models do not accept. The correct parameter is max_completion_tokens.

Problem

Exact error from OpenHuman logs:

tinyagents harness run failed: model error: model error: openai returned HTTP 400
(unsupported_parameter): Unsupported parameter: 'max_tokens' is not supported with
this model. Use 'max_completion_tokens' instead.

OpenAI's GPT-5.x model family (gpt-5.4-mini, gpt-5.6-luna, and likely the full family) dropped support for the max_tokens request field and require max_completion_tokens in its place. tinyagents is sending max_tokens unconditionally, so every turn with one of these models hard-fails before the model produces any output.

This is a parameter name mismatch in the tinyagents request builder — auth and connectivity are fine, the request reaches OpenAI, and OpenAI rejects it at the protocol level.

Reproduction

  1. Fresh macOS DMG install (no source modifications).
  2. Set main model to gpt-5.4-mini or gpt-5.6-luna with a valid OpenAI key.
  3. Send any chat message.
  4. Result: immediate failure, no response, HTTP 400 in logs.

Confirmed on:

  • gpt-5.4-mini
  • gpt-5.6-luna

Root cause

tinyagents constructs the OpenAI chat completion request with max_tokens. For GPT-5.x models this field must be max_completion_tokens. The fix needs to be applied at the request-building layer — either by detecting the model family and switching the field name, or by migrating to max_completion_tokens across the board (OpenAI accepts it for older models too).

Solution

  • Replace max_tokens with max_completion_tokens in the tinyagents OpenAI request builder.
  • Audit other OpenAI-compatible parameters that may have similar deprecation gaps in the GPT-5.x family.
  • Regression-test with at least gpt-5.4-mini and gpt-5.6-luna to confirm chat turns complete successfully.

Acceptance criteria

  • Sending a chat message with gpt-5.4-mini or gpt-5.6-luna returns a response — no HTTP 400 unsupported_parameter errors in logs.
  • No regression for older models (gpt-4o, gpt-4-turbo, etc.) that currently work.
  • Fix applied at the request-builder layer, not patched per individual model slug.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

priority: p2Soon. Real but survivable — a rough edge, a gap, a thing that will bite later.

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions