Skip to content

πŸ™Œ OpenHands: AI-Driven Development

feat: clarify free OpenHands model endpoints (#16281)

Juan Pedro Michelini Jorget7d897d766990
diff --git a/__tests__/components/features/chat/components/chat-input-llm-profile-picker.test.tsx b/__tests__/components/features/chat/components/chat-input-llm-profile-picker.test.tsx
index ef63736b74..6bd0193d89 100644
--- a/__tests__/components/features/chat/components/chat-input-llm-profile-picker.test.tsx
+++ b/__tests__/components/features/chat/components/chat-input-llm-profile-picker.test.tsx
@@ -95,6 +95,44 @@ describe("ChatInputLlmProfilePicker", () => {
).not.toBeInTheDocument();
});
+ it("labels a free OpenHands route in the profile menu", () => {
+ useChatInputLlmProfileStateMock.mockReturnValue(
+ state({
+ profiles: [
+ {
+ name: "Free",
+ model: "openhands/glm-5.2",
+ base_url: null,
+ api_key_set: true,
+ },
+ ],
+ currentProfileName: "Free",
+ currentProfileModel: "openhands/glm-5.2",
+ }),
+ );
+
+ renderWithProviders(<ChatInputLlmProfilePicker />);
+ fireEvent.click(screen.getByTestId("chat-input-llm-profile"));
+
+ expect(screen.getByText("OpenHands GLM-5.2 (free)")).toBeInTheDocument();
+ });
+
+ it("labels a free OpenHands route in the read-only profile menu", () => {
+ useChatInputLlmProfileStateMock.mockReturnValue(
+ state({
+ canSwitchProfile: false,
+ currentProfileModel: "openhands/glm-5.2",
+ }),
+ );
+
+ renderWithProviders(<ChatInputLlmProfilePicker />);
+ fireEvent.click(screen.getByTestId("chat-input-llm-profile"));
+
+ expect(
+ screen.getByTestId("chat-input-llm-profile-current"),
+ ).toHaveTextContent("OpenHands GLM-5.2 (free)");
+ });
+
it("links to the LLM profiles settings page", () => {
const { container } = renderWithProviders(<ChatInputLlmProfilePicker />);
fireEvent.click(screen.getByTestId("chat-input-llm-profile"));
diff --git a/__tests__/components/features/chat/model-messages.test.tsx b/__tests__/components/features/chat/model-messages.test.tsx
index 21f608ec07..0ffb0f4d42 100644
--- a/__tests__/components/features/chat/model-messages.test.tsx
+++ b/__tests__/components/features/chat/model-messages.test.tsx
@@ -104,4 +104,32 @@ describe("ModelMessages", () => {
"ℹ️ Switched to profile haiku",
);
});
+
+ it("labels a free OpenHands route in expanded profile diagnostics", async () => {
+ const user = userEvent.setup();
+ useModelStore.getState().show(CONVERSATION_ID, "event-1", [
+ {
+ name: "free",
+ model: "openhands/glm-5.2",
+ base_url: null,
+ api_key_set: true,
+ },
+ ]);
+
+ renderWithProviders(
+ <ModelMessages
+ conversationId={CONVERSATION_ID}
+ anchorEventId="event-1"
+ />,
+ );
+
+ await user.click(screen.getByRole("button", { name: "BUTTON$EXPAND" }));
+ await user.click(
+ screen.getByRole("button", { name: "Toggle details for free" }),
+ );
+
+ expect(
+ screen.getByText(/model:\s+OpenHands GLM-5\.2 \(free\)/),
+ ).toBeInTheDocument();
+ });
});
diff --git a/__tests__/components/features/conversation-panel/conversation-card.test.tsx b/__tests__/components/features/conversation-panel/conversation-card.test.tsx
index 0a367d424e..7c7bef4b4b 100644
--- a/__tests__/components/features/conversation-panel/conversation-card.test.tsx
+++ b/__tests__/components/features/conversation-panel/conversation-card.test.tsx
@@ -1013,6 +1013,23 @@ describe("ConversationCard", () => {
).not.toBeInTheDocument();
});
+ it("labels a free OpenHands route on native conversation chips", () => {
+ renderWithProviders(
+ <ConversationCard
+ title="Conversation 1"
+ selectedRepository={null}
+ lastUpdatedAt="2021-10-01T12:00:00Z"
+ showLlmProfiles
+ agentKind="openhands"
+ llmModel="openhands/glm-5.2"
+ />,
+ );
+
+ const chip = screen.getByTestId("conversation-card-agent-chip");
+ expect(chip).toHaveTextContent("OpenHands GLM-5.2 (free)");
+ expect(chip).toHaveAttribute("title", "openhands/glm-5.2");
+ });
+
it("hides the chip for OpenHands conversations with no model", () => {
// Toggle on, but no model string and no ACP server β€” nothing to
// display, so the chip collapses rather than showing a bare logo.
diff --git a/__tests__/components/modals/settings/model-selector-openhands.test.tsx b/__tests__/components/modals/settings/model-selector-openhands.test.tsx
index 2ef670fe56..5aeb348a11 100644
--- a/__tests__/components/modals/settings/model-selector-openhands.test.tsx
+++ b/__tests__/components/modals/settings/model-selector-openhands.test.tsx
@@ -1,6 +1,7 @@
import { describe, expect, it, beforeEach } from "vitest";
import React from "react";
import { render, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
import { http, HttpResponse } from "msw";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ModelSelector } from "#/components/shared/modals/settings/model-selector";
@@ -28,7 +29,12 @@ describe("ModelSelector β€” OpenHands provider display", () => {
verifiedCount += 1;
return HttpResponse.json({
models: {
- openhands: ["claude-opus-4-7"],
+ openhands: [
+ "claude-opus-4-7",
+ "glm-5.2",
+ "deepseek-v4-flash",
+ "minimax-m2.7",
+ ],
anthropic: ["claude-opus-4-5-20251101"],
},
});
@@ -60,4 +66,36 @@ describe("ModelSelector β€” OpenHands provider display", () => {
expect(verifiedCount).toBe(1);
expect(modelsCount).toBe(1);
});
+
+ it("makes clear which OpenHands models are free", async () => {
+ const user = userEvent.setup();
+ renderWithQuery(<ModelSelector currentModel="openhands/glm-5.2" />);
+
+ await waitFor(() => {
+ expect(
+ screen.getByTestId("openhands-free-models-note"),
+ ).toHaveTextContent("openhands/glm-5.2");
+ });
+ expect(screen.getByTestId("openhands-free-models-note")).toHaveTextContent(
+ "openhands/deepseek-v4-flash",
+ );
+ expect(screen.getByTestId("openhands-free-models-note")).toHaveTextContent(
+ "openhands/minimax-m2.7",
+ );
+ expect(screen.getByTestId("selected-free-model-badge")).toHaveTextContent(
+ "Free",
+ );
+
+ await user.click(screen.getByLabelText("LLM$MODEL"));
+
+ expect(screen.getAllByText("Free")).toHaveLength(4);
+ expect(screen.getByLabelText("LLM$MODEL")).toHaveValue("glm-5.2");
+
+ await user.click(screen.getByText("minimax-m2.7"));
+
+ expect(screen.getByLabelText("LLM$MODEL")).toHaveValue("minimax-m2.7");
+ expect(screen.getByTestId("selected-free-model-badge")).toHaveTextContent(
+ "Free",
+ );
+ });
});
diff --git a/__tests__/components/settings/llm-profiles/llm-settings-local-view.test.tsx b/__tests__/components/settings/llm-profiles/llm-settings-local-view.test.tsx
index 6f2bec2644..acbcff523c 100644
--- a/__tests__/components/settings/llm-profiles/llm-settings-local-view.test.tsx
+++ b/__tests__/components/settings/llm-profiles/llm-settings-local-view.test.tsx
@@ -1,3 +1,4 @@
+/* eslint-disable i18next/no-literal-string -- test mocks intentionally use literal labels */
import { describe, expect, it, vi, beforeEach, type Mock } from "vitest";
import { AxiosError } from "axios";
import { fireEvent, screen, waitFor } from "@testing-library/react";
@@ -318,7 +319,7 @@ describe("LlmSettingsLocalView", () => {
});
describe("create mode form initialization", () => {
- it("passes empty initial values when creating a new profile", async () => {
+ it("prefills the free OpenHands default when creating a new profile", async () => {
const user = userEvent.setup();
renderWithProviders(<LlmSettingsLocalView />);
@@ -328,14 +329,13 @@ describe("LlmSettingsLocalView", () => {
// Should be in create view
expect(screen.getByTestId("profile-name-input")).toBeInTheDocument();
- // The profile name input should be empty
+ // The profile name is auto-derived from the prefilled free default model.
const nameInput = screen.getByTestId("profile-name-input");
- expect(nameInput).toHaveValue("");
+ expect(nameInput).toHaveValue("glm-5.2");
- // The embedded LlmSettingsScreen receives initialValueOverrides with
- // empty values for create mode. We verify this by checking the
- // component's behavior - the profile name should start empty and
- // the form should be ready for fresh input.
+ expect(screen.getByTestId("mock-basic-model-input")).toHaveValue(
+ "openhands/glm-5.2",
+ );
});
it("uses unique key for create mode to ensure form remounts", async () => {
@@ -346,10 +346,9 @@ describe("LlmSettingsLocalView", () => {
await user.click(screen.getByTestId("add-llm-profile"));
expect(screen.getByTestId("profile-name-input")).toBeInTheDocument();
- // Fill in some data
+ // The profile name starts from the free-model derived default.
const nameInput = screen.getByTestId("profile-name-input");
- await user.type(nameInput, "test-profile");
- expect(nameInput).toHaveValue("test-profile");
+ expect(nameInput).toHaveValue("glm-5.2");
// Go back to list
await user.click(screen.getByTestId("back-to-profiles"));
@@ -358,9 +357,10 @@ describe("LlmSettingsLocalView", () => {
// Navigate to create view again
await user.click(screen.getByTestId("add-llm-profile"));
- // The profile name should be empty again (fresh form)
+ // The profile name should return to the free-model derived default
+ // again (fresh form).
const freshNameInput = screen.getByTestId("profile-name-input");
- expect(freshNameInput).toHaveValue("");
+ expect(freshNameInput).toHaveValue("glm-5.2");
});
it("does not carry over values from edit mode to create mode", async () => {
@@ -373,9 +373,9 @@ describe("LlmSettingsLocalView", () => {
// Navigate directly to create view (not edit)
await user.click(screen.getByTestId("add-llm-profile"));
- // Should be in create view with empty profile name
+ // Should be in create view with the free-model derived profile name.
const nameInput = screen.getByTestId("profile-name-input");
- expect(nameInput).toHaveValue("");
+ expect(nameInput).toHaveValue("glm-5.2");
// The key "new-profile" should be used, ensuring a fresh form mount
// that doesn't inherit any existing profile data
diff --git a/__tests__/components/settings/llm-profiles/profile-row.test.tsx b/__tests__/components/settings/llm-profiles/profile-row.test.tsx
index 0e503c3036..ef91c719ef 100644
--- a/__tests__/components/settings/llm-profiles/profile-row.test.tsx
+++ b/__tests__/components/settings/llm-profiles/profile-row.test.tsx
@@ -52,6 +52,20 @@ describe("ProfileRow", () => {
expect(screen.getByText("openai/gpt-4")).toBeInTheDocument();
});
+ it("labels a free OpenHands route without changing the raw title", () => {
+ render(
+ <ProfileRow
+ {...defaultProps}
+ profile={{ ...mockProfile, model: "openhands/glm-5.2" }}
+ />,
+ );
+
+ expect(screen.getByText("OpenHands GLM-5.2 (free)")).toHaveAttribute(
+ "title",
+ "openhands/glm-5.2",
+ );
+ });
+
it("does not display model when null", () => {
const profileWithoutModel: ProfileInfo = {
...mockProfile,
diff --git a/__tests__/hooks/chat/use-slash-command.test.ts b/__tests__/hooks/chat/use-slash-command.test.ts
index 4b2dc846a0..7c06d7cbdf 100644
--- a/__tests__/hooks/chat/use-slash-command.test.ts
+++ b/__tests__/hooks/chat/use-slash-command.test.ts
@@ -154,6 +154,12 @@ describe("useSlashCommand", () => {
base_url: null,
api_key_set: true,
},
+ {
+ name: "free",
+ model: "openhands/glm-5.2",
+ base_url: null,
+ api_key_set: true,
+ },
],
active_profile: "haiku",
};
@@ -169,7 +175,12 @@ describe("useSlashCommand", () => {
expect(result.current.filteredItems.map((i) => i.command)).toEqual([
"/model haiku",
"/model gpt",
+ "/model free",
]);
+ expect(
+ result.current.filteredItems.find((i) => i.command === "/model free")
+ ?.skill.content,
+ ).toBe("Switch to OpenHands GLM-5.2 (free)");
});
it("filters saved LLM profile suggestions by profile name or model", () => {
diff --git a/__tests__/utils/format-model-name.test.ts b/__tests__/utils/format-model-name.test.ts
index d8aa702281..6a40c4df80 100644
--- a/__tests__/utils/format-model-name.test.ts
+++ b/__tests__/utils/format-model-name.test.ts
@@ -1,5 +1,11 @@
import { describe, expect, it } from "vitest";
-import { formatNativeModelName } from "#/utils/format-model-name";
+import {
+ FREE_OPENHANDS_MODELS,
+ formatModelNameForDisplay,
+ formatNativeModelName,
+ formatProviderModelNameForDisplay,
+ isFreeOpenHandsModel,
+} from "#/utils/format-model-name";
describe("formatNativeModelName", () => {
it("strips the provider route prefix", () => {
@@ -9,6 +15,37 @@ describe("formatNativeModelName", () => {
expect(formatNativeModelName("openai/gpt-4o")).toBe("gpt-4o");
});
+ it("labels only configured OpenHands free-model routes as free", () => {
+ expect(Object.keys(FREE_OPENHANDS_MODELS)).toEqual([
+ "openhands/glm-5.2",
+ "openhands/deepseek-v4-flash",
+ "openhands/minimax-m2.7",
+ ]);
+
+ for (const [model, label] of Object.entries(FREE_OPENHANDS_MODELS)) {
+ expect(formatModelNameForDisplay(model)).toBe(label);
+ expect(
+ formatProviderModelNameForDisplay("openhands", model.slice(10)),
+ ).toBe(label);
+ expect(isFreeOpenHandsModel(model)).toBe(true);
+ }
+
+ expect(formatModelNameForDisplay("openai/glm-5.2")).toBe("openai/glm-5.2");
+ expect(formatProviderModelNameForDisplay("openai", "glm-5.2")).toBe(
+ "glm-5.2",
+ );
+ expect(isFreeOpenHandsModel("openai/glm-5.2")).toBe(false);
+ });
+
+ it("keeps free OpenHands labels on native conversation chips", () => {
+ expect(formatNativeModelName("openhands/glm-5.2")).toBe(
+ FREE_OPENHANDS_MODELS["openhands/glm-5.2"],
+ );
+ expect(formatNativeModelName("openhands/deepseek-v4-flash")).toBe(
+ FREE_OPENHANDS_MODELS["openhands/deepseek-v4-flash"],
+ );
+ });
+
it("strips nested routing prefixes to the last segment", () => {
expect(formatNativeModelName("litellm_proxy/openai/gpt-4o")).toBe("gpt-4o");
});
diff --git a/src/components/features/chat/components/chat-input-llm-profile-picker.tsx b/src/components/features/chat/components/chat-input-llm-profile-picker.tsx
index 564028d0a9..0cf740f7e6 100644
--- a/src/components/features/chat/components/chat-input-llm-profile-picker.tsx
+++ b/src/components/features/chat/components/chat-input-llm-profile-picker.tsx
@@ -13,6 +13,7 @@ import { Typography } from "#/ui/typography";
import { I18nKey } from "#/i18n/declaration";
import { cn } from "#/utils/utils";
import { chatInputPillButtonClassName } from "#/utils/form-control-classes";
+import { formatModelNameForDisplay } from "#/utils/format-model-name";
const PROFILE_LABEL_MAX_CHARS = 18;
@@ -73,6 +74,7 @@ export function ChatInputLlmProfileMenuContent({
</li>
{profiles.map((profile) => {
const isCurrent = profile.name === currentProfileName;
+ const displayModel = formatModelNameForDisplay(profile.model);
return (
<ContextMenuListItem
key={profile.name}
@@ -107,9 +109,9 @@ export function ChatInputLlmProfileMenuContent({
/>
)}
</span>
- {profile.model && (
+ {displayModel && (
<span className="block truncate text-xs leading-4 text-[var(--oh-muted)]">
- {profile.model}
+ {displayModel}
</span>
)}
</ContextMenuListItem>
@@ -125,7 +127,7 @@ export function ChatInputLlmProfileMenuContent({
</span>
{currentProfileModel && (
<span className="truncate text-xs leading-4 text-[var(--oh-muted)]">
- {currentProfileModel}
+ {formatModelNameForDisplay(currentProfileModel)}
</span>
)}
</div>
diff --git a/src/components/features/chat/model-messages.tsx b/src/components/features/chat/model-messages.tsx
index 85991cc2d4..901ae6ddca 100644
--- a/src/components/features/chat/model-messages.tsx
+++ b/src/components/features/chat/model-messages.tsx
@@ -5,6 +5,7 @@ import { useModelStore } from "#/stores/model-store";
import { I18nKey } from "#/i18n/declaration";
import InfoCircleIcon from "#/icons/info-circle.svg?react";
import type { ProfileInfo } from "#/api/profiles-service/profiles-service.api";
+import { formatModelNameForDisplay } from "#/utils/format-model-name";
import { GenericEventMessage } from "./generic-event-message";
interface ProfileRowProps {
@@ -13,6 +14,7 @@ interface ProfileRowProps {
function ProfileRow({ profile }: ProfileRowProps) {
const [expanded, setExpanded] = React.useState(false);
+ const displayModel = formatModelNameForDisplay(profile.model);
return (
<div className="border border-neutral-700 rounded-md overflow-hidden">
@@ -34,7 +36,7 @@ function ProfileRow({ profile }: ProfileRowProps) {
<>
<hr className="border-neutral-700" />
<div className="px-3 py-2 text-xs text-neutral-300 font-mono whitespace-pre-wrap">
- {`model: ${profile.model ?? "β€”"}\n` +
+ {`model: ${displayModel ?? "β€”"}\n` +
`base_url: ${profile.base_url ?? "β€”"}\n` +
// eslint-disable-next-line i18next/no-literal-string -- diagnostic readout; field labels are intentionally untranslated
`api_key: ${profile.api_key_set ? "set" : "not set"}`}
diff --git a/src/components/features/settings/llm-profiles/llm-settings-local-view.tsx b/src/components/features/settings/llm-profiles/llm-settings-local-view.tsx
index b91eab40c2..57079ed920 100644
--- a/src/components/features/settings/llm-profiles/llm-settings-local-view.tsx
+++ b/src/components/features/settings/llm-profiles/llm-settings-local-view.tsx
@@ -15,6 +15,7 @@ import { useActivateLlmProfile } from "#/hooks/mutation/use-activate-llm-profile
import { useLlmProfiles } from "#/hooks/query/use-llm-profiles";
import { useSettings } from "#/hooks/query/use-settings";
import { useAgentSettingsSchema } from "#/hooks/query/use-agent-settings-schema";
+import { DEFAULT_SETTINGS } from "#/services/settings";
import ProfilesService, {
ProfileInfo,
type SaveProfileRequest,
@@ -427,9 +428,10 @@ export function LlmSettingsLocalView() {
viewMode === "edit" && editingProfile?.initialValues
? // Edit mode: use the existing profile values
editingProfile.initialValues
- : // Create mode: start with empty fields for a fresh profile
+ : // Create mode: prefill the model with Canvas' free default,
+ // while keeping secret/base URL fields blank for a fresh profile.
{
- "llm.model": "",
+ "llm.model": DEFAULT_SETTINGS.llm_model,
"llm.api_key": "",
"llm.base_url": "",
[LLM_AUTH_TYPE_KEY]: LLM_AUTH_TYPE_API_KEY,
diff --git a/src/components/features/settings/llm-profiles/profile-row.tsx b/src/components/features/settings/llm-profiles/profile-row.tsx
index e5fd69b01c..67cd79a350 100644
--- a/src/components/features/settings/llm-profiles/profile-row.tsx
+++ b/src/components/features/settings/llm-profiles/profile-row.tsx
@@ -6,6 +6,7 @@ import { I18nKey } from "#/i18n/declaration";
import { EllipsisButton } from "#/components/features/conversation-panel/ellipsis-button";
import { BrandBadge } from "#/components/shared/badge";
import { cn } from "#/utils/utils";
+import { formatModelNameForDisplay } from "#/utils/format-model-name";
import {
settingsListIconActionButtonClassName,
settingsListRowClassName,
@@ -38,6 +39,7 @@ export function ProfileRow({
const { t } = useTranslation("openhands");
const [menuOpen, setMenuOpen] = useState(false);
const triggerRef = useRef<HTMLButtonElement>(null);
+ const displayModel = formatModelNameForDisplay(profile.model);
return (
<div
@@ -51,12 +53,12 @@ export function ProfileRow({
>
{profile.name}
</span>
- {profile.model ? (
+ {displayModel ? (
<span
className="min-w-0 max-w-full truncate text-sm text-[var(--oh-muted)]"
- title={profile.model}
+ title={profile.model ?? undefined}
>
- {profile.model}
+ {displayModel}
</span>
) : null}
{isActive && (
diff --git a/src/components/shared/modals/settings/model-selector.tsx b/src/components/shared/modals/settings/model-selector.tsx
index bc2361e214..754f24743f 100644
--- a/src/components/shared/modals/settings/model-selector.tsx
+++ b/src/components/shared/modals/settings/model-selector.tsx
@@ -3,6 +3,7 @@ import {
AutocompleteItem,
AutocompleteSection,
} from "@heroui/react";
+import { Info } from "lucide-react";
import React from "react";
import { useTranslation } from "react-i18next";
import { I18nKey } from "#/i18n/declaration";
@@ -15,6 +16,26 @@ import { HelpLink } from "#/ui/help-link";
import { PRODUCT_URL } from "#/utils/constants";
import { useSearchProviders } from "#/hooks/query/use-search-providers";
import { useProviderModels } from "#/hooks/query/use-provider-models";
+import {
+ FREE_MODEL_BADGE_LABEL,
+ FREE_OPENHANDS_MODEL_NOTE,
+ isFreeOpenHandsModel,
+} from "#/utils/format-model-name";
+
+const freeModelBadgeClassName =
+ "shrink-0 rounded-full border border-warning/40 bg-warning/10 px-1.5 py-0.5 text-[10px] leading-none text-warning";
+
+function FreeOpenHandsModelsNote() {
+ return (
+ <p
+ data-testid="openhands-free-models-note"
+ className="flex items-start gap-2 text-xs text-warning"
+ >
+ <Info className="mt-0.5 size-4 shrink-0 text-warning" aria-hidden />
+ <span>{FREE_OPENHANDS_MODEL_NOTE}</span>
+ </p>
+ );
+}
interface ModelSelectorProps {
isDisabled?: boolean;
@@ -100,6 +121,38 @@ export function ModelSelector({
setLitellmId(null);
};
+ const selectedFullModel =
+ selectedProvider && selectedModel
+ ? `${selectedProvider}/${selectedModel}`
+ : null;
+ const isSelectedModelFree = isFreeOpenHandsModel(selectedFullModel);
+ const selectedModelMeasureRef = React.useRef<HTMLSpanElement>(null);
+ const [selectedModelTextWidth, setSelectedModelTextWidth] = React.useState(0);
+
+ React.useLayoutEffect(() => {
+ if (!isSelectedModelFree || !selectedModelMeasureRef.current) {
+ setSelectedModelTextWidth(0);
+ return undefined;
+ }
+
+ const measureSelectedModel = () => {
+ setSelectedModelTextWidth(
+ Math.ceil(
+ selectedModelMeasureRef.current?.getBoundingClientRect().width ?? 0,
+ ),
+ );
+ };
+ measureSelectedModel();
+
+ if (typeof ResizeObserver === "undefined") {
+ return undefined;
+ }
+
+ const observer = new ResizeObserver(measureSelectedModel);
+ observer.observe(selectedModelMeasureRef.current);
+ return () => observer.disconnect();
+ }, [isSelectedModelFree, selectedModel]);
+
const { t } = useTranslation("openhands");
return (
@@ -168,75 +221,115 @@ export function ModelSelector({
</fieldset>
{selectedProvider === "openhands" && (
- <HelpLink
- testId="openhands-account-help"
- text={t(I18nKey.SETTINGS$NEED_OPENHANDS_ACCOUNT)}
- linkText={t(I18nKey.SETTINGS$CLICK_HERE)}
- href={PRODUCT_URL.PRODUCTION}
- size="settings"
- linkColor="white"
- />
+ <div className="flex flex-col gap-2">
+ <HelpLink
+ testId="openhands-account-help"
+ text={t(I18nKey.SETTINGS$NEED_OPENHANDS_ACCOUNT)}
+ linkText={t(I18nKey.SETTINGS$CLICK_HERE)}
+ href={PRODUCT_URL.PRODUCTION}
+ size="settings"
+ linkColor="white"
+ />
+ </div>
)}
<fieldset className="flex flex-col gap-2.5 w-full">
<label className={cn("text-sm", labelClassName)}>
{t(I18nKey.LLM$MODEL)}
</label>
- <Autocomplete
- data-testid="llm-model-input"
- isRequired
- isVirtualized={false}
- isLoading={isLoadingModels}
- name="llm-model-input"
- aria-label={t(I18nKey.LLM$MODEL)}
- isClearable={false}
- onSelectionChange={(e) => {
- if (e?.toString()) handleChangeModel(e.toString());
- }}
- isDisabled={isDisabled || !selectedProvider}
- selectedKey={selectedModel}
- defaultSelectedKey={selectedModel ?? undefined}
- classNames={{
- popoverContent:
- "bg-content1 rounded-xl border border-[var(--oh-border)]",
- selectorButton: heroUiAutocompleteSelectorButtonClassName,
- }}
- selectorButtonProps={{ disableRipple: true }}
- inputProps={{
- classNames: {
- inputWrapper: formControlSettingsFieldClassName,
- },
- }}
- >
- <AutocompleteSection
- title={t(I18nKey.MODEL_SELECTOR$VERIFIED)}
- classNames={{ heading: "text-[var(--oh-muted)]" }}
+ <div className="relative">
+ <Autocomplete
+ data-testid="llm-model-input"
+ isRequired
+ isVirtualized={false}
+ isLoading={isLoadingModels}
+ name="llm-model-input"
+ aria-label={t(I18nKey.LLM$MODEL)}
+ isClearable={false}
+ onSelectionChange={(e) => {
+ if (e?.toString()) handleChangeModel(e.toString());
+ }}
+ isDisabled={isDisabled || !selectedProvider}
+ selectedKey={selectedModel}
+ defaultSelectedKey={selectedModel ?? undefined}
+ classNames={{
+ popoverContent:
+ "bg-content1 rounded-xl border border-[var(--oh-border)]",
+ selectorButton: heroUiAutocompleteSelectorButtonClassName,
+ }}
+ selectorButtonProps={{ disableRipple: true }}
+ inputProps={{
+ classNames: {
+ inputWrapper: formControlSettingsFieldClassName,
+ },
+ }}
>
- {verifiedModels.map((model) => (
- <AutocompleteItem key={model.name}>{model.name}</AutocompleteItem>
- ))}
- </AutocompleteSection>
- {unverifiedModels.length > 0 ? (
<AutocompleteSection
- title={t(I18nKey.MODEL_SELECTOR$OTHERS)}
+ title={t(I18nKey.MODEL_SELECTOR$VERIFIED)}
classNames={{ heading: "text-[var(--oh-muted)]" }}
>
- {unverifiedModels.map((model) => (
- <AutocompleteItem
- data-testid={`model-item-${model.name}`}
- key={model.name}
- >
- {model.name}
+ {verifiedModels.map((model) => (
+ <AutocompleteItem key={model.name} textValue={model.name}>
+ <span className="flex min-w-0 items-center gap-2">
+ <span className="truncate">{model.name}</span>
+ {isFreeOpenHandsModel(
+ `${selectedProvider}/${model.name}`,
+ ) ? (
+ <span className={freeModelBadgeClassName}>
+ {FREE_MODEL_BADGE_LABEL}
+ </span>
+ ) : null}
+ </span>
</AutocompleteItem>
))}
</AutocompleteSection>
+ {unverifiedModels.length > 0 ? (
+ <AutocompleteSection
+ title={t(I18nKey.MODEL_SELECTOR$OTHERS)}
+ classNames={{ heading: "text-[var(--oh-muted)]" }}
+ >
+ {unverifiedModels.map((model) => (
+ <AutocompleteItem
+ data-testid={`model-item-${model.name}`}
+ key={model.name}
+ textValue={model.name}
+ >
+ {model.name}
+ </AutocompleteItem>
+ ))}
+ </AutocompleteSection>
+ ) : null}
+ </Autocomplete>
+ {isSelectedModelFree && selectedModel ? (
+ <>
+ <span
+ ref={selectedModelMeasureRef}
+ className="pointer-events-none absolute left-3 top-1/2 whitespace-pre text-sm opacity-0"
+ aria-hidden
+ >
+ {selectedModel}
+ </span>
+ <span
+ data-testid="selected-free-model-badge"
+ className={cn(
+ freeModelBadgeClassName,
+ "pointer-events-none absolute top-1/2 z-10 -translate-y-1/2",
+ )}
+ style={{
+ left: `calc(0.75rem + ${selectedModelTextWidth}px + 0.5rem)`,
+ }}
+ >
+ {FREE_MODEL_BADGE_LABEL}
+ </span>
+ </>
) : null}
- </Autocomplete>
+ </div>
{modelsError && (
<p data-testid="models-error" className="text-danger text-xs">
{t(I18nKey.CONFIGURATION$ERROR_FETCH_MODELS)}
</p>
)}
+ {selectedProvider === "openhands" ? <FreeOpenHandsModelsNote /> : null}
</fieldset>
</div>
);
diff --git a/src/hooks/chat/use-slash-command.ts b/src/hooks/chat/use-slash-command.ts
index 5fc2283f2b..f27c526249 100644
--- a/src/hooks/chat/use-slash-command.ts
+++ b/src/hooks/chat/use-slash-command.ts
@@ -5,6 +5,7 @@ import { Microagent } from "#/api/open-hands.types";
import { BUILT_IN_COMMANDS, MODEL_COMMAND } from "#/utils/constants";
import { useActiveBackend } from "#/contexts/active-backend-context";
import { useLlmProfiles } from "#/hooks/query/use-llm-profiles";
+import { formatModelNameForDisplay } from "#/utils/format-model-name";
export type SlashCommandSkill = SkillInfo | Microagent;
@@ -88,7 +89,7 @@ export const useSlashCommand = (
name: profile.name,
type: "agentskills",
content: profile.model
- ? `Switch to ${profile.model}`
+ ? `Switch to ${formatModelNameForDisplay(profile.model)}`
: "Switch to this LLM profile",
triggers: [command],
},
diff --git a/src/routes/app-settings.tsx b/src/routes/app-settings.tsx
index cfb3e57349..6ff8c69119 100644
--- a/src/routes/app-settings.tsx
+++ b/src/routes/app-settings.tsx
@@ -21,6 +21,7 @@ import { SettingsDropdownInput } from "#/components/features/settings/settings-d
import { NavigationLink } from "#/components/shared/navigation-link";
import { useLlmProfiles } from "#/hooks/query/use-llm-profiles";
import { useActiveBackend } from "#/contexts/active-backend-context";
+import { formatModelNameForDisplay } from "#/utils/format-model-name";
const AUTOMATIC_TITLE_LLM_PROFILE_KEY = "__automatic__";
@@ -72,7 +73,7 @@ export function AppSettingsScreen() {
label: profile.model
? t(I18nKey.SETTINGS$TITLE_GENERATION_PROFILE_OPTION, {
name: profile.name,
- model: profile.model,
+ model: formatModelNameForDisplay(profile.model) ?? profile.model,
})
: profile.name,
})) ?? []),
diff --git a/src/routes/llm-settings.tsx b/src/routes/llm-settings.tsx
index 51ec427acb..c8216ee594 100644
--- a/src/routes/llm-settings.tsx
+++ b/src/routes/llm-settings.tsx
@@ -1,4 +1,5 @@
import React from "react";
+import { Info } from "lucide-react";
import { useTranslation } from "react-i18next";
import { ModelSelector } from "#/components/shared/modals/settings/model-selector";
import { useAgentSettingsSchema } from "#/hooks/query/use-agent-settings-schema";
@@ -32,6 +33,10 @@ import {
resolveLlmAuthType,
} from "#/constants/llm-subscription";
import { useOpenAISubscriptionModels } from "#/hooks/query/use-llm-subscription-models";
+import {
+ FREE_OPENHANDS_MODEL_NOTE,
+ isFreeOpenHandsModel,
+} from "#/utils/format-model-name";
const LLM_EXCLUDED_KEYS = new Set([
"llm.model",
@@ -103,6 +108,18 @@ function OpenHandsApiKeyHelp({ testId }: OpenHandsApiKeyHelpProps) {
);
}
+function OpenHandsFreeModelsNote() {
+ return (
+ <p
+ data-testid="openhands-free-models-note"
+ className="flex items-start gap-2 text-xs text-warning"
+ >
+ <Info className="mt-0.5 size-4 shrink-0 text-warning" aria-hidden />
+ <span>{FREE_OPENHANDS_MODEL_NOTE}</span>
+ </p>
+ );
+}
+
export function LlmSettingsScreen({
scope = "personal",
onSaveSuccess,
@@ -388,7 +405,12 @@ export function LlmSettingsScreen({
/>
{showOpenHandsApiKeyHelp ? (
- <OpenHandsApiKeyHelp testId="openhands-api-key-help-2" />
+ <>
+ {isFreeOpenHandsModel(modelValue) ? (
+ <OpenHandsFreeModelsNote />
+ ) : null}
+ <OpenHandsApiKeyHelp testId="openhands-api-key-help-2" />
+ </>
) : null}
<SettingsInput
diff --git a/src/utils/format-model-name.ts b/src/utils/format-model-name.ts
index 6563831a7a..b771b7efb1 100644
--- a/src/utils/format-model-name.ts
+++ b/src/utils/format-model-name.ts
@@ -1,3 +1,39 @@
+export const FREE_MODEL_BADGE_LABEL = "Free";
+
+export const FREE_OPENHANDS_MODELS = {
+ "openhands/glm-5.2": "OpenHands GLM-5.2 (free)",
+ "openhands/deepseek-v4-flash": "OpenHands DeepSeek V4 Flash (free)",
+ "openhands/minimax-m2.7": "OpenHands MiniMax M2.7 (free)",
+} as const;
+
+export const FREE_OPENHANDS_MODEL_IDS = Object.keys(FREE_OPENHANDS_MODELS);
+export const FREE_OPENHANDS_MODEL_NOTE = `Free OpenHands models: ${FREE_OPENHANDS_MODEL_IDS.join(
+ ", ",
+)}. Other provider endpoints with similar model names may require separate billing.`;
+
+export const isFreeOpenHandsModel = (
+ model: string | null | undefined,
+): model is keyof typeof FREE_OPENHANDS_MODELS =>
+ Boolean(model && model in FREE_OPENHANDS_MODELS);
+
+export function formatModelNameForDisplay(
+ model: string | null | undefined,
+): string | null {
+ if (!model) return null;
+ return isFreeOpenHandsModel(model) ? FREE_OPENHANDS_MODELS[model] : model;
+}
+
+export function formatProviderModelNameForDisplay(
+ provider: string | null | undefined,
+ model: string | null | undefined,
+): string | null {
+ if (!model) return null;
+ const fullModel = provider ? `${provider}/${model}` : model;
+ return isFreeOpenHandsModel(fullModel)
+ ? FREE_OPENHANDS_MODELS[fullModel]
+ : model;
+}
+
/**
* Format a native (OpenHands-kind) routing model string for display, stripping
* the provider route prefix (e.g. ``"anthropic/claude-sonnet-4-5-20250929"`` β†’
@@ -16,6 +52,7 @@ export function formatNativeModelName(
model: string | null | undefined,
): string | null {
if (!model) return null;
+ if (isFreeOpenHandsModel(model)) return FREE_OPENHANDS_MODELS[model];
const lastSegment = model.split("/").pop();
return lastSegment || model;
}