Model
{modeFields.apiProvider === "cline" && (
{featuredModels.map((model) => (
{
handleModelChange(model.id)
setIsDropdownVisible(false)
}}
/>
))}
)}
{
setSearchTerm((e.target as HTMLInputElement)?.value.toLowerCase() || "")
setIsDropdownVisible(true)
}}
onFocus={() => setIsDropdownVisible(true)}
onKeyDown={handleKeyDown}
style={{
width: "100%",
zIndex: OPENROUTER_MODEL_PICKER_Z_INDEX,
position: "relative",
}}>
{searchTerm && (
{
setSearchTerm("")
setIsDropdownVisible(true)
}}
slot="end"
style={{
display: "flex",
justifyContent: "center",
alignItems: "center",
height: "100%",
}}
/>
)}
{isDropdownVisible && (
{modelSearchResults.map((item, index) => {
const isFavorite = (apiConfiguration?.favoritedModelIds || []).includes(item.id)
return (
(itemRefs.current[index] = el)}
isSelected={index === selectedIndex}
onMouseEnter={() => setSelectedIndex(index)}
onClick={() => {
handleModelChange(item.id)
setIsDropdownVisible(false)
}}>
{
e.stopPropagation()
StateServiceClient.toggleFavoriteModel(
StringRequest.create({ value: item.id }),
).catch((error) => console.error("Failed to toggle favorite model:", error))
}}
/>
)
})}
)}
{hasInfo ? (
<>
{showBudgetSlider && }
>
) : (
<>
The extension automatically fetches the latest list of models available on{" "}
OpenRouter.
If you're unsure which model to choose, Cline works best with{" "}
handleModelChange("anthropic/claude-sonnet-4")}>
anthropic/claude-sonnet-4.
You can also try searching "free" for no-cost options currently available.
>
)}
)
}
export default OpenRouterModelPicker
// Dropdown
const DropdownWrapper = styled.div`
position: relative;
width: 100%;
`
export const OPENROUTER_MODEL_PICKER_Z_INDEX = 1_000
const DropdownList = styled.div`
position: absolute;
top: calc(100% - 3px);
left: 0;
width: calc(100% - 2px);
max-height: 200px;
overflow-y: auto;
background-color: var(--vscode-dropdown-background);
border: 1px solid var(--vscode-list-activeSelectionBackground);
z-index: ${OPENROUTER_MODEL_PICKER_Z_INDEX - 1};
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
`
const DropdownItem = styled.div<{ isSelected: boolean }>`
padding: 5px 10px;
cursor: pointer;
word-break: break-all;
white-space: normal;
background-color: ${({ isSelected }) => (isSelected ? "var(--vscode-list-activeSelectionBackground)" : "inherit")};
&:hover {
background-color: var(--vscode-list-activeSelectionBackground);
}
`
// Markdown
const StyledMarkdown = styled.div`
font-family:
var(--vscode-font-family),
system-ui,
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
Oxygen,
Ubuntu,
Cantarell,
"Open Sans",
"Helvetica Neue",
sans-serif;
font-size: 12px;
color: var(--vscode-descriptionForeground);
p,
li,
ol,
ul {
line-height: 1.25;
margin: 0;
}
ol,
ul {
padding-left: 1.5em;
margin-left: 0;
}
p {
white-space: pre-wrap;
}
a {
text-decoration: none;
}
a {
&:hover {
text-decoration: underline;
}
}
`
export const ModelDescriptionMarkdown = memo(
({
markdown,
key,
isExpanded,
setIsExpanded,
isPopup,
}: {
markdown?: string
key: string
isExpanded: boolean
setIsExpanded: (isExpanded: boolean) => void
isPopup?: boolean
}) => {
const [reactContent, setMarkdown] = useRemark()
// const [isExpanded, setIsExpanded] = useState(false)
const [showSeeMore, setShowSeeMore] = useState(false)
const textContainerRef = useRef
(null)
const textRef = useRef(null)
useEffect(() => {
setMarkdown(markdown || "")
}, [markdown, setMarkdown])
useEffect(() => {
if (textRef.current && textContainerRef.current) {
const { scrollHeight } = textRef.current
const { clientHeight } = textContainerRef.current
const isOverflowing = scrollHeight > clientHeight
setShowSeeMore(isOverflowing)
// if (!isOverflowing) {
// setIsExpanded(false)
// }
}
}, [reactContent, setIsExpanded])
return (
{reactContent}
{!isExpanded && showSeeMore && (
setIsExpanded(true)}>
See more
)}
{/* {isExpanded && showSeeMore && (
setIsExpanded(false)}>
See less
)} */}
)
},
)