Skip to content

fix: support max_completion_tokens for reasoning models - #24

Open
tink-bot wants to merge 2 commits into
appleboy:mainfrom
tink-bot:feat-max-completion-tokens
Open

fix: support max_completion_tokens for reasoning models#24
tink-bot wants to merge 2 commits into
appleboy:mainfrom
tink-bot:feat-max-completion-tokens

Conversation

@tink-bot

@tink-bot tink-bot commented Aug 3, 2026

Copy link
Copy Markdown

Reasoning models (o1/o3/o4/gpt-5 series) unusable with this action — go-openai's ReasoningValidator rejects requests client-side: max_tokens set = this model is not supported MaxTokens, please use MaxCompletionTokens; temperature other than 1 fails too. Action always sends both (defaults 1000 / 0.7), so every reasoning-model run errors before any HTTP request.

Fixes #23

Changes:

  • New max_completion_tokens input, takes precedence over max_tokens.
  • Auto-remap: reasoning model + only max_tokens set = budget sent as max_completion_tokens, existing configs keep working without changes.
  • Temperature omitted for reasoning models (fixed at 1 by the API); note printed when a different value was configured. Non-reasoning models unchanged.
  • Tests for config parsing and request building, README + action.yml docs updated.

How to verify

  1. Run the action with model: gpt-5.6-luna (or any o1/o3/o4/gpt-5 model), max_tokens: '4000', and temperature: '0.2' against the OpenAI API.
  2. Expected: The request succeeds, the log contains a note that the temperature value is omitted, and the response is generated with a completion budget of 4000 tokens.
  3. Run the action with a non-reasoning model such as gpt-4o and the same inputs.
  4. Expected: The request behaves exactly as before this change, with max_tokens and temperature sent as configured.

Before this PR: step 1 failed with chat completion error: this model is not supported MaxTokens, please use MaxCompletionTokens.

Reasoning models (o1/o3/o4/gpt-5 series) reject max_tokens and
non-default temperature; go-openai's ReasoningValidator fails such
requests client-side before anything is sent.

- Add a max_completion_tokens input that takes precedence over
  max_tokens.
- When the model is a reasoning model and max_completion_tokens is not
  set, send the max_tokens budget as max_completion_tokens so existing
  configs keep working.
- Omit temperature for reasoning models (fixed at 1) and print a note
  when a different value was configured.
@kolaente

kolaente commented Aug 3, 2026

Copy link
Copy Markdown

This PR is entirely AI generated and reviewed by me, feel free to discard it completely

kolaente added a commit to go-vikunja/vikunja that referenced this pull request Aug 3, 2026
Upstream rejects max_tokens/temperature for gpt-5 series models,
breaking auto-label with gpt-5.6-luna. Pin to the fork carrying
appleboy/LLM-action#24 until it is merged and released.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error using this action with gpt 5.6 luna

2 participants