[Bug] OpenAI 400 BadRequestError when using newer models (e.g., gpt-6-luna): 'max_tokens' is not supported, use 'max_completion_tokens'
Deploy mode
Self-hosted
Honcho version
v3.2.0
Describe the bug
Issue Description:
When configuring Honcho (specifically HONCHO_REASONING_MODEL or dialectic/deriver queries) with newer OpenAI models such as gpt-6-luna, API requests fail with a 400 BadRequestError.
OpenAI's latest model generations have deprecated/removed the legacy max_tokens parameter in favor of max_completion_tokens. Because Honcho passes max_tokens to the OpenAI client invocation, all requests to
these models are rejected.
──────
Error Log:
zepp-honcho-api | openai.BadRequestError: Error code: 400 - {
zepp-honcho-api | 'error': {
zepp-honcho-api | 'message': "Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.",
zepp-honcho-api | 'type': 'invalid_request_error',
zepp-honcho-api | 'param': 'max_tokens',
zepp-honcho-api | 'code': 'unsupported_parameter'
zepp-honcho-api | }
zepp-honcho-api | }Downstream clients (such as agents making dialectic queries) consequently fail with:
WARNING plugins.memory.honcho.session: Honcho dialectic query failed: An unexpected error occurred
──────
Steps to Reproduce:
Deploy Honcho API and Deriver services.
Configure environment variables to use gpt-6-luna: HONCHO_REASONING_MODEL=gpt-6-luna
Trigger a session or memory derivation that calls OpenAI.
Check honcho-api / honcho-deriver container logs. ──────
Expected Behavior:
Honcho should successfully complete chat completion requests with newer models by utilizing max_completion_tokens instead of max_tokens, or by dynamically selecting the parameter depending on model
capability.
──────
Actual Behavior:
The OpenAI client raises openai.BadRequestError: 400 due to param: 'max_tokens'. ──────
Suggested Fix:
In the OpenAI API call wrapper (or LiteLLM / provider configuration within Honcho):
- Migrate from max_tokens to max_completion_tokens when sending chat completion requests to OpenAI, or
- Conditionally map max_tokens -> max_completion_tokens for newer model families (e.g. gpt-6*, o1*, o3*, etc.), or
- Update the underlying SDK / LiteLLM dependency if parameter translation is handled upstream. ──────
Workaround (temporary):
Reverting the model back to gpt-5.6-luna:
HONCHO_REASONING_MODEL=gpt-5.6-lunaSteps to reproduce
Deploy Honcho
v3.2.1(ghcr.io/plastic-labs/honcho:latest) via Docker Compose.In your environment configuration, set the reasoning model to
gpt-6-luna:HONCHO_REASONING_MODEL=gpt-6-lunaSend a message to Honcho or initiate a dialectic/deriver session that triggers an LLM completion call with OpenAI.
Observe the honcho-api / honcho-deriver container logs.
Logs and evidence
Additional context
No response
Source: plastic-labs/honcho