Skip to content

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

@muni-corn

Description

@muni-corn

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"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions