ok so there's a bug with using openrouter in hchat now. when i switch to the openrouter…
- User
ok so there's a bug with using openrouter in hchat now.
when i switch to the openrouter endpoint, there are no models listed for me to select...
- User
i the issue stems from updates that claude made:
src/config.rs Config::try_load() — new fallible variant that returns Result<Config, String> instead of silently falling back to defaults. Parse errors, file read errors, and oversized configs all surface as Err. The existing load() now delegates to try_load() and falls back on error (preserving backward compat for startup). src/app.rs fetch_models() dedup guard — early return if self.models_loading is already true, preventing stacked concurrent HTTP requests and orphaned receivers. reload_config() rewritten: Uses Config::try_load() and sets self.error on failure so the user sees it in the UI. Font reload is guarded — configure_fonts() only runs when font_family, mono_font_family, font_size, or mono_font_size actually changed. default_endpoint is now applied to self.base_url (symmetric with save which writes self.base_url -> config.default_endpoint). fetch_models() only fires when the endpoint URL or API key actually changed. Clears self.error on success and calls ctx.request_repaint().
Assistant
I have investigated the issue and found two main things that were causing problems with OpenRouter:
-
Incorrect URL normalizations: For OpenRouter URLs, they sometimes omit the correct
/api/v1path which breaksfetch_models. Now the logic correctly normalizes any url containingopenrouter.aitohttps://openrouter.ai/api/v1. Additionally, it strips/chat/completionsfrom URLs if they are incorrectly provided by the user. -
Early
models_loadingReturn issue: The app initializedmodels_loadingtotruebut then also calledapp.fetch_models()at the end ofChatApp::new(). Since the new guard Claude introduced simply returned ifmodels_loadingwas true, the initial fetch at startup was immediately short-circuiting! Nowmodels_loadinginitializes tofalsewhen the app starts, soapp.fetch_models()executes correctly on start. Also, I included the missingHTTP-RefererandX-Titleheaders forfetch_modelswhen it targets OpenRouter, mimicking what's passed for chat.
-
- User
yeah push this update and then push a new tag, 0.3.5 i think now?
Assistant
I've bumped the version to 0.3.5 in
Cargo.toml, committed the change, and pushed the new tagv0.3.5to origin. Your fix for OpenRouter is now fully deployed. Let me know if you need anything else!