NextChat sends both temperature and top_p to Anthropic — Claude 4.x rejects with 400
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- nextjs, typescript
Research direction
Start in app/api/anthropic/route.ts, or locate the Anthropic request builder, and inspect how temperature and top_p are added to the outgoing payload. Reproduce the failure with a Claude 4.x model, then verify the request no longer sends both parameters and succeeds against Anthropic; the issue does not name an existing repository test.
Written by the indexing model from the issue text.
Description
Summary
NextChat's Anthropic adapter sends both temperature and top_p on every request. Claude 4.x (Sonnet 4.5, Haiku 4.5, Opus 4) explicitly rejects this combination:
{"type":"error","error":{"type":"invalid_request_error","message":"temperature and top_p cannot both be specified"}}
Claude 3.x silently accepts both, which is why this hasn't surfaced as a bug before — but the moment a user picks a 4.x model, every message errors out.
Reproduction
- Run NextChat with
ENABLE_MCP=true(or without, doesn't matter — the bug is in the base Anthropic adapter). - Pick
claude-sonnet-4-5(or any Claude 4 model). - Send any message.
- Response: 400 Bad Request from Anthropic with the message above.
Confirmed via Playwright-driven smoke test on yidadaa/chatgpt-next-web:latest (NextChat v2.16.1) against https://api.anthropic.com/v1/messages 2026-05-20.
Fix
Per Anthropic's docs:
You should either alter
temperatureortop_p, but not both.
For the Anthropic adapter specifically, the safest fix is:
- Default to sending only
temperature(the more commonly-used param) - Omit
top_pentirely from outgoing Anthropic requests unless the user has explicitly customized it AND set temperature to the model default
Or even simpler: detect the model family at request-build time and drop one of the two params when targeting claude-*-4-*.
Workarounds users hit today
- Use Claude 3.x (works, accepts both)
- Use a non-Anthropic provider (OpenAI / Gemini / etc.)
- Edit
app/api/anthropic/route.ts(or wherever the payload is built) and droptop_pbefore the fetch
Filing because this blocks any third-party integration that pairs NextChat with Claude 4.x — we hit it via our durable-memory recipe (engram-nextchat) and worked around it with a Playwright interceptor to strip top_p.
Version
NextChat v2.16.1 (yidadaa/chatgpt-next-web:latest as of 2026-05-20)
— Lumetra
- Dominant language
- TypeScript
- Stars
- 88.8k
- Forks
- 59k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ChatGPTNextWeb/NextChat
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ChatGPTNextWeb/NextChat#6883 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ChatGPTNextWeb/NextChat#6864 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ChatGPTNextWeb/NextChat#6773 ·
-
bug
Difficulty 5/5 Over a week Newbie friendliness 18/100
ChatGPTNextWeb/NextChat#6885 · 1 comment · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
ChatGPTNextWeb/NextChat#6881 ·
All issues in ChatGPTNextWeb/NextChat
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100