new-api icon indicating copy to clipboard operation
new-api copied to clipboard

fix(relay): sanitize Opus 4.7 incompatible params + bump VERSION to v0.12.14

Open forgottener opened this issue 7 months ago • 2 comments

Summary

Claude Opus 4.7 rejects non-default temperature, top_p, top_k with HTTP 400 "Improperly formed request". When the bare model name claude-opus-4-7 (no effort/thinking suffix) is used, these parameters are forwarded as-is to the Anthropic API, causing the request to fail.

Additionally, ReasoningEffort / Reasoning parameters set thinking.type="enabled" which Opus 4.7 also rejects.

Changes

Phase 1: Fix Opus 4.7 parameter sanitization

  • relay/channel/claude/relay-claude.go (OpenAI-compat path): clear temperature/topP/topK for claude-opus-4-7 prefix; convert thinking.type="enabled" → "adaptive" for Opus 4.7
  • relay/claude_handler.go (native Claude API path): clear temperature/topP/topK for claude-opus-4-7 prefix

Phase 2: Bump VERSION

  • VERSION: v0.12.12 → v0.12.14

Test plan

  • [ ] Send request to claude-opus-4-7 with temperature set — should succeed (param stripped)
  • [ ] Send request to claude-opus-4-7-high — should still work as before
  • [ ] Send request to claude-opus-4-7 with reasoning_effort — thinking type should be adaptive, not enabled

forgottener avatar Apr 18 '26 15:04 forgottener

hope to merge it

chaotmk avatar May 20 '26 06:05 chaotmk

[Bot Review]

This issue has been automatically marked as stale due to inactivity. If this is still relevant, please reply within 7 days — otherwise it will be closed automatically.