From 219a798affa0ed8e4ec8d4036382d002491fc5b3 Mon Sep 17 00:00:00 2001 From: zfoong Date: Wed, 21 Oct 2026 22:25:12 +0900 Subject: [PATCH] update default LLM model and update some APIs --- agent_core/core/impl/vlm/interface.py | 91 +++++-- agent_core/core/models/connection_tester.py | 2 +- agent_core/core/models/provider_config.py | 251 ++++++++++++------ agent_core/core/models/reasoning.py | 32 +++ agent_file_system/AGENT.md | 10 +- app/agent_base.py | 7 +- app/config.py | 10 +- app/config/connection_test_models.json | 14 +- app/data/action/describe_image.py | 2 +- app/data/action/generate_video.py | 16 +- app/data/agent_file_system_template/AGENT.md | 10 +- .../src/pages/Onboarding/OnboardingPage.tsx | 7 +- .../pages/Settings/OpenRouterModelPicker.tsx | 2 +- .../src/store/slices/modelSettingsSlice.ts | 6 +- app/ui_layer/settings/model_settings.py | 2 +- .../test_claude_code_subscription.py | 4 +- tests/test_settings_transactions.py | 6 +- tests/test_vlm_reasoning.py | 144 ++++++++++ 18 files changed, 465 insertions(+), 151 deletions(-) create mode 100644 tests/test_vlm_reasoning.py diff --git a/agent_core/core/impl/vlm/interface.py b/agent_core/core/impl/vlm/interface.py index df9a2f6f6..5e23001be 100644 --- a/agent_core/core/impl/vlm/interface.py +++ b/agent_core/core/impl/vlm/interface.py @@ -21,7 +21,13 @@ import requests +from agent_core.core.impl.llm import reasoning_wire from agent_core.core.impl.llm.cache import get_cache_config, get_cache_metrics +from agent_core.core.models.reasoning import ( + ReasoningChoice, + ReasoningDecision, + resolve_reasoning, +) from agent_core.utils.token import billable_tokens from agent_core.core.hooks import ( GetTokenCountHook, @@ -53,6 +59,13 @@ class VLMInterface: _CODE_BLOCK_RE = re.compile(r"^```(?:\w+)?\s*|\s*```$", re.MULTILINE) + #: Output-token cap of a vision request, before reasoning raises it. + _MAX_TOKENS = 2048 + + #: "subscription" when the factory authenticated with an OAuth bearer + #: (selects the reasoning table's subscription surface), else "api_key". + _auth_mode: str = "api_key" + def __init__( self, *, @@ -87,7 +100,7 @@ def __init__( from app.models.types import InterfaceType from agent_core.core.models.model_registry import MODEL_REGISTRY - # Providers like DeepSeek have VLM=None in the registry. Initializing + # Providers like Groq have VLM=None in the registry. Initializing # them would raise inside ModelFactory and crash the backend at startup. # Set up an uninitialized state instead — VLM actions then surface a # clean "VLM not available" error to the event stream. @@ -119,6 +132,7 @@ def __init__( self._anthropic_client = ctx.get("anthropic_client") self._bedrock_client = ctx.get("bedrock_client") self._initialized = ctx.get("initialized", False) + self._auth_mode = ctx.get("auth_mode", "api_key") if ctx["byteplus"]: self.api_key = ctx["byteplus"]["api_key"] @@ -194,6 +208,7 @@ def reinitialize( self._anthropic_client = ctx.get("anthropic_client") self._bedrock_client = ctx.get("bedrock_client") self._initialized = ctx.get("initialized", False) + self._auth_mode = ctx.get("auth_mode", "api_key") if ctx["byteplus"]: self.api_key = ctx["byteplus"]["api_key"] @@ -281,11 +296,10 @@ def describe_image_bytes( _profile = get_registry().get(self.provider) _wire = _profile.wire if _profile is not None else "chat_completions" - if self.provider == "deepseek": - raise RuntimeError( - "DeepSeek does not support vision/VLM. Use a different provider for image description." - ) - elif self.provider == "remote": + # DeepSeek used to be refused here; deepseek-flash (V4.1 Flash) + # takes image_url parts (https://api-docs.deepseek.com/guides/vision), + # so it falls through to the OpenAI-compatible path below. + if self.provider == "remote": response = self._ollama_describe_bytes( image_bytes, system_prompt, user_prompt ) @@ -542,6 +556,23 @@ def _multi_frame_describe_fallback( ) return synthesis + def _reasoning(self) -> Optional[ReasoningDecision]: + """The reasoning decision a vision request carries. + + Vision requests ask for the provider's default reasoning, so a model + without a rule in agent_core/core/models/reasoning.py keeps the + request it always had. A model's rule still applies its + consequences: temperature is dropped where the model rejects it, + and the output cap is raised where the model reasons by default, + because reasoning tokens count against it. + """ + return resolve_reasoning( + self.provider, + self.model, + self._auth_mode, + ReasoningChoice.PROVIDER_DEFAULT, + ) + def _openai_describe_bytes( self, image_bytes: bytes, sys: str | None, usr: str, json_mode: bool = True ) -> Dict[str, Any]: @@ -570,25 +601,36 @@ def _openai_describe_bytes( # Same per-profile request policies as the LLM chat_completions # transport: temperature via resolve_temperature (OpenAI and # Kimi/Moonshot omit the field — their reasoning models reject an - # explicit value); response_format json_object omitted for providers - # that reject it (Perplexity/LM Studio); max-tokens field name via - # profile.uses_max_completion_tokens. + # explicit value) and the model's reasoning rule; response_format + # json_object omitted for providers that reject it (Perplexity/LM + # Studio); max-tokens value capped to profile.max_output_tokens and + # field name via profile.uses_max_completion_tokens. from agent_core.core.models.registry import get_registry from agent_core.core.models.provider_config import ( OMIT_TEMPERATURE, resolve_temperature, ) + applied = reasoning_wire.for_chat_completions( + self._reasoning(), self._MAX_TOKENS + ) _profile = get_registry().get(self.provider) _temp = resolve_temperature(_profile, self.temperature) - if _temp is not OMIT_TEMPERATURE: + if _temp is not OMIT_TEMPERATURE and applied.send_temperature: request_kwargs["temperature"] = _temp + reasoning_kwargs, reasoning_extra_body = applied.fields + request_kwargs.update(reasoning_kwargs) + if reasoning_extra_body: + request_kwargs["extra_body"] = reasoning_extra_body if json_mode and (_profile is None or _profile.supports_json_object): request_kwargs["response_format"] = {"type": "json_object"} + max_tokens = applied.output_cap + if _profile is not None and _profile.max_output_tokens: + max_tokens = min(max_tokens, _profile.max_output_tokens) if _profile is not None and _profile.uses_max_completion_tokens: - request_kwargs["max_completion_tokens"] = 2048 + request_kwargs["max_completion_tokens"] = max_tokens else: - request_kwargs["max_tokens"] = 2048 + request_kwargs["max_tokens"] = max_tokens response = self.client.chat.completions.create(**request_kwargs) if not response.choices: @@ -792,9 +834,10 @@ def _anthropic_describe_bytes( }, ] + applied = reasoning_wire.for_anthropic(self._reasoning(), self._MAX_TOKENS) message_kwargs = { "model": self.model, - "max_tokens": 2048, + "max_tokens": applied.output_cap, "messages": [{"role": "user", "content": message_content}], } @@ -810,7 +853,12 @@ def _anthropic_describe_bytes( else: message_kwargs["system"] = sys - message_kwargs["extra_body"] = {"temperature": self.temperature} + message_kwargs.update(applied.fields) + + # Claude 4.7+ rejects any non-default temperature (as does thinking + # on 4.5/4.6), so the model's rule drops it there. + if applied.send_temperature: + message_kwargs["extra_body"] = {"temperature": self.temperature} response = self._anthropic_client.messages.create(**message_kwargs) @@ -912,14 +960,21 @@ def _bedrock_describe_bytes( {"text": usr}, ] + # Claude on Converse takes the Messages-API thinking/effort keys + # through additionalModelRequestFields, with the same cap and + # temperature consequences. + applied = reasoning_wire.for_anthropic(self._reasoning(), self._MAX_TOKENS) + inference_config: Dict[str, Any] = {"maxTokens": applied.output_cap} + if applied.send_temperature: + inference_config["temperature"] = self.temperature + converse_kwargs: Dict[str, Any] = { "modelId": self.model, "messages": [{"role": "user", "content": message_content}], - "inferenceConfig": { - "maxTokens": 2048, - "temperature": self.temperature, - }, + "inferenceConfig": inference_config, } + if applied.fields: + converse_kwargs["additionalModelRequestFields"] = applied.fields if sys: use_cache = ( diff --git a/agent_core/core/models/connection_tester.py b/agent_core/core/models/connection_tester.py index c306fcc31..f5f937b82 100644 --- a/agent_core/core/models/connection_tester.py +++ b/agent_core/core/models/connection_tester.py @@ -728,7 +728,7 @@ def _test_grok( "provider": "grok", "error": "Missing API key", } - test_model = _resolve_test_model("grok", model, fallback="grok-3") + test_model = _resolve_test_model("grok", model, fallback="grok-4.3") try: with httpx.Client(timeout=timeout) as client: response = client.post( diff --git a/agent_core/core/models/provider_config.py b/agent_core/core/models/provider_config.py index 3a0d13b2d..a6e16c19d 100644 --- a/agent_core/core/models/provider_config.py +++ b/agent_core/core/models/provider_config.py @@ -208,13 +208,21 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): # model (the server applies its default), so the profile drops it # unconditionally — same policy as Kimi/Moonshot. fixed_temperature=OMIT_TEMPERATURE, - connection_test_model="gpt-4o-mini", + # gpt-4o-mini shuts down 2027-01-14; OpenAI names gpt-6-luna as its + # replacement (https://developers.openai.com/api/docs/deprecations). + connection_test_model="gpt-6-luna", default_models={ - InterfaceType.LLM: "gpt-5.2-2025-12-11", - InterfaceType.VLM: "gpt-5.2-2025-12-11", + # GPT-6.1 Sol: the tier below GPT-6 Astra, $2/$10 per 1M, + # image input (https://developers.openai.com/api/docs/models/gpt-6.1-sol). + # Chat Completions serves it without tool calling, which this + # transport never sends (it uses JSON mode). + InterfaceType.LLM: "gpt-6.1-sol", + InterfaceType.VLM: "gpt-6.1-sol", InterfaceType.EMBEDDING: "text-embedding-3-small", InterfaceType.IMAGE_GEN: "gpt-image-2", - InterfaceType.VIDEO_GEN: "sora-2", + # Sora 2 and the whole Videos API were retired on 2026-09-24 + # with no replacement API, so OpenAI has no video model. + InterfaceType.VIDEO_GEN: None, }, ), "gemini": ProviderProfile( @@ -223,13 +231,24 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): display_name="Google Gemini", wire="gemini_native", settings_key="google", - connection_test_model="gemini-2.0-flash", + # gemini-2.0-flash shut down on 2026-06-01. + connection_test_model="gemini-3.5-flash-lite", default_models={ - InterfaceType.LLM: "gemini-2.5-pro", - InterfaceType.VLM: "gemini-2.5-pro", - InterfaceType.EMBEDDING: "text-embedding-004", + # Gemini 3.8 Flash: the stable tier below Gemini 4 Argon, $0.75 + # /$3.75 per 1M, image input. Gemini 2.5 access is limited to + # earlier users, so new keys could not run 2.5 Pro + # (https://ai.google.dev/gemini-api/docs/models). + InterfaceType.LLM: "gemini-3.8-flash", + InterfaceType.VLM: "gemini-3.8-flash", + # text-embedding-004 shut down on 2026-01-14. + InterfaceType.EMBEDDING: "gemini-embedding-2", InterfaceType.IMAGE_GEN: "gemini-3-pro-image", - InterfaceType.VIDEO_GEN: "veo-3.1-generate-preview", + # Every Veo id on the Gemini API (veo-3.1-*-preview) shuts down + # on 2026-10-22. Its replacement, gemini-omni-1.1-flash, runs only + # on the Interactions API (POST /v1beta/interactions), which the + # video client does not speak + # (https://ai.google.dev/gemini-api/docs/deprecations). + InterfaceType.VIDEO_GEN: None, }, ), "anthropic": ProviderProfile( @@ -243,8 +262,10 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): connection_test_model="claude-haiku-4-5-20251001", connection_test_max_tokens=1, default_models={ - InterfaceType.LLM: "claude-sonnet-4-6", - InterfaceType.VLM: "claude-sonnet-4-6", + # Claude Sonnet 5.5: the price/performance tier below Fable and + # Opus, $2/$10 per 1M, image input. + InterfaceType.LLM: "claude-sonnet-5-5", + InterfaceType.VLM: "claude-sonnet-5-5", # Anthropic does not provide native embedding models. InterfaceType.EMBEDDING: None, InterfaceType.IMAGE_GEN: None, @@ -259,11 +280,18 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): display_name="BytePlus", wire="byteplus_responses", settings_key="byteplus", - connection_test_model="kimi-k2-250905", + # kimi-k2-250905 was deactivated on 2026-05-13; Seed 2.0 Mini is the + # cheapest current model. + connection_test_model="seed-2-0-mini-260428", default_models={ - InterfaceType.LLM: "seed-2-0-pro-260328", - InterfaceType.VLM: "seed-2-0-pro-260328", - InterfaceType.EMBEDDING: "skylark-embedding-vision-250615", + # Seed 2.0 Lite: the tier below the Seed 2.1 Turbo / 2.0 Pro + # flagships, $0.25/$2.00 per 1M, image input + # (https://docs.byteplus.com/en/docs/ModelArk/1330310). + InterfaceType.LLM: "seed-2-0-lite-260428", + InterfaceType.VLM: "seed-2-0-lite-260428", + # skylark-embedding-vision-250615 is deprecated (deactivation + # 2026-11-11). + InterfaceType.EMBEDDING: "skylark-embedding-vision-251215", InterfaceType.IMAGE_GEN: None, # BytePlus international (ap-southeast.bytepluses.com) model IDs # use dated build suffixes, no dots, no `doubao-` prefix @@ -308,21 +336,26 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): uses_max_completion_tokens=True, # MiniMax has no /v1/models endpoint — the connection tester must do # a real (tiny) chat call against this model. - connection_test_model="MiniMax-M2.1", + connection_test_model="MiniMax-M3.1-Flash", openrouter_proxy=True, openrouter_namespace="minimax", openrouter_slug_map={ # Slugs follow OpenRouter's lowercase convention; verify against # openrouter.ai/models when bumping the MiniMax model family. + # As of 2026-10-21 OpenRouter lists M3.1 Flash only as the + # ":free" variant, so the paid slug below starts working once + # OpenRouter publishes it. + "MiniMax-M3.1-Flash": "minimax/minimax-m3.1-flash", "MiniMax-M3": "minimax/minimax-m3", "MiniMax-M2.1": "minimax/minimax-m2.1", "MiniMax-M2": "minimax/minimax-m2", }, default_models={ - # MiniMax-Text-01 was retired upstream; M-series is current - # (M3 flagship, M2.x cheap tier). - InterfaceType.LLM: "MiniMax-M2.1", - InterfaceType.VLM: None, + # M2.x is retired; the lineup is M3 (flagship) and M3.1 Flash, + # $0.15/$0.60 per 1M with image input + # (https://platform.minimax.io/docs/faq/models). + InterfaceType.LLM: "MiniMax-M3.1-Flash", + InterfaceType.VLM: "MiniMax-M3.1-Flash", InterfaceType.EMBEDDING: None, InterfaceType.IMAGE_GEN: None, InterfaceType.VIDEO_GEN: None, @@ -337,10 +370,13 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): error_display_name="DeepSeek", settings_key="deepseek", supports_prompt_cache_key=True, - connection_test_model="deepseek-chat", + connection_test_model="deepseek-flash", default_models={ - InterfaceType.LLM: "deepseek-chat", - InterfaceType.VLM: None, + # deepseek-chat / deepseek-reasoner were retired on 2026-07-24. + # deepseek-flash (V4.1 Flash) is the tier below V4 Pro, $0.30/$1.20 + # per 1M at peak, image input (https://api-docs.deepseek.com/quick_start/pricing). + InterfaceType.LLM: "deepseek-flash", + InterfaceType.VLM: "deepseek-flash", InterfaceType.EMBEDDING: None, InterfaceType.IMAGE_GEN: None, InterfaceType.VIDEO_GEN: None, @@ -362,21 +398,21 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): # Kimi thinking models (k2.5+) reject an explicit temperature — omit # it (verified: Kimi API docs + Hermes kimi-coding profile). fixed_temperature=OMIT_TEMPERATURE, - connection_test_model="kimi-k2.5", + connection_test_model="kimi-k2.6", openrouter_proxy=True, openrouter_namespace="moonshotai", openrouter_slug_map={ + "kimi-k3": "moonshotai/kimi-k3", + "kimi-k2.6": "moonshotai/kimi-k2.6", "kimi-k2.5": "moonshotai/kimi-k2.5", - "moonshot-v1-8k": "moonshotai/moonshot-v1-8k", - "moonshot-v1-32k": "moonshotai/moonshot-v1-32k", - "moonshot-v1-128k": "moonshotai/moonshot-v1-128k", - "moonshot-v1-8k-vision-preview": ( - "moonshotai/moonshot-v1-8k-vision-preview" - ), }, default_models={ - InterfaceType.LLM: "kimi-k2.5", - InterfaceType.VLM: "moonshot-v1-8k-vision-preview", + # kimi-k2.5 and the moonshot-v1 series were retired on + # 2026-08-31. Kimi K2.6 is the general tier below Kimi K3, + # $0.95/$4.00 per 1M, image input (base64 only) + # (https://platform.kimi.ai/docs/models). + InterfaceType.LLM: "kimi-k2.6", + InterfaceType.VLM: "kimi-k2.6", InterfaceType.EMBEDDING: None, InterfaceType.IMAGE_GEN: None, InterfaceType.VIDEO_GEN: None, @@ -394,11 +430,16 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): # this path in May 2026. oauth_backend="grok", subscription_label="Sign in with Grok", - subscription_models=("grok-4-0709", "grok-3"), + subscription_models=("grok-4.3", "grok-4.7"), supports_prompt_cache_key=True, + connection_test_model="grok-4.3", default_models={ - InterfaceType.LLM: "grok-3", - InterfaceType.VLM: "grok-4-0709", + # grok-3 and grok-4-0709 were retired on 2026-05-15 and now + # redirect to grok-4.3 (https://docs.x.ai/developers/migration/may-15-retirement). + # Grok 4.3 is the tier below Grok 4.7, $1.25/$2.50 per 1M, image + # input. + InterfaceType.LLM: "grok-4.3", + InterfaceType.VLM: "grok-4.3", InterfaceType.EMBEDDING: None, InterfaceType.IMAGE_GEN: None, InterfaceType.VIDEO_GEN: None, @@ -413,12 +454,13 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): display_name="Z.ai (GLM)", settings_key="glm", supports_prompt_cache_key=True, - connection_test_model="glm-5.2", + connection_test_model="glm-5.3-flash", default_models={ - # Z.ai (Zhipu AI) GLM-5.2 -- 1M-context, OpenAI-compatible, - # multimodal. - InterfaceType.LLM: "glm-5.2", - InterfaceType.VLM: "glm-5.2", + # GLM-5.3 Flash: the tier below GLM-5.3, 1M context, $0.15/$0.50 + # per 1M, natively multimodal (GLM-5.2 and 5.3 take text only) + # (https://docs.z.ai/guides/vlm/glm-5.3-flash). + InterfaceType.LLM: "glm-5.3-flash", + InterfaceType.VLM: "glm-5.3-flash", InterfaceType.EMBEDDING: None, InterfaceType.IMAGE_GEN: None, InterfaceType.VIDEO_GEN: None, @@ -432,7 +474,15 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): default_base_url="https://api.sakana.ai/v1", display_name="Sakana (Fugu)", settings_key="fugu", - supports_prompt_cache_key=True, + # prompt_cache_key is not in Sakana's Chat Completions field table + # (https://console.sakana.ai/models), and Sakana rejects some fields + # outright, so don't send it. Caching is automatic server-side; hits + # are reported in usage cached_tokens. + supports_prompt_cache_key=False, + # Sakana documents temperature as "accepted but ignored", but fugu + # has been seen answering 400 "Only the default (1) value is + # supported" for a non-default value. It has no effect, so omit it. + fixed_temperature=OMIT_TEMPERATURE, connection_test_model="fugu", default_models={ # Sakana AI Fugu -- OpenAI-compatible orchestration model. @@ -459,8 +509,8 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): # OpenRouter slugs follow `/` format. Default to # a Claude model so KV caching exercises the cache_control path on # first use. - InterfaceType.LLM: "anthropic/claude-sonnet-4.5", - InterfaceType.VLM: "anthropic/claude-sonnet-4.5", + InterfaceType.LLM: "anthropic/claude-sonnet-5.5", + InterfaceType.VLM: "anthropic/claude-sonnet-5.5", InterfaceType.EMBEDDING: None, InterfaceType.IMAGE_GEN: None, InterfaceType.VIDEO_GEN: None, @@ -480,17 +530,18 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): aws_credential_block=True, connection_test_model="us.anthropic.claude-haiku-4-5-20251001-v1:0", default_models={ - # Default to Claude Haiku 4.5 — best price/performance on Bedrock - # with cachePoint support (5-min + 1-hour TTL). The `us.` prefix - # is the cross-region inference profile, required because Claude - # 4.x models reject on-demand invocations against the bare - # `anthropic.*` ID. The `us.anthropic.` prefix still matches - # `_BEDROCK_CACHE_PREFIXES`, so cachePoint is exercised. Users in - # EU / APAC regions should change `us.` to `eu.` / `ap.`. - # Haiku 4.5 also accepts image content blocks via Converse, so it - # doubles as the VLM default. Embedding stays on Titan. - InterfaceType.LLM: "us.anthropic.claude-haiku-4-5-20251001-v1:0", - InterfaceType.VLM: "us.anthropic.claude-haiku-4-5-20251001-v1:0", + # Default to Claude Sonnet 5.5, the same tier as the Anthropic + # default, with cachePoint support. The `us.` prefix is the + # cross-region inference profile, required because Sonnet 5.5 + # has no in-Region (bare `anthropic.*`) invocation. The + # `us.anthropic.` prefix still matches `_BEDROCK_CACHE_PREFIXES`, + # so cachePoint is exercised. Users in EU / Australia regions + # should change `us.` to `eu.` / `au.` (AWS model card: + # model-card-anthropic-claude-sonnet-5-5). Sonnet 5.5 also + # accepts image content blocks via Converse, so it doubles as + # the VLM default. Embedding stays on Titan. + InterfaceType.LLM: "us.anthropic.claude-sonnet-5-5", + InterfaceType.VLM: "us.anthropic.claude-sonnet-5-5", InterfaceType.EMBEDDING: "amazon.titan-embed-text-v2:0", InterfaceType.IMAGE_GEN: None, InterfaceType.VIDEO_GEN: None, @@ -534,8 +585,12 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): default_base_url="https://api.mistral.ai/v1", display_name="Mistral", settings_key="mistral", - # "-latest" aliases insulate against Mistral's dated concrete ids. - connection_test_model="mistral-small-latest", + # Pinned ids, not "-latest" aliases: an alias moves across + # generations (https://docs.mistral.ai/inference/model-lifecycle), + # and mistral-large-latest is expected to move to Large 4, which + # reasons by default and returns message.content as a list of + # chunks instead of a string. + connection_test_model="mistral-small-2603", supports_model_discovery=True, # Mistral La Plateforme has prompt caching and honors the # `prompt_cache_key` field (cached tokens billed at 10%, reported in @@ -544,10 +599,13 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): # prefixes (observed in a live session at slow_mode's TPM ceiling). supports_prompt_cache_key=True, default_models={ - InterfaceType.LLM: "mistral-large-latest", - # pixtral-large-latest was retired (2026-05-31). mistral-small is - # multimodal and current, so it doubles as the VLM default. - InterfaceType.VLM: "mistral-small-latest", + # Mistral Medium 3.5: the tier below Large 4, $1.50/$7.50 per 1M. + # With reasoning_effort omitted (as sent here) Medium 3.5 and + # Small 4 do not reason, so content stays a string. + InterfaceType.LLM: "mistral-medium-3-5", + # pixtral-large-latest was retired (2026-05-31). Mistral Small 4 + # is multimodal and current, so it doubles as the VLM default. + InterfaceType.VLM: "mistral-small-2603", InterfaceType.EMBEDDING: "mistral-embed", InterfaceType.IMAGE_GEN: None, InterfaceType.VIDEO_GEN: None, @@ -563,15 +621,20 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): default_base_url="https://api.together.ai/v1", display_name="Together AI", settings_key="together", - connection_test_model="meta-llama/Llama-3.1-8B-Instruct-Turbo", + connection_test_model="deepseek-ai/DeepSeek-V4.1-Flash", supports_model_discovery=True, # Together's serverless models cap output well below our default; # Llama-3.3-70B ~16k. Exceeding it 4xxes. max_output_tokens=16384, default_models={ - InterfaceType.LLM: "meta-llama/Llama-3.3-70B-Instruct-Turbo", - InterfaceType.VLM: "meta-llama/Llama-4-Scout-17B-16E-Instruct", - InterfaceType.EMBEDDING: "BAAI/bge-large-en-v1.5", + # The Llama 3.x / 4 Scout serverless models are removed + # (https://docs.together.ai/docs/deprecations). DeepSeek V4.1 + # Flash: $0.30/$1.20 per 1M, image input, strong at multi-step + # tool use. + InterfaceType.LLM: "deepseek-ai/DeepSeek-V4.1-Flash", + InterfaceType.VLM: "deepseek-ai/DeepSeek-V4.1-Flash", + # Together no longer serves any serverless embedding model. + InterfaceType.EMBEDDING: None, InterfaceType.IMAGE_GEN: None, InterfaceType.VIDEO_GEN: None, }, @@ -584,17 +647,18 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): default_base_url="https://api.fireworks.ai/inference/v1", display_name="Fireworks", settings_key="fireworks", - connection_test_model="accounts/fireworks/models/llama-v3p1-8b-instruct", + connection_test_model="accounts/fireworks/models/deepseek-v4p1-flash", supports_model_discovery=True, default_models={ - # `p`-for-dot version naming: v3p3 = 3.3, qwen2p5-vl = Qwen2.5-VL. - # llama-v3p3-70b's serverless availability is ambiguous; glm-5p2 is - # a Hermes-verified served Fireworks model (their aux default). - InterfaceType.LLM: "accounts/fireworks/models/glm-5p2", - InterfaceType.VLM: "accounts/fireworks/models/qwen2p5-vl-32b-instruct", - InterfaceType.EMBEDDING: ( - "accounts/fireworks/models/nomic-embed-text-v1.5" - ), + # `p`-for-dot version naming: v4p1 = 4.1. glm-5p2 lost serverless + # on 2026-09-25, and qwen2p5-vl-32b / llama-v3p1-8b are not + # serverless. DeepSeek V4.1 Flash is serverless, $0.30/$1.20 per + # 1M, image input (fireworks.ai/models/deepseek-ai/deepseek-v4p1-flash). + InterfaceType.LLM: "accounts/fireworks/models/deepseek-v4p1-flash", + InterfaceType.VLM: "accounts/fireworks/models/deepseek-v4p1-flash", + # Legacy embedding models are addressed by their Hugging Face id + # (https://docs.fireworks.ai/guides/querying-embeddings-models). + InterfaceType.EMBEDDING: "nomic-ai/nomic-embed-text-v1.5", InterfaceType.IMAGE_GEN: None, InterfaceType.VIDEO_GEN: None, }, @@ -648,8 +712,12 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): # Qwen output caps are well under our default; 8k is a safe ceiling. max_output_tokens=8192, default_models={ - InterfaceType.LLM: "qwen-max", - InterfaceType.VLM: "qwen-vl-max", + # Qwen3.7 Plus: the Plus tier below Qwen3.8 Max, $0.40/$1.60 per + # 1M up to 256K input, image input. qwen-max is legacy and + # qwen-vl-max was retired on 2026-10-10 + # (https://www.alibabacloud.com/help/en/model-studio/models). + InterfaceType.LLM: "qwen3.7-plus", + InterfaceType.VLM: "qwen3.7-plus", InterfaceType.EMBEDDING: "text-embedding-v4", InterfaceType.IMAGE_GEN: None, InterfaceType.VIDEO_GEN: None, @@ -664,12 +732,16 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): display_name="Hugging Face", settings_key="huggingface", # Hub ids, optionally suffixed with a provider (":groq") or policy - # (":fastest" default, ":cheapest"). - connection_test_model="meta-llama/Llama-3.1-8B-Instruct", + # (":fastest" default, ":cheapest"). Gated repos (Llama) fail for + # users who have not accepted the license, so test an ungated one. + connection_test_model="deepseek-ai/DeepSeek-V4.1-Flash", supports_model_discovery=True, default_models={ - InterfaceType.LLM: "deepseek-ai/DeepSeek-V3-0324", - InterfaceType.VLM: "Qwen/Qwen2.5-VL-7B-Instruct", + # DeepSeek V4.1 Flash: routable through several providers, + # $0.20-0.30/$0.60-1.20 per 1M, image input. Qwen2.5-VL-7B is no + # longer listed by the router. + InterfaceType.LLM: "deepseek-ai/DeepSeek-V4.1-Flash", + InterfaceType.VLM: "deepseek-ai/DeepSeek-V4.1-Flash", # The router's OpenAI-compatible /v1 surface is chat-only; no # /v1/embeddings, so no embedding default here. InterfaceType.EMBEDDING: None, @@ -685,14 +757,18 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): default_base_url="https://integrate.api.nvidia.com/v1", display_name="NVIDIA NIM", settings_key="nvidia", - connection_test_model="meta/llama-3.1-8b-instruct", + connection_test_model="deepseek-ai/deepseek-v4.1-flash", supports_model_discovery=True, # NIM caps output low; Hermes ships 16384 as its battle-tested value. max_output_tokens=16384, default_models={ - InterfaceType.LLM: "meta/llama-3.3-70b-instruct", - InterfaceType.VLM: "meta/llama-3.2-90b-vision-instruct", - InterfaceType.EMBEDDING: "nvidia/nv-embedqa-e5-v5", + # meta/llama-3.3-70b-instruct, meta/llama-3.1-8b-instruct and + # nvidia/nv-embedqa-e5-v5 reached end of life in August 2026 (the + # API answers 410). NIM retires hosted models quickly; re-check + # GET /v1/models when bumping these. + InterfaceType.LLM: "deepseek-ai/deepseek-v4.1-flash", + InterfaceType.VLM: "deepseek-ai/deepseek-v4.1-flash", + InterfaceType.EMBEDDING: "nvidia/nemotron-3.5-embed-1b", InterfaceType.IMAGE_GEN: None, InterfaceType.VIDEO_GEN: None, }, @@ -702,9 +778,12 @@ def resolve_temperature(profile: Optional[ProviderProfile], caller_temperature): session_accumulation=True, api_key_env="PERPLEXITY_API_KEY", base_url_env="PERPLEXITY_BASE_URL", - # Legacy Sonar chat-completions surface. NOTE: Perplexity retires the - # Sonar tiers on 2026-09-27; the successor is the Agent API - # (https://api.perplexity.ai/docs/agent-api). Migrate before then. + # Legacy Sonar chat-completions surface. Perplexity ended it on + # 2026-09-27: POST /chat/completions now answers 403 + # "chat_completions_not_available" for every model, so this + # provider fails until it moves to the Agent API (POST /v1/agent, + # Responses-style input/output; model "perplexity/sonar" or a + # preset; https://docs.perplexity.ai/docs/agent-api/). default_base_url="https://api.perplexity.ai", display_name="Perplexity", settings_key="perplexity", diff --git a/agent_core/core/models/reasoning.py b/agent_core/core/models/reasoning.py index d923a2a5c..e6f451828 100644 --- a/agent_core/core/models/reasoning.py +++ b/agent_core/core/models/reasoning.py @@ -599,6 +599,16 @@ def _bedrock_ids(base_id: str, *profile_prefixes: str) -> Tuple[str, ...]: off=ReasoningOff.OMIT, temperature=TemperaturePolicy.OMIT_WHILE_THINKING, ) +#: Claude Sonnet 5.5 / Opus 5.5: reasoning is mandatory (default high) and +#: temperature is not a supported parameter. +_OPENROUTER_CLAUDE_ALWAYS_THINKING = ReasoningRule( + wire=ReasoningWire.OPENROUTER_EFFORT, + levels=("low", "medium", "high", "xhigh", "max"), + provider_default="high", + source=_OPENROUTER_MODELS, + output_tokens=_ANTHROPIC_OUTPUT_TOKENS, + temperature=TemperaturePolicy.OMIT_ALWAYS, +) _OPENROUTER_OPENAI_GPT5 = ReasoningRule( wire=ReasoningWire.OPENROUTER_EFFORT, levels=("minimal", "low", "medium", "high"), @@ -765,6 +775,19 @@ def _bedrock_ids(base_id: str, *profile_prefixes: str) -> Tuple[str, ...]: extended_output_tokens=_EFFORT_EXTENDED_OUTPUT_TOKENS, ) +# ── MiniMax (``reasoning_effort``) ── +# https://platform.minimax.io/docs/api-reference/text-openai-api: M3.1 Flash +# takes low/medium/high/xhigh/max, defaults to max, and cannot stop thinking. + +_MINIMAX_M31_FLASH = ReasoningRule( + wire=ReasoningWire.EFFORT, + levels=("low", "medium", "high", "xhigh", "max"), + provider_default="max", + source="https://platform.minimax.io/docs/api-reference/text-openai-api", + output_tokens=_EFFORT_OUTPUT_TOKENS, + extended_output_tokens=_EFFORT_EXTENDED_OUTPUT_TOKENS, +) + # ── gpt-oss on Groq / Cerebras (``reasoning_effort``) ── # low/medium/high, default medium; always reasons; out-of-set values are a # 400. Output caps are clamped further by each provider profile's @@ -927,6 +950,11 @@ def _bedrock_ids(base_id: str, *profile_prefixes: str) -> Tuple[str, ...]: "anthropic/claude-sonnet-4.6", "anthropic/claude-opus-4.6", ), + _models( + _OPENROUTER_CLAUDE_ALWAYS_THINKING, + "anthropic/claude-sonnet-5.5", + "anthropic/claude-opus-5.5", + ), _models(_OPENROUTER_OPENAI_GPT5, "openai/gpt-5", "openai/gpt-5-mini"), _models(_OPENROUTER_OPENAI_GPT51, "openai/gpt-5.1"), _models( @@ -991,6 +1019,9 @@ def _bedrock_ids(base_id: str, *profile_prefixes: str) -> Tuple[str, ...]: "moonshot": _surface( _models(_KIMI_K3, "kimi-k3"), ), + "minimax": _surface( + _models(_MINIMAX_M31_FLASH, "MiniMax-M3.1-Flash"), + ), "groq": _surface( _models( _GPT_OSS_GROQ, @@ -1076,6 +1107,7 @@ def _bedrock_ids(base_id: str, *profile_prefixes: str) -> Tuple[str, ...]: _BEDROCK_CLAUDE_ALWAYS_THINKING, *_bedrock_ids("anthropic.claude-fable-5", "us", "global"), *_bedrock_ids("anthropic.claude-fable-5-1", "us", "global"), + *_bedrock_ids("anthropic.claude-sonnet-5-5", "us", "eu", "au", "global"), ), _models( _BEDROCK_CLAUDE_OPUS_55, diff --git a/agent_file_system/AGENT.md b/agent_file_system/AGENT.md index 0fda456ae..c3bf74e6b 100644 --- a/agent_file_system/AGENT.md +++ b/agent_file_system/AGENT.md @@ -1868,7 +1868,7 @@ model: this doc does not enumerate them; the registry is authoritative vlm_provider: same options (VLM-capable providers only) image_gen_provider / video_gen_provider: string - llm_model: string | null (null = provider default; e.g. "claude-sonnet-4-6") + llm_model: string | null (null = provider default; e.g. "claude-sonnet-5-5") vlm_model: string | null image_gen_model / video_gen_model: string | null slow_mode: bool (true throttles requests for rate-limited providers) @@ -2074,7 +2074,7 @@ Switch LLM provider: read_file app/config/settings.json stream_edit app/config/settings.json model.llm_provider: "openai" → "anthropic" - model.llm_model: "" → "claude-sonnet-4-6" + model.llm_model: "" → "claude-sonnet-5-5" api_keys.anthropic must be set or the next LLM call fails (see ## Models). ``` @@ -3116,7 +3116,7 @@ ChatGPT subscription specifics: - The real hard failure is a Free-tier account (no Plus/Pro/Team): `CHATGPT_SUBSCRIPTION_REJECTED`. That's the "upgrade or switch to an API key" case — do not retry. - If the credential is disconnected mid-session, the client raises an actionable error telling the user to re-save model settings or reconnect. -Grok subscription: same OAuth pattern against `api.x.ai`; models grok-4-0709 / grok-3. Anthropic subscription OAuth is deliberately NOT supported (forbidden by ToS). +Grok subscription: same OAuth pattern against `api.x.ai`; models grok-4.3 / grok-4.7. Anthropic subscription OAuth is deliberately NOT supported (forbidden by ToS). ### Connection testing @@ -3194,8 +3194,8 @@ When the user is undecided: ``` Goal Suggested provider ────────────────────────────────────────── ────────────────────────── -General chat / coding / reasoning anthropic (claude-sonnet-4-6) - openai (gpt-5.2) +General chat / coding / reasoning anthropic (claude-sonnet-5-5) + openai (gpt-6.1-sol) Vision / image understanding any of: anthropic, openai, gemini, byteplus, grok Long-context document analysis gemini (1-2M context) anthropic with extended cache diff --git a/app/agent_base.py b/app/agent_base.py index 16836ed79..e545a0284 100644 --- a/app/agent_base.py +++ b/app/agent_base.py @@ -304,9 +304,10 @@ def __init__( deferred=True, # always deferred — many users won't have an image-gen key ) - # Video generation uses its own provider/model settings (defaults to - # Gemini Veo since it's the strongest free-tier option). Always - # deferred — most users won't have a video-gen key configured. + # Video generation uses its own provider/model settings. Always + # deferred — most users won't have a video-gen key configured, and a + # provider without a video model (Gemini and OpenAI, whose Veo and + # Sora were retired) stays uninitialized instead of raising. from app.config import ( get_video_gen_provider as _get_vid_prov, get_video_gen_model as _get_vid_model, diff --git a/app/config.py b/app/config.py index 2f0d8741a..91220646b 100644 --- a/app/config.py +++ b/app/config.py @@ -96,7 +96,7 @@ def _get_default_settings() -> Dict[str, Any]: "llm_provider": "anthropic", "vlm_provider": "anthropic", "image_gen_provider": "openai", - "video_gen_provider": "gemini", + "video_gen_provider": "byteplus", "llm_model": None, "vlm_model": None, "context_window": 128000, @@ -298,14 +298,12 @@ def get_image_gen_model() -> Optional[str]: def get_video_gen_provider() -> str: """Get configured video generation provider. - Falls back to the image-gen provider, then to a sensible default - ('gemini' since Veo is the strongest free-tier video model). + Falls back to 'byteplus', the only built-in provider with a video model + since Google Veo and OpenAI Sora were retired upstream. """ settings = get_settings() model = settings.get("model", {}) - return ( - model.get("video_gen_provider") or model.get("image_gen_provider") or "gemini" - ) + return model.get("video_gen_provider") or "byteplus" def get_video_gen_model() -> Optional[str]: diff --git a/app/config/connection_test_models.json b/app/config/connection_test_models.json index e0ca50b1e..64282ac15 100644 --- a/app/config/connection_test_models.json +++ b/app/config/connection_test_models.json @@ -5,25 +5,25 @@ "max_tokens": 1 }, "openai": { - "model": "gpt-4o-mini" + "model": "gpt-6-luna" }, "gemini": { - "model": "gemini-2.0-flash" + "model": "gemini-3.5-flash-lite" }, "byteplus": { - "model": "kimi-k2-250905" + "model": "seed-2-0-mini-260428" }, "deepseek": { - "model": "deepseek-chat" + "model": "deepseek-flash" }, "minimax": { - "model": "MiniMax-Text-01" + "model": "MiniMax-M3.1-Flash" }, "moonshot": { - "model": "kimi-k2.5" + "model": "kimi-k2.6" }, "glm": { - "model": "glm-5.2" + "model": "glm-5.3-flash" }, "fugu": { "model": "fugu" diff --git a/app/data/action/describe_image.py b/app/data/action/describe_image.py index 8f38f0dbc..8547cb205 100644 --- a/app/data/action/describe_image.py +++ b/app/data/action/describe_image.py @@ -78,7 +78,7 @@ def view_image(input_data: dict) -> dict: "Providers with VLM support: openai, anthropic, gemini, byteplus.\n\n" "To switch provider, edit 'app/config/settings.json' and update:\n" ' "vlm_provider": "" (e.g. "anthropic")\n' - ' "vlm_model": "" (e.g. "claude-sonnet-4-6" for anthropic)\n\n' + ' "vlm_model": "" (e.g. "claude-sonnet-5-5" for anthropic)\n\n' "Make sure the corresponding API key is configured under 'api_keys' in the same file. " "If no API key is set, ask the user to provide one. " "The system will automatically detect the config change and reload." diff --git a/app/data/action/generate_video.py b/app/data/action/generate_video.py index e38caedaf..8f4aa7f38 100644 --- a/app/data/action/generate_video.py +++ b/app/data/action/generate_video.py @@ -3,8 +3,8 @@ @action( name="generate_video", - description="""Generates a video from a text prompt using the configured video generation provider (Google Gemini Veo, OpenAI Sora, or BytePlus Seedance). -- The provider is determined by 'video_gen_provider' in settings.json (default: gemini). Supported: gemini, openai, byteplus. + description="""Generates a video from a text prompt using the configured video generation provider (BytePlus Seedance; Google Veo and OpenAI Sora have been retired upstream). +- The provider is determined by 'video_gen_provider' in settings.json; a provider without a video model falls back to one that has a model and a configured key. Supported: byteplus. - The action BLOCKS while the long-running generation completes (typically 60-300s; up to ~25 min hard cap). - Saves the result as an MP4 file to output_path, or a timestamped temp file if omitted. - TIP: For image-to-video, pass an absolute path to a single start frame via 'reference_image'. @@ -142,8 +142,10 @@ def generate_video(input_data: dict) -> dict: "message": "prompt is required.", } - # Fallback priority when the configured provider can't generate videos: - # prefer Gemini Veo, then OpenAI Sora, then BytePlus Seedance. + # Fallback priority when the configured provider can't generate videos. + # Only providers whose profile has a VIDEO_GEN default qualify + # (_supports): Gemini Veo and OpenAI Sora were retired upstream, so their + # defaults are None and BytePlus Seedance is the one that remains. _VIDEO_GEN_PRIORITY = ["gemini", "openai", "byteplus"] def _supports(p): @@ -178,9 +180,9 @@ def _resolve_video_gen_provider(configured): "video_paths": [], "message": ( "No video-generation provider is available. Video generation requires " - "Google (Gemini Veo), OpenAI (Sora), or BytePlus (Seedance) with a " - "configured API key. Set 'video_gen_provider' and add the matching " - "key under 'api_keys' in settings.json." + "BytePlus (Seedance) with a configured API key (Google Veo and OpenAI " + "Sora have been retired upstream). Set 'video_gen_provider' to " + "'byteplus' and add the key under 'api_keys' in settings.json." ), } diff --git a/app/data/agent_file_system_template/AGENT.md b/app/data/agent_file_system_template/AGENT.md index 0fda456ae..c3bf74e6b 100644 --- a/app/data/agent_file_system_template/AGENT.md +++ b/app/data/agent_file_system_template/AGENT.md @@ -1868,7 +1868,7 @@ model: this doc does not enumerate them; the registry is authoritative vlm_provider: same options (VLM-capable providers only) image_gen_provider / video_gen_provider: string - llm_model: string | null (null = provider default; e.g. "claude-sonnet-4-6") + llm_model: string | null (null = provider default; e.g. "claude-sonnet-5-5") vlm_model: string | null image_gen_model / video_gen_model: string | null slow_mode: bool (true throttles requests for rate-limited providers) @@ -2074,7 +2074,7 @@ Switch LLM provider: read_file app/config/settings.json stream_edit app/config/settings.json model.llm_provider: "openai" → "anthropic" - model.llm_model: "" → "claude-sonnet-4-6" + model.llm_model: "" → "claude-sonnet-5-5" api_keys.anthropic must be set or the next LLM call fails (see ## Models). ``` @@ -3116,7 +3116,7 @@ ChatGPT subscription specifics: - The real hard failure is a Free-tier account (no Plus/Pro/Team): `CHATGPT_SUBSCRIPTION_REJECTED`. That's the "upgrade or switch to an API key" case — do not retry. - If the credential is disconnected mid-session, the client raises an actionable error telling the user to re-save model settings or reconnect. -Grok subscription: same OAuth pattern against `api.x.ai`; models grok-4-0709 / grok-3. Anthropic subscription OAuth is deliberately NOT supported (forbidden by ToS). +Grok subscription: same OAuth pattern against `api.x.ai`; models grok-4.3 / grok-4.7. Anthropic subscription OAuth is deliberately NOT supported (forbidden by ToS). ### Connection testing @@ -3194,8 +3194,8 @@ When the user is undecided: ``` Goal Suggested provider ────────────────────────────────────────── ────────────────────────── -General chat / coding / reasoning anthropic (claude-sonnet-4-6) - openai (gpt-5.2) +General chat / coding / reasoning anthropic (claude-sonnet-5-5) + openai (gpt-6.1-sol) Vision / image understanding any of: anthropic, openai, gemini, byteplus, grok Long-context document analysis gemini (1-2M context) anthropic with extended cache diff --git a/app/ui_layer/browser/frontend/src/pages/Onboarding/OnboardingPage.tsx b/app/ui_layer/browser/frontend/src/pages/Onboarding/OnboardingPage.tsx index bb6e2cfe7..95a072acb 100644 --- a/app/ui_layer/browser/frontend/src/pages/Onboarding/OnboardingPage.tsx +++ b/app/ui_layer/browser/frontend/src/pages/Onboarding/OnboardingPage.tsx @@ -483,8 +483,9 @@ export function OnboardingPage() { // Providers that route through OpenRouter - model slug is configurable. const OR_PROXIED = ['moonshot', 'minimax'] const OR_MODEL_DEFAULTS: Record = { - moonshot: 'moonshotai/kimi-k2.5', - minimax: 'minimax/minimax-01', + moonshot: 'moonshotai/kimi-k2.6', + // OpenRouter lists MiniMax M3.1 Flash only as a free variant so far. + minimax: 'minimax/minimax-m3', } // Subscription OAuth (ChatGPT Plus/Pro, SuperGrok). The connect/status @@ -815,7 +816,7 @@ export function OnboardingPage() { className={styles.textInput} value={orModel} onChange={e => setOrModel(e.target.value)} - placeholder={OR_MODEL_DEFAULTS[onboardingStep.provider!] ?? 'e.g. moonshotai/kimi-k2.5'} + placeholder={OR_MODEL_DEFAULTS[onboardingStep.provider!] ?? 'e.g. moonshotai/kimi-k2.6'} /> )} diff --git a/app/ui_layer/browser/frontend/src/pages/Settings/OpenRouterModelPicker.tsx b/app/ui_layer/browser/frontend/src/pages/Settings/OpenRouterModelPicker.tsx index 77df00bd4..11c064c82 100644 --- a/app/ui_layer/browser/frontend/src/pages/Settings/OpenRouterModelPicker.tsx +++ b/app/ui_layer/browser/frontend/src/pages/Settings/OpenRouterModelPicker.tsx @@ -473,7 +473,7 @@ export function OpenRouterModelPicker({ type="text" value={value} onChange={(e) => onChange(e.target.value)} - placeholder="anthropic/claude-sonnet-4.5" + placeholder="anthropic/claude-sonnet-5.5" /> diff --git a/app/ui_layer/browser/frontend/src/store/slices/modelSettingsSlice.ts b/app/ui_layer/browser/frontend/src/store/slices/modelSettingsSlice.ts index 8edbcb49f..c5e6e154c 100644 --- a/app/ui_layer/browser/frontend/src/store/slices/modelSettingsSlice.ts +++ b/app/ui_layer/browser/frontend/src/store/slices/modelSettingsSlice.ts @@ -94,7 +94,7 @@ const initialState: ModelSettingsState = { providers: [], provider: 'anthropic', imageGenProvider: 'openai', - videoGenProvider: 'gemini', + videoGenProvider: 'byteplus', apiKeys: {}, baseUrls: {}, currentLlmModel: '', @@ -251,7 +251,7 @@ register('model_settings_get', (data, dispatch) => { dispatch(setSettings({ provider: d.llm_provider || 'anthropic', imageGenProvider: d.image_gen_provider || 'openai', - videoGenProvider: d.video_gen_provider || 'gemini', + videoGenProvider: d.video_gen_provider || 'byteplus', llmModel: d.llm_model || '', vlmModel: d.vlm_model || '', imageGenModel: d.image_gen_model || '', @@ -286,7 +286,7 @@ register('model_settings_update', (data, dispatch) => { // using `!== undefined` so version-mismatched backends that omit the field don't // silently leave the UI showing a stale provider. if (d.image_gen_provider !== undefined) dispatch(setImageGenProvider(d.image_gen_provider || 'openai')) - if (d.video_gen_provider !== undefined) dispatch(setVideoGenProvider(d.video_gen_provider || 'gemini')) + if (d.video_gen_provider !== undefined) dispatch(setVideoGenProvider(d.video_gen_provider || 'byteplus')) if (d.api_keys) dispatch(setApiKeys(d.api_keys)) if (d.base_urls) dispatch(setBaseUrls(d.base_urls)) if (d.llm_model !== undefined) dispatch(setCurrentLlmModel(d.llm_model || '')) diff --git a/app/ui_layer/settings/model_settings.py b/app/ui_layer/settings/model_settings.py index f2da56191..8f9875c0f 100644 --- a/app/ui_layer/settings/model_settings.py +++ b/app/ui_layer/settings/model_settings.py @@ -216,7 +216,7 @@ def get_model_settings(*, include_subscription_status: bool = True) -> Dict[str, if MODEL_REGISTRY.get(vlm_provider, {}).get(InterfaceType.VIDEO_GEN): video_gen_provider = vlm_provider else: - video_gen_provider = "gemini" + video_gen_provider = "byteplus" video_gen_model = model_settings.get("video_gen_model") or MODEL_REGISTRY.get( video_gen_provider, {} ).get(InterfaceType.VIDEO_GEN) diff --git a/tests/integrations/test_claude_code_subscription.py b/tests/integrations/test_claude_code_subscription.py index ba186af13..16bba62f4 100644 --- a/tests/integrations/test_claude_code_subscription.py +++ b/tests/integrations/test_claude_code_subscription.py @@ -765,7 +765,7 @@ async def pull(*args, **kwargs): monkeypatch.setattr("app.config.reload_settings", lambda: None) monkeypatch.setattr("app.config.get_image_gen_provider", lambda: "openai") monkeypatch.setattr("app.config.get_image_gen_model", lambda: None) - monkeypatch.setattr("app.config.get_video_gen_provider", lambda: "gemini") + monkeypatch.setattr("app.config.get_video_gen_provider", lambda: "byteplus") monkeypatch.setattr("app.config.get_video_gen_model", lambda: None) monkeypatch.setattr(browser_adapter, "connect_subscription_async", connect) monkeypatch.setattr( @@ -798,7 +798,7 @@ async def run(): elif operation == "image_rollback": await adapter._handle_model_settings_update({"imageGenProvider": "openai"}) elif operation == "video_rollback": - await adapter._handle_model_settings_update({"videoGenProvider": "gemini"}) + await adapter._handle_model_settings_update({"videoGenProvider": "byteplus"}) elif operation == "connect": await adapter._handle_model_subscription_connect("anthropic") elif operation == "complete": diff --git a/tests/test_settings_transactions.py b/tests/test_settings_transactions.py index a2c8ac105..e60c3c023 100644 --- a/tests/test_settings_transactions.py +++ b/tests/test_settings_transactions.py @@ -366,7 +366,7 @@ def update(**kwargs): async def run(): first = asyncio.create_task( adapter._handle_model_settings_update( - {provider_key: "gemini" if kind == "image" else "openai"} + {provider_key: "gemini" if kind == "image" else "byteplus"} ) ) try: @@ -383,5 +383,7 @@ async def run(): asyncio.run(run()) saved = json.loads(settings_path.read_text())["model"] - assert saved[f"{kind}_gen_provider"] == ("openai" if kind == "image" else "gemini") + # BytePlus is the only provider with a video model, so the video save + # rolls back to it as well. + assert saved[f"{kind}_gen_provider"] == ("openai" if kind == "image" else "byteplus") assert saved["llm_provider"] == adapter._controller.agent.provider == "openai" diff --git a/tests/test_vlm_reasoning.py b/tests/test_vlm_reasoning.py new file mode 100644 index 000000000..e368999b0 --- /dev/null +++ b/tests/test_vlm_reasoning.py @@ -0,0 +1,144 @@ +# -*- coding: utf-8 -*- +"""Vision requests follow each model's reasoning rule. + +The VLM paths send no reasoning parameter (the provider's default applies), +but a model's rule in agent_core/core/models/reasoning.py still decides +whether the request may carry a temperature and how much output room it +needs. Claude Sonnet 5.5 rejects a non-default temperature and always +thinks, so its requests drop the temperature and get the reasoning output +cap; a model without a rule keeps the request it always had. +""" + +from types import SimpleNamespace +from typing import Any, Dict + +import pytest + +from agent_core.core.impl.vlm.interface import VLMInterface + +PNG = b"\x89PNG\r\n\x1a\n" + b"\x00" * 16 + + +class _Capture: + """Records the keyword arguments of the one call it receives.""" + + def __init__(self, response: Any) -> None: + self.kwargs: Dict[str, Any] = {} + self._response = response + + def __call__(self, **kwargs: Any) -> Any: + self.kwargs = kwargs + return self._response + + +def _iface(provider: str, model: str) -> VLMInterface: + iface = VLMInterface.__new__(VLMInterface) + iface.provider = provider + iface.model = model + iface.temperature = 0.5 + iface._report_usage_async = lambda *a, **kw: None + return iface + + +def _anthropic(provider: str, model: str): + usage = SimpleNamespace( + input_tokens=10, + output_tokens=5, + cache_creation_input_tokens=0, + cache_read_input_tokens=0, + ) + create = _Capture( + SimpleNamespace(content=[SimpleNamespace(type="text", text="ok")], usage=usage) + ) + iface = _iface(provider, model) + iface._anthropic_client = SimpleNamespace(messages=SimpleNamespace(create=create)) + iface._anthropic_describe_bytes(PNG, None, "describe") + return create.kwargs + + +def _bedrock(model: str): + converse = _Capture( + { + "output": {"message": {"content": [{"text": "ok"}]}}, + "usage": {"inputTokens": 10, "outputTokens": 5}, + } + ) + iface = _iface("bedrock", model) + iface._bedrock_client = SimpleNamespace(converse=converse) + iface._bedrock_describe_bytes(PNG, None, "describe") + return converse.kwargs + + +def _chat(provider: str, model: str): + create = _Capture( + SimpleNamespace( + choices=[SimpleNamespace(message=SimpleNamespace(content="ok"))], + usage=SimpleNamespace( + prompt_tokens=10, completion_tokens=5, prompt_tokens_details=None + ), + ) + ) + iface = _iface(provider, model) + iface.client = SimpleNamespace( + chat=SimpleNamespace(completions=SimpleNamespace(create=create)) + ) + iface._openai_describe_bytes(PNG, None, "describe") + return create.kwargs + + +def test_anthropic_model_without_a_rule_keeps_its_request(): + kwargs = _anthropic("anthropic", "claude-3-5-sonnet-20241022") + assert kwargs["max_tokens"] == 2048 + assert kwargs["extra_body"] == {"temperature": 0.5} + assert "thinking" not in kwargs and "output_config" not in kwargs + + +def test_anthropic_sonnet_55_drops_temperature_and_gets_reasoning_room(): + kwargs = _anthropic("anthropic", "claude-sonnet-5-5") + assert "extra_body" not in kwargs + assert kwargs["max_tokens"] > 2048 + # Provider default: no reasoning parameter is sent. + assert "thinking" not in kwargs and "output_config" not in kwargs + + +def test_anthropic_model_that_does_not_think_by_default_keeps_temperature(): + kwargs = _anthropic("anthropic", "claude-sonnet-4-6") + assert kwargs["max_tokens"] == 2048 + assert kwargs["extra_body"] == {"temperature": 0.5} + + +@pytest.mark.parametrize( + "model", ["us.anthropic.claude-sonnet-5-5", "global.anthropic.claude-sonnet-5-5"] +) +def test_bedrock_sonnet_55_drops_temperature_and_gets_reasoning_room(model): + kwargs = _bedrock(model) + assert "temperature" not in kwargs["inferenceConfig"] + assert kwargs["inferenceConfig"]["maxTokens"] > 2048 + assert "additionalModelRequestFields" not in kwargs + + +def test_bedrock_model_without_a_rule_keeps_its_request(): + kwargs = _bedrock("anthropic.claude-3-5-sonnet-20241022-v2:0") + assert kwargs["inferenceConfig"] == {"maxTokens": 2048, "temperature": 0.5} + assert "additionalModelRequestFields" not in kwargs + + +def test_openrouter_sonnet_55_drops_temperature_and_gets_reasoning_room(): + kwargs = _chat("openrouter", "anthropic/claude-sonnet-5.5") + assert "temperature" not in kwargs + assert kwargs["max_tokens"] > 2048 + assert "extra_body" not in kwargs + + +def test_chat_model_without_a_rule_keeps_its_request(): + kwargs = _chat("together", "deepseek-ai/DeepSeek-V4.1-Flash") + assert kwargs["temperature"] == 0.5 + assert kwargs["max_tokens"] == 2048 + + +def test_chat_reasoning_cap_uses_the_profile_field_name(): + # gpt-oss reasons by default (cap 32000, under Groq's 32768 limit), and + # Groq takes max_completion_tokens. + kwargs = _chat("groq", "openai/gpt-oss-120b") + assert kwargs["max_completion_tokens"] == 32000 + assert "max_tokens" not in kwargs