Problem/Motivation

When using model o4-mini the following error message is displayed:

Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.

Steps to reproduce

Go to chat API explore here /admin/config/ai/explorers/chat_generator
Choose o4-mini model
Try to run a request

Proposed resolution

Use the same workaround as for o1 and o3 models

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

a.dmitriiev created an issue. See original summary.

a.dmitriiev’s picture

a.dmitriiev’s picture

Status: Active » Needs review

Added the fix to pass the correct parameter. Be aware that o4-mini supports only one value for temperature parameter and it is 1.

ahmad khader’s picture

Assigned: Unassigned » ahmad khader
ahmad khader’s picture

Assigned: ahmad khader » Unassigned
Status: Needs review » Reviewed & tested by the community

Thanks @a.dmitriiev, Looks good to me.
I updated the comment as well

a.dmitriiev’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.