🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(model-bank): lobehub provider add Claude Sonnet 4.6 support (#12373)
YuTengjingf91acfca95a1
diff --git a/packages/model-bank/src/aiModels/lobehub/chat/anthropic.ts b/packages/model-bank/src/aiModels/lobehub/chat/anthropic.tsindex 483051380c9..30967663aa4 100644--- a/packages/model-bank/src/aiModels/lobehub/chat/anthropic.ts+++ b/packages/model-bank/src/aiModels/lobehub/chat/anthropic.ts@@ -1,6 +1,33 @@import type { AIChatModelCard } from '../../../types/aiModel';export const anthropicChatModels: AIChatModelCard[] = [+ {+ abilities: {+ functionCall: true,+ reasoning: true,+ search: true,+ vision: true,+ },+ contextWindowTokens: 200_000,+ description: "Claude Sonnet 4.6 is Anthropic's best combination of speed and intelligence.",+ displayName: 'Claude Sonnet 4.6',+ enabled: true,+ id: 'claude-sonnet-4-6',+ maxOutput: 64_000,+ pricing: {+ units: [+ { name: 'textInput_cacheRead', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'textInput_cacheWrite', rate: 3.75, strategy: 'fixed', unit: 'millionTokens' },+ ],+ },+ releasedAt: '2026-02-18',+ settings: {+ extendParams: ['disableContextCaching', 'enableAdaptiveThinking', 'effort'],+ },+ type: 'chat',+ },{abilities: {functionCall: true,diff --git a/packages/model-runtime/src/core/anthropicCompatibleFactory/index.ts b/packages/model-runtime/src/core/anthropicCompatibleFactory/index.tsindex 1d1373c0e2f..4e634932cf2 100644--- a/packages/model-runtime/src/core/anthropicCompatibleFactory/index.ts+++ b/packages/model-runtime/src/core/anthropicCompatibleFactory/index.ts@@ -1,10 +1,10 @@-import Anthropic, { ClientOptions } from '@anthropic-ai/sdk';+import Anthropic, { type ClientOptions } from '@anthropic-ai/sdk';import type { Stream } from '@anthropic-ai/sdk/streaming';import type { ChatModelCard } from '@lobechat/types';import debug from 'debug';import { hasTemperatureTopPConflict } from '../../const/models';-import {+import type {ChatCompletionErrorPayload,ChatMethodOptions,ChatStreamCallbacks,@@ -12,14 +12,15 @@ import {GenerateObjectOptions,GenerateObjectPayload,} from '../../types';-import { AgentRuntimeErrorType, ILobeAgentRuntimeErrorType } from '../../types/error';+import type { ILobeAgentRuntimeErrorType } from '../../types/error';+import { AgentRuntimeErrorType } from '../../types/error';import { AgentRuntimeError } from '../../utils/createError';import { debugStream } from '../../utils/debugStream';import { desensitizeUrl } from '../../utils/desensitizeUrl';import { getModelPricing } from '../../utils/getModelPricing';import { MODEL_LIST_CONFIGS, processModelList } from '../../utils/modelParse';import { StreamingResponse } from '../../utils/response';-import { LobeRuntimeAI } from '../BaseAI';+import type { LobeRuntimeAI } from '../BaseAI';import {buildAnthropicMessages,buildAnthropicTools,@@ -148,8 +149,8 @@ export const buildDefaultAnthropicPayload = async (const postMessages = await buildAnthropicMessages(userMessages, { enabledContextCaching });- // Claude Opus 4.6 does not support assistant turn prefill- if (model.includes('opus-4-6') && postMessages.at(-1)?.role === 'assistant') {+ // Claude 4.6 models do not support assistant turn prefill+ if (model.includes('-4-6') && postMessages.at(-1)?.role === 'assistant') {postMessages.pop();}@@ -166,10 +167,7 @@ export const buildDefaultAnthropicPayload = async (const resolvedThinking: Anthropic.MessageCreateParams['thinking'] =thinking.type === 'enabled'? {- budget_tokens: Math.min(- thinking?.budget_tokens || 1024,- resolvedMaxTokens - 1,- ),+ budget_tokens: Math.min(thinking?.budget_tokens || 1024, resolvedMaxTokens - 1),type: 'enabled',}: { type: 'adaptive' };@@ -431,7 +429,9 @@ export const createAnthropicCompatibleRuntime = <T extends Record<string, any> =const finalPayload = { ...postPayload, stream: shouldStream };if (debugParams?.chatCompletion?.()) {+ // eslint-disable-next-line no-consoleconsole.log('[requestPayload]');+ // eslint-disable-next-line no-consoleconsole.log(JSON.stringify(finalPayload), '\n');}diff --git a/packages/model-runtime/src/providers/bedrock/index.ts b/packages/model-runtime/src/providers/bedrock/index.tsindex bf2a1718a5d..8c7cca8eecc 100644--- a/packages/model-runtime/src/providers/bedrock/index.ts+++ b/packages/model-runtime/src/providers/bedrock/index.ts@@ -8,6 +8,8 @@ import { cloudModelIdMapping } from '@lobechat/business-const';import { ModelProvider } from 'model-bank';import { hasTemperatureTopPConflict } from '../../const/models';+import { resolveCacheTTL } from '../../core/anthropicCompatibleFactory/resolveCacheTTL';+import { resolveMaxTokens } from '../../core/anthropicCompatibleFactory/resolveMaxTokens';import type { LobeRuntimeAI } from '../../core/BaseAI';import { buildAnthropicMessages, buildAnthropicTools } from '../../core/contextBuilders/anthropic';import { resolveParameters } from '../../core/parameterResolver';@@ -28,8 +30,6 @@ import { AgentRuntimeError } from '../../utils/createError';import { debugStream } from '../../utils/debugStream';import { getModelPricing } from '../../utils/getModelPricing';import { StreamingResponse } from '../../utils/response';-import { resolveCacheTTL } from '../../core/anthropicCompatibleFactory/resolveCacheTTL';-import { resolveMaxTokens } from '../../core/anthropicCompatibleFactory/resolveMaxTokens';/*** A prompt constructor for HuggingFace LLama 2 chat models.@@ -86,9 +86,9 @@ export class LobeBedrockAI implements LobeRuntimeAI {this.id = id ?? ModelProvider.Bedrock;this.client = new BedrockRuntimeClient({credentials: {- accessKeyId: accessKeyId,+ accessKeyId,secretAccessKey: accessKeySecret,- sessionToken: sessionToken,+ sessionToken,},region: this.region,});@@ -199,8 +199,8 @@ export class LobeBedrockAI implements LobeRuntimeAI {const postMessages = await buildAnthropicMessages(user_messages, { enabledContextCaching });- // Claude Opus 4.6 does not support assistant turn prefill- if (model.includes('opus-4-6') && postMessages.at(-1)?.role === 'assistant') {+ // Claude 4.6 models do not support assistant turn prefill+ if (model.includes('-4-6') && postMessages.at(-1)?.role === 'assistant') {postMessages.pop();}@@ -218,10 +218,7 @@ export class LobeBedrockAI implements LobeRuntimeAI {const resolvedThinking =thinking.type === 'enabled'? {- budget_tokens: Math.min(- thinking?.budget_tokens || 1024,- resolvedMaxTokens - 1,- ),+ budget_tokens: Math.min(thinking?.budget_tokens || 1024, resolvedMaxTokens - 1),type: 'enabled' as const,}: { type: 'adaptive' as const };