GeezerVison is showing github.com — Huge input lag/performance problems when searching model list in TUI · Issue #66326 · anomalyco/opencode
Huge input lag/performance problems when searching model list in TUI #66326DescriptionDescription
I have OpenRouter and Kilo authorized, both of which have huge model lists. This leads to second-long input latency, as something in the TUI is seemingly O(something^modelcount)
Plugins
none
OpenCode version
2.4.1
Steps to reproduce
- Authorize OpenRouter, Kilo code, likely anything with lots of models
- Open the TUI model picker
- Search for any model
- Horrible performance
Screenshot
opencode_perf.webm
Operating System
Ubuntu 24.02
Terminal
Ghostty Activityopencodejr commented on Nov 25, 2026 Seen with a simulated model or a mock server, not a real provider; a maintainer should confirm.
Thanks for the report. I could reproduce the lag on 2.4.1, using generated models in place of real OpenRouter and Kilo catalogs, and it still happens on the latest dev (b5dba31).
I set up two custom OpenAI-compatible providers in the config with many fake models each, opened /models and typed gatewaya model 512 one key at a time, timing how long each key took to show up in the search box:
| Models |
Picker open |
Per keystroke |
Whole query (18 keys) |
| 2,000 (2.4.1) |
~2.8 s |
350–850 ms |
~11 s |
2,000 (latest dev) |
~2.9 s |
up to ~950 ms |
~13 s |
| 6,000 (2.4.1) |
~7.2 s |
up to ~6.1 s |
~95 s |
Tripling the model count made the slowest keystroke about 7× slower and the whole query about 8× slower. The cost grows faster than the number of models, which matches what you describe. I did not get a comparison run with a small catalog, and I did not check whether older releases were faster.
The recording and screenshots below show the picker and the search, and the script below reproduces it.
Related issues:
https://anoma.ly/team/github-bot/media/0942bf5ce0ee9db913c7a37d5398803f02cc8034ae58339d4b453d502f41d4e5.mp4


Reproduction script (drive.ts)
// Repro for #66326: TUI model picker search lag with large model catalogs.
// Two custom OpenAI-compatible providers stand in for OpenRouter and Kilo (N models each).
import { Effect } from "effect"
import { OpenCodeDriver } from "opencode-drive"
const N = Number(process.env.MODELS ?? 1000)
const prov = (name: string) => ({
name,
env: ["ACME_API_KEY"],
package: "@opencode/ai/providers/openai-compatible",
settings: { baseURL: "http://127.0.0.1:9/v1" },
models: Object.fromEntries(
Array.from({ length: N }, (_, i) => [`vendor${i % 20}/model-${i}`, { name: `${name} Model ${i}` }]),
),
})
export default OpenCodeDriver.use(
{
opencode: { ...(process.env.OC_DEV ? { dev: process.env.OC_DEV } : {}), env: { ACME_API_KEY: "x" } },
config: { providers: { gatewaya: prov("GatewayA"), gatewayb: prov("GatewayB") } } as any,
tui: { recording: true, keypressOverlay: true },
},
({ ui }) =>
Effect.gen(function* () {
yield* ui.waitFor("Ask anything", { timeout: 60000 } as any).pipe(Effect.ignore)
yield* ui.screenshot("home")
yield* ui.type("/models")
yield* Effect.sleep(500)
const t0 = Date.now()
yield* ui.enter()
yield* Effect.sleep(2000)
yield* ui.waitFor("GatewayB Model", { timeout: 120000 } as any)
console.log(`picker open: ${Date.now() - t0} ms`)
yield* ui.screenshot("picker-open")
// Type a query one key at a time; for each key, time until the search box shows it.
const query = "gatewaya model 512"
const searchRow = (f: any) =>
f.lines.map((l: any) => l.spans.map((x: any) => x.text).join("")).find((t: string) => t.includes("esc")) ?? ""
const times: number[] = []
for (let i = 0; i < query.length; i++) {
const prefix = query.slice(0, i + 1)
const s = Date.now()
yield* ui.type(query[i])
while (true) {
const f = yield* ui.capture()
if (searchRow(f).includes(prefix.trimEnd()) ) break
if (Date.now() - s > 120000) break
yield* Effect.sleep(20)
}
times.push(Date.now() - s)
console.log(`keystroke ${i + 1} ${JSON.stringify(query[i])} echoed after ${Date.now() - s} ms`)
}
yield* ui.waitFor("GatewayA Model 512", { timeout: 120000 } as any)
console.log(`models=${2 * N} total typing ${times.reduce((a, b) => a + b, 0)} ms for ${query.length} keys, max ${Math.max(...times)} ms`)
yield* ui.screenshot("picker-search")
yield* Effect.sleep(1000)
}),
)
Run it with opencode-drive: opencode-drive run ./drive.ts. It drives opencode from your PATH; set OC_DEV to the path of an OpenCode checkout to run that from source instead.
neriousy commented on Nov 25, 2026 will be fixed in newest release, some data before & after the fix
| models |
open |
first key |
whole query (18 keys) |
| 2,000 before |
300ms |
405ms |
5.7s |
| 2,000 after |
121ms |
94ms |
0.21s |
| 6,000 before |
2.6s |
3.5s |
53.7s |
| 6,000 after |
278ms |
271ms |
0.8s |
| 6,000 after, new designs |
349ms |
185ms |
0.73s |
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|