Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I Built a Terminal AI Assistant That Never Freezes — Here's the Architecture

说明与用途

一个永不冻结的终端 AI 助手,采用异步 UI、实时 Markdown 渲染、会话中模型切换,并通过 OpenRouter 自动更新免费模型列表。

问题

Developers need an AI assistant that can be used directly in the terminal without freezing, allowing seamless switching between free LLM models and preserving conversation context.

结果

The terminal AI assistant runs asynchronously, never blocks the UI, renders Markdown live, supports mid‑conversation model switching, and self‑heals the free model list by querying OpenRouter’s catalog and filtering by actual pricing.

工作流

  • 1. Install the CLI via pipx or editable install.
  • 2. Run ai-agent to launch the Textual TUI.
  • 3. Type prompts; responses render live as Markdown.
  • 4. Switch models mid‑conversation using the UI; context is retained.
  • 5. The assistant fetches the OpenRouter model catalog on startup, filters free models by pricing, caches for 6 hours, and rebuilds the model list automatically.
  • 6. Use keybindings (Enter, Ctrl+L, Ctrl+C, mouse) for interaction.
  • 7. Future enhancements include voice engine and persistent memory.

证据

The entire top tier had quietly gone paid. The :free suffix in the model id doesn't mean anything once a provider pulls the model from the free tier — OpenRouter just updates the pricing fields in their API.

来源

I wrote openrouter_models.py — a self-healing module that fetches OpenRouter's live model catalog on startup and filters by actual pricing data, not by the id string.

来源

  • 记录日期: 2026-09-06T07:21:45.166Z