opencommit icon indicating copy to clipboard operation
opencommit copied to clipboard

[Bug]: `temperature` and `top_p` cannot both be specified for Claude Haiku 4.5 and Sonnet 4.5

Open muni-corn opened this issue 1 month ago • 0 comments
trafficstars

Opencommit Version

3.2.10

Node Version

22.18.0

NPM Version

10.9.3

What OS are you seeing the problem on?

Other Linux Distro

What happened?

(Linux distro: NixOS)

i set my OCO_MODEL to claude-haiku-4-5 with the anthropic provider, and i get the following message when i run oco:

┌  opencommit
│
â—“  Generating commit message   
│
└  ✖ 400 {"type":"error","error":{"type":"invalid_request_error","message":"`temperature` and `top_p` cannot both be specified for this model. Please use only one."},"request_id":"req_011CUK6BqmnBWwnEtihUBmak"}

│
└  ✖ Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"`temperature` and `top_p` cannot both be specified for this model. Please use only one."},"request_id":"req_011CUK6BqmnBWwnEtihUBmak"}

Expected Behavior

opencommit should only set one of temperature or top_p for Claude models that don't support both, and it should successfully generate a commit message

Current Behavior

opencommit cannot generate commit messages with Haiku 4.5 because Anthropic doesn't allow both temperature and top_p parameters to be set

Possible Solution

remove either temperature or top_p from the parameters object when sending requests to Anthropic, optionally only for Haiku 4.5 (and other models with this issue, if applicable)

Steps to Reproduce

  1. set OCO_MODEL=claude-haiku-4-5
  2. and OCO_AI_PROVIDER=anthropic
  3. run oco or git commit after oco hook set

Relevant log output

┌  opencommit
│
â—“  Generating commit message   
│
└  ✖ 400 {"type":"error","error":{"type":"invalid_request_error","message":"`temperature` and `top_p` cannot both be specified for this model. Please use only one."},"request_id":"req_011CUK6BqmnBWwnEtihUBmak"}

│
└  ✖ Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"`temperature` and `top_p` cannot both be specified for this model. Please use only one."},"request_id":"req_011CUK6BqmnBWwnEtihUBmak"}

muni-corn avatar Oct 20 '25 20:10 muni-corn