Skip to content

feat(aihubmix): align with Anthropic official plugin v0.3.24#3422

Merged
crazywoola merged 4 commits into
langgenius:mainfrom
DDU1222:feat/aihubmix-align-anthropic
Jul 10, 2026
Merged

feat(aihubmix): align with Anthropic official plugin v0.3.24#3422
crazywoola merged 4 commits into
langgenius:mainfrom
DDU1222:feat/aihubmix-align-anthropic

Conversation

@DDU1222

@DDU1222 DDU1222 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adaptive Thinking: support thinking.type=adaptive for opus-4-7/4-8, sonnet-5, fable-5 (always-on); auto-remove temperature/top_p for adaptive models
  • output_config: effort (low~max) + task_budget (≥20000 with beta header task-budgets-2026-03-13)
  • Prompt Caching TTL: 5m (default, 1.25x write) / 1h (2.0x write) with per-tier billing in both streaming and non-streaming paths
  • 7 bug fixes: assistant message content loss (elif→collect both), multi-tool stream param cross-contamination (str→dict), redacted_thinking close tag, JSON prefill adaptive guard, count_tokens adaptive branch, streaming TTL cache-split lookup, token fallback zero-value bug
  • 13 new models: claude-opus-4-8(-think), claude-sonnet-5, claude-fable-5, gpt-5.6-sol/luna/terra, grok-4.5, glm-5.2, hy3, doubao-seed-2-1-pro/turbo, grok-build-0.1
  • 7 YAML updates: context_size corrections (opus-4-6/4-7: 200K→1M, haiku-4-5: 204800→200000), document feature, prompt_caching params

Test plan

  • Python syntax check (ast.parse) — passed
  • All 189 YAML files validated against AIModelEntity schema — 0 failures
  • API direct test: adaptive thinking (opus-4-7), always-on (fable-5), disabled (sonnet-5)
  • API direct test: output_config effort + task_budget with beta header
  • API direct test: cache TTL 1h with per-tier cache_creation breakdown
  • API direct test: multi-tool call (2 tools, no param cross-contamination)
  • API direct test: gpt-5.6-sol new model
  • API direct test: opus-4-6 regression (non-adaptive model unchanged)
  • Local Dify community edition: plugin registration, model list, basic conversation
  • Line-by-line diff with Anthropic official plugin v0.3.24 — confirmed aligned

🤖 Generated with Claude Code

Add Adaptive Thinking (type=adaptive), output_config (effort/task_budget),
prompt caching TTL (5m/1h), fix 7 bugs (assistant message loss, multi-tool
stream, redacted_thinking, JSON prefill, count_tokens adaptive, TTL stream
split, token fallback zero), add 13 new models (opus-4-8, sonnet-5, fable-5,
gpt-5.6-sol/luna/terra, grok-4.5, glm-5.2, hy3, doubao-seed-2-1-pro/turbo,
grok-build-0.1), update 7 existing Claude YAMLs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Jul 10, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for several new models (including Claude Fable 5, Claude Opus 4.8, Claude Sonnet 5, GPT 5.6 variants, Grok 4.5, Doubao, GLM, and Hunyuan 3) and updates existing configurations. It also updates the Anthropic integration to support adaptive thinking, task budgets, effort parameters, and custom prompt caching TTLs. Critical feedback includes resolving thread-safety issues with request-specific state stored on a shared singleton, correcting the prompt token adjustment formula to prevent over-billing, properly handling list-based system prompt serialization, and filtering out empty text blocks in assistant messages to avoid API failures.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread models/aihubmix/models/llm/anthropic.py
Comment thread models/aihubmix/models/llm/anthropic.py
Comment thread models/aihubmix/models/llm/anthropic.py
Comment thread models/aihubmix/models/llm/anthropic.py
DDU1222 and others added 3 commits July 10, 2026 17:40
Prevent sending empty text content blocks to Anthropic API which would
cause 400 errors during tool-use flows with empty assistant content.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 10, 2026
@crazywoola crazywoola deployed to models/aihubmix July 10, 2026 10:01 — with GitHub Actions Active
@crazywoola crazywoola merged commit 6d0c844 into langgenius:main Jul 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants