-
Couldn't load subscription status.
- Fork 16
support claude 4.* models #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Hello @jfbloom22! Thank you so much for your work on this. The community needs a better go to Anthropic integration that is supported/updated. If this is approved, I'll reach out to Justin to suggest this as a consideration for the update to our Pipe on the Open WebUI community site. One problem I have with your implementation of Opus4.1 (for all the API token rich out there): Claude Opus 4.1 has the same constraint and returns 400: “temperature and top_p cannot both be specified for this model.” Please gate Opus 4.x the same way as Sonnet 4.5 so only one sampler is sent. Suggested change: # Handle temperature/top_p settings
ONE_SAMPLER_PREFIXES = ("claude-sonnet-4-5", "claude-opus-4")
if api_model_name.startswith(ONE_SAMPLER_PREFIXES):
if is_thinking_model:
payload.pop("top_p", None)
payload["temperature"] = 1.0
elif self.valves.CLAUDE_45_USE_TEMPERATURE:
payload.pop("top_p", None)
payload["temperature"] = body.get("temperature", 0.8)
else:
payload.pop("temperature", None)
payload["top_p"] = body.get("top_p", 0.9)
else:
# Other Claude models support both
payload["temperature"] = body.get("temperature", 0.8)
payload["top_p"] = body.get("top_p", 0.9)This will prevent the 400 on Opus 4.1 while keeping existing behavior for 4.5. Thank you! |
- Updated valve naming for temperature settings to be more generic for Claude 4.x models. - Added a new method to determine if a model is a Claude 4.x generation model with temperature/top_p constraints.
|
@christian-taillon Thanks for the feedback. I am trying to make this a bit more future proof and as best I can tell Anthropic intends to only support top_p or temperature for all 4.* models. I added a dedicated pattern match: |
|
fyi this is working really well for me. Haiku 4.5 started working automatically |
|
That is great. For reference, I'm using this integration hosted on my github for some extra features. Feel free to cannibalize anything you'd like. We (the community) definitely could up our game on Anthropic integration. I'd love to see oauth support added for Pro license users (some of my colleges): christian-taillon/open-webui-pipelines/pipe/anthropic.py |
|
@christian-taillon cool! thanks. Are you aware of any other pipes that have oauth working? maybe I can cannibalize 😄 |
|
I am not. However OpenCode supports it and maybe we can learn from how they are handling the Anthropic provider. |
Claude 4.5 (and Claude Opus 4.1) has a strict API constraint that prevents specifying both temperature and top_p parameters simultaneously.
updated your anthropic/main.py pipe with intelligent parameter handling
Smart Detection: The pipe detects if both parameters are provided by checking if they're different from their defaults
Priority Logic: If both are provided, it prioritizes temperature (most common use case)
Fallback: If only top_p is provided, it uses top_p instead