π OpenHands: AI-Driven Development
refactor(llm): clean up reverse-mapping OpenHands provider models (#14725)
Engel Nysta947e312d854
diff --git a/containers/dev/compose.yml b/containers/dev/compose.ymlindex 660f471887..66e248c3e9 100644--- a/containers/dev/compose.yml+++ b/containers/dev/compose.yml@@ -13,7 +13,7 @@ services:- DOCKER_HOST_ADDR=host.docker.internal#- AGENT_SERVER_IMAGE_REPOSITORY=${AGENT_SERVER_IMAGE_REPOSITORY:-ghcr.io/openhands/agent-server}- - AGENT_SERVER_IMAGE_TAG=${AGENT_SERVER_IMAGE_TAG:-1.25.0-python}+ - AGENT_SERVER_IMAGE_TAG=${AGENT_SERVER_IMAGE_TAG:-1.28.0-python}- SANDBOX_USER_ID=${SANDBOX_USER_ID:-1234}- WORKSPACE_MOUNT_PATH=${WORKSPACE_BASE:-$PWD/workspace}ports:diff --git a/dev_config/python/.pre-commit-config.yaml b/dev_config/python/.pre-commit-config.yamlindex 12ac5c0c0f..062aa7f185 100644--- a/dev_config/python/.pre-commit-config.yaml+++ b/dev_config/python/.pre-commit-config.yaml@@ -57,8 +57,8 @@ repos:types-Markdown,pydantic,lxml,- "openhands-sdk==1.27.0",- "openhands-tools==1.27.0",+ "openhands-sdk==1.28.0",+ "openhands-tools==1.28.0","sqlalchemy>=2.0",]# To see gaps add `--html-report mypy-report/`diff --git a/docker-compose.yml b/docker-compose.ymlindex 263e8e7e64..6b89ab3204 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -8,7 +8,7 @@ services:container_name: openhands-app-${DATE:-}environment:- AGENT_SERVER_IMAGE_REPOSITORY=${AGENT_SERVER_IMAGE_REPOSITORY:-ghcr.io/openhands/agent-server}- - AGENT_SERVER_IMAGE_TAG=${AGENT_SERVER_IMAGE_TAG:-1.25.0-python}+ - AGENT_SERVER_IMAGE_TAG=${AGENT_SERVER_IMAGE_TAG:-1.28.0-python}#- SANDBOX_USER_ID=${SANDBOX_USER_ID:-1234} # enable this only if you want a specific non-root sandbox user but you will have to manually adjust permissions of ~/.openhands for this user- WORKSPACE_MOUNT_PATH=${WORKSPACE_BASE:-$PWD/workspace}ports:diff --git a/enterprise/poetry.lock b/enterprise/poetry.lockindex c9e2677deb..ebfe31775a 100644--- a/enterprise/poetry.lock+++ b/enterprise/poetry.lock@@ -5817,14 +5817,14 @@ numpy = {version = ">=2", markers = "python_version >= \"3.9\""}[[package]]name = "openhands-agent-server"-version = "1.27.0"+version = "1.28.0"description = "OpenHands Agent Server - REST/WebSocket interface for OpenHands AI Agent"optional = falsepython-versions = ">=3.12"groups = ["main"]files = [- {file = "openhands_agent_server-1.27.0-py3-none-any.whl", hash = "sha256:a15511e58b8032459a1a1cac0c9851eaa22fe48e291d6ba482da02700b656d47"},- {file = "openhands_agent_server-1.27.0.tar.gz", hash = "sha256:db2d2a30804e80408be6f3a2b0447769effaf43583121891c07f17a8c1b10209"},+ {file = "openhands_agent_server-1.28.0-py3-none-any.whl", hash = "sha256:21c7d53a708d1fb8ef62375f3db0014040a356a635e0fb4a8b02608793771453"},+ {file = "openhands_agent_server-1.28.0.tar.gz", hash = "sha256:e6bc4c98fe09ba8ce3587a11ae9bf0b550a373c35bce35fd84528485255313aa"},][package.dependencies]@@ -5832,6 +5832,7 @@ aiosqlite = ">=0.19"alembic = ">=1.13"docker = ">=7.1,<8"fastapi = ">=0.104"+openai = ">=2.33.0,<3"openhands-sdk = "*"pydantic = ">=2"sqlalchemy = ">=2"@@ -5841,7 +5842,7 @@ wsproto = ">=1.2.0"[[package]]name = "openhands-ai"-version = "1.7.0"+version = "1.8.0"description = "OpenHands: Code Less, Make More"optional = falsepython-versions = "^3.12,<3.14"@@ -5886,9 +5887,9 @@ mcp = ">=1.25"memory-profiler = ">=0.61"numpy = "*"openai = "2.33.0"-openhands-agent-server = "1.27.0"-openhands-sdk = "1.27.0"-openhands-tools = "1.27.0"+openhands-agent-server = "1.28.0"+openhands-sdk = "1.28.0"+openhands-tools = "1.28.0"opentelemetry-api = ">=1.33.1"opentelemetry-exporter-otlp-proto-grpc = ">=1.33.1"orjson = ">=3.11.6"@@ -5941,14 +5942,14 @@ url = ".."[[package]]name = "openhands-sdk"-version = "1.27.0"+version = "1.28.0"description = "OpenHands SDK - Core functionality for building AI agents"optional = falsepython-versions = ">=3.12"groups = ["main"]files = [- {file = "openhands_sdk-1.27.0-py3-none-any.whl", hash = "sha256:6a0fb0c664017757d25ab299c3581d400d7f9ce7a3ea3ad8b8f6ef00100ae7a8"},- {file = "openhands_sdk-1.27.0.tar.gz", hash = "sha256:2d8280a11cc34122b6a89a6992007b132154a2ef58adcfa0c6be28337dd8f010"},+ {file = "openhands_sdk-1.28.0-py3-none-any.whl", hash = "sha256:22f947ba012caf071678e524daf10df3e9863496e86978a71b718d3cd4058906"},+ {file = "openhands_sdk-1.28.0.tar.gz", hash = "sha256:ee083743b70c27a0e36fcc23bda3da7b22fc6cb6fcc77a5bf94a22b06ab84a20"},][package.dependencies]@@ -5975,14 +5976,14 @@ boto3 = ["boto3 (>=1.35.0)"][[package]]name = "openhands-tools"-version = "1.27.0"+version = "1.28.0"description = "OpenHands Tools - Runtime tools for AI agents"optional = falsepython-versions = ">=3.12"groups = ["main"]files = [- {file = "openhands_tools-1.27.0-py3-none-any.whl", hash = "sha256:593a9e56aeb9175fed25985748f0048e1a69db4a906cb923e9cd6bda4ff738dc"},- {file = "openhands_tools-1.27.0.tar.gz", hash = "sha256:b3f2a8457fee14d085f026ca6dd280154380aebea4d0faafc7b4784689641c96"},+ {file = "openhands_tools-1.28.0-py3-none-any.whl", hash = "sha256:6f84c383e29862c2ba6441cd16036ee90b26e8f68d3994cfb2022ced4e643feb"},+ {file = "openhands_tools-1.28.0.tar.gz", hash = "sha256:7873df6ff3a0ccea92c21523f3c7da81bb088ff38cda3dbe705f751e06ea1406"},][package.dependencies]diff --git a/enterprise/server/routes/org_models.py b/enterprise/server/routes/org_models.pyindex e03caf3c7a..7632602d07 100644--- a/enterprise/server/routes/org_models.py+++ b/enterprise/server/routes/org_models.py@@ -410,16 +410,13 @@ class OrgDefaultsSettingsResponse(BaseModel):def from_org(cls, org: Org) -> 'OrgDefaultsSettingsResponse':"""Create response from Org entity.- Denormalizes the SDK's ``litellm_proxy/`` prefix back to- ``openhands/`` so the frontend's basic-view provider/model dropdowns- can be populated, and nulls ``api_key`` so neither the raw secret- nor the ``MASKED_API_KEY`` marker leaks in the response.- ``base_url`` is returned exactly as stored so ``org.agent_settings``,- ``org_member.agent_settings_diff`` and this response always carry- the same value.+ The SDK now keeps ``openhands/`` as the public/stored provider prefix+ and translates to ``litellm_proxy/`` only at the transport boundary, so+ organization responses should not reverse-map model names. Secret+ values are still stripped before returning the response."""agent_settings = _load_persisted_agent_settings(org.agent_settings)- cls._denormalize_llm_for_response(agent_settings)+ cls._prepare_llm_for_response(agent_settings)return cls(agent_settings=agent_settings,conversation_settings=_load_persisted_conversation_settings(@@ -430,31 +427,16 @@ class OrgDefaultsSettingsResponse(BaseModel):)@staticmethod- def _denormalize_llm_for_response(agent_settings: AgentSettingsConfig) -> None:- """Rewrite ``agent_settings.llm`` in-place for UI consumption.-- * ``litellm_proxy/X`` β ``openhands/X`` so the basic-view provider- dropdown matches (the SDK's ``AgentSettings`` validator- normalizes the other direction on load).- * ``base_url`` is returned **as stored** so the three sync targets- (``org.agent_settings.llm.base_url``,- ``org_member.agent_settings_diff.llm.base_url``, and the GET- response) always agree. The frontend is responsible for- recognizing the managed LiteLLM proxy URL / provider-default URL- as "basic mode" β see ``KNOWN_PROVIDER_DEFAULT_BASE_URLS`` in- ``frontend/src/routes/llm-settings.tsx``.- * ``api_key`` is nulled so neither the raw secret nor the- ``MASKED_API_KEY`` marker leaks in the response β the frontend- reads ``llm_api_key_set`` to know whether a key exists.-- Pydantic v2 field assignment bypasses ``field_validator`` /- ``model_validator`` by default (``validate_assignment`` is off on- the SDK's ``LLM`` model), so the rename survives without being- re-normalized back to ``litellm_proxy/``.- """+ def _prepare_llm_for_response(agent_settings: AgentSettingsConfig) -> None:+ """Strip response-only LLM fields without changing provider names."""llm = agent_settings.llm- if llm.model and llm.model.startswith('litellm_proxy/'):- llm.model = f'openhands/{llm.model.removeprefix("litellm_proxy/")}'+ if (+ llm.model+ and llm.model.startswith('openhands/')+ and llm.base_url+ and llm.base_url.rstrip('/') == LITE_LLM_API_URL.rstrip('/')+ ):+ llm.base_url = Nonellm.api_key = Nonediff --git a/enterprise/tests/unit/server/routes/test_org_defaults_settings.py b/enterprise/tests/unit/server/routes/test_org_defaults_settings.pyindex 3648eda83f..dbc1c94f0b 100644--- a/enterprise/tests/unit/server/routes/test_org_defaults_settings.py+++ b/enterprise/tests/unit/server/routes/test_org_defaults_settings.py@@ -142,14 +142,14 @@ def test_from_org_preserves_acp_agent_settings_without_500():assert response.agent_settings.agent_context is None-def test_from_org_denormalizes_litellm_proxy_prefix_and_returns_base_url_as_stored():- """Managed-model responses should be denormalized for the frontend."""+def test_from_org_keeps_openhands_prefix_and_hides_managed_base_url():+ """Managed OpenHands models should return the public prefix in basic mode."""org = MagicMock(spec=Org)org.agent_settings = {'schema_version': 1,'agent': 'CodeActAgent','llm': {- 'model': 'litellm_proxy/minimax-m2.5',+ 'model': 'openhands/minimax-m2.5','base_url': LITE_LLM_API_URL,'api_key': MASKED_API_KEY,},@@ -161,7 +161,7 @@ def test_from_org_denormalizes_litellm_proxy_prefix_and_returns_base_url_as_storresponse = OrgDefaultsSettingsResponse.from_org(org)assert response.agent_settings.llm.model == 'openhands/minimax-m2.5'- assert response.agent_settings.llm.base_url == LITE_LLM_API_URL+ assert response.agent_settings.llm.base_url is Noneassert response.agent_settings.llm.api_key is Nonediff --git a/enterprise/tests/unit/test_org_store.py b/enterprise/tests/unit/test_org_store.pyindex 2627c1d218..2252116a4a 100644--- a/enterprise/tests/unit/test_org_store.py+++ b/enterprise/tests/unit/test_org_store.py@@ -135,7 +135,7 @@ async def test_update_org(async_session_maker, mock_litellm_api):assert updated_org is not Noneassert updated_org.name == 'updated-org'agent_settings = OrgStore.get_agent_settings_from_org(updated_org)- assert agent_settings.llm.model == 'litellm_proxy/claude-3'+ assert agent_settings.llm.model == 'openhands/claude-3'def test_get_org_settings_from_org_use_persisted_loaders():@@ -1427,7 +1427,7 @@ async def test_update_org_defaults_async_propagates_managed_key_reset():assert result is not Noneagent_settings = OrgStore.get_agent_settings_from_org(result)- assert agent_settings.llm.model == 'litellm_proxy/claude-3'+ assert agent_settings.llm.model == 'openhands/claude-3'mock_member_update.assert_called_once()member_settings = mock_member_update.call_args[0][2]assert member_settings.llm_api_key.get_secret_value() == 'managed-key'diff --git a/enterprise/tests/unit/test_saas_settings_store.py b/enterprise/tests/unit/test_saas_settings_store.pyindex fee832f958..a2cb841b63 100644--- a/enterprise/tests/unit/test_saas_settings_store.py+++ b/enterprise/tests/unit/test_saas_settings_store.py@@ -539,10 +539,9 @@ async def test_store_keeps_openhands_managed_keys_member_specific(with session_maker() as session:org = session.execute(select(Org).where(Org.id == org_id)).scalars().first()assert org is not None- # Settings normalizes openhands/ β litellm_proxy/ during construction+ # Settings keeps the public openhands/ provider prefix in persisted dataassert (- org.agent_settings['llm']['model']- == 'litellm_proxy/claude-opus-4-5-20251101'+ org.agent_settings['llm']['model'] == 'openhands/claude-opus-4-5-20251101')assert org.agent_settings['llm']['base_url'] == LITE_LLM_API_URLassert org.conversation_settings['max_iterations'] == 75@@ -568,7 +567,7 @@ async def test_store_keeps_openhands_managed_keys_member_specific(for member in members.values():assert (member.agent_settings_diff['llm']['model']- == 'litellm_proxy/claude-opus-4-5-20251101'+ == 'openhands/claude-opus-4-5-20251101')assert member.agent_settings_diff['llm']['base_url'] == LITE_LLM_API_URLassert member.conversation_settings_diff['max_iterations'] == 75diff --git a/frontend/__tests__/routes/llm-settings.test.tsx b/frontend/__tests__/routes/llm-settings.test.tsxindex c43fce2d5c..053c2e90d9 100644--- a/frontend/__tests__/routes/llm-settings.test.tsx+++ b/frontend/__tests__/routes/llm-settings.test.tsx@@ -348,6 +348,74 @@ describe("LlmSettingsScreen", () => {expect(screen.getByTestId("base-url-input")).toBeInTheDocument();});+ it("defaults to basic view when an OpenHands managed model has no base URL", async () => {+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(+ buildSettingsWithAdvancedToggle({+ llm_model: "openhands/claude-opus-4-5-20251101",+ llm_base_url: "",+ agent_settings: {+ llm: {+ model: "openhands/claude-opus-4-5-20251101",+ },+ },+ }),+ );++ await renderLlmSettingsScreen({ appMode: "oss" });++ await screen.findByTestId("llm-settings-form-basic");+ expect(+ screen.queryByTestId("llm-settings-form-advanced"),+ ).not.toBeInTheDocument();+ });++ it("opens advanced view when an OpenHands model has a custom base URL", async () => {+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(+ buildSettingsWithAdvancedToggle({+ llm_model: "openhands/claude-opus-4-5-20251101",+ llm_base_url: "https://custom.example/v1",+ agent_settings: {+ llm: {+ model: "openhands/claude-opus-4-5-20251101",+ base_url: "https://custom.example/v1",+ },+ },+ }),+ );++ await renderLlmSettingsScreen({ appMode: "oss" });++ await screen.findByTestId("llm-settings-form-advanced");+ expect(screen.getByTestId("base-url-input")).toHaveValue(+ "https://custom.example/v1",+ );+ });++ it("treats a litellm_proxy model with the managed proxy URL as an explicit custom endpoint", async () => {+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(+ buildSettingsWithAdvancedToggle({+ llm_model: "litellm_proxy/claude-opus-4-5-20251101",+ llm_base_url: "https://llm-proxy.app.all-hands.dev",+ agent_settings: {+ llm: {+ model: "litellm_proxy/claude-opus-4-5-20251101",+ base_url: "https://llm-proxy.app.all-hands.dev",+ },+ },+ }),+ );++ await renderLlmSettingsScreen({ appMode: "oss" });++ await screen.findByTestId("llm-settings-form-advanced");+ expect(screen.getByTestId("llm-custom-model-input")).toHaveValue(+ "litellm_proxy/claude-opus-4-5-20251101",+ );+ expect(+ screen.queryByTestId("openhands-api-key-help-2"),+ ).not.toBeInTheDocument();+ });+it("shows Advanced and All toggles in OSS mode for the default LLM route schema", async () => {vi.spyOn(SettingsService, "getSettings").mockResolvedValue(buildSettings());@@ -1550,7 +1618,7 @@ describe("LlmSettingsScreen", () => {});});- it("does not reveal all-only fields after save when refetch returns a litellm_proxy model with the managed proxy base URL", async () => {+ it("does not reveal all-only fields after save when refetch returns an OpenHands managed model", async () => {const schema = structuredClone(MOCK_DEFAULT_USER_SETTINGS.agent_settings_schema!,);@@ -1591,8 +1659,7 @@ describe("LlmSettingsScreen", () => {agent_settings_schema: schema,agent_settings: {llm: {- model: "litellm_proxy/claude-opus-4-5-20251101",- base_url: "https://llm-proxy.app.all-hands.dev",+ model: "openhands/claude-opus-4-5-20251101",},},});diff --git a/frontend/src/routes/llm-settings.tsx b/frontend/src/routes/llm-settings.tsxindex 7b9074d2cb..c34b0f4a27 100644--- a/frontend/src/routes/llm-settings.tsx+++ b/frontend/src/routes/llm-settings.tsx@@ -65,14 +65,6 @@ const getSchemaFieldDefaultValue = (const KNOWN_PROVIDER_DEFAULT_BASE_URLS: Partial<Record<string, Set<string>>> = {openai: new Set(["https://api.openai.com", "https://api.openai.com/v1"]),- openhands: new Set([- "https://llm-proxy.app.all-hands.dev",- "https://llm-proxy.app.all-hands.dev/v1",- ]),- litellm_proxy: new Set([- "https://llm-proxy.app.all-hands.dev",- "https://llm-proxy.app.all-hands.dev/v1",- ]),};const normalizeBaseUrl = (baseUrl: string) => {diff --git a/openhands/app_server/config.py b/openhands/app_server/config.pyindex 0625a38e90..b899313dd9 100644--- a/openhands/app_server/config.py+++ b/openhands/app_server/config.py@@ -129,9 +129,9 @@ def get_default_tavily_api_key() -> str | None:return os.getenv('TAVILY_API_KEY') or os.getenv('SEARCH_API_KEY') or None-# The SDK auto-fills this URL as the default for openhands/ and litellm_proxy/-# models. Deployments (e.g. staging) may use a different LLM proxy, configured-# via OPENHANDS_PROVIDER_BASE_URL.+# OpenHands provider models use this proxy at the SDK transport boundary.+# Deployments (e.g. staging) may use a different LLM proxy, configured via+# OPENHANDS_PROVIDER_BASE_URL._SDK_DEFAULT_PROXY = 'https://llm-proxy.app.all-hands.dev/'@@ -142,21 +142,19 @@ def resolve_provider_llm_base_url() -> str | None:"""Apply deployment-specific LLM proxy override when needed.- When the model uses ``openhands/`` or ``litellm_proxy/`` prefix and the- stored ``base_url`` is the SDK default, replace it with the deployment's- provider URL.+ When the model uses the public ``openhands/`` prefix and the stored+ ``base_url`` is the SDK default, replace it with the deployment's provider+ URL.Priority: user-explicit URL > deployment provider URL > SDK default.Args:- model: LLM model name (e.g. ``litellm_proxy/gpt-4``).+ model: LLM model name (e.g. ``openhands/gpt-5.5``).base_url: The base URL from user/org settings.provider_base_url: Deployment provider URL. Falls back to``get_openhands_provider_base_url()`` when *None*."""- if not model or not (- model.startswith('openhands/') or model.startswith('litellm_proxy/')- ):+ if not model or not model.startswith('openhands/'):return base_urluser_set_custom = base_url and base_url.rstrip('/') != _SDK_DEFAULT_PROXY.rstrip(diff --git a/openhands/app_server/settings/llm_profiles.py b/openhands/app_server/settings/llm_profiles.pyindex 452f24436f..6ead5db089 100644--- a/openhands/app_server/settings/llm_profiles.py+++ b/openhands/app_server/settings/llm_profiles.py@@ -180,9 +180,8 @@ class LLMProfiles(BaseModel):"key stored" vs. "needs key" without fetching each profile.When ``managed_proxy_url`` is provided, ``base_url`` is resolved to the- value the profile will actually use at runtime β e.g. the managed proxy- for a ``litellm_proxy/`` model saved without one β so callers display- the effective endpoint instead of an empty value.+ value the profile will actually use at runtime for public OpenHands+ provider profiles."""return [{diff --git a/openhands/app_server/settings/settings_models.py b/openhands/app_server/settings/settings_models.pyindex 20e3d624b1..d5386e86dd 100644--- a/openhands/app_server/settings/settings_models.py+++ b/openhands/app_server/settings/settings_models.py@@ -404,15 +404,7 @@ class Settings(BaseModel):return self.agent_settingsdef get_agent_settings_display(self) -> dict[str, Any]:- """Return agent_settings dict with display-friendly model names.-- ``litellm_proxy/`` prefixes are normalised to ``openhands/`` only when- using the OpenHands proxy URL. Custom litellm_proxy endpoints keep their- litellm_proxy/ prefix.- The LiteLLM proxy ``base_url`` is cleared for managed models so- that the frontend can display "basic" mode.- Secrets are masked by Pydantic's default serialiser.- """+ """Return agent_settings with display-only defaults removed."""from openhands.app_server.settings.settings_router import LITE_LLM_API_URLfrom openhands.app_server.utils.llm import is_openhands_model@@ -421,16 +413,6 @@ class Settings(BaseModel):if isinstance(llm, dict):model = llm.get('model')base_url = llm.get('base_url')-- # Only convert litellm_proxy/ to openhands/ if using the OpenHands proxy- if isinstance(model, str) and model.startswith('litellm_proxy/'):- normalized_base = (base_url or '').rstrip('/')- normalized_proxy = LITE_LLM_API_URL.rstrip('/')- if normalized_base == normalized_proxy:- llm['model'] = f'openhands/{model.removeprefix("litellm_proxy/")}'-- # Clear the proxy base_url for managed models so the frontend- # sees null and can display the simple "basic" settings view.if is_openhands_model(model):normalized_base = (base_url or '').rstrip('/')normalized_proxy = LITE_LLM_API_URL.rstrip('/')diff --git a/openhands/app_server/settings/settings_router.py b/openhands/app_server/settings/settings_router.pyindex 033c18bca1..4d925a8fcb 100644--- a/openhands/app_server/settings/settings_router.py+++ b/openhands/app_server/settings/settings_router.py@@ -143,20 +143,10 @@ async def load_settings(provider_tokens_set=provider_tokens_set,)- # Convert litellm_proxy/ back to openhands/ for the frontend, but only- # if the base_url is the OpenHands proxy. Custom litellm_proxy endpoints- # should keep their litellm_proxy/ prefix.resp_llm = settings_with_token_data.agent_settings.llmnormalized_base = (llm.base_url or '').rstrip('/')normalized_proxy = LITE_LLM_API_URL.rstrip('/')- if resp_llm.model and resp_llm.model.startswith('litellm_proxy/'):- # Only convert to openhands/ if using the OpenHands proxy URL- if normalized_base == normalized_proxy:- resp_llm.model = (- f'openhands/{resp_llm.model.removeprefix("litellm_proxy/")}'- )-# If the base url matches the default for the provider, we don't send it# So that the frontend can display basic mode.if is_openhands_model(llm.model):diff --git a/openhands/app_server/utils/llm.py b/openhands/app_server/utils/llm.pyindex 3bccadc7d9..8f9b78f3c8 100644--- a/openhands/app_server/utils/llm.py+++ b/openhands/app_server/utils/llm.py@@ -90,22 +90,8 @@ class ModelsResponse(BaseModel):def is_openhands_model(model: str | None) -> bool:- """Check if the model uses the OpenHands provider.-- The SDK's ``AgentSettings`` validator automatically transforms- ``openhands/X`` to ``litellm_proxy/X`` (the internal proxy name),- so both prefixes must be recognised.-- Args:- model: The model name to check.-- Returns:- True if the model starts with 'openhands/' or 'litellm_proxy/',- False otherwise.- """- return bool(- model and (model.startswith('openhands/') or model.startswith('litellm_proxy/'))- )+ """Return True when the model uses the public OpenHands provider prefix."""+ return bool(model and model.startswith('openhands/'))# Canonical masked placeholder for LLM API keys. Matches pydantic'sdiff --git a/openhands/app_server/utils/llm_metadata.py b/openhands/app_server/utils/llm_metadata.pyindex 8413b437e3..b519f9a1c8 100644--- a/openhands/app_server/utils/llm_metadata.py+++ b/openhands/app_server/utils/llm_metadata.py@@ -13,8 +13,8 @@ def should_set_litellm_extra_body(model_name: str) -> bool:Only set litellm_extra_body for openhands models to avoid issueswith providers that don't support extra_body parameters.- The SDK internally translates "openhands/" prefix to "litellm_proxy/"- when making API calls, so we check for both.+ The SDK translates "openhands/" models to the LiteLLM proxy only when+ making transport calls.Args:model_name: Name of the LLM model@@ -22,7 +22,7 @@ def should_set_litellm_extra_body(model_name: str) -> bool:Returns:True if litellm_extra_body should be set, False otherwise"""- return 'openhands/' in model_name or 'litellm_proxy/' in model_name+ return model_name.startswith('openhands/')def get_llm_metadata(diff --git a/poetry.lock b/poetry.lockindex 591c088bf3..7f7eff99da 100644--- a/poetry.lock+++ b/poetry.lock@@ -5561,14 +5561,14 @@ pydantic = ">=1.8"[[package]]name = "openhands-agent-server"-version = "1.27.0"+version = "1.28.0"description = "OpenHands Agent Server - REST/WebSocket interface for OpenHands AI Agent"optional = falsepython-versions = ">=3.12"groups = ["main"]files = [- {file = "openhands_agent_server-1.27.0-py3-none-any.whl", hash = "sha256:a15511e58b8032459a1a1cac0c9851eaa22fe48e291d6ba482da02700b656d47"},- {file = "openhands_agent_server-1.27.0.tar.gz", hash = "sha256:db2d2a30804e80408be6f3a2b0447769effaf43583121891c07f17a8c1b10209"},+ {file = "openhands_agent_server-1.28.0-py3-none-any.whl", hash = "sha256:21c7d53a708d1fb8ef62375f3db0014040a356a635e0fb4a8b02608793771453"},+ {file = "openhands_agent_server-1.28.0.tar.gz", hash = "sha256:e6bc4c98fe09ba8ce3587a11ae9bf0b550a373c35bce35fd84528485255313aa"},][package.dependencies]@@ -5576,6 +5576,7 @@ aiosqlite = ">=0.19"alembic = ">=1.13"docker = ">=7.1,<8"fastapi = ">=0.104"+openai = ">=2.33.0,<3"openhands-sdk = "*"pydantic = ">=2"sqlalchemy = ">=2"@@ -5585,14 +5586,14 @@ wsproto = ">=1.2.0"[[package]]name = "openhands-sdk"-version = "1.27.0"+version = "1.28.0"description = "OpenHands SDK - Core functionality for building AI agents"optional = falsepython-versions = ">=3.12"groups = ["main"]files = [- {file = "openhands_sdk-1.27.0-py3-none-any.whl", hash = "sha256:6a0fb0c664017757d25ab299c3581d400d7f9ce7a3ea3ad8b8f6ef00100ae7a8"},- {file = "openhands_sdk-1.27.0.tar.gz", hash = "sha256:2d8280a11cc34122b6a89a6992007b132154a2ef58adcfa0c6be28337dd8f010"},+ {file = "openhands_sdk-1.28.0-py3-none-any.whl", hash = "sha256:22f947ba012caf071678e524daf10df3e9863496e86978a71b718d3cd4058906"},+ {file = "openhands_sdk-1.28.0.tar.gz", hash = "sha256:ee083743b70c27a0e36fcc23bda3da7b22fc6cb6fcc77a5bf94a22b06ab84a20"},][package.dependencies]@@ -5619,14 +5620,14 @@ boto3 = ["boto3 (>=1.35.0)"][[package]]name = "openhands-tools"-version = "1.27.0"+version = "1.28.0"description = "OpenHands Tools - Runtime tools for AI agents"optional = falsepython-versions = ">=3.12"groups = ["main"]files = [- {file = "openhands_tools-1.27.0-py3-none-any.whl", hash = "sha256:593a9e56aeb9175fed25985748f0048e1a69db4a906cb923e9cd6bda4ff738dc"},- {file = "openhands_tools-1.27.0.tar.gz", hash = "sha256:b3f2a8457fee14d085f026ca6dd280154380aebea4d0faafc7b4784689641c96"},+ {file = "openhands_tools-1.28.0-py3-none-any.whl", hash = "sha256:6f84c383e29862c2ba6441cd16036ee90b26e8f68d3994cfb2022ced4e643feb"},+ {file = "openhands_tools-1.28.0.tar.gz", hash = "sha256:7873df6ff3a0ccea92c21523f3c7da81bb088ff38cda3dbe705f751e06ea1406"},][package.dependencies]@@ -13804,4 +13805,4 @@ cffi = ["cffi (>=1.17,<2.0) ; platform_python_implementation != \"PyPy\" and pyt[metadata]lock-version = "2.1"python-versions = "^3.12,<3.14"-content-hash = "8d7689caad77cf324665b532b365a3080ea1b748c676bc26e655a0cf3692220c"+content-hash = "bc1854bf59bf5ab409d0cc099505dcbdf078dd517c9eb36a2ee424faac713f8d"diff --git a/pyproject.toml b/pyproject.tomlindex 4e2ffc3d74..a648f8115b 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -57,9 +57,9 @@ dependencies = ["memory-profiler>=0.61","numpy","openai==2.33.0",- "openhands-agent-server==1.27.0",- "openhands-sdk==1.27.0",- "openhands-tools==1.27.0",+ "openhands-agent-server==1.28.0",+ "openhands-sdk==1.28.0",+ "openhands-tools==1.28.0","opentelemetry-api>=1.33.1","opentelemetry-exporter-otlp-proto-grpc>=1.33.1","orjson>=3.11.6",@@ -246,9 +246,9 @@ e2b-code-interpreter = { version = "^2.0.0", optional = true }pybase62 = "^1.0.0"# V1 dependencies-openhands-sdk = "==1.27.0"-openhands-agent-server = "==1.27.0"-openhands-tools = "==1.27.0"+openhands-sdk = "==1.28.0"+openhands-agent-server = "==1.28.0"+openhands-tools = "==1.28.0"joserfc = ">=1.0.0"sqlalchemy = { extras = [ "asyncio" ], version = "^2.0.40" }pg8000 = "^1.31.5"diff --git a/tests/unit/app_server/test_live_status_app_conversation_service.py b/tests/unit/app_server/test_live_status_app_conversation_service.pyindex e66291a163..5f34920d02 100644--- a/tests/unit/app_server/test_live_status_app_conversation_service.py+++ b/tests/unit/app_server/test_live_status_app_conversation_service.py@@ -715,7 +715,7 @@ class TestLiveStatusAppConversationService:@pytest.mark.asyncioasync def test_configure_llm_and_mcp_openhands_model_no_base_urls(self):- """openhands/* model still uses the SDK proxy when no other URLs exist."""+ """openhands/* model is kept public when no explicit base URL exists."""# Arrangeself.mock_user.llm_model = 'openhands/default'self.mock_user.llm_base_url = None@@ -728,30 +728,28 @@ class TestLiveStatusAppConversationService:)# Assert- assert llm.base_url == 'https://llm-proxy.app.all-hands.dev/'+ assert llm.model == 'openhands/default'+ assert llm.base_url is None@pytest.mark.asyncio- async def test_configure_llm_and_mcp_litellm_proxy_model_uses_provider_default(+ async def test_configure_llm_and_mcp_litellm_proxy_model_keeps_empty_base_url(self,):- """litellm_proxy/* model (inherited by sub-conversations) falls back to provider base URL."""- # Arrange β simulates a sub-conversation inheriting the SDK-transformed model name+ """litellm_proxy/* is not treated as an OpenHands provider model."""self.mock_user.llm_base_url = Noneself.mock_user_context.get_mcp_api_key.return_value = None- # Actllm, _ = await self.service._configure_llm_and_mcp(self.mock_user, 'litellm_proxy/minimax-2.5', self.conversation_id)- # Assert- assert llm.base_url == 'https://provider.example.com'+ assert llm.base_url is None@pytest.mark.asyncio- async def test_configure_llm_and_mcp_litellm_proxy_model_prefers_user_base_url(+ async def test_configure_llm_and_mcp_litellm_proxy_model_preserves_user_base_url(self,):- """litellm_proxy/* model uses user.llm_base_url when provided."""+ """litellm_proxy/* model preserves an explicitly configured base_url."""# Arrangeself.mock_user.llm_base_url = 'https://user-llm.example.com'self.mock_user_context.get_mcp_api_key.return_value = Nonediff --git a/tests/unit/app_server/test_resolve_provider_llm_base_url.py b/tests/unit/app_server/test_resolve_provider_llm_base_url.pyindex f9a4b0ae12..a5ca071741 100644--- a/tests/unit/app_server/test_resolve_provider_llm_base_url.py+++ b/tests/unit/app_server/test_resolve_provider_llm_base_url.py@@ -73,7 +73,7 @@ class TestOpenHandsPrefixNoProviderUrl:class TestNonMatchingModelPrefix:- """Model without openhands/ or litellm_proxy/ prefix β returns base_url unchanged."""+ """Model without openhands/ prefix β returns base_url unchanged."""def test_plain_model_returns_base_url(self):result = resolve_provider_llm_base_url(@@ -101,15 +101,15 @@ class TestNonMatchingModelPrefix:class TestLitellmProxyPrefix:- """litellm_proxy/ prefix behaves identically to openhands/ prefix."""+ """litellm_proxy/ prefix is treated as an explicit LiteLLM proxy model."""- def test_replaces_sdk_default(self):+ def test_provider_url_not_applied_to_litellm_proxy(self):result = resolve_provider_llm_base_url(model='litellm_proxy/gpt-4',base_url=SDK_DEFAULT,provider_base_url=STAGING_URL,)- assert result == STAGING_URL+ assert result == SDK_DEFAULTdef test_custom_url_preserved(self):result = resolve_provider_llm_base_url(@@ -119,13 +119,13 @@ class TestLitellmProxyPrefix:)assert result == CUSTOM_URL- def test_sdk_default_returned_when_no_provider(self):+ def test_none_base_url_stays_none(self):result = resolve_provider_llm_base_url(model='litellm_proxy/gpt-4',- base_url=SDK_DEFAULT,- provider_base_url='',+ base_url=None,+ provider_base_url=STAGING_URL,)- assert result == SDK_DEFAULT+ assert result is Noneclass TestEdgeCases:diff --git a/tests/unit/storage/data_models/test_llm_profiles.py b/tests/unit/storage/data_models/test_llm_profiles.pyindex 21714c356d..d5ccbf00f6 100644--- a/tests/unit/storage/data_models/test_llm_profiles.py+++ b/tests/unit/storage/data_models/test_llm_profiles.py@@ -85,8 +85,11 @@ def test_summaries_empty_by_default():def test_summaries_resolves_base_url_with_managed_proxy_url():profiles = LLMProfiles()- # Managed model saved without a base_url (would otherwise display as "β").- profiles.save('managed', LLM(model='litellm_proxy/minimax-m2.7'))+ # Managed model saved in the public SDK shape without a base_url.+ managed_llm = LLM(model='openhands/minimax-m2.7').model_copy(+ update={'model': 'openhands/minimax-m2.7', 'base_url': None}+ )+ profiles.save('managed', managed_llm)# BYOR model with its own base_url.profiles.save('byor', LLM(model='openai/gpt-4o', base_url='https://byor.example.com')diff --git a/tests/unit/storage/data_models/test_settings.py b/tests/unit/storage/data_models/test_settings.pyindex f021b3a2d9..3d6f7ecbf6 100644--- a/tests/unit/storage/data_models/test_settings.py+++ b/tests/unit/storage/data_models/test_settings.py@@ -486,8 +486,8 @@ def test_settings_no_pydantic_frozen_field_warning():)-def test_litellm_proxy_to_openhands_conversion_with_openhands_proxy():- """Test that litellm_proxy/ is converted to openhands/ when using OpenHands proxy."""+def test_litellm_proxy_with_openhands_proxy_keeps_prefix_for_display():+ """Display data no longer reverse-maps LiteLLM proxy model names."""settings = Settings(agent_settings=OpenHandsAgentSettings(llm=LLM(@@ -497,12 +497,8 @@ def test_litellm_proxy_to_openhands_conversion_with_openhands_proxy():))- # Internal representation should be litellm_proxy/- assert settings.agent_settings.llm.model == 'litellm_proxy/claude-opus-4-5-20251101'-- # Display representation should convert to openhands/api_data = settings.get_agent_settings_display()- assert api_data['llm']['model'] == 'openhands/claude-opus-4-5-20251101'+ assert api_data['llm']['model'] == 'litellm_proxy/claude-opus-4-5-20251101'def test_litellm_proxy_custom_endpoint_keeps_prefix():@@ -524,17 +520,13 @@ def test_litellm_proxy_custom_endpoint_keeps_prefix():assert api_data['llm']['model'] == 'litellm_proxy/gpt-5.3-codex'-def test_openhands_model_converts_to_litellm_proxy_internally():- """Test that openhands/ models are stored as litellm_proxy/ internally."""+def test_openhands_model_display_does_not_reverse_map():+ """Display data reflects the LLM model shape provided by the SDK."""settings = Settings(agent_settings=OpenHandsAgentSettings(llm=LLM(model='openhands/claude-opus-4-5-20251101')))- # Internal representation should be litellm_proxy/- assert settings.agent_settings.llm.model == 'litellm_proxy/claude-opus-4-5-20251101'-- # Display representation should convert back to openhands/api_data = settings.get_agent_settings_display()- assert api_data['llm']['model'] == 'openhands/claude-opus-4-5-20251101'+ assert api_data['llm']['model'] == settings.agent_settings.llm.modeldiff --git a/tests/unit/utils/test_llm_utils.py b/tests/unit/utils/test_llm_utils.pyindex 80d43debbf..bcf7b381f5 100644--- a/tests/unit/utils/test_llm_utils.py+++ b/tests/unit/utils/test_llm_utils.py@@ -24,6 +24,7 @@ class TestIsOpenhandsModel:assert is_openhands_model('claude-3-opus-20240229') is Falseassert is_openhands_model('anthropic/claude-3-opus-20240229') is Falseassert is_openhands_model('openai/gpt-4') is False+ assert is_openhands_model('litellm_proxy/gpt-4') is Falsedef test_none_model_returns_false(self):"""Test that None model returns False."""diff --git a/uv.lock b/uv.lockindex 803c1b2136..5cd73c1858 100644--- a/uv.lock+++ b/uv.lock@@ -3181,13 +3181,14 @@ wheels = [[[package]]name = "openhands-agent-server"-version = "1.27.0"+version = "1.28.0"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "aiosqlite" },{ name = "alembic" },{ name = "docker" },{ name = "fastapi" },+ { name = "openai" },{ name = "openhands-sdk" },{ name = "pydantic" },{ name = "sqlalchemy" },@@ -3195,9 +3196,9 @@ dependencies = [{ name = "websockets" },{ name = "wsproto" },]-sdist = { url = "https://files.pythonhosted.org/packages/e0/61/38e89ec5bccfbdb986d453c67862499e00b53705634642bff1a416ad0b29/openhands_agent_server-1.27.0.tar.gz", hash = "sha256:db2d2a30804e80408be6f3a2b0447769effaf43583121891c07f17a8c1b10209", size = 146559, upload-time = "2026-06-09T14:21:41.868Z" }+sdist = { url = "https://files.pythonhosted.org/packages/20/e7/db277cb0e416839d6c9ea12bbd3c109f585325452a18ee08a4374b0d02c9/openhands_agent_server-1.28.0.tar.gz", hash = "sha256:e6bc4c98fe09ba8ce3587a11ae9bf0b550a373c35bce35fd84528485255313aa", size = 152997, upload-time = "2026-06-10T22:23:40.661Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/33/7c/fa9e18348e399889b5803f4650fdadc07b0c0431f19e271ebc8839fa9cd2/openhands_agent_server-1.27.0-py3-none-any.whl", hash = "sha256:a15511e58b8032459a1a1cac0c9851eaa22fe48e291d6ba482da02700b656d47", size = 169695, upload-time = "2026-06-09T14:21:44.251Z" },+ { url = "https://files.pythonhosted.org/packages/d8/e7/c6c4ccddba9fa814ec6cfcb1cdf79a24643315a5641d08e9897a02ee828b/openhands_agent_server-1.28.0-py3-none-any.whl", hash = "sha256:21c7d53a708d1fb8ef62375f3db0014040a356a635e0fb4a8b02608793771453", size = 177263, upload-time = "2026-06-10T22:23:39.469Z" },][[package]]@@ -3356,9 +3357,9 @@ requires-dist = [{ name = "memory-profiler", specifier = ">=0.61" },{ name = "numpy" },{ name = "openai", specifier = "==2.33.0" },- { name = "openhands-agent-server", specifier = "==1.27.0" },- { name = "openhands-sdk", specifier = "==1.27.0" },- { name = "openhands-tools", specifier = "==1.27.0" },+ { name = "openhands-agent-server", specifier = "==1.28.0" },+ { name = "openhands-sdk", specifier = "==1.28.0" },+ { name = "openhands-tools", specifier = "==1.28.0" },{ name = "opentelemetry-api", specifier = ">=1.33.1" },{ name = "opentelemetry-exporter-otlp-proto-grpc", specifier = ">=1.33.1" },{ name = "orjson", specifier = ">=3.11.6" },@@ -3436,7 +3437,7 @@ test = [[[package]]name = "openhands-sdk"-version = "1.27.0"+version = "1.28.0"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "agent-client-protocol" },@@ -3457,14 +3458,14 @@ dependencies = [{ name = "tree-sitter-bash" },{ name = "websockets" },]-sdist = { url = "https://files.pythonhosted.org/packages/63/0e/726f88ddf74129cb4d7eda80c71f43de2d4a885b8c0bd3024108741e4384/openhands_sdk-1.27.0.tar.gz", hash = "sha256:2d8280a11cc34122b6a89a6992007b132154a2ef58adcfa0c6be28337dd8f010", size = 527602, upload-time = "2026-06-09T14:21:38.029Z" }+sdist = { url = "https://files.pythonhosted.org/packages/04/6c/1b0b22111f505fd67cb3bd2515ae68eab4aac109694c41c754715c306610/openhands_sdk-1.28.0.tar.gz", hash = "sha256:ee083743b70c27a0e36fcc23bda3da7b22fc6cb6fcc77a5bf94a22b06ab84a20", size = 536820, upload-time = "2026-06-10T22:23:43.231Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/cb/5c/80d90103fbfc57016848f83ccdb930cce23abb65c8ea832ab5b109de5e77/openhands_sdk-1.27.0-py3-none-any.whl", hash = "sha256:6a0fb0c664017757d25ab299c3581d400d7f9ce7a3ea3ad8b8f6ef00100ae7a8", size = 638870, upload-time = "2026-06-09T14:21:36.6Z" },+ { url = "https://files.pythonhosted.org/packages/64/94/65ea9c0fa85b45f2c3f7c62916ac2d5941bb753556e730639e8c8167cf3d/openhands_sdk-1.28.0-py3-none-any.whl", hash = "sha256:22f947ba012caf071678e524daf10df3e9863496e86978a71b718d3cd4058906", size = 649530, upload-time = "2026-06-10T22:23:36.357Z" },][[package]]name = "openhands-tools"-version = "1.27.0"+version = "1.28.0"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "binaryornot" },@@ -3478,9 +3479,9 @@ dependencies = [{ name = "tree-sitter" },{ name = "tree-sitter-bash" },]-sdist = { url = "https://files.pythonhosted.org/packages/e4/2e/5c292c04a218943d665fe0ceef59b9ff6cee7317f36e18f9db5d82ded078/openhands_tools-1.27.0.tar.gz", hash = "sha256:b3f2a8457fee14d085f026ca6dd280154380aebea4d0faafc7b4784689641c96", size = 141272, upload-time = "2026-06-09T14:21:40.856Z" }+sdist = { url = "https://files.pythonhosted.org/packages/eb/03/1a8c599a79721b3a45acba6ade54c98b06918f0e3343f74898828f0e8050/openhands_tools-1.28.0.tar.gz", hash = "sha256:7873df6ff3a0ccea92c21523f3c7da81bb088ff38cda3dbe705f751e06ea1406", size = 142456, upload-time = "2026-06-10T22:23:38.536Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/78/30/459be71e9fef1f3f104afd32775dd016a8aa5bc683478f9770f2288584fd/openhands_tools-1.27.0-py3-none-any.whl", hash = "sha256:593a9e56aeb9175fed25985748f0048e1a69db4a906cb923e9cd6bda4ff738dc", size = 186309, upload-time = "2026-06-09T14:21:43.042Z" },+ { url = "https://files.pythonhosted.org/packages/17/8b/96e949128fbc33444b12e4c0a4acbeca536ecd2dab1753efa6a24909fdf6/openhands_tools-1.28.0-py3-none-any.whl", hash = "sha256:6f84c383e29862c2ba6441cd16036ee90b26e8f68d3994cfb2022ced4e643feb", size = 187637, upload-time = "2026-06-10T22:23:41.39Z" },][[package]]