Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(backend/copilot): tame Kimi compaction storm + tunable threshold + Langfuse cost backfill (#12889)

Zamil Majdy39cdc0a5e031
diff --git a/autogpt_platform/backend/backend/blocks/llm.py b/autogpt_platform/backend/backend/blocks/llm.py
index 8543a03b69..4e922dda1b 100644
--- a/autogpt_platform/backend/backend/blocks/llm.py
+++ b/autogpt_platform/backend/backend/blocks/llm.py
@@ -206,6 +206,10 @@ class LlmModel(str, Enum, metaclass=LlmModelMeta):
GROK_4_20_MULTI_AGENT = "x-ai/grok-4.20-multi-agent"
GROK_CODE_FAST_1 = "x-ai/grok-code-fast-1"
KIMI_K2 = "moonshotai/kimi-k2"
+ KIMI_K2_0905 = "moonshotai/kimi-k2-0905"
+ KIMI_K2_5 = "moonshotai/kimi-k2.5"
+ KIMI_K2_6 = "moonshotai/kimi-k2.6"
+ KIMI_K2_THINKING = "moonshotai/kimi-k2-thinking"
QWEN3_235B_A22B_THINKING = "qwen/qwen3-235b-a22b-thinking-2507"
QWEN3_CODER = "qwen/qwen3-coder"
# Z.ai (Zhipu) models
@@ -646,6 +650,24 @@ MODEL_METADATA = {
LlmModel.KIMI_K2: ModelMetadata(
"open_router", 131000, 131000, "Kimi K2", "OpenRouter", "Moonshot AI", 1
),
+ LlmModel.KIMI_K2_0905: ModelMetadata(
+ "open_router", 262144, 262144, "Kimi K2 0905", "OpenRouter", "Moonshot AI", 1
+ ),
+ LlmModel.KIMI_K2_5: ModelMetadata(
+ "open_router", 262144, 262144, "Kimi K2.5", "OpenRouter", "Moonshot AI", 1
+ ),
+ LlmModel.KIMI_K2_6: ModelMetadata(
+ "open_router", 262144, 262144, "Kimi K2.6", "OpenRouter", "Moonshot AI", 2
+ ),
+ LlmModel.KIMI_K2_THINKING: ModelMetadata(
+ "open_router",
+ 262144,
+ 262144,
+ "Kimi K2 Thinking",
+ "OpenRouter",
+ "Moonshot AI",
+ 2,
+ ),
LlmModel.QWEN3_235B_A22B_THINKING: ModelMetadata(
"open_router",
262144,
diff --git a/autogpt_platform/backend/backend/copilot/config.py b/autogpt_platform/backend/backend/copilot/config.py
index 4554173060..332d15edc5 100644
--- a/autogpt_platform/backend/backend/copilot/config.py
+++ b/autogpt_platform/backend/backend/copilot/config.py
@@ -229,6 +229,20 @@ class ChatConfig(BaseSettings):
"Set to $10 to allow most tasks to complete (p50=$5.37, p75=$13.07). "
"Override via CHAT_CLAUDE_AGENT_MAX_BUDGET_USD env var.",
)
+ claude_agent_autocompact_pct_override: int = Field(
+ default=50,
+ ge=0,
+ le=100,
+ description="Auto-compaction trigger threshold as a percentage of the "
+ "CLI's perceived window (sets ``CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`` on the "
+ "SDK subprocess). The CLI caps at its default (~93% of window); values "
+ "above that have no effect. 50 (= 100K of a 200K window) keeps Anthropic "
+ "context creation costs down. Set to 0 to omit the env var entirely "
+ "and let the CLI use its default ~93% threshold — useful when the "
+ "post-compaction floor (system prompt + tool defs ≈ 65-110K) is close "
+ "to the trigger and a more aggressive value causes back-to-back "
+ "compaction cascades. Skipped unconditionally for Moonshot routes.",
+ )
claude_agent_max_thinking_tokens: int = Field(
default=8192,
ge=0,
diff --git a/autogpt_platform/backend/backend/copilot/sdk/env.py b/autogpt_platform/backend/backend/copilot/sdk/env.py
index 780ed4b12c..cf77dab224 100644
--- a/autogpt_platform/backend/backend/copilot/sdk/env.py
+++ b/autogpt_platform/backend/backend/copilot/sdk/env.py
@@ -11,6 +11,7 @@ from __future__ import annotations
import re
from backend.copilot.config import ChatConfig
+from backend.copilot.moonshot import is_moonshot_model
from backend.copilot.sdk.subscription import validate_subscription
# ChatConfig is stateless (reads env vars) — a separate instance is fine.
@@ -27,6 +28,7 @@ def build_sdk_env(
session_id: str | None = None,
user_id: str | None = None,
sdk_cwd: str | None = None,
+ model: str | None = None,
) -> dict[str, str]:
"""Build env vars for the SDK CLI subprocess.
@@ -40,6 +42,11 @@ def build_sdk_env(
All modes receive workspace isolation (``CLAUDE_CODE_TMPDIR``) and
security hardening env vars to prevent .claude.md loading, prompt
history persistence, auto-memory writes, and non-essential traffic.
+
+ *model* is the resolved SDK model slug (e.g. ``"moonshotai/kimi-k2.6"``
+ or ``"anthropic/claude-sonnet-4-6"``). Used to gate model-specific env
+ vars (currently: ``CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`` is skipped for
+ Moonshot since the cache-cost rationale doesn't apply there).
"""
# --- Mode 1: Claude Code subscription auth ---
if config.use_claude_code_subscription:
@@ -103,10 +110,19 @@ def build_sdk_env(
# this flag harmlessly (those betas are not enabled there either by default).
env["CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS"] = "1"
- # Trigger context compaction earlier — default is 70% of 200K = 140K.
- # Set to 50% = 100K to keep context smaller and reduce cache creation costs.
- # Context >200K accounts for 54% of total cost despite being only 3% of calls.
- env["CLAUDE_AUTOCOMPACT_PCT_OVERRIDE"] = "50"
+ # Auto-compaction trigger threshold (CLI default: ~93% of perceived window).
+ # The override caps Anthropic cache-creation cost; Moonshot routes skip it
+ # because their OpenRouter endpoint returns ``cache_create=0`` (no cache
+ # writes happen, so there's no cost to cap) and an aggressive trigger
+ # against Kimi's larger window cascades into 3+ compactions per turn.
+ # Operators can also set the config to 0 to disable globally.
+ if (
+ not is_moonshot_model(model)
+ and config.claude_agent_autocompact_pct_override > 0
+ ):
+ env["CLAUDE_AUTOCOMPACT_PCT_OVERRIDE"] = str(
+ config.claude_agent_autocompact_pct_override
+ )
# Disable gzip on API responses to prevent ZlibError decompression
# failures (see oven-sh/bun#23149, anthropics/claude-code#18302).
diff --git a/autogpt_platform/backend/backend/copilot/sdk/env_test.py b/autogpt_platform/backend/backend/copilot/sdk/env_test.py
index 36f3dc32cb..1e1dc692f4 100644
--- a/autogpt_platform/backend/backend/copilot/sdk/env_test.py
+++ b/autogpt_platform/backend/backend/copilot/sdk/env_test.py
@@ -345,3 +345,130 @@ class TestClaudeCodeTmpdir:
assert result["CLAUDE_CODE_TMPDIR"] == "/tmp/sub-workspace"
assert result["ANTHROPIC_API_KEY"] == ""
+
+
+# ---------------------------------------------------------------------------
+# CLAUDE_AUTOCOMPACT_PCT_OVERRIDE — Moonshot gate
+# ---------------------------------------------------------------------------
+
+
+class TestAutocompactPctOverrideMoonshotGate:
+ """Override is set for Anthropic / unknown models, skipped for Moonshot.
+
+ Moonshot's OpenRouter endpoint silently drops cache writes
+ (cache_create=0 in observed traces), so the 50% threshold's
+ cache-cost rationale doesn't apply there. Forcing aggressive
+ compaction made the CLI auto-compact 3+ times per turn against
+ Kimi's larger effective window — each compaction added a slow
+ extra LLM round-trip.
+ """
+
+ @pytest.mark.parametrize(
+ "model",
+ [
+ None,
+ "anthropic/claude-sonnet-4-6",
+ "anthropic/claude-opus-4-7",
+ "claude-sonnet-4-6",
+ ],
+ )
+ def test_override_set_for_non_moonshot(self, model):
+ cfg = _make_config(use_openrouter=False)
+ with patch("backend.copilot.sdk.env.config", cfg):
+ from backend.copilot.sdk.env import build_sdk_env
+
+ result = build_sdk_env(model=model)
+
+ assert result.get("CLAUDE_AUTOCOMPACT_PCT_OVERRIDE") == "50"
+
+ @pytest.mark.parametrize(
+ "model",
+ [
+ "moonshotai/kimi-k2.6",
+ "moonshotai/kimi-k2.5",
+ "moonshotai/kimi-k3.0",
+ ],
+ )
+ def test_override_skipped_for_moonshot(self, model):
+ cfg = _make_config(
+ use_openrouter=True,
+ api_key="sk-or-test",
+ base_url="https://openrouter.ai/api/v1",
+ thinking_standard_model=model,
+ )
+ with patch("backend.copilot.sdk.env.config", cfg):
+ from backend.copilot.sdk.env import build_sdk_env
+
+ result = build_sdk_env(model=model)
+
+ assert "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE" not in result
+
+
+class TestAutocompactPctOverrideConfigurable:
+ """The override percentage is read from
+ ``claude_agent_autocompact_pct_override`` so operators can tune it per
+ deployment. Setting to 0 omits the env var entirely (CLI uses its
+ ~93% default), useful when the post-compact floor (system prompt +
+ tool defs ≈ 65-110K) sits close to an aggressive trigger and
+ cascading recompactions show up.
+ """
+
+ @pytest.mark.parametrize("pct", [25, 50, 70, 93])
+ def test_config_value_propagates_to_env(self, pct):
+ cfg = _make_config(
+ use_openrouter=False, claude_agent_autocompact_pct_override=pct
+ )
+ with patch("backend.copilot.sdk.env.config", cfg):
+ from backend.copilot.sdk.env import build_sdk_env
+
+ result = build_sdk_env(model="anthropic/claude-sonnet-4-6")
+
+ assert result.get("CLAUDE_AUTOCOMPACT_PCT_OVERRIDE") == str(pct)
+
+ def test_zero_omits_env_var(self):
+ cfg = _make_config(
+ use_openrouter=False, claude_agent_autocompact_pct_override=0
+ )
+ with patch("backend.copilot.sdk.env.config", cfg):
+ from backend.copilot.sdk.env import build_sdk_env
+
+ result = build_sdk_env(model="anthropic/claude-sonnet-4-6")
+
+ assert "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE" not in result
+
+ def test_moonshot_still_skipped_regardless_of_config(self):
+ cfg = _make_config(
+ use_openrouter=True,
+ api_key="sk-or-test",
+ base_url="https://openrouter.ai/api/v1",
+ thinking_standard_model="moonshotai/kimi-k2.6",
+ claude_agent_autocompact_pct_override=70,
+ )
+ with patch("backend.copilot.sdk.env.config", cfg):
+ from backend.copilot.sdk.env import build_sdk_env
+
+ result = build_sdk_env(model="moonshotai/kimi-k2.6")
+
+ assert "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE" not in result
+
+ def test_pct_override_rejects_out_of_range(self):
+ """Pydantic bounds (ge=0, le=100) prevent invalid percentages so the
+ env var never receives garbage."""
+ from pydantic import ValidationError
+
+ with pytest.raises(ValidationError):
+ _make_config(claude_agent_autocompact_pct_override=101)
+ with pytest.raises(ValidationError):
+ _make_config(claude_agent_autocompact_pct_override=-1)
+
+ def test_override_set_when_model_is_none(self):
+ """When build_sdk_env is called without a resolved model (e.g. very
+ early init paths), default to setting the env var — Anthropic-default
+ behaviour is the safe choice since most non-Moonshot routes benefit."""
+ cfg = _make_config(use_openrouter=False)
+ with patch("backend.copilot.sdk.env.config", cfg):
+ from backend.copilot.sdk.env import build_sdk_env
+
+ result = build_sdk_env(model=None)
+
+ assert result.get("CLAUDE_AUTOCOMPACT_PCT_OVERRIDE") == "50"
diff --git a/autogpt_platform/backend/backend/copilot/sdk/openrouter_cost.py b/autogpt_platform/backend/backend/copilot/sdk/openrouter_cost.py
index ee0f02de44..ebf183b8d2 100644
--- a/autogpt_platform/backend/backend/copilot/sdk/openrouter_cost.py
+++ b/autogpt_platform/backend/backend/copilot/sdk/openrouter_cost.py
@@ -33,6 +33,7 @@ from pathlib import Path
from typing import TYPE_CHECKING
import httpx
+from langfuse import get_client
from backend.copilot.token_tracking import persist_and_record_usage
from backend.util import json
@@ -256,6 +257,7 @@ async def record_turn_cost_from_openrouter(
fallback_cost_usd: float | None,
api_key: str | None,
log_prefix: str,
+ langfuse_trace_id: str | None = None,
) -> None:
"""Persist turn cost from OpenRouter's authoritative ``/generation``.
@@ -336,8 +338,10 @@ async def record_turn_cost_from_openrouter(
results = []
fetched = [r for r in results if isinstance(r, (int, float))]
+ cost_source = "fallback"
if fetched and len(fetched) == len(generation_ids):
real_cost: float | None = sum(fetched)
+ cost_source = "openrouter"
# Log real (OpenRouter billed) vs CLI rate-card estimate so an
# operator can spot divergence without querying OpenRouter by
# hand. Under-count typically means a gen-ID source we don't
@@ -397,3 +401,36 @@ async def record_turn_cost_from_openrouter(
log_prefix,
exc,
)
+
+ # Backfill the Langfuse trace with reconciled cost + token usage. The
+ # OTel span for the turn closes before this background task runs, so the
+ # Langfuse trace UI otherwise shows the SDK-CLI rate-card estimate (which
+ # for non-Anthropic OpenRouter routes is wildly wrong — Sonnet pricing on
+ # Kimi tokens, ~5x too high). Emitting a child event with the real
+ # numbers gives operators a single Langfuse view per turn instead of
+ # cross-referencing pod logs.
+ if langfuse_trace_id and real_cost is not None:
+ try:
+ get_client().create_event(
+ trace_context={"trace_id": langfuse_trace_id},
+ name="openrouter-cost-reconcile",
+ metadata={
+ "cost_usd": real_cost,
+ "cost_source": cost_source,
+ "fallback_cost_usd": fallback_cost_usd,
+ "prompt_tokens": prompt_tokens,
+ "completion_tokens": completion_tokens,
+ "cache_read_tokens": cache_read_tokens,
+ "cache_creation_tokens": cache_creation_tokens,
+ "resolved_generation_id_count": len(fetched),
+ "generation_id_count": len(generation_ids),
+ "model": model,
+ "provider": "open_router",
+ },
+ )
+ except Exception:
+ logger.debug(
+ "%s[cost-record] Langfuse event emit failed",
+ log_prefix,
+ exc_info=True,
+ )
diff --git a/autogpt_platform/backend/backend/copilot/sdk/openrouter_cost_test.py b/autogpt_platform/backend/backend/copilot/sdk/openrouter_cost_test.py
index 442e858c0a..ed22af4fa4 100644
--- a/autogpt_platform/backend/backend/copilot/sdk/openrouter_cost_test.py
+++ b/autogpt_platform/backend/backend/copilot/sdk/openrouter_cost_test.py
@@ -3,7 +3,7 @@
from __future__ import annotations
from datetime import UTC, datetime
-from unittest.mock import AsyncMock, patch
+from unittest.mock import AsyncMock, MagicMock, patch
import httpx
import pytest
@@ -518,3 +518,198 @@ class TestRecordTurnCostFromOpenRouter:
assert mock_persist.call_args.kwargs["cost_usd"] == pytest.approx(
sum(costs_by_id.values()), rel=1e-9
)
+
+
+class TestLangfuseTraceBackfill:
+ """Reconciled cost is mirrored back onto the Langfuse trace as a
+ child event so operators see the real number alongside the SDK-CLI
+ rate-card estimate the OTel bridge already wrote."""
+
+ @pytest.mark.asyncio
+ async def test_event_emitted_with_real_cost_when_trace_id_supplied(self):
+ real_cost = 0.025
+ mock_lf = MagicMock()
+
+ async def _get(_self, _url, **_kwargs):
+ return httpx.Response(200, json=_mock_generation_response(real_cost))
+
+ with (
+ patch(
+ "backend.copilot.sdk.openrouter_cost.persist_and_record_usage",
+ new_callable=AsyncMock,
+ ),
+ patch("httpx.AsyncClient.get", new=_get),
+ patch(
+ "backend.copilot.sdk.openrouter_cost.get_client",
+ return_value=mock_lf,
+ ),
+ ):
+ await record_turn_cost_from_openrouter(
+ session=_session(),
+ user_id="u1",
+ model="moonshotai/kimi-k2.6",
+ prompt_tokens=29669,
+ completion_tokens=280,
+ cache_read_tokens=0,
+ cache_creation_tokens=0,
+ generation_ids=["gen-1"],
+ cli_project_dir=None,
+ cli_session_id=None,
+ turn_start_ts=None,
+ fallback_cost_usd=0.018,
+ api_key="sk-or-test",
+ log_prefix="[test]",
+ langfuse_trace_id="trace-abc",
+ )
+
+ mock_lf.create_event.assert_called_once()
+ kwargs = mock_lf.create_event.call_args.kwargs
+ assert kwargs["trace_context"] == {"trace_id": "trace-abc"}
+ assert kwargs["name"] == "openrouter-cost-reconcile"
+ meta = kwargs["metadata"]
+ assert meta["cost_usd"] == pytest.approx(real_cost, rel=1e-9)
+ assert meta["cost_source"] == "openrouter"
+ assert meta["fallback_cost_usd"] == pytest.approx(0.018, rel=1e-9)
+ assert meta["resolved_generation_id_count"] == 1
+ assert meta["generation_id_count"] == 1
+ assert meta["prompt_tokens"] == 29669
+ assert meta["completion_tokens"] == 280
+ assert meta["model"] == "moonshotai/kimi-k2.6"
+ assert meta["provider"] == "open_router"
+
+ @pytest.mark.asyncio
+ async def test_event_marks_fallback_when_lookup_partial(self):
+ """When some gen-ID lookups fail, real_cost falls back to the
+ rate-card estimate. The Langfuse event must mark cost_source as
+ ``"fallback"`` so operators don't mistake it for an authoritative
+ OpenRouter reconciliation.
+ """
+ mock_lf = MagicMock()
+ call_count = {"n": 0}
+
+ async def _get(_self, _url, **_kwargs):
+ call_count["n"] += 1
+ if call_count["n"] == 1:
+ return httpx.Response(200, json=_mock_generation_response(0.012))
+ return httpx.Response(404, json={"error": "not found"})
+
+ with (
+ patch(
+ "backend.copilot.sdk.openrouter_cost.persist_and_record_usage",
+ new_callable=AsyncMock,
+ ),
+ patch("httpx.AsyncClient.get", new=_get),
+ patch(
+ "backend.copilot.sdk.openrouter_cost.asyncio.sleep",
+ new_callable=AsyncMock,
+ ),
+ patch(
+ "backend.copilot.sdk.openrouter_cost.get_client",
+ return_value=mock_lf,
+ ),
+ ):
+ await record_turn_cost_from_openrouter(
+ session=_session(),
+ user_id="u1",
+ model="moonshotai/kimi-k2.6",
+ prompt_tokens=100,
+ completion_tokens=10,
+ cache_read_tokens=0,
+ cache_creation_tokens=0,
+ generation_ids=["gen-1", "gen-2"],
+ cli_project_dir=None,
+ cli_session_id=None,
+ turn_start_ts=None,
+ fallback_cost_usd=0.018,
+ api_key="sk-or-test",
+ log_prefix="[test]",
+ langfuse_trace_id="trace-partial",
+ )
+
+ mock_lf.create_event.assert_called_once()
+ meta = mock_lf.create_event.call_args.kwargs["metadata"]
+ assert meta["cost_source"] == "fallback"
+ assert meta["cost_usd"] == pytest.approx(0.018, rel=1e-9)
+ assert meta["resolved_generation_id_count"] == 1
+ assert meta["generation_id_count"] == 2
+
+ @pytest.mark.asyncio
+ async def test_no_event_when_trace_id_missing(self):
+ """Anthropic-direct turns and any path without an active Langfuse
+ OTel context don't have a trace_id — backfill is a no-op."""
+ mock_lf = MagicMock()
+
+ async def _get(_self, _url, **_kwargs):
+ return httpx.Response(200, json=_mock_generation_response(0.01))
+
+ with (
+ patch(
+ "backend.copilot.sdk.openrouter_cost.persist_and_record_usage",
+ new_callable=AsyncMock,
+ ),
+ patch("httpx.AsyncClient.get", new=_get),
+ patch(
+ "backend.copilot.sdk.openrouter_cost.get_client",
+ return_value=mock_lf,
+ ),
+ ):
+ await record_turn_cost_from_openrouter(
+ session=_session(),
+ user_id="u1",
+ model="moonshotai/kimi-k2.6",
+ prompt_tokens=100,
+ completion_tokens=10,
+ cache_read_tokens=0,
+ cache_creation_tokens=0,
+ generation_ids=["gen-1"],
+ cli_project_dir=None,
+ cli_session_id=None,
+ turn_start_ts=None,
+ fallback_cost_usd=0.005,
+ api_key="sk-or-test",
+ log_prefix="[test]",
+ langfuse_trace_id=None,
+ )
+
+ mock_lf.create_event.assert_not_called()
+
+ @pytest.mark.asyncio
+ async def test_backfill_failure_swallowed_does_not_break_persist(self):
+ """If Langfuse is unavailable, the reconcile still persists the
+ cost row — backfill is best-effort and must not raise."""
+ mock_lf = MagicMock()
+ mock_lf.create_event = MagicMock(side_effect=RuntimeError("network down"))
+
+ async def _get(_self, _url, **_kwargs):
+ return httpx.Response(200, json=_mock_generation_response(0.02))
+
+ with (
+ patch(
+ "backend.copilot.sdk.openrouter_cost.persist_and_record_usage",
+ new_callable=AsyncMock,
+ ) as mock_persist,
+ patch("httpx.AsyncClient.get", new=_get),
+ patch(
+ "backend.copilot.sdk.openrouter_cost.get_client",
+ return_value=mock_lf,
+ ),
+ ):
+ await record_turn_cost_from_openrouter(
+ session=_session(),
+ user_id="u1",
+ model="moonshotai/kimi-k2.6",
+ prompt_tokens=100,
+ completion_tokens=10,
+ cache_read_tokens=0,
+ cache_creation_tokens=0,
+ generation_ids=["gen-1"],
+ cli_project_dir=None,
+ cli_session_id=None,
+ turn_start_ts=None,
+ fallback_cost_usd=0.018,
+ api_key="sk-or-test",
+ log_prefix="[test]",
+ langfuse_trace_id="trace-xyz",
+ )
+
+ mock_persist.assert_called_once()
diff --git a/autogpt_platform/backend/backend/copilot/sdk/service.py b/autogpt_platform/backend/backend/copilot/sdk/service.py
index 73db9f34ba..f57e6ea791 100644
--- a/autogpt_platform/backend/backend/copilot/sdk/service.py
+++ b/autogpt_platform/backend/backend/copilot/sdk/service.py
@@ -34,7 +34,7 @@ from claude_agent_sdk import (
ToolUseBlock,
)
from claude_agent_sdk.types import SystemPromptPreset
-from langfuse import propagate_attributes
+from langfuse import get_client, propagate_attributes
from langsmith.integrations.claude_agent_sdk import configure_claude_agent_sdk
from opentelemetry import trace as otel_trace
from pydantic import BaseModel
@@ -437,6 +437,35 @@ _BARE_MESSAGE_TOKEN_FLOOR: int = 5_000
# seeded JSONL upload stays compact and future gap injections are small.
_SEED_TARGET_TOKENS: int = 30_000
+# Headroom subtracted from the CLI's autocompact threshold when sizing our
+# own retry-path compaction target. Without this gap the post-compact
+# context would land just under the CLI's threshold and the next assistant
+# message would tip it back over → CLI immediately re-compacts → cascade.
+_COMPACTION_HEADROOM_TOKENS: int = 20_000
+
+
+def _compaction_target_tokens(model: str) -> int:
+ """Compaction target consistent with the CLI's autocompact threshold.
+
+ Mirrors the bundled CLI's ``i6_()`` formula for autocompact:
+ ``min(window * pct/100, window - 13K)``, then subtracts a 20K headroom
+ so post-compaction context sits comfortably below the CLI's trigger and
+ a follow-up assistant message doesn't immediately re-trigger.
+ Floors at 10K to preserve at least some history budget.
+ """
+ from backend.util.prompt import DEFAULT_TOKEN_THRESHOLD, get_context_window
+
+ window = get_context_window(model)
+ if window is None:
+ return DEFAULT_TOKEN_THRESHOLD
+ pct = config.claude_agent_autocompact_pct_override
+ cli_buffer = 13_000 # E88 in the bundled CLI
+ if pct > 0 and not _is_moonshot_model(model):
+ cli_threshold = min(window * pct // 100, window - cli_buffer)
+ else:
+ cli_threshold = window - cli_buffer
+ return max(10_000, cli_threshold - _COMPACTION_HEADROOM_TOKENS)
+
async def _reduce_context(
transcript_content: str,
@@ -445,6 +474,7 @@ async def _reduce_context(
sdk_cwd: str,
log_prefix: str,
attempt: int = 1,
+ runtime_model: str | None = None,
) -> ReducedContext:
"""Prepare reduced context for a retry attempt.
@@ -471,10 +501,15 @@ async def _reduce_context(
# retry runs without --resume. The compacted builder state is still
# useful for the eventual upload_transcript call that seeds future turns.
if transcript_content and not tried_compaction:
+ # The compactor LLM is fixed (config.thinking_standard_model); the
+ # token target is sized against the RUNTIME model since that's the
+ # one whose CLI autocompact threshold we're trying to land below.
+ target_model = runtime_model or config.thinking_standard_model
compacted = await compact_transcript(
transcript_content,
model=config.thinking_standard_model,
log_prefix=log_prefix,
+ target_tokens=_compaction_target_tokens(target_model),
)
if (
compacted
@@ -776,6 +811,17 @@ def _resolve_fallback_model() -> str | None:
return _normalize_model_name(raw)
+def _resolve_env_model(sdk_model: str | None, fallback_model: str | None) -> str | None:
+ """Pick the model that drives ``build_sdk_env``'s model-aware gates.
+
+ Use the fallback when it's Moonshot so a 529-triggered swap to Kimi
+ still suppresses ``CLAUDE_AUTOCOMPACT_PCT_OVERRIDE``.
+ """
+ if fallback_model and _is_moonshot_model(fallback_model):
+ return fallback_model
+ return sdk_model
+
+
async def _resolve_sdk_model_for_request(
model: "CopilotLlmModel | None",
session_id: str,
@@ -3104,6 +3150,12 @@ async def stream_chat_completion_sdk(
# OTEL context manager — initialized inside the try and cleaned up in finally.
_otel_ctx: Any = None
+ # Parent Langfuse span for the turn — created so that the
+ # ``openrouter-cost-reconcile`` backfill event has a stable trace_id to
+ # attach to even though it fires after the SDK-emitted spans end.
+ # ``propagate_attributes`` alone doesn't create a span, so without this
+ # wrapper ``get_current_trace_id()`` returns None at the finally block.
+ _lf_span: Any = None
skip_transcript_upload = False
has_history = len(session.messages) > 1
transcript_content: str = ""
@@ -3234,11 +3286,6 @@ async def stream_chat_completion_sdk(
permissions=permissions,
)
- # Fail fast when no API credentials are available at all.
- # sdk_cwd routes the CLI's temp dir into the per-session workspace
- # so sub-agent output files land inside sdk_cwd (see build_sdk_env).
- sdk_env = build_sdk_env(session_id=session_id, user_id=user_id, sdk_cwd=sdk_cwd)
-
if not config.api_key and not config.use_claude_code_subscription:
raise RuntimeError(
"No API key configured. Set OPEN_ROUTER_API_KEY, "
@@ -3250,7 +3297,19 @@ async def stream_chat_completion_sdk(
mcp_server = create_copilot_mcp_server(use_e2b=use_e2b)
# Resolve model (request tier → LD per-user override → config default).
+ # Done BEFORE build_sdk_env so model-aware env vars (e.g. the
+ # Moonshot autocompact gate) can branch on the resolved slug.
sdk_model = await _resolve_sdk_model_for_request(model, session_id, user_id)
+ fallback_model = _resolve_fallback_model()
+
+ # sdk_cwd routes the CLI's temp dir into the per-session workspace
+ # so sub-agent output files land inside sdk_cwd (see build_sdk_env).
+ sdk_env = build_sdk_env(
+ session_id=session_id,
+ user_id=user_id,
+ sdk_cwd=sdk_cwd,
+ model=_resolve_env_model(sdk_model, fallback_model),
+ )
# Track SDK-internal compaction (PreCompact hook → start, next msg → end)
compaction = CompactionTracker()
@@ -3318,7 +3377,7 @@ async def stream_chat_completion_sdk(
# --- P0 guardrails ---
# fallback_model: SDK auto-retries with this cheaper model on
# 529 (overloaded) errors, avoiding user-visible failures.
- "fallback_model": _resolve_fallback_model(),
+ "fallback_model": fallback_model,
# max_turns: hard cap on agentic tool-use loops per query to
# prevent runaway execution from burning budget.
"max_turns": config.agent_max_turns,
@@ -3403,6 +3462,16 @@ async def stream_chat_completion_sdk(
if _user_tier:
_otel_metadata["subscription_tier"] = _user_tier.value
+ # Open a Langfuse parent span so the trace_id is observable from
+ # the finally block — ``propagate_attributes`` only annotates an
+ # existing span, it does not create one.
+ try:
+ _lf_span = get_client().start_as_current_span(name="copilot-sdk-turn")
+ _lf_span.__enter__()
+ except Exception:
+ logger.debug("Failed to open Langfuse parent span", exc_info=True)
+ _lf_span = None
+
_otel_ctx = propagate_attributes(
user_id=user_id,
session_id=session_id,
@@ -3662,6 +3731,7 @@ async def stream_chat_completion_sdk(
sdk_cwd,
log_prefix,
attempt=attempt,
+ runtime_model=sdk_model,
)
state.transcript_builder = ctx.builder
state.use_resume = ctx.use_resume
@@ -4058,6 +4128,11 @@ async def stream_chat_completion_sdk(
# point belongs to the next turn.
# --- Close OTEL context (with cost attributes) ---
+ # Captured before __exit__ so the reconcile task (launched below,
+ # after the span closes) can attach a backfill event to this turn's
+ # Langfuse trace. Without it, Langfuse shows the rate-card estimate
+ # only — for non-Anthropic OpenRouter routes that's wildly wrong.
+ langfuse_trace_id: str | None = None
if _otel_ctx is not None:
try:
span = otel_trace.get_current_span()
@@ -4081,6 +4156,18 @@ async def stream_chat_completion_sdk(
_otel_ctx.__exit__(*sys.exc_info())
except Exception:
logger.warning("OTEL context teardown failed", exc_info=True)
+ if _lf_span is not None:
+ # Capture from our Langfuse parent span before tearing it down;
+ # tracks the lifetime of ``_lf_span`` so the trace id is still
+ # available if ``_otel_ctx`` was never entered.
+ try:
+ langfuse_trace_id = get_client().get_current_trace_id()
+ except Exception:
+ logger.debug("Failed to capture Langfuse trace_id", exc_info=True)
+ try:
+ _lf_span.__exit__(*sys.exc_info())
+ except Exception:
+ logger.warning("Langfuse parent span teardown failed", exc_info=True)
# --- Persist token usage to session + rate-limit counters ---
# Both must live in finally so they stay consistent even when an
@@ -4139,7 +4226,7 @@ async def stream_chat_completion_sdk(
# Brief window (~0.5-2s) where the rate-limit counter is
# unaware of this turn — back-to-back turns in that window
# see a stale counter.
- asyncio.create_task(
+ cost_reconcile_task = asyncio.create_task(
record_turn_cost_from_openrouter(
session=session,
user_id=user_id,
@@ -4155,8 +4242,11 @@ async def stream_chat_completion_sdk(
fallback_cost_usd=turn_cost_usd,
api_key=config.api_key,
log_prefix=log_prefix,
+ langfuse_trace_id=langfuse_trace_id,
)
)
+ _background_tasks.add(cost_reconcile_task)
+ cost_reconcile_task.add_done_callback(_background_tasks.discard)
else:
# Reconcile disabled, OpenRouter inactive, or subscription
# path (no gen-IDs). Record the SDK CLI's
diff --git a/autogpt_platform/backend/backend/copilot/sdk/service_helpers_test.py b/autogpt_platform/backend/backend/copilot/sdk/service_helpers_test.py
index 0146fe53f1..09a31dbedd 100644
--- a/autogpt_platform/backend/backend/copilot/sdk/service_helpers_test.py
+++ b/autogpt_platform/backend/backend/copilot/sdk/service_helpers_test.py
@@ -17,6 +17,7 @@ from .conftest import build_test_transcript as _build_transcript
from .service import (
_RETRY_TARGET_TOKENS,
ReducedContext,
+ _compaction_target_tokens,
_is_prompt_too_long,
_is_tool_only_message,
_iter_sdk_messages,
@@ -1000,3 +1001,129 @@ class TestRestoreCliSessionModeCheck:
gap_asst = result.context_messages[3]
assert gap_user.content == "GAP_USER_2"
assert gap_asst.content == "GAP_ASSISTANT_3"
+
+
+# ---------------------------------------------------------------------------
+# _compaction_target_tokens — keeps our retry compaction below the CLI's
+# autocompact threshold so a compacted retry doesn't immediately re-trigger
+# the CLI's own autocompact on the next call.
+# ---------------------------------------------------------------------------
+
+
+class TestCompactionTargetTokens:
+ @pytest.mark.parametrize(
+ ("model", "window", "pct", "expected"),
+ [
+ # Sonnet 200K window with PCT=50 → CLI threshold 100K → target 80K
+ ("anthropic/claude-sonnet-4-6", 200_000, 50, 80_000),
+ # Sonnet 200K with PCT=0 → CLI uses ~93% (window-13K=187K) → 167K target
+ ("anthropic/claude-sonnet-4-6", 200_000, 0, 167_000),
+ # Aggressive PCT=30 on 200K window → CLI threshold 60K → target 40K
+ ("anthropic/claude-sonnet-4-6", 200_000, 30, 40_000),
+ ],
+ )
+ def test_anthropic_target_below_cli_threshold(
+ self, model, window, pct, expected
+ ) -> None:
+ with (
+ patch("backend.util.prompt.get_context_window", return_value=window),
+ patch("backend.copilot.sdk.service.config") as mock_cfg,
+ ):
+ mock_cfg.claude_agent_autocompact_pct_override = pct
+ assert _compaction_target_tokens(model) == expected
+
+ def test_moonshot_uses_cli_default_threshold(self) -> None:
+ # Moonshot routes ignore PCT override (config.gate skips the env var
+ # entirely), so our target should mirror the CLI's ~93% default
+ # regardless of the configured pct value.
+ with (
+ patch("backend.util.prompt.get_context_window", return_value=262_144),
+ patch("backend.copilot.sdk.service.config") as mock_cfg,
+ ):
+ mock_cfg.claude_agent_autocompact_pct_override = 50 # ignored
+ # 262144 - 13000 = 249144 (CLI default), minus 20K headroom = 229144
+ assert _compaction_target_tokens("moonshotai/kimi-k2.6") == 229_144
+
+ def test_unknown_model_falls_back_to_default_threshold(self) -> None:
+ from backend.util.prompt import DEFAULT_TOKEN_THRESHOLD
+
+ with patch("backend.util.prompt.get_context_window", return_value=None):
+ assert _compaction_target_tokens("unknown/model") == DEFAULT_TOKEN_THRESHOLD
+
+ def test_floor_at_10k_for_extremely_aggressive_pct(self) -> None:
+ # PCT=1 on a 50K window → CLI threshold = 500 → target would be
+ # negative without the floor.
+ with (
+ patch("backend.util.prompt.get_context_window", return_value=50_000),
+ patch("backend.copilot.sdk.service.config") as mock_cfg,
+ ):
+ mock_cfg.claude_agent_autocompact_pct_override = 1
+ assert _compaction_target_tokens("anthropic/foo") == 10_000
+
+ def test_resolve_env_model_prefers_moonshot_fallback(self) -> None:
+ """When the primary is Anthropic and the fallback is Moonshot, the
+ env-gate model resolves to the fallback so a 529-triggered swap to
+ Kimi still suppresses ``CLAUDE_AUTOCOMPACT_PCT_OVERRIDE``."""
+ from backend.copilot.sdk.service import _resolve_env_model
+
+ assert (
+ _resolve_env_model("anthropic/claude-sonnet-4-6", "moonshotai/kimi-k2.6")
+ == "moonshotai/kimi-k2.6"
+ )
+
+ def test_resolve_env_model_keeps_primary_when_fallback_anthropic(self) -> None:
+ from backend.copilot.sdk.service import _resolve_env_model
+
+ assert (
+ _resolve_env_model(
+ "anthropic/claude-sonnet-4-6", "anthropic/claude-haiku-3-5"
+ )
+ == "anthropic/claude-sonnet-4-6"
+ )
+
+ def test_resolve_env_model_keeps_primary_when_no_fallback(self) -> None:
+ from backend.copilot.sdk.service import _resolve_env_model
+
+ assert (
+ _resolve_env_model("anthropic/claude-sonnet-4-6", None)
+ == "anthropic/claude-sonnet-4-6"
+ )
+
+ @pytest.mark.asyncio
+ async def test_reduce_context_uses_runtime_model_for_target(self) -> None:
+ """Compactor LLM is fixed (Sonnet) but target must be sized for the
+ RUNTIME model that the CLI is actually serving — otherwise a Kimi
+ runtime gets a 200K-window-derived target while the CLI threshold
+ is computed against Kimi's 256K window.
+ """
+ from backend.copilot.sdk.service import _reduce_context
+
+ transcript = _build_transcript([("user", "hi"), ("assistant", "hello")])
+ captured: dict = {}
+
+ async def fake_compact(content, *, model, log_prefix, target_tokens):
+ captured["target_tokens"] = target_tokens
+ captured["compactor_model"] = model
+ return None
+
+ with (
+ patch(
+ "backend.copilot.sdk.service.compact_transcript",
+ side_effect=fake_compact,
+ ),
+ patch(
+ "backend.copilot.sdk.service._compaction_target_tokens",
+ side_effect=lambda m: 12345 if "kimi" in m else 99999,
+ ),
+ ):
+ await _reduce_context(
+ transcript,
+ False,
+ "sess",
+ "/tmp",
+ "[t]",
+ runtime_model="moonshotai/kimi-k2.6",
+ )
+
+ # Target derived from the RUNTIME model, not the compactor model.
+ assert captured["target_tokens"] == 12345
diff --git a/autogpt_platform/backend/backend/copilot/transcript.py b/autogpt_platform/backend/backend/copilot/transcript.py
index 468a02f796..d89064de54 100644
--- a/autogpt_platform/backend/backend/copilot/transcript.py
+++ b/autogpt_platform/backend/backend/copilot/transcript.py
@@ -1339,6 +1339,7 @@ async def compact_transcript(
*,
model: str,
log_prefix: str = "[Transcript]",
+ target_tokens: int | None = None,
) -> str | None:
"""Compact an oversized JSONL transcript using LLM summarization.
@@ -1378,7 +1379,9 @@ async def compact_transcript(
logger.warning("%s Nothing to compress (only tail entries remain)", log_prefix)
return None
try:
- result = await _run_compression(messages, model, log_prefix)
+ result = await _run_compression(
+ messages, model, log_prefix, target_tokens=target_tokens
+ )
if not result.was_compacted:
logger.warning(
"%s Compressor reports within budget but SDK rejected — "
diff --git a/autogpt_platform/backend/backend/data/block_cost_config.py b/autogpt_platform/backend/backend/data/block_cost_config.py
index 5d2aed1fe3..a9f2215239 100644
--- a/autogpt_platform/backend/backend/data/block_cost_config.py
+++ b/autogpt_platform/backend/backend/data/block_cost_config.py
@@ -170,6 +170,10 @@ MODEL_COST: dict[LlmModel, int] = {
LlmModel.GROK_4_20_MULTI_AGENT: 5,
LlmModel.GROK_CODE_FAST_1: 1,
LlmModel.KIMI_K2: 1,
+ LlmModel.KIMI_K2_0905: 1,
+ LlmModel.KIMI_K2_5: 1,
+ LlmModel.KIMI_K2_6: 2,
+ LlmModel.KIMI_K2_THINKING: 2,
LlmModel.QWEN3_235B_A22B_THINKING: 1,
LlmModel.QWEN3_CODER: 9,
# Z.ai (Zhipu) models
diff --git a/docs/integrations/block-integrations/llm.md b/docs/integrations/block-integrations/llm.md
index e0d39ed302..ce0a29998b 100644
--- a/docs/integrations/block-integrations/llm.md
+++ b/docs/integrations/block-integrations/llm.md
@@ -65,7 +65,7 @@ The result routes data to yes_output or no_output, enabling intelligent branchin
| condition | A plaintext English description of the condition to evaluate | str | Yes |
| yes_value | (Optional) Value to output if the condition is true. If not provided, input_value will be used. | Yes Value | No |
| no_value | (Optional) Value to output if the condition is false. If not provided, input_value will be used. | No Value | No |
-| model | The language model to use for evaluating the condition. | "o3-mini" \| "o3-2025-04-16" \| "o1" \| "o1-mini" \| "gpt-5.2-2025-12-11" \| "gpt-5.1-2025-11-13" \| "gpt-5-2025-08-07" \| "gpt-5-mini-2025-08-07" \| "gpt-5-nano-2025-08-07" \| "gpt-5-chat-latest" \| "gpt-4.1-2025-04-14" \| "gpt-4.1-mini-2025-04-14" \| "gpt-4o-mini" \| "gpt-4o" \| "gpt-4-turbo" \| "claude-opus-4-1-20250805" \| "claude-opus-4-20250514" \| "claude-sonnet-4-20250514" \| "claude-opus-4-5-20251101" \| "claude-sonnet-4-5-20250929" \| "claude-haiku-4-5-20251001" \| "claude-opus-4-6" \| "claude-sonnet-4-6" \| "claude-3-haiku-20240307" \| "Qwen/Qwen2.5-72B-Instruct-Turbo" \| "nvidia/llama-3.1-nemotron-70b-instruct" \| "meta-llama/Llama-3.3-70B-Instruct-Turbo" \| "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" \| "meta-llama/Llama-3.2-3B-Instruct-Turbo" \| "llama-3.3-70b-versatile" \| "llama-3.1-8b-instant" \| "llama3.3" \| "llama3.2" \| "llama3" \| "llama3.1:405b" \| "dolphin-mistral:latest" \| "openai/gpt-oss-120b" \| "openai/gpt-oss-20b" \| "google/gemini-2.5-pro-preview-03-25" \| "google/gemini-2.5-pro" \| "google/gemini-3.1-pro-preview" \| "google/gemini-3-flash-preview" \| "google/gemini-2.5-flash" \| "google/gemini-2.0-flash-001" \| "google/gemini-3.1-flash-lite-preview" \| "google/gemini-2.5-flash-lite-preview-06-17" \| "google/gemini-2.0-flash-lite-001" \| "mistralai/mistral-nemo" \| "mistralai/mistral-large-2512" \| "mistralai/mistral-medium-3.1" \| "mistralai/mistral-small-3.2-24b-instruct" \| "mistralai/codestral-2508" \| "cohere/command-r-08-2024" \| "cohere/command-r-plus-08-2024" \| "cohere/command-a-03-2025" \| "cohere/command-a-translate-08-2025" \| "cohere/command-a-reasoning-08-2025" \| "cohere/command-a-vision-07-2025" \| "deepseek/deepseek-chat" \| "deepseek/deepseek-r1-0528" \| "perplexity/sonar" \| "perplexity/sonar-pro" \| "perplexity/sonar-reasoning-pro" \| "perplexity/sonar-deep-research" \| "nousresearch/hermes-3-llama-3.1-405b" \| "nousresearch/hermes-3-llama-3.1-70b" \| "amazon/nova-lite-v1" \| "amazon/nova-micro-v1" \| "amazon/nova-pro-v1" \| "microsoft/wizardlm-2-8x22b" \| "microsoft/phi-4" \| "gryphe/mythomax-l2-13b" \| "meta-llama/llama-4-scout" \| "meta-llama/llama-4-maverick" \| "x-ai/grok-3" \| "x-ai/grok-4" \| "x-ai/grok-4-fast" \| "x-ai/grok-4.1-fast" \| "x-ai/grok-4.20" \| "x-ai/grok-4.20-multi-agent" \| "x-ai/grok-code-fast-1" \| "moonshotai/kimi-k2" \| "qwen/qwen3-235b-a22b-thinking-2507" \| "qwen/qwen3-coder" \| "z-ai/glm-4-32b" \| "z-ai/glm-4.5" \| "z-ai/glm-4.5-air" \| "z-ai/glm-4.5-air:free" \| "z-ai/glm-4.5v" \| "z-ai/glm-4.6" \| "z-ai/glm-4.6v" \| "z-ai/glm-4.7" \| "z-ai/glm-4.7-flash" \| "z-ai/glm-5" \| "z-ai/glm-5-turbo" \| "z-ai/glm-5v-turbo" \| "Llama-4-Scout-17B-16E-Instruct-FP8" \| "Llama-4-Maverick-17B-128E-Instruct-FP8" \| "Llama-3.3-8B-Instruct" \| "Llama-3.3-70B-Instruct" \| "v0-1.5-md" \| "v0-1.5-lg" \| "v0-1.0-md" | No |
+| model | The language model to use for evaluating the condition. | "o3-mini" \| "o3-2025-04-16" \| "o1" \| "o1-mini" \| "gpt-5.2-2025-12-11" \| "gpt-5.1-2025-11-13" \| "gpt-5-2025-08-07" \| "gpt-5-mini-2025-08-07" \| "gpt-5-nano-2025-08-07" \| "gpt-5-chat-latest" \| "gpt-4.1-2025-04-14" \| "gpt-4.1-mini-2025-04-14" \| "gpt-4o-mini" \| "gpt-4o" \| "gpt-4-turbo" \| "claude-opus-4-1-20250805" \| "claude-opus-4-20250514" \| "claude-sonnet-4-20250514" \| "claude-opus-4-5-20251101" \| "claude-sonnet-4-5-20250929" \| "claude-haiku-4-5-20251001" \| "claude-opus-4-6" \| "claude-sonnet-4-6" \| "claude-3-haiku-20240307" \| "Qwen/Qwen2.5-72B-Instruct-Turbo" \| "nvidia/llama-3.1-nemotron-70b-instruct" \| "meta-llama/Llama-3.3-70B-Instruct-Turbo" \| "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" \| "meta-llama/Llama-3.2-3B-Instruct-Turbo" \| "llama-3.3-70b-versatile" \| "llama-3.1-8b-instant" \| "llama3.3" \| "llama3.2" \| "llama3" \| "llama3.1:405b" \| "dolphin-mistral:latest" \| "openai/gpt-oss-120b" \| "openai/gpt-oss-20b" \| "google/gemini-2.5-pro-preview-03-25" \| "google/gemini-2.5-pro" \| "google/gemini-3.1-pro-preview" \| "google/gemini-3-flash-preview" \| "google/gemini-2.5-flash" \| "google/gemini-2.0-flash-001" \| "google/gemini-3.1-flash-lite-preview" \| "google/gemini-2.5-flash-lite-preview-06-17" \| "google/gemini-2.0-flash-lite-001" \| "mistralai/mistral-nemo" \| "mistralai/mistral-large-2512" \| "mistralai/mistral-medium-3.1" \| "mistralai/mistral-small-3.2-24b-instruct" \| "mistralai/codestral-2508" \| "cohere/command-r-08-2024" \| "cohere/command-r-plus-08-2024" \| "cohere/command-a-03-2025" \| "cohere/command-a-translate-08-2025" \| "cohere/command-a-reasoning-08-2025" \| "cohere/command-a-vision-07-2025" \| "deepseek/deepseek-chat" \| "deepseek/deepseek-r1-0528" \| "perplexity/sonar" \| "perplexity/sonar-pro" \| "perplexity/sonar-reasoning-pro" \| "perplexity/sonar-deep-research" \| "nousresearch/hermes-3-llama-3.1-405b" \| "nousresearch/hermes-3-llama-3.1-70b" \| "amazon/nova-lite-v1" \| "amazon/nova-micro-v1" \| "amazon/nova-pro-v1" \| "microsoft/wizardlm-2-8x22b" \| "microsoft/phi-4" \| "gryphe/mythomax-l2-13b" \| "meta-llama/llama-4-scout" \| "meta-llama/llama-4-maverick" \| "x-ai/grok-3" \| "x-ai/grok-4" \| "x-ai/grok-4-fast" \| "x-ai/grok-4.1-fast" \| "x-ai/grok-4.20" \| "x-ai/grok-4.20-multi-agent" \| "x-ai/grok-code-fast-1" \| "moonshotai/kimi-k2" \| "moonshotai/kimi-k2-0905" \| "moonshotai/kimi-k2.5" \| "moonshotai/kimi-k2.6" \| "moonshotai/kimi-k2-thinking" \| "qwen/qwen3-235b-a22b-thinking-2507" \| "qwen/qwen3-coder" \| "z-ai/glm-4-32b" \| "z-ai/glm-4.5" \| "z-ai/glm-4.5-air" \| "z-ai/glm-4.5-air:free" \| "z-ai/glm-4.5v" \| "z-ai/glm-4.6" \| "z-ai/glm-4.6v" \| "z-ai/glm-4.7" \| "z-ai/glm-4.7-flash" \| "z-ai/glm-5" \| "z-ai/glm-5-turbo" \| "z-ai/glm-5v-turbo" \| "Llama-4-Scout-17B-16E-Instruct-FP8" \| "Llama-4-Maverick-17B-128E-Instruct-FP8" \| "Llama-3.3-8B-Instruct" \| "Llama-3.3-70B-Instruct" \| "v0-1.5-md" \| "v0-1.5-lg" \| "v0-1.0-md" | No |
### Outputs
@@ -103,7 +103,7 @@ The block sends the entire conversation history to the chosen LLM, including sys
|-------|-------------|------|----------|
| prompt | The prompt to send to the language model. | str | No |
| messages | List of messages in the conversation. | List[Any] | Yes |
-| model | The language model to use for the conversation. | "o3-mini" \| "o3-2025-04-16" \| "o1" \| "o1-mini" \| "gpt-5.2-2025-12-11" \| "gpt-5.1-2025-11-13" \| "gpt-5-2025-08-07" \| "gpt-5-mini-2025-08-07" \| "gpt-5-nano-2025-08-07" \| "gpt-5-chat-latest" \| "gpt-4.1-2025-04-14" \| "gpt-4.1-mini-2025-04-14" \| "gpt-4o-mini" \| "gpt-4o" \| "gpt-4-turbo" \| "claude-opus-4-1-20250805" \| "claude-opus-4-20250514" \| "claude-sonnet-4-20250514" \| "claude-opus-4-5-20251101" \| "claude-sonnet-4-5-20250929" \| "claude-haiku-4-5-20251001" \| "claude-opus-4-6" \| "claude-sonnet-4-6" \| "claude-3-haiku-20240307" \| "Qwen/Qwen2.5-72B-Instruct-Turbo" \| "nvidia/llama-3.1-nemotron-70b-instruct" \| "meta-llama/Llama-3.3-70B-Instruct-Turbo" \| "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" \| "meta-llama/Llama-3.2-3B-Instruct-Turbo" \| "llama-3.3-70b-versatile" \| "llama-3.1-8b-instant" \| "llama3.3" \| "llama3.2" \| "llama3" \| "llama3.1:405b" \| "dolphin-mistral:latest" \| "openai/gpt-oss-120b" \| "openai/gpt-oss-20b" \| "google/gemini-2.5-pro-preview-03-25" \| "google/gemini-2.5-pro" \| "google/gemini-3.1-pro-preview" \| "google/gemini-3-flash-preview" \| "google/gemini-2.5-flash" \| "google/gemini-2.0-flash-001" \| "google/gemini-3.1-flash-lite-preview" \| "google/gemini-2.5-flash-lite-preview-06-17" \| "google/gemini-2.0-flash-lite-001" \| "mistralai/mistral-nemo" \| "mistralai/mistral-large-2512" \| "mistralai/mistral-medium-3.1" \| "mistralai/mistral-small-3.2-24b-instruct" \| "mistralai/codestral-2508" \| "cohere/command-r-08-2024" \| "cohere/command-r-plus-08-2024" \| "cohere/command-a-03-2025" \| "cohere/command-a-translate-08-2025" \| "cohere/command-a-reasoning-08-2025" \| "cohere/command-a-vision-07-2025" \| "deepseek/deepseek-chat" \| "deepseek/deepseek-r1-0528" \| "perplexity/sonar" \| "perplexity/sonar-pro" \| "perplexity/sonar-reasoning-pro" \| "perplexity/sonar-deep-research" \| "nousresearch/hermes-3-llama-3.1-405b" \| "nousresearch/hermes-3-llama-3.1-70b" \| "amazon/nova-lite-v1" \| "amazon/nova-micro-v1" \| "amazon/nova-pro-v1" \| "microsoft/wizardlm-2-8x22b" \| "microsoft/phi-4" \| "gryphe/mythomax-l2-13b" \| "meta-llama/llama-4-scout" \| "meta-llama/llama-4-maverick" \| "x-ai/grok-3" \| "x-ai/grok-4" \| "x-ai/grok-4-fast" \| "x-ai/grok-4.1-fast" \| "x-ai/grok-4.20" \| "x-ai/grok-4.20-multi-agent" \| "x-ai/grok-code-fast-1" \| "moonshotai/kimi-k2" \| "qwen/qwen3-235b-a22b-thinking-2507" \| "qwen/qwen3-coder" \| "z-ai/glm-4-32b" \| "z-ai/glm-4.5" \| "z-ai/glm-4.5-air" \| "z-ai/glm-4.5-air:free" \| "z-ai/glm-4.5v" \| "z-ai/glm-4.6" \| "z-ai/glm-4.6v" \| "z-ai/glm-4.7" \| "z-ai/glm-4.7-flash" \| "z-ai/glm-5" \| "z-ai/glm-5-turbo" \| "z-ai/glm-5v-turbo" \| "Llama-4-Scout-17B-16E-Instruct-FP8" \| "Llama-4-Maverick-17B-128E-Instruct-FP8" \| "Llama-3.3-8B-Instruct" \| "Llama-3.3-70B-Instruct" \| "v0-1.5-md" \| "v0-1.5-lg" \| "v0-1.0-md" | No |
+| model | The language model to use for the conversation. | "o3-mini" \| "o3-2025-04-16" \| "o1" \| "o1-mini" \| "gpt-5.2-2025-12-11" \| "gpt-5.1-2025-11-13" \| "gpt-5-2025-08-07" \| "gpt-5-mini-2025-08-07" \| "gpt-5-nano-2025-08-07" \| "gpt-5-chat-latest" \| "gpt-4.1-2025-04-14" \| "gpt-4.1-mini-2025-04-14" \| "gpt-4o-mini" \| "gpt-4o" \| "gpt-4-turbo" \| "claude-opus-4-1-20250805" \| "claude-opus-4-20250514" \| "claude-sonnet-4-20250514" \| "claude-opus-4-5-20251101" \| "claude-sonnet-4-5-20250929" \| "claude-haiku-4-5-20251001" \| "claude-opus-4-6" \| "claude-sonnet-4-6" \| "claude-3-haiku-20240307" \| "Qwen/Qwen2.5-72B-Instruct-Turbo" \| "nvidia/llama-3.1-nemotron-70b-instruct" \| "meta-llama/Llama-3.3-70B-Instruct-Turbo" \| "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" \| "meta-llama/Llama-3.2-3B-Instruct-Turbo" \| "llama-3.3-70b-versatile" \| "llama-3.1-8b-instant" \| "llama3.3" \| "llama3.2" \| "llama3" \| "llama3.1:405b" \| "dolphin-mistral:latest" \| "openai/gpt-oss-120b" \| "openai/gpt-oss-20b" \| "google/gemini-2.5-pro-preview-03-25" \| "google/gemini-2.5-pro" \| "google/gemini-3.1-pro-preview" \| "google/gemini-3-flash-preview" \| "google/gemini-2.5-flash" \| "google/gemini-2.0-flash-001" \| "google/gemini-3.1-flash-lite-preview" \| "google/gemini-2.5-flash-lite-preview-06-17" \| "google/gemini-2.0-flash-lite-001" \| "mistralai/mistral-nemo" \| "mistralai/mistral-large-2512" \| "mistralai/mistral-medium-3.1" \| "mistralai/mistral-small-3.2-24b-instruct" \| "mistralai/codestral-2508" \| "cohere/command-r-08-2024" \| "cohere/command-r-plus-08-2024" \| "cohere/command-a-03-2025" \| "cohere/command-a-translate-08-2025" \| "cohere/command-a-reasoning-08-2025" \| "cohere/command-a-vision-07-2025" \| "deepseek/deepseek-chat" \| "deepseek/deepseek-r1-0528" \| "perplexity/sonar" \| "perplexity/sonar-pro" \| "perplexity/sonar-reasoning-pro" \| "perplexity/sonar-deep-research" \| "nousresearch/hermes-3-llama-3.1-405b" \| "nousresearch/hermes-3-llama-3.1-70b" \| "amazon/nova-lite-v1" \| "amazon/nova-micro-v1" \| "amazon/nova-pro-v1" \| "microsoft/wizardlm-2-8x22b" \| "microsoft/phi-4" \| "gryphe/mythomax-l2-13b" \| "meta-llama/llama-4-scout" \| "meta-llama/llama-4-maverick" \| "x-ai/grok-3" \| "x-ai/grok-4" \| "x-ai/grok-4-fast" \| "x-ai/grok-4.1-fast" \| "x-ai/grok-4.20" \| "x-ai/grok-4.20-multi-agent" \| "x-ai/grok-code-fast-1" \| "moonshotai/kimi-k2" \| "moonshotai/kimi-k2-0905" \| "moonshotai/kimi-k2.5" \| "moonshotai/kimi-k2.6" \| "moonshotai/kimi-k2-thinking" \| "qwen/qwen3-235b-a22b-thinking-2507" \| "qwen/qwen3-coder" \| "z-ai/glm-4-32b" \| "z-ai/glm-4.5" \| "z-ai/glm-4.5-air" \| "z-ai/glm-4.5-air:free" \| "z-ai/glm-4.5v" \| "z-ai/glm-4.6" \| "z-ai/glm-4.6v" \| "z-ai/glm-4.7" \| "z-ai/glm-4.7-flash" \| "z-ai/glm-5" \| "z-ai/glm-5-turbo" \| "z-ai/glm-5v-turbo" \| "Llama-4-Scout-17B-16E-Instruct-FP8" \| "Llama-4-Maverick-17B-128E-Instruct-FP8" \| "Llama-3.3-8B-Instruct" \| "Llama-3.3-70B-Instruct" \| "v0-1.5-md" \| "v0-1.5-lg" \| "v0-1.0-md" | No |
| max_tokens | The maximum number of tokens to generate in the chat completion. | int | No |
| ollama_host | Ollama host for local models | str | No |
@@ -257,7 +257,7 @@ The block formulates a prompt based on the given focus or source data, sends it
|-------|-------------|------|----------|
| focus | The focus of the list to generate. | str | No |
| source_data | The data to generate the list from. | str | No |
-| model | The language model to use for generating the list. | "o3-mini" \| "o3-2025-04-16" \| "o1" \| "o1-mini" \| "gpt-5.2-2025-12-11" \| "gpt-5.1-2025-11-13" \| "gpt-5-2025-08-07" \| "gpt-5-mini-2025-08-07" \| "gpt-5-nano-2025-08-07" \| "gpt-5-chat-latest" \| "gpt-4.1-2025-04-14" \| "gpt-4.1-mini-2025-04-14" \| "gpt-4o-mini" \| "gpt-4o" \| "gpt-4-turbo" \| "claude-opus-4-1-20250805" \| "claude-opus-4-20250514" \| "claude-sonnet-4-20250514" \| "claude-opus-4-5-20251101" \| "claude-sonnet-4-5-20250929" \| "claude-haiku-4-5-20251001" \| "claude-opus-4-6" \| "claude-sonnet-4-6" \| "claude-3-haiku-20240307" \| "Qwen/Qwen2.5-72B-Instruct-Turbo" \| "nvidia/llama-3.1-nemotron-70b-instruct" \| "meta-llama/Llama-3.3-70B-Instruct-Turbo" \| "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" \| "meta-llama/Llama-3.2-3B-Instruct-Turbo" \| "llama-3.3-70b-versatile" \| "llama-3.1-8b-instant" \| "llama3.3" \| "llama3.2" \| "llama3" \| "llama3.1:405b" \| "dolphin-mistral:latest" \| "openai/gpt-oss-120b" \| "openai/gpt-oss-20b" \| "google/gemini-2.5-pro-preview-03-25" \| "google/gemini-2.5-pro" \| "google/gemini-3.1-pro-preview" \| "google/gemini-3-flash-preview" \| "google/gemini-2.5-flash" \| "google/gemini-2.0-flash-001" \| "google/gemini-3.1-flash-lite-preview" \| "google/gemini-2.5-flash-lite-preview-06-17" \| "google/gemini-2.0-flash-lite-001" \| "mistralai/mistral-nemo" \| "mistralai/mistral-large-2512" \| "mistralai/mistral-medium-3.1" \| "mistralai/mistral-small-3.2-24b-instruct" \| "mistralai/codestral-2508" \| "cohere/command-r-08-2024" \| "cohere/command-r-plus-08-2024" \| "cohere/command-a-03-2025" \| "cohere/command-a-translate-08-2025" \| "cohere/command-a-reasoning-08-2025" \| "cohere/command-a-vision-07-2025" \| "deepseek/deepseek-chat" \| "deepseek/deepseek-r1-0528" \| "perplexity/sonar" \| "perplexity/sonar-pro" \| "perplexity/sonar-reasoning-pro" \| "perplexity/sonar-deep-research" \| "nousresearch/hermes-3-llama-3.1-405b" \| "nousresearch/hermes-3-llama-3.1-70b" \| "amazon/nova-lite-v1" \| "amazon/nova-micro-v1" \| "amazon/nova-pro-v1" \| "microsoft/wizardlm-2-8x22b" \| "microsoft/phi-4" \| "gryphe/mythomax-l2-13b" \| "meta-llama/llama-4-scout" \| "meta-llama/llama-4-maverick" \| "x-ai/grok-3" \| "x-ai/grok-4" \| "x-ai/grok-4-fast" \| "x-ai/grok-4.1-fast" \| "x-ai/grok-4.20" \| "x-ai/grok-4.20-multi-agent" \| "x-ai/grok-code-fast-1" \| "moonshotai/kimi-k2" \| "qwen/qwen3-235b-a22b-thinking-2507" \| "qwen/qwen3-coder" \| "z-ai/glm-4-32b" \| "z-ai/glm-4.5" \| "z-ai/glm-4.5-air" \| "z-ai/glm-4.5-air:free" \| "z-ai/glm-4.5v" \| "z-ai/glm-4.6" \| "z-ai/glm-4.6v" \| "z-ai/glm-4.7" \| "z-ai/glm-4.7-flash" \| "z-ai/glm-5" \| "z-ai/glm-5-turbo" \| "z-ai/glm-5v-turbo" \| "Llama-4-Scout-17B-16E-Instruct-FP8" \| "Llama-4-Maverick-17B-128E-Instruct-FP8" \| "Llama-3.3-8B-Instruct" \| "Llama-3.3-70B-Instruct" \| "v0-1.5-md" \| "v0-1.5-lg" \| "v0-1.0-md" | No |
+| model | The language model to use for generating the list. | "o3-mini" \| "o3-2025-04-16" \| "o1" \| "o1-mini" \| "gpt-5.2-2025-12-11" \| "gpt-5.1-2025-11-13" \| "gpt-5-2025-08-07" \| "gpt-5-mini-2025-08-07" \| "gpt-5-nano-2025-08-07" \| "gpt-5-chat-latest" \| "gpt-4.1-2025-04-14" \| "gpt-4.1-mini-2025-04-14" \| "gpt-4o-mini" \| "gpt-4o" \| "gpt-4-turbo" \| "claude-opus-4-1-20250805" \| "claude-opus-4-20250514" \| "claude-sonnet-4-20250514" \| "claude-opus-4-5-20251101" \| "claude-sonnet-4-5-20250929" \| "claude-haiku-4-5-20251001" \| "claude-opus-4-6" \| "claude-sonnet-4-6" \| "claude-3-haiku-20240307" \| "Qwen/Qwen2.5-72B-Instruct-Turbo" \| "nvidia/llama-3.1-nemotron-70b-instruct" \| "meta-llama/Llama-3.3-70B-Instruct-Turbo" \| "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" \| "meta-llama/Llama-3.2-3B-Instruct-Turbo" \| "llama-3.3-70b-versatile" \| "llama-3.1-8b-instant" \| "llama3.3" \| "llama3.2" \| "llama3" \| "llama3.1:405b" \| "dolphin-mistral:latest" \| "openai/gpt-oss-120b" \| "openai/gpt-oss-20b" \| "google/gemini-2.5-pro-preview-03-25" \| "google/gemini-2.5-pro" \| "google/gemini-3.1-pro-preview" \| "google/gemini-3-flash-preview" \| "google/gemini-2.5-flash" \| "google/gemini-2.0-flash-001" \| "google/gemini-3.1-flash-lite-preview" \| "google/gemini-2.5-flash-lite-preview-06-17" \| "google/gemini-2.0-flash-lite-001" \| "mistralai/mistral-nemo" \| "mistralai/mistral-large-2512" \| "mistralai/mistral-medium-3.1" \| "mistralai/mistral-small-3.2-24b-instruct" \| "mistralai/codestral-2508" \| "cohere/command-r-08-2024" \| "cohere/command-r-plus-08-2024" \| "cohere/command-a-03-2025" \| "cohere/command-a-translate-08-2025" \| "cohere/command-a-reasoning-08-2025" \| "cohere/command-a-vision-07-2025" \| "deepseek/deepseek-chat" \| "deepseek/deepseek-r1-0528" \| "perplexity/sonar" \| "perplexity/sonar-pro" \| "perplexity/sonar-reasoning-pro" \| "perplexity/sonar-deep-research" \| "nousresearch/hermes-3-llama-3.1-405b" \| "nousresearch/hermes-3-llama-3.1-70b" \| "amazon/nova-lite-v1" \| "amazon/nova-micro-v1" \| "amazon/nova-pro-v1" \| "microsoft/wizardlm-2-8x22b" \| "microsoft/phi-4" \| "gryphe/mythomax-l2-13b" \| "meta-llama/llama-4-scout" \| "meta-llama/llama-4-maverick" \| "x-ai/grok-3" \| "x-ai/grok-4" \| "x-ai/grok-4-fast" \| "x-ai/grok-4.1-fast" \| "x-ai/grok-4.20" \| "x-ai/grok-4.20-multi-agent" \| "x-ai/grok-code-fast-1" \| "moonshotai/kimi-k2" \| "moonshotai/kimi-k2-0905" \| "moonshotai/kimi-k2.5" \| "moonshotai/kimi-k2.6" \| "moonshotai/kimi-k2-thinking" \| "qwen/qwen3-235b-a22b-thinking-2507" \| "qwen/qwen3-coder" \| "z-ai/glm-4-32b" \| "z-ai/glm-4.5" \| "z-ai/glm-4.5-air" \| "z-ai/glm-4.5-air:free" \| "z-ai/glm-4.5v" \| "z-ai/glm-4.6" \| "z-ai/glm-4.6v" \| "z-ai/glm-4.7" \| "z-ai/glm-4.7-flash" \| "z-ai/glm-5" \| "z-ai/glm-5-turbo" \| "z-ai/glm-5v-turbo" \| "Llama-4-Scout-17B-16E-Instruct-FP8" \| "Llama-4-Maverick-17B-128E-Instruct-FP8" \| "Llama-3.3-8B-Instruct" \| "Llama-3.3-70B-Instruct" \| "v0-1.5-md" \| "v0-1.5-lg" \| "v0-1.0-md" | No |
| max_retries | Maximum number of retries for generating a valid list. | int | No |
| force_json_output | Whether to force the LLM to produce a JSON-only response. This can increase the block's reliability, but may also reduce the quality of the response because it prohibits the LLM from reasoning before providing its JSON response. | bool | No |
| max_tokens | The maximum number of tokens to generate in the chat completion. | int | No |
@@ -424,7 +424,7 @@ The block sends the input prompt to a chosen LLM, along with any system prompts
| prompt | The prompt to send to the language model. | str | Yes |
| expected_format | Expected format of the response. If provided, the response will be validated against this format. The keys should be the expected fields in the response, and the values should be the description of the field. | Dict[str, str] | Yes |
| list_result | Whether the response should be a list of objects in the expected format. | bool | No |
-| model | The language model to use for answering the prompt. | "o3-mini" \| "o3-2025-04-16" \| "o1" \| "o1-mini" \| "gpt-5.2-2025-12-11" \| "gpt-5.1-2025-11-13" \| "gpt-5-2025-08-07" \| "gpt-5-mini-2025-08-07" \| "gpt-5-nano-2025-08-07" \| "gpt-5-chat-latest" \| "gpt-4.1-2025-04-14" \| "gpt-4.1-mini-2025-04-14" \| "gpt-4o-mini" \| "gpt-4o" \| "gpt-4-turbo" \| "claude-opus-4-1-20250805" \| "claude-opus-4-20250514" \| "claude-sonnet-4-20250514" \| "claude-opus-4-5-20251101" \| "claude-sonnet-4-5-20250929" \| "claude-haiku-4-5-20251001" \| "claude-opus-4-6" \| "claude-sonnet-4-6" \| "claude-3-haiku-20240307" \| "Qwen/Qwen2.5-72B-Instruct-Turbo" \| "nvidia/llama-3.1-nemotron-70b-instruct" \| "meta-llama/Llama-3.3-70B-Instruct-Turbo" \| "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" \| "meta-llama/Llama-3.2-3B-Instruct-Turbo" \| "llama-3.3-70b-versatile" \| "llama-3.1-8b-instant" \| "llama3.3" \| "llama3.2" \| "llama3" \| "llama3.1:405b" \| "dolphin-mistral:latest" \| "openai/gpt-oss-120b" \| "openai/gpt-oss-20b" \| "google/gemini-2.5-pro-preview-03-25" \| "google/gemini-2.5-pro" \| "google/gemini-3.1-pro-preview" \| "google/gemini-3-flash-preview" \| "google/gemini-2.5-flash" \| "google/gemini-2.0-flash-001" \| "google/gemini-3.1-flash-lite-preview" \| "google/gemini-2.5-flash-lite-preview-06-17" \| "google/gemini-2.0-flash-lite-001" \| "mistralai/mistral-nemo" \| "mistralai/mistral-large-2512" \| "mistralai/mistral-medium-3.1" \| "mistralai/mistral-small-3.2-24b-instruct" \| "mistralai/codestral-2508" \| "cohere/command-r-08-2024" \| "cohere/command-r-plus-08-2024" \| "cohere/command-a-03-2025" \| "cohere/command-a-translate-08-2025" \| "cohere/command-a-reasoning-08-2025" \| "cohere/command-a-vision-07-2025" \| "deepseek/deepseek-chat" \| "deepseek/deepseek-r1-0528" \| "perplexity/sonar" \| "perplexity/sonar-pro" \| "perplexity/sonar-reasoning-pro" \| "perplexity/sonar-deep-research" \| "nousresearch/hermes-3-llama-3.1-405b" \| "nousresearch/hermes-3-llama-3.1-70b" \| "amazon/nova-lite-v1" \| "amazon/nova-micro-v1" \| "amazon/nova-pro-v1" \| "microsoft/wizardlm-2-8x22b" \| "microsoft/phi-4" \| "gryphe/mythomax-l2-13b" \| "meta-llama/llama-4-scout" \| "meta-llama/llama-4-maverick" \| "x-ai/grok-3" \| "x-ai/grok-4" \| "x-ai/grok-4-fast" \| "x-ai/grok-4.1-fast" \| "x-ai/grok-4.20" \| "x-ai/grok-4.20-multi-agent" \| "x-ai/grok-code-fast-1" \| "moonshotai/kimi-k2" \| "qwen/qwen3-235b-a22b-thinking-2507" \| "qwen/qwen3-coder" \| "z-ai/glm-4-32b" \| "z-ai/glm-4.5" \| "z-ai/glm-4.5-air" \| "z-ai/glm-4.5-air:free" \| "z-ai/glm-4.5v" \| "z-ai/glm-4.6" \| "z-ai/glm-4.6v" \| "z-ai/glm-4.7" \| "z-ai/glm-4.7-flash" \| "z-ai/glm-5" \| "z-ai/glm-5-turbo" \| "z-ai/glm-5v-turbo" \| "Llama-4-Scout-17B-16E-Instruct-FP8" \| "Llama-4-Maverick-17B-128E-Instruct-FP8" \| "Llama-3.3-8B-Instruct" \| "Llama-3.3-70B-Instruct" \| "v0-1.5-md" \| "v0-1.5-lg" \| "v0-1.0-md" | No |
+| model | The language model to use for answering the prompt. | "o3-mini" \| "o3-2025-04-16" \| "o1" \| "o1-mini" \| "gpt-5.2-2025-12-11" \| "gpt-5.1-2025-11-13" \| "gpt-5-2025-08-07" \| "gpt-5-mini-2025-08-07" \| "gpt-5-nano-2025-08-07" \| "gpt-5-chat-latest" \| "gpt-4.1-2025-04-14" \| "gpt-4.1-mini-2025-04-14" \| "gpt-4o-mini" \| "gpt-4o" \| "gpt-4-turbo" \| "claude-opus-4-1-20250805" \| "claude-opus-4-20250514" \| "claude-sonnet-4-20250514" \| "claude-opus-4-5-20251101" \| "claude-sonnet-4-5-20250929" \| "claude-haiku-4-5-20251001" \| "claude-opus-4-6" \| "claude-sonnet-4-6" \| "claude-3-haiku-20240307" \| "Qwen/Qwen2.5-72B-Instruct-Turbo" \| "nvidia/llama-3.1-nemotron-70b-instruct" \| "meta-llama/Llama-3.3-70B-Instruct-Turbo" \| "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" \| "meta-llama/Llama-3.2-3B-Instruct-Turbo" \| "llama-3.3-70b-versatile" \| "llama-3.1-8b-instant" \| "llama3.3" \| "llama3.2" \| "llama3" \| "llama3.1:405b" \| "dolphin-mistral:latest" \| "openai/gpt-oss-120b" \| "openai/gpt-oss-20b" \| "google/gemini-2.5-pro-preview-03-25" \| "google/gemini-2.5-pro" \| "google/gemini-3.1-pro-preview" \| "google/gemini-3-flash-preview" \| "google/gemini-2.5-flash" \| "google/gemini-2.0-flash-001" \| "google/gemini-3.1-flash-lite-preview" \| "google/gemini-2.5-flash-lite-preview-06-17" \| "google/gemini-2.0-flash-lite-001" \| "mistralai/mistral-nemo" \| "mistralai/mistral-large-2512" \| "mistralai/mistral-medium-3.1" \| "mistralai/mistral-small-3.2-24b-instruct" \| "mistralai/codestral-2508" \| "cohere/command-r-08-2024" \| "cohere/command-r-plus-08-2024" \| "cohere/command-a-03-2025" \| "cohere/command-a-translate-08-2025" \| "cohere/command-a-reasoning-08-2025" \| "cohere/command-a-vision-07-2025" \| "deepseek/deepseek-chat" \| "deepseek/deepseek-r1-0528" \| "perplexity/sonar" \| "perplexity/sonar-pro" \| "perplexity/sonar-reasoning-pro" \| "perplexity/sonar-deep-research" \| "nousresearch/hermes-3-llama-3.1-405b" \| "nousresearch/hermes-3-llama-3.1-70b" \| "amazon/nova-lite-v1" \| "amazon/nova-micro-v1" \| "amazon/nova-pro-v1" \| "microsoft/wizardlm-2-8x22b" \| "microsoft/phi-4" \| "gryphe/mythomax-l2-13b" \| "meta-llama/llama-4-scout" \| "meta-llama/llama-4-maverick" \| "x-ai/grok-3" \| "x-ai/grok-4" \| "x-ai/grok-4-fast" \| "x-ai/grok-4.1-fast" \| "x-ai/grok-4.20" \| "x-ai/grok-4.20-multi-agent" \| "x-ai/grok-code-fast-1" \| "moonshotai/kimi-k2" \| "moonshotai/kimi-k2-0905" \| "moonshotai/kimi-k2.5" \| "moonshotai/kimi-k2.6" \| "moonshotai/kimi-k2-thinking" \| "qwen/qwen3-235b-a22b-thinking-2507" \| "qwen/qwen3-coder" \| "z-ai/glm-4-32b" \| "z-ai/glm-4.5" \| "z-ai/glm-4.5-air" \| "z-ai/glm-4.5-air:free" \| "z-ai/glm-4.5v" \| "z-ai/glm-4.6" \| "z-ai/glm-4.6v" \| "z-ai/glm-4.7" \| "z-ai/glm-4.7-flash" \| "z-ai/glm-5" \| "z-ai/glm-5-turbo" \| "z-ai/glm-5v-turbo" \| "Llama-4-Scout-17B-16E-Instruct-FP8" \| "Llama-4-Maverick-17B-128E-Instruct-FP8" \| "Llama-3.3-8B-Instruct" \| "Llama-3.3-70B-Instruct" \| "v0-1.5-md" \| "v0-1.5-lg" \| "v0-1.0-md" | No |
| force_json_output | Whether to force the LLM to produce a JSON-only response. This can increase the block's reliability, but may also reduce the quality of the response because it prohibits the LLM from reasoning before providing its JSON response. | bool | No |
| sys_prompt | The system prompt to provide additional context to the model. | str | No |
| conversation_history | The conversation history to provide context for the prompt. | List[Dict[str, Any]] | No |
@@ -464,7 +464,7 @@ The block sends the input prompt to a chosen LLM, processes the response, and re
| Input | Description | Type | Required |
|-------|-------------|------|----------|
| prompt | The prompt to send to the language model. You can use any of the {keys} from Prompt Values to fill in the prompt with values from the prompt values dictionary by putting them in curly braces. | str | Yes |
-| model | The language model to use for answering the prompt. | "o3-mini" \| "o3-2025-04-16" \| "o1" \| "o1-mini" \| "gpt-5.2-2025-12-11" \| "gpt-5.1-2025-11-13" \| "gpt-5-2025-08-07" \| "gpt-5-mini-2025-08-07" \| "gpt-5-nano-2025-08-07" \| "gpt-5-chat-latest" \| "gpt-4.1-2025-04-14" \| "gpt-4.1-mini-2025-04-14" \| "gpt-4o-mini" \| "gpt-4o" \| "gpt-4-turbo" \| "claude-opus-4-1-20250805" \| "claude-opus-4-20250514" \| "claude-sonnet-4-20250514" \| "claude-opus-4-5-20251101" \| "claude-sonnet-4-5-20250929" \| "claude-haiku-4-5-20251001" \| "claude-opus-4-6" \| "claude-sonnet-4-6" \| "claude-3-haiku-20240307" \| "Qwen/Qwen2.5-72B-Instruct-Turbo" \| "nvidia/llama-3.1-nemotron-70b-instruct" \| "meta-llama/Llama-3.3-70B-Instruct-Turbo" \| "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" \| "meta-llama/Llama-3.2-3B-Instruct-Turbo" \| "llama-3.3-70b-versatile" \| "llama-3.1-8b-instant" \| "llama3.3" \| "llama3.2" \| "llama3" \| "llama3.1:405b" \| "dolphin-mistral:latest" \| "openai/gpt-oss-120b" \| "openai/gpt-oss-20b" \| "google/gemini-2.5-pro-preview-03-25" \| "google/gemini-2.5-pro" \| "google/gemini-3.1-pro-preview" \| "google/gemini-3-flash-preview" \| "google/gemini-2.5-flash" \| "google/gemini-2.0-flash-001" \| "google/gemini-3.1-flash-lite-preview" \| "google/gemini-2.5-flash-lite-preview-06-17" \| "google/gemini-2.0-flash-lite-001" \| "mistralai/mistral-nemo" \| "mistralai/mistral-large-2512" \| "mistralai/mistral-medium-3.1" \| "mistralai/mistral-small-3.2-24b-instruct" \| "mistralai/codestral-2508" \| "cohere/command-r-08-2024" \| "cohere/command-r-plus-08-2024" \| "cohere/command-a-03-2025" \| "cohere/command-a-translate-08-2025" \| "cohere/command-a-reasoning-08-2025" \| "cohere/command-a-vision-07-2025" \| "deepseek/deepseek-chat" \| "deepseek/deepseek-r1-0528" \| "perplexity/sonar" \| "perplexity/sonar-pro" \| "perplexity/sonar-reasoning-pro" \| "perplexity/sonar-deep-research" \| "nousresearch/hermes-3-llama-3.1-405b" \| "nousresearch/hermes-3-llama-3.1-70b" \| "amazon/nova-lite-v1" \| "amazon/nova-micro-v1" \| "amazon/nova-pro-v1" \| "microsoft/wizardlm-2-8x22b" \| "microsoft/phi-4" \| "gryphe/mythomax-l2-13b" \| "meta-llama/llama-4-scout" \| "meta-llama/llama-4-maverick" \| "x-ai/grok-3" \| "x-ai/grok-4" \| "x-ai/grok-4-fast" \| "x-ai/grok-4.1-fast" \| "x-ai/grok-4.20" \| "x-ai/grok-4.20-multi-agent" \| "x-ai/grok-code-fast-1" \| "moonshotai/kimi-k2" \| "qwen/qwen3-235b-a22b-thinking-2507" \| "qwen/qwen3-coder" \| "z-ai/glm-4-32b" \| "z-ai/glm-4.5" \| "z-ai/glm-4.5-air" \| "z-ai/glm-4.5-air:free" \| "z-ai/glm-4.5v" \| "z-ai/glm-4.6" \| "z-ai/glm-4.6v" \| "z-ai/glm-4.7" \| "z-ai/glm-4.7-flash" \| "z-ai/glm-5" \| "z-ai/glm-5-turbo" \| "z-ai/glm-5v-turbo" \| "Llama-4-Scout-17B-16E-Instruct-FP8" \| "Llama-4-Maverick-17B-128E-Instruct-FP8" \| "Llama-3.3-8B-Instruct" \| "Llama-3.3-70B-Instruct" \| "v0-1.5-md" \| "v0-1.5-lg" \| "v0-1.0-md" | No |
+| model | The language model to use for answering the prompt. | "o3-mini" \| "o3-2025-04-16" \| "o1" \| "o1-mini" \| "gpt-5.2-2025-12-11" \| "gpt-5.1-2025-11-13" \| "gpt-5-2025-08-07" \| "gpt-5-mini-2025-08-07" \| "gpt-5-nano-2025-08-07" \| "gpt-5-chat-latest" \| "gpt-4.1-2025-04-14" \| "gpt-4.1-mini-2025-04-14" \| "gpt-4o-mini" \| "gpt-4o" \| "gpt-4-turbo" \| "claude-opus-4-1-20250805" \| "claude-opus-4-20250514" \| "claude-sonnet-4-20250514" \| "claude-opus-4-5-20251101" \| "claude-sonnet-4-5-20250929" \| "claude-haiku-4-5-20251001" \| "claude-opus-4-6" \| "claude-sonnet-4-6" \| "claude-3-haiku-20240307" \| "Qwen/Qwen2.5-72B-Instruct-Turbo" \| "nvidia/llama-3.1-nemotron-70b-instruct" \| "meta-llama/Llama-3.3-70B-Instruct-Turbo" \| "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" \| "meta-llama/Llama-3.2-3B-Instruct-Turbo" \| "llama-3.3-70b-versatile" \| "llama-3.1-8b-instant" \| "llama3.3" \| "llama3.2" \| "llama3" \| "llama3.1:405b" \| "dolphin-mistral:latest" \| "openai/gpt-oss-120b" \| "openai/gpt-oss-20b" \| "google/gemini-2.5-pro-preview-03-25" \| "google/gemini-2.5-pro" \| "google/gemini-3.1-pro-preview" \| "google/gemini-3-flash-preview" \| "google/gemini-2.5-flash" \| "google/gemini-2.0-flash-001" \| "google/gemini-3.1-flash-lite-preview" \| "google/gemini-2.5-flash-lite-preview-06-17" \| "google/gemini-2.0-flash-lite-001" \| "mistralai/mistral-nemo" \| "mistralai/mistral-large-2512" \| "mistralai/mistral-medium-3.1" \| "mistralai/mistral-small-3.2-24b-instruct" \| "mistralai/codestral-2508" \| "cohere/command-r-08-2024" \| "cohere/command-r-plus-08-2024" \| "cohere/command-a-03-2025" \| "cohere/command-a-translate-08-2025" \| "cohere/command-a-reasoning-08-2025" \| "cohere/command-a-vision-07-2025" \| "deepseek/deepseek-chat" \| "deepseek/deepseek-r1-0528" \| "perplexity/sonar" \| "perplexity/sonar-pro" \| "perplexity/sonar-reasoning-pro" \| "perplexity/sonar-deep-research" \| "nousresearch/hermes-3-llama-3.1-405b" \| "nousresearch/hermes-3-llama-3.1-70b" \| "amazon/nova-lite-v1" \| "amazon/nova-micro-v1" \| "amazon/nova-pro-v1" \| "microsoft/wizardlm-2-8x22b" \| "microsoft/phi-4" \| "gryphe/mythomax-l2-13b" \| "meta-llama/llama-4-scout" \| "meta-llama/llama-4-maverick" \| "x-ai/grok-3" \| "x-ai/grok-4" \| "x-ai/grok-4-fast" \| "x-ai/grok-4.1-fast" \| "x-ai/grok-4.20" \| "x-ai/grok-4.20-multi-agent" \| "x-ai/grok-code-fast-1" \| "moonshotai/kimi-k2" \| "moonshotai/kimi-k2-0905" \| "moonshotai/kimi-k2.5" \| "moonshotai/kimi-k2.6" \| "moonshotai/kimi-k2-thinking" \| "qwen/qwen3-235b-a22b-thinking-2507" \| "qwen/qwen3-coder" \| "z-ai/glm-4-32b" \| "z-ai/glm-4.5" \| "z-ai/glm-4.5-air" \| "z-ai/glm-4.5-air:free" \| "z-ai/glm-4.5v" \| "z-ai/glm-4.6" \| "z-ai/glm-4.6v" \| "z-ai/glm-4.7" \| "z-ai/glm-4.7-flash" \| "z-ai/glm-5" \| "z-ai/glm-5-turbo" \| "z-ai/glm-5v-turbo" \| "Llama-4-Scout-17B-16E-Instruct-FP8" \| "Llama-4-Maverick-17B-128E-Instruct-FP8" \| "Llama-3.3-8B-Instruct" \| "Llama-3.3-70B-Instruct" \| "v0-1.5-md" \| "v0-1.5-lg" \| "v0-1.0-md" | No |
| sys_prompt | The system prompt to provide additional context to the model. | str | No |
| retry | Number of times to retry the LLM call if the response does not match the expected format. | int | No |
| prompt_values | Values used to fill in the prompt. The values can be used in the prompt by putting them in a double curly braces, e.g. {{variable_name}}. | Dict[str, str] | No |
@@ -501,7 +501,7 @@ The block splits the input text into smaller chunks, sends each chunk to an LLM
| Input | Description | Type | Required |
|-------|-------------|------|----------|
| text | The text to summarize. | str | Yes |
-| model | The language model to use for summarizing the text. | "o3-mini" \| "o3-2025-04-16" \| "o1" \| "o1-mini" \| "gpt-5.2-2025-12-11" \| "gpt-5.1-2025-11-13" \| "gpt-5-2025-08-07" \| "gpt-5-mini-2025-08-07" \| "gpt-5-nano-2025-08-07" \| "gpt-5-chat-latest" \| "gpt-4.1-2025-04-14" \| "gpt-4.1-mini-2025-04-14" \| "gpt-4o-mini" \| "gpt-4o" \| "gpt-4-turbo" \| "claude-opus-4-1-20250805" \| "claude-opus-4-20250514" \| "claude-sonnet-4-20250514" \| "claude-opus-4-5-20251101" \| "claude-sonnet-4-5-20250929" \| "claude-haiku-4-5-20251001" \| "claude-opus-4-6" \| "claude-sonnet-4-6" \| "claude-3-haiku-20240307" \| "Qwen/Qwen2.5-72B-Instruct-Turbo" \| "nvidia/llama-3.1-nemotron-70b-instruct" \| "meta-llama/Llama-3.3-70B-Instruct-Turbo" \| "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" \| "meta-llama/Llama-3.2-3B-Instruct-Turbo" \| "llama-3.3-70b-versatile" \| "llama-3.1-8b-instant" \| "llama3.3" \| "llama3.2" \| "llama3" \| "llama3.1:405b" \| "dolphin-mistral:latest" \| "openai/gpt-oss-120b" \| "openai/gpt-oss-20b" \| "google/gemini-2.5-pro-preview-03-25" \| "google/gemini-2.5-pro" \| "google/gemini-3.1-pro-preview" \| "google/gemini-3-flash-preview" \| "google/gemini-2.5-flash" \| "google/gemini-2.0-flash-001" \| "google/gemini-3.1-flash-lite-preview" \| "google/gemini-2.5-flash-lite-preview-06-17" \| "google/gemini-2.0-flash-lite-001" \| "mistralai/mistral-nemo" \| "mistralai/mistral-large-2512" \| "mistralai/mistral-medium-3.1" \| "mistralai/mistral-small-3.2-24b-instruct" \| "mistralai/codestral-2508" \| "cohere/command-r-08-2024" \| "cohere/command-r-plus-08-2024" \| "cohere/command-a-03-2025" \| "cohere/command-a-translate-08-2025" \| "cohere/command-a-reasoning-08-2025" \| "cohere/command-a-vision-07-2025" \| "deepseek/deepseek-chat" \| "deepseek/deepseek-r1-0528" \| "perplexity/sonar" \| "perplexity/sonar-pro" \| "perplexity/sonar-reasoning-pro" \| "perplexity/sonar-deep-research" \| "nousresearch/hermes-3-llama-3.1-405b" \| "nousresearch/hermes-3-llama-3.1-70b" \| "amazon/nova-lite-v1" \| "amazon/nova-micro-v1" \| "amazon/nova-pro-v1" \| "microsoft/wizardlm-2-8x22b" \| "microsoft/phi-4" \| "gryphe/mythomax-l2-13b" \| "meta-llama/llama-4-scout" \| "meta-llama/llama-4-maverick" \| "x-ai/grok-3" \| "x-ai/grok-4" \| "x-ai/grok-4-fast" \| "x-ai/grok-4.1-fast" \| "x-ai/grok-4.20" \| "x-ai/grok-4.20-multi-agent" \| "x-ai/grok-code-fast-1" \| "moonshotai/kimi-k2" \| "qwen/qwen3-235b-a22b-thinking-2507" \| "qwen/qwen3-coder" \| "z-ai/glm-4-32b" \| "z-ai/glm-4.5" \| "z-ai/glm-4.5-air" \| "z-ai/glm-4.5-air:free" \| "z-ai/glm-4.5v" \| "z-ai/glm-4.6" \| "z-ai/glm-4.6v" \| "z-ai/glm-4.7" \| "z-ai/glm-4.7-flash" \| "z-ai/glm-5" \| "z-ai/glm-5-turbo" \| "z-ai/glm-5v-turbo" \| "Llama-4-Scout-17B-16E-Instruct-FP8" \| "Llama-4-Maverick-17B-128E-Instruct-FP8" \| "Llama-3.3-8B-Instruct" \| "Llama-3.3-70B-Instruct" \| "v0-1.5-md" \| "v0-1.5-lg" \| "v0-1.0-md" | No |
+| model | The language model to use for summarizing the text. | "o3-mini" \| "o3-2025-04-16" \| "o1" \| "o1-mini" \| "gpt-5.2-2025-12-11" \| "gpt-5.1-2025-11-13" \| "gpt-5-2025-08-07" \| "gpt-5-mini-2025-08-07" \| "gpt-5-nano-2025-08-07" \| "gpt-5-chat-latest" \| "gpt-4.1-2025-04-14" \| "gpt-4.1-mini-2025-04-14" \| "gpt-4o-mini" \| "gpt-4o" \| "gpt-4-turbo" \| "claude-opus-4-1-20250805" \| "claude-opus-4-20250514" \| "claude-sonnet-4-20250514" \| "claude-opus-4-5-20251101" \| "claude-sonnet-4-5-20250929" \| "claude-haiku-4-5-20251001" \| "claude-opus-4-6" \| "claude-sonnet-4-6" \| "claude-3-haiku-20240307" \| "Qwen/Qwen2.5-72B-Instruct-Turbo" \| "nvidia/llama-3.1-nemotron-70b-instruct" \| "meta-llama/Llama-3.3-70B-Instruct-Turbo" \| "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" \| "meta-llama/Llama-3.2-3B-Instruct-Turbo" \| "llama-3.3-70b-versatile" \| "llama-3.1-8b-instant" \| "llama3.3" \| "llama3.2" \| "llama3" \| "llama3.1:405b" \| "dolphin-mistral:latest" \| "openai/gpt-oss-120b" \| "openai/gpt-oss-20b" \| "google/gemini-2.5-pro-preview-03-25" \| "google/gemini-2.5-pro" \| "google/gemini-3.1-pro-preview" \| "google/gemini-3-flash-preview" \| "google/gemini-2.5-flash" \| "google/gemini-2.0-flash-001" \| "google/gemini-3.1-flash-lite-preview" \| "google/gemini-2.5-flash-lite-preview-06-17" \| "google/gemini-2.0-flash-lite-001" \| "mistralai/mistral-nemo" \| "mistralai/mistral-large-2512" \| "mistralai/mistral-medium-3.1" \| "mistralai/mistral-small-3.2-24b-instruct" \| "mistralai/codestral-2508" \| "cohere/command-r-08-2024" \| "cohere/command-r-plus-08-2024" \| "cohere/command-a-03-2025" \| "cohere/command-a-translate-08-2025" \| "cohere/command-a-reasoning-08-2025" \| "cohere/command-a-vision-07-2025" \| "deepseek/deepseek-chat" \| "deepseek/deepseek-r1-0528" \| "perplexity/sonar" \| "perplexity/sonar-pro" \| "perplexity/sonar-reasoning-pro" \| "perplexity/sonar-deep-research" \| "nousresearch/hermes-3-llama-3.1-405b" \| "nousresearch/hermes-3-llama-3.1-70b" \| "amazon/nova-lite-v1" \| "amazon/nova-micro-v1" \| "amazon/nova-pro-v1" \| "microsoft/wizardlm-2-8x22b" \| "microsoft/phi-4" \| "gryphe/mythomax-l2-13b" \| "meta-llama/llama-4-scout" \| "meta-llama/llama-4-maverick" \| "x-ai/grok-3" \| "x-ai/grok-4" \| "x-ai/grok-4-fast" \| "x-ai/grok-4.1-fast" \| "x-ai/grok-4.20" \| "x-ai/grok-4.20-multi-agent" \| "x-ai/grok-code-fast-1" \| "moonshotai/kimi-k2" \| "moonshotai/kimi-k2-0905" \| "moonshotai/kimi-k2.5" \| "moonshotai/kimi-k2.6" \| "moonshotai/kimi-k2-thinking" \| "qwen/qwen3-235b-a22b-thinking-2507" \| "qwen/qwen3-coder" \| "z-ai/glm-4-32b" \| "z-ai/glm-4.5" \| "z-ai/glm-4.5-air" \| "z-ai/glm-4.5-air:free" \| "z-ai/glm-4.5v" \| "z-ai/glm-4.6" \| "z-ai/glm-4.6v" \| "z-ai/glm-4.7" \| "z-ai/glm-4.7-flash" \| "z-ai/glm-5" \| "z-ai/glm-5-turbo" \| "z-ai/glm-5v-turbo" \| "Llama-4-Scout-17B-16E-Instruct-FP8" \| "Llama-4-Maverick-17B-128E-Instruct-FP8" \| "Llama-3.3-8B-Instruct" \| "Llama-3.3-70B-Instruct" \| "v0-1.5-md" \| "v0-1.5-lg" \| "v0-1.0-md" | No |
| focus | The topic to focus on in the summary | str | No |
| style | The style of the summary to generate. | "concise" \| "detailed" \| "bullet points" \| "numbered list" | No |
| max_tokens | The maximum number of tokens to generate in the chat completion. | int | No |
@@ -721,7 +721,7 @@ _Add technical explanation here._
| Input | Description | Type | Required |
|-------|-------------|------|----------|
| prompt | The prompt to send to the language model. | str | Yes |
-| model | The language model to use for answering the prompt. | "o3-mini" \| "o3-2025-04-16" \| "o1" \| "o1-mini" \| "gpt-5.2-2025-12-11" \| "gpt-5.1-2025-11-13" \| "gpt-5-2025-08-07" \| "gpt-5-mini-2025-08-07" \| "gpt-5-nano-2025-08-07" \| "gpt-5-chat-latest" \| "gpt-4.1-2025-04-14" \| "gpt-4.1-mini-2025-04-14" \| "gpt-4o-mini" \| "gpt-4o" \| "gpt-4-turbo" \| "claude-opus-4-1-20250805" \| "claude-opus-4-20250514" \| "claude-sonnet-4-20250514" \| "claude-opus-4-5-20251101" \| "claude-sonnet-4-5-20250929" \| "claude-haiku-4-5-20251001" \| "claude-opus-4-6" \| "claude-sonnet-4-6" \| "claude-3-haiku-20240307" \| "Qwen/Qwen2.5-72B-Instruct-Turbo" \| "nvidia/llama-3.1-nemotron-70b-instruct" \| "meta-llama/Llama-3.3-70B-Instruct-Turbo" \| "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" \| "meta-llama/Llama-3.2-3B-Instruct-Turbo" \| "llama-3.3-70b-versatile" \| "llama-3.1-8b-instant" \| "llama3.3" \| "llama3.2" \| "llama3" \| "llama3.1:405b" \| "dolphin-mistral:latest" \| "openai/gpt-oss-120b" \| "openai/gpt-oss-20b" \| "google/gemini-2.5-pro-preview-03-25" \| "google/gemini-2.5-pro" \| "google/gemini-3.1-pro-preview" \| "google/gemini-3-flash-preview" \| "google/gemini-2.5-flash" \| "google/gemini-2.0-flash-001" \| "google/gemini-3.1-flash-lite-preview" \| "google/gemini-2.5-flash-lite-preview-06-17" \| "google/gemini-2.0-flash-lite-001" \| "mistralai/mistral-nemo" \| "mistralai/mistral-large-2512" \| "mistralai/mistral-medium-3.1" \| "mistralai/mistral-small-3.2-24b-instruct" \| "mistralai/codestral-2508" \| "cohere/command-r-08-2024" \| "cohere/command-r-plus-08-2024" \| "cohere/command-a-03-2025" \| "cohere/command-a-translate-08-2025" \| "cohere/command-a-reasoning-08-2025" \| "cohere/command-a-vision-07-2025" \| "deepseek/deepseek-chat" \| "deepseek/deepseek-r1-0528" \| "perplexity/sonar" \| "perplexity/sonar-pro" \| "perplexity/sonar-reasoning-pro" \| "perplexity/sonar-deep-research" \| "nousresearch/hermes-3-llama-3.1-405b" \| "nousresearch/hermes-3-llama-3.1-70b" \| "amazon/nova-lite-v1" \| "amazon/nova-micro-v1" \| "amazon/nova-pro-v1" \| "microsoft/wizardlm-2-8x22b" \| "microsoft/phi-4" \| "gryphe/mythomax-l2-13b" \| "meta-llama/llama-4-scout" \| "meta-llama/llama-4-maverick" \| "x-ai/grok-3" \| "x-ai/grok-4" \| "x-ai/grok-4-fast" \| "x-ai/grok-4.1-fast" \| "x-ai/grok-4.20" \| "x-ai/grok-4.20-multi-agent" \| "x-ai/grok-code-fast-1" \| "moonshotai/kimi-k2" \| "qwen/qwen3-235b-a22b-thinking-2507" \| "qwen/qwen3-coder" \| "z-ai/glm-4-32b" \| "z-ai/glm-4.5" \| "z-ai/glm-4.5-air" \| "z-ai/glm-4.5-air:free" \| "z-ai/glm-4.5v" \| "z-ai/glm-4.6" \| "z-ai/glm-4.6v" \| "z-ai/glm-4.7" \| "z-ai/glm-4.7-flash" \| "z-ai/glm-5" \| "z-ai/glm-5-turbo" \| "z-ai/glm-5v-turbo" \| "Llama-4-Scout-17B-16E-Instruct-FP8" \| "Llama-4-Maverick-17B-128E-Instruct-FP8" \| "Llama-3.3-8B-Instruct" \| "Llama-3.3-70B-Instruct" \| "v0-1.5-md" \| "v0-1.5-lg" \| "v0-1.0-md" | No |
+| model | The language model to use for answering the prompt. | "o3-mini" \| "o3-2025-04-16" \| "o1" \| "o1-mini" \| "gpt-5.2-2025-12-11" \| "gpt-5.1-2025-11-13" \| "gpt-5-2025-08-07" \| "gpt-5-mini-2025-08-07" \| "gpt-5-nano-2025-08-07" \| "gpt-5-chat-latest" \| "gpt-4.1-2025-04-14" \| "gpt-4.1-mini-2025-04-14" \| "gpt-4o-mini" \| "gpt-4o" \| "gpt-4-turbo" \| "claude-opus-4-1-20250805" \| "claude-opus-4-20250514" \| "claude-sonnet-4-20250514" \| "claude-opus-4-5-20251101" \| "claude-sonnet-4-5-20250929" \| "claude-haiku-4-5-20251001" \| "claude-opus-4-6" \| "claude-sonnet-4-6" \| "claude-3-haiku-20240307" \| "Qwen/Qwen2.5-72B-Instruct-Turbo" \| "nvidia/llama-3.1-nemotron-70b-instruct" \| "meta-llama/Llama-3.3-70B-Instruct-Turbo" \| "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" \| "meta-llama/Llama-3.2-3B-Instruct-Turbo" \| "llama-3.3-70b-versatile" \| "llama-3.1-8b-instant" \| "llama3.3" \| "llama3.2" \| "llama3" \| "llama3.1:405b" \| "dolphin-mistral:latest" \| "openai/gpt-oss-120b" \| "openai/gpt-oss-20b" \| "google/gemini-2.5-pro-preview-03-25" \| "google/gemini-2.5-pro" \| "google/gemini-3.1-pro-preview" \| "google/gemini-3-flash-preview" \| "google/gemini-2.5-flash" \| "google/gemini-2.0-flash-001" \| "google/gemini-3.1-flash-lite-preview" \| "google/gemini-2.5-flash-lite-preview-06-17" \| "google/gemini-2.0-flash-lite-001" \| "mistralai/mistral-nemo" \| "mistralai/mistral-large-2512" \| "mistralai/mistral-medium-3.1" \| "mistralai/mistral-small-3.2-24b-instruct" \| "mistralai/codestral-2508" \| "cohere/command-r-08-2024" \| "cohere/command-r-plus-08-2024" \| "cohere/command-a-03-2025" \| "cohere/command-a-translate-08-2025" \| "cohere/command-a-reasoning-08-2025" \| "cohere/command-a-vision-07-2025" \| "deepseek/deepseek-chat" \| "deepseek/deepseek-r1-0528" \| "perplexity/sonar" \| "perplexity/sonar-pro" \| "perplexity/sonar-reasoning-pro" \| "perplexity/sonar-deep-research" \| "nousresearch/hermes-3-llama-3.1-405b" \| "nousresearch/hermes-3-llama-3.1-70b" \| "amazon/nova-lite-v1" \| "amazon/nova-micro-v1" \| "amazon/nova-pro-v1" \| "microsoft/wizardlm-2-8x22b" \| "microsoft/phi-4" \| "gryphe/mythomax-l2-13b" \| "meta-llama/llama-4-scout" \| "meta-llama/llama-4-maverick" \| "x-ai/grok-3" \| "x-ai/grok-4" \| "x-ai/grok-4-fast" \| "x-ai/grok-4.1-fast" \| "x-ai/grok-4.20" \| "x-ai/grok-4.20-multi-agent" \| "x-ai/grok-code-fast-1" \| "moonshotai/kimi-k2" \| "moonshotai/kimi-k2-0905" \| "moonshotai/kimi-k2.5" \| "moonshotai/kimi-k2.6" \| "moonshotai/kimi-k2-thinking" \| "qwen/qwen3-235b-a22b-thinking-2507" \| "qwen/qwen3-coder" \| "z-ai/glm-4-32b" \| "z-ai/glm-4.5" \| "z-ai/glm-4.5-air" \| "z-ai/glm-4.5-air:free" \| "z-ai/glm-4.5v" \| "z-ai/glm-4.6" \| "z-ai/glm-4.6v" \| "z-ai/glm-4.7" \| "z-ai/glm-4.7-flash" \| "z-ai/glm-5" \| "z-ai/glm-5-turbo" \| "z-ai/glm-5v-turbo" \| "Llama-4-Scout-17B-16E-Instruct-FP8" \| "Llama-4-Maverick-17B-128E-Instruct-FP8" \| "Llama-3.3-8B-Instruct" \| "Llama-3.3-70B-Instruct" \| "v0-1.5-md" \| "v0-1.5-lg" \| "v0-1.0-md" | No |
| multiple_tool_calls | Whether to allow multiple tool calls in a single response. | bool | No |
| sys_prompt | The system prompt to provide additional context to the model. | str | No |
| conversation_history | The conversation history to provide context for the prompt. | List[Dict[str, Any]] | No |
diff --git a/docs/integrations/block-integrations/misc.md b/docs/integrations/block-integrations/misc.md
index 0bd006aae1..72ede9c537 100644
--- a/docs/integrations/block-integrations/misc.md
+++ b/docs/integrations/block-integrations/misc.md
@@ -58,7 +58,7 @@ Tool and block identifiers provided in `tools` and `blocks` are validated at run
| system_context | Optional additional context prepended to the prompt. Use this to constrain autopilot behavior, provide domain context, or set output format requirements. | str | No |
| session_id | Session ID to continue an existing autopilot conversation. Leave empty to start a new session. Use the session_id output from a previous run to continue. | str | No |
| max_recursion_depth | Maximum nesting depth when the autopilot calls this block recursively (sub-agent pattern). Prevents infinite loops. | int | No |
-| tools | Tool names to filter. Works with tools_exclude to form an allow-list or deny-list. Leave empty to apply no tool filter. | List["add_understanding" \| "ask_question" \| "bash_exec" \| "browser_act" \| "browser_navigate" \| "browser_screenshot" \| "connect_integration" \| "continue_run_block" \| "create_agent" \| "create_feature_request" \| "create_folder" \| "customize_agent" \| "delete_folder" \| "delete_workspace_file" \| "edit_agent" \| "find_agent" \| "find_block" \| "find_library_agent" \| "fix_agent_graph" \| "get_agent_building_guide" \| "get_doc_page" \| "get_mcp_guide" \| "get_sub_session_result" \| "list_folders" \| "list_workspace_files" \| "memory_forget_confirm" \| "memory_forget_search" \| "memory_search" \| "memory_store" \| "move_agents_to_folder" \| "move_folder" \| "read_workspace_file" \| "run_agent" \| "run_block" \| "run_mcp_tool" \| "run_sub_session" \| "search_docs" \| "search_feature_requests" \| "update_folder" \| "validate_agent_graph" \| "view_agent_output" \| "web_fetch" \| "web_search" \| "write_workspace_file" \| "Agent" \| "Edit" \| "Glob" \| "Grep" \| "Read" \| "Task" \| "TodoWrite" \| "WebSearch" \| "Write"] | No |
+| tools | Tool names to filter. Works with tools_exclude to form an allow-list or deny-list. Leave empty to apply no tool filter. | List["add_understanding" \| "bash_exec" \| "browser_act" \| "browser_navigate" \| "browser_screenshot" \| "connect_integration" \| "continue_run_block" \| "create_agent" \| "create_feature_request" \| "create_folder" \| "customize_agent" \| "delete_folder" \| "delete_workspace_file" \| "edit_agent" \| "find_agent" \| "find_block" \| "find_library_agent" \| "fix_agent_graph" \| "get_agent_building_guide" \| "get_doc_page" \| "get_mcp_guide" \| "get_sub_session_result" \| "list_folders" \| "list_workspace_files" \| "memory_forget_confirm" \| "memory_forget_search" \| "memory_search" \| "memory_store" \| "move_agents_to_folder" \| "move_folder" \| "read_workspace_file" \| "run_agent" \| "run_block" \| "run_mcp_tool" \| "run_sub_session" \| "search_docs" \| "search_feature_requests" \| "update_folder" \| "validate_agent_graph" \| "view_agent_output" \| "web_fetch" \| "web_search" \| "write_workspace_file" \| "Agent" \| "Edit" \| "Glob" \| "Grep" \| "Read" \| "Task" \| "TodoWrite" \| "WebSearch" \| "Write"] | No |
| tools_exclude | Controls how the 'tools' list is interpreted. True (default): 'tools' is a deny-list — listed tools are blocked, all others are allowed. An empty 'tools' list means allow everything. False: 'tools' is an allow-list — only listed tools are permitted. | bool | No |
| blocks | Block identifiers to filter when the copilot uses run_block. Each entry can be: a block name (e.g. 'HTTP Request'), a full block UUID, or the first 8 hex characters of the UUID (e.g. 'c069dc6b'). Works with blocks_exclude. Leave empty to apply no block filter. | List[str] | No |
| blocks_exclude | Controls how the 'blocks' list is interpreted. True (default): 'blocks' is a deny-list — listed blocks are blocked, all others are allowed. An empty 'blocks' list means allow everything. False: 'blocks' is an allow-list — only listed blocks are permitted. | bool | No |