[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-xenodium--chatgpt-shell":3,"tool-xenodium--chatgpt-shell":64},[4,17,25,39,48,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",138956,2,"2026-04-05T11:33:21",[13,14,15],"开发框架","Agent","语言模型","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":10,"last_commit_at":23,"category_tags":24,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,15],{"id":26,"name":27,"github_repo":28,"description_zh":29,"stars":30,"difficulty_score":10,"last_commit_at":31,"category_tags":32,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[33,34,35,36,14,37,15,13,38],"图像","数据工具","视频","插件","其他","音频",{"id":40,"name":41,"github_repo":42,"description_zh":43,"stars":44,"difficulty_score":45,"last_commit_at":46,"category_tags":47,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,3,"2026-04-04T04:44:48",[14,33,13,15,37],{"id":49,"name":50,"github_repo":51,"description_zh":52,"stars":53,"difficulty_score":45,"last_commit_at":54,"category_tags":55,"status":16},519,"PaddleOCR","PaddlePaddle\u002FPaddleOCR","PaddleOCR 是一款基于百度飞桨框架开发的高性能开源光学字符识别工具包。它的核心能力是将图片、PDF 等文档中的文字提取出来，转换成计算机可读取的结构化数据，让机器真正“看懂”图文内容。\n\n面对海量纸质或电子文档，PaddleOCR 解决了人工录入效率低、数字化成本高的问题。尤其在人工智能领域，它扮演着连接图像与大型语言模型（LLM）的桥梁角色，能将视觉信息直接转化为文本输入，助力智能问答、文档分析等应用场景落地。\n\nPaddleOCR 适合开发者、算法研究人员以及有文档自动化需求的普通用户。其技术优势十分明显：不仅支持全球 100 多种语言的识别，还能在 Windows、Linux、macOS 等多个系统上运行，并灵活适配 CPU、GPU、NPU 等各类硬件。作为一个轻量级且社区活跃的开源项目，PaddleOCR 既能满足快速集成的需求，也能支撑前沿的视觉语言研究，是处理文字识别任务的理想选择。",74913,"2026-04-05T10:44:17",[15,33,13,37],{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":45,"last_commit_at":62,"category_tags":63,"status":16},2181,"OpenHands","OpenHands\u002FOpenHands","OpenHands 是一个专注于 AI 驱动开发的开源平台，旨在让智能体（Agent）像人类开发者一样理解、编写和调试代码。它解决了传统编程中重复性劳动多、环境配置复杂以及人机协作效率低等痛点，通过自动化流程显著提升开发速度。\n\n无论是希望提升编码效率的软件工程师、探索智能体技术的研究人员，还是需要快速原型验证的技术团队，都能从中受益。OpenHands 提供了灵活多样的使用方式：既可以通过命令行（CLI）或本地图形界面在个人电脑上轻松上手，体验类似 Devin 的流畅交互；也能利用其强大的 Python SDK 自定义智能体逻辑，甚至在云端大规模部署上千个智能体并行工作。\n\n其核心技术亮点在于模块化的软件智能体 SDK，这不仅构成了平台的引擎，还支持高度可组合的开发模式。此外，OpenHands 在 SWE-bench 基准测试中取得了 77.6% 的优异成绩，证明了其解决真实世界软件工程问题的能力。平台还具备完善的企业级功能，支持与 Slack、Jira 等工具集成，并提供细粒度的权限管理，适合从个人开发者到大型企业的各类用户场景。",70612,"2026-04-05T11:12:22",[15,14,13,36],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":70,"readme_en":71,"readme_zh":72,"quickstart_zh":73,"use_case_zh":74,"hero_image_url":75,"owner_login":76,"owner_name":77,"owner_avatar_url":78,"owner_bio":77,"owner_company":77,"owner_location":79,"owner_email":77,"owner_twitter":76,"owner_website":80,"owner_url":81,"languages":82,"stars":87,"forks":88,"last_commit_at":89,"license":90,"difficulty_score":10,"env_os":91,"env_gpu":92,"env_ram":91,"env_deps":93,"category_tags":100,"github_topics":101,"view_count":10,"oss_zip_url":77,"oss_zip_packed_at":77,"status":16,"created_at":106,"updated_at":107,"faqs":108,"releases":137},2591,"xenodium\u002Fchatgpt-shell","chatgpt-shell","A multi-llm Emacs shell (ChatGPT, Claude, DeepSeek, Gemini, Kagi, Ollama, Perplexity) + editing integrations","chatgpt-shell 是一款专为 Emacs 用户打造的多模型 AI 交互终端。它打破了单一模型的局限，让用户能在熟悉的 Emacs 命令行环境中，无缝切换并调用 ChatGPT、Claude、DeepSeek、Gemini、Ollama 等主流大语言模型服务。\n\n对于习惯在 Emacs 中进行开发或写作的用户而言，频繁切换浏览器或独立客户端会打断心流。chatgpt-shell 通过将 AI 对话深度集成到 Emacs 的 comint  shell 机制中，解决了这一痛点。用户无需离开编辑器即可直接获取代码建议、文本润色或逻辑分析结果，极大地提升了人机协作的流畅度。\n\n这款工具特别适合重度 Emacs 用户、软件开发者及技术研究人员。其核心亮点在于“混合式”交互体验：不仅支持标准的命令行问答，还独创了“组合缓冲区（compose buffer）”模式。用户可以选中代码或文本区域，一键生成可编辑的草稿区来精心构建提示词，提交后又能通过简洁的单键指令（如'n'切换历史、'r'追问、'm'获取更多结果）高效管理对话上下文。这种设计既保留了极客的键盘操作效率，又兼顾了复杂任务所需的编","chatgpt-shell 是一款专为 Emacs 用户打造的多模型 AI 交互终端。它打破了单一模型的局限，让用户能在熟悉的 Emacs 命令行环境中，无缝切换并调用 ChatGPT、Claude、DeepSeek、Gemini、Ollama 等主流大语言模型服务。\n\n对于习惯在 Emacs 中进行开发或写作的用户而言，频繁切换浏览器或独立客户端会打断心流。chatgpt-shell 通过将 AI 对话深度集成到 Emacs 的 comint  shell 机制中，解决了这一痛点。用户无需离开编辑器即可直接获取代码建议、文本润色或逻辑分析结果，极大地提升了人机协作的流畅度。\n\n这款工具特别适合重度 Emacs 用户、软件开发者及技术研究人员。其核心亮点在于“混合式”交互体验：不仅支持标准的命令行问答，还独创了“组合缓冲区（compose buffer）”模式。用户可以选中代码或文本区域，一键生成可编辑的草稿区来精心构建提示词，提交后又能通过简洁的单键指令（如'n'切换历史、'r'追问、'm'获取更多结果）高效管理对话上下文。这种设计既保留了极客的键盘操作效率，又兼顾了复杂任务所需的编辑灵活性，是让 AI 真正融入本地工作流的得力助手。","👉 [[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][Support this work via GitHub Sponsors]]\n\n[[https:\u002F\u002Fstable.melpa.org\u002F#\u002Fchatgpt-shell][file:https:\u002F\u002Fstable.melpa.org\u002Fpackages\u002Fchatgpt-shell-badge.svg]] [[https:\u002F\u002Fmelpa.org\u002F#\u002Fchatgpt-shell][file:https:\u002F\u002Fmelpa.org\u002Fpackages\u002Fchatgpt-shell-badge.svg]]\n\n* chatgpt-shell\n\nA multi-llm Emacs [[https:\u002F\u002Fwww.gnu.org\u002Fsoftware\u002Femacs\u002Fmanual\u002Fhtml_node\u002Femacs\u002FShell-Prompts.html][comint]] shell, by [[https:\u002F\u002Flmno.lol\u002Falvaro][me]].\n\n* Related packages\n\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fob-chatgpt-shell][ob-chatgpt-shell]]: Evaluate chatgpt-shell blocks as Emacs org babel blocks.\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fob-dall-e-shell][ob-dall-e-shell]]: Evaluate DALL-E shell blocks as Emacs org babel blocks.\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fdall-e-shell][dall-e-shell]]: An Emacs shell for OpenAI's DALL-E.\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fshell-maker][shell-maker]]: Create Emacs shells backed by either local or cloud services.\n\n* News\n\nchatgpt-shell goes multi model 🎉\n\nPlease sponsor the project to make development + support sustainable.\n\n| Provider   | Model         | Supported | Setup                            |\n|------------+---------------+-----------+----------------------------------|\n| Anthropic  | Claude        | Yes       | Set =chatgpt-shell-anthropic-key=  |\n| Deepseek   | Chat\u002FReasoner | Yes       | Set =chatgpt-shell-deepseek-key=   |\n| Google     | Gemini        | Yes       | Set =chatgpt-shell-google-key=     |\n| Kagi       | Summarizer    | Yes       | Set =chatgpt-shell-kagi-key=       |\n| Ollama     | Llama         | Yes       | Install [[https:\u002F\u002Follama.com\u002F][Ollama]]                   |\n| OpenAI     | ChatGPT       | Yes       | Set =chatgpt-shell-openai-key=     |\n| OpenRouter | Various       | Yes       | Set =chatgpt-shell-openrouter-key= |\n| Perplexity | Llama Sonar   | Yes       | Set =chatgpt-shell-perplexity-key= |\n\nNote: With the exception of [[https:\u002F\u002Follama.com\u002F][Ollama]], you typically have to pay the cloud services for API access. Please check with each respective LLM service.\n\nMy favourite model is missing.\n\n| [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002Fissues][File a feature request]] | [[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][sponsor the work]] |\n\n** A familiar shell\n\nchatgpt-shell is a [[https:\u002F\u002Fwww.gnu.org\u002Fsoftware\u002Femacs\u002Fmanual\u002Fhtml_node\u002Femacs\u002FShell-Prompts.html][comint]] shell. Bring your favourite Emacs shell flows along.\n\n#+HTML: \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_bbb9832913bc.gif\" width=\"80%\" \u002F>\n\n** Swap models\n\nOne shell to query all. Swap LLM provider (via =M-x chatgpt-shell-swap-model=) and continue with your familiar flow.\n\n#+HTML: \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_b4f4bef9d7e9.gif\" width=\"80%\" \u002F>\n\n** A shell hybrid\n\n=chatgpt-shell= includes a compose buffer experience. This is my favourite and most frequently used mechanism to interact with LLMs.\n\nFor example, select a region and invoke =M-x chatgpt-shell-prompt-compose= (=C-c C-e= is my preferred binding), and an editable buffer automatically copies the region and enables crafting a more thorough query. When ready, submit with the familiar =C-c C-c= binding. The buffer automatically becomes read-only and enables single-character bindings.\n\n#+HTML: \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_5d3e63a28197.gif\" width=\"80%\" \u002F>\n\n*** Navigation: n\u002Fp (or TAB\u002Fshift-TAB)\n\nNavigate through source blocks (including previous submissions in history). Source blocks are automatically selected.\n\n*** Reply: r\n\nReply with with follow-up requests using the =r= binding.\n\n*** Give me more: m\n\nWant to ask for more of the same data? Press =m= to request more of it. This is handy to follow up on any kind of list (suggestion, candidates, results, etc).\n\n*** Quick quick: q\n\nI'm a big fan of quickly disposing of Emacs buffers with the =q= binding. chatgpt-shell compose buffers are no exception.\n\n*** Request entire snippets: e\n\nLLM being lazy and returning partial code? Press =e= to request entire snippet.\n\n*** Quick Actions with Transient Menu\n\n   For quick access to common actions, =chatgpt-shell= provides a transient menu,\n   powered by the excellent [[https:\u002F\u002Fgithub.com\u002Fmagit\u002Ftransient][transient]] package. Think of it as a temporary keymap\n   overlay that pops up, shows you available commands with their keybindings,\n   and disappears after you select one.\n\n   Invoke it with =C-c C-t= while inside a =chatgpt-shell= buffer.\n\n   The menu is organized into logical groups for easy navigation:\n\n   #+BEGIN_SRC text :exports code\n     ┌──────────────────────────────────────────────────────────────────────────────┐\n     │ Shells                          Compose prompt via              Inline edit  │\n     │ b: Switch to shell buffer       e: Dedicated buffer             q: Quick     │\n     │ N: Create new shell             p: Minibuffer                      insert\u002F   │\n     │                                 P: Minibuffer (include last        edit      │\n     │                                    kill)                        r: Send      │\n     │                                                                    region    │\n     │                                                                 R: Send &    │\n     │                                                                    review    │\n     │                                                                    region    │\n     │                                                                              │\n     │ Session                         History                         Navigation   │\n     │ m: Swap model                   h: Search                       n: Next item │\n     │ L: Reload models                                                p: Previous  │\n     │ y: Swap system prompt                                              item      │\n     │                                                                 TAB: Next    │\n     │                                                                      source  │\n     │                                                                      block   │\n     │                                                                 \u003Cbacktab>:   │\n     │                                                                      Previous│\n     │                                                                      source  │\n     │                                                                      block   │\n     │                                                                              │\n     │ Source blocks                   Transcript                      Code Actions │\n     │ C-c C-c: Execute                S: Save                         d: Describe  │\n     │ E: Edit                         O: Restore                         code      │\n     │ V: View                                                         f: Refactor  │\n     │                                                                    code      │\n     │                                                                 g: Write git │\n     │                                                                    commit    │\n     │                                                                 t: Generate  │\n     │                                                                    unit test │\n     │                                                                 w: Proofread │\n     │                                                                              │\n     │ Other                                                                        │\n     │ C: Clear buffer                                                              │\n     │ I: Interrupt                                                                 │\n     │ v: Show version                                                              │\n     └──────────────────────────────────────────────────────────────────────────────┘\n   #+END_SRC\n\n   (Note: The exact commands shown depend on context, like whether a region is active\n   or if you are inside a =chatgpt-shell= buffer.)\n\n   If you prefer a global keybinding (available everywhere in Emacs), you can add\n   something like this to your personal Emacs configuration:\n\n   #+begin_src emacs-lisp :lexical no\n     ;; In your init.el or equivalent\n     (global-set-key (kbd \"C-c C-g\") 'chatgpt-shell-transient)\n   #+end_src\n\n   This menu helps with discovering available commands and executing them quickly\n   without needing to remember every single keybinding or =M-x= command name.\n\n** Confirm inline mods (via diffs)\n\nRequest inline modifications, with explicit confirmation before accepting.\n\n#+HTML: \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_9e09c270a5da.gif\" width=\"80%\" \u002F>\n\n** Execute snippets (a la [[https:\u002F\u002Forgmode.org\u002Fworg\u002Forg-contrib\u002Fbabel\u002Fintro.html][org babel]])\n\nBoth the shell and the compose buffers enable users to execute source blocks via =C-c C-c=, leveraging [[https:\u002F\u002Forgmode.org\u002Fworg\u002Forg-contrib\u002Fbabel\u002Fintro.html][org babel]].\n\n#+HTML: \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_ba149443ad76.gif\" width=\"80%\" \u002F>\n\n** Vision experiments\n\nI've been experimenting with image queries (currently ChatGPT only, please [[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][sponsor]] to help bring support for others).\n\nBelow is a handy integration to extract Japanese vocabulary. There's also a generic image descriptor available via =M-x chatgpt-shell-describe-image= that works on any Emacs image (via dired, image buffer, point on image, or selecting a desktop region).\n\n#+HTML: \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_f94f1a5c1453.gif\" width=\"80%\" \u002F>\n\n* Support this effort\n\nIf you're finding =chatgpt-shell= useful, help make the project sustainable and consider ✨[[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][sponsoring]]✨.\n\n=chatgpt-shell= is in development. Please report issues or send [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002Fpulls][pull requests]] for improvements.\n\n* Like this package? Tell me about it 💙\n\nFinding it useful? Like the package? I'd love to hear from you. Get in touch ([[https:\u002F\u002Findieweb.social\u002F@xenodium][Mastodon]] \u002F [[https:\u002F\u002Ftwitter.com\u002Fxenodium][Twitter]] \u002F [[https:\u002F\u002Fbsky.app\u002Fprofile\u002Fxenodium.bsky.social][Bluesky]] \u002F [[https:\u002F\u002Fwww.reddit.com\u002Fuser\u002Fxenodium][Reddit]] \u002F [[mailto:me__AT__xenodium.com][Email]]).\n\n* Install\n\n** MELPA\n\nVia [[https:\u002F\u002Fgithub.com\u002Fjwiegley\u002Fuse-package][use-package]], you can install with =:ensure t=.\n\n#+begin_src emacs-lisp :lexical no\n  (use-package chatgpt-shell\n    :ensure t\n    :custom\n    ((chatgpt-shell-openai-key\n      (lambda ()\n        (auth-source-pass-get 'secret \"openai-key\")))))\n#+end_src\n\n** Straight\n\n#+begin_src emacs-lisp :lexical no\n  (use-package shell-maker\n    :straight (:type git :host github :repo \"xenodium\u002Fshell-maker\"))\n\n  (use-package chatgpt-shell\n    :straight (:type git :host github :repo \"xenodium\u002Fchatgpt-shell\" :files (\"chatgpt-shell*.el\"))\n    :custom\n    ((chatgpt-shell-openai-key\n      (lambda ()\n        (auth-source-pass-get 'secret \"openai-key\")))))\n#+end_src\n\n* Swap models\n** M-x chatgpt-shell-swap-model\n#+HTML: \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_04d6c689d499.png\" width=\"80%\" \u002F>\n\n* Set default model\n#+begin_src emacs-lisp :lexical no\n  (setq chatgpt-shell-model-version \"llama3.2\")\n#+end_src\n\n* Set API Keys\n\nYou will first need to get an API key for each of the various public LLM endpoints you\nwant to interact with.\n\n| Service    | Model(s)      | Link: get an API Key                                                                      |\n|------------|---------------|-------------------------------------------------------------------------------------------|\n| OpenAI     | ChatGPT       | [[https:\u002F\u002Fplatform.openai.com\u002Faccount\u002Fapi-keys][Get an API Key]]                          |\n| Anthropic  | Claude        | [[https:\u002F\u002Fconsole.anthropic.com\u002Fdashboard][Visit the Dashboard]]                          |\n| Deepseek   | Chat\u002FReasoner | [[https:\u002F\u002Fplatform.deepseek.com\u002Fapi_keys][Get an API Key]]                                |\n| Google     | Gemini        | [[https:\u002F\u002Faistudio.google.com\u002Fapp\u002Fapikey][Get an API Key]]                                |\n| Kagi       | Summarizer    | [[https:\u002F\u002Fkagi.com\u002Fsettings?p=api][Get an API Key]]                                       |\n| OpenRouter | Various       | [[https:\u002F\u002Fopenrouter.ai\u002Fsettings\u002Fkeys][Manage your API keys]]                             |\n| Perplexity | Llama Sonar   | [[https:\u002F\u002Fdocs.perplexity.ai\u002Fguides\u002Fgetting-started#generate-an-api-key][Get an API Key]] |\n\n\n** Provide the API Key to ChatGPT via a function\n\nYou can define a function that chatgpt-shell invokes to get the API Key. The\nfollowing example is for Open AI; use a similar approach for other services.\n\n#+begin_src emacs-lisp\n  ;; if you are using the \"pass\" password manager\n  (setq chatgpt-shell-openai-key\n        (lambda ()\n          ;; (auth-source-pass-get 'secret \"openai-key\") ; alternative using pass support in auth-sources\n          (nth 0 (process-lines \"pass\" \"show\" \"openai-key\"))))\n\n  ;; or if using auth-sources, e.g., so the file ~\u002F.authinfo has this line:\n  ;;  machine api.openai.com password OPENAI_KEY\n  (setq chatgpt-shell-openai-key\n        (auth-source-pick-first-password :host \"api.openai.com\"))\n\n  ;; or same as previous but lazy loaded (prevents unexpected passphrase prompt)\n  (setq chatgpt-shell-openai-key\n        (lambda ()\n          (auth-source-pick-first-password :host \"api.openai.com\")))\n#+end_src\n\n** Set the appropriate variable Manually\u002FInteractively\n\n=M-x set-variable chatgpt-shell-anthropic-key=\n\n=M-x set-variable chatgpt-shell-deepseek-key=\n\n=M-x set-variable chatgpt-shell-google-key=\n\n...\n\n** Set the appropriate variable programatically, in your emacs init file\n#+begin_src emacs-lisp\n  ;; set anthropic key from a string\n  (setq chatgpt-shell-anthropic-key \"my anthropic key\")\n  ;; set OpenAI key from the environment\n  (setq chatgpt-shell-openai-key (getenv \"OPENAI_API_KEY\"))\n\n#+end_src\n\n* ChatGPT through proxy service\n\nIf you use ChatGPT through proxy service \"https:\u002F\u002Fapi.chatgpt.domain.com\", set options like the following:\n\n#+begin_src emacs-lisp :lexical no\n  (use-package chatgpt-shell\n    :ensure t\n    :custom\n    ((chatgpt-shell-api-url-base \"https:\u002F\u002Fapi.chatgpt.domain.com\")\n     (chatgpt-shell-openai-key\n      (lambda ()\n        ;; Here the openai-key should be the proxy service key.\n        (auth-source-pass-get 'secret \"openai-key\")))))\n#+end_src\n\nIf your proxy service API path is not OpenAI ChatGPT default path like \"=\u002Fv1\u002Fchat\u002Fcompletions=\", then\nyou can customize option ~chatgpt-shell-api-url-path~.\n\n* Using ChatGPT through HTTP(S) proxy\n\nBehind the scenes chatgpt-shell uses =curl= to send requests to the openai server.\nIf you use ChatGPT through a HTTP proxy (for example you are in a corporate network and a HTTP proxy shields the corporate network from the internet), you need to tell =curl= to use the proxy via the curl option =-x http:\u002F\u002Fyour_proxy=.\nFor this, use =chatgpt-shell-proxy=.\n\nFor example, if you want curl =-x= and =http:\u002F\u002Fyour_proxy=, set =chatgpt-shell-proxy= to \"=http:\u002F\u002Fyour_proxy=\".\n* Launch\n\nLaunch with =M-x chatgpt-shell=.\n\nNote: =M-x chatgpt-shell= keeps a single shell around, refocusing if needed. To launch multiple shells, use =C-u M-x chatgpt-shell=.\n\n* Clear buffer\n\nType =clear= as a prompt.\n\n#+begin_src sh\n  ChatGPT> clear\n#+end_src\n\nAlternatively, use either =M-x chatgpt-shell-clear-buffer= or =M-x comint-clear-buffer=.\n\n* Saving and restoring\n\nSave with =M-x chatgpt-shell-save-session-transcript= and restore with =M-x chatgpt-shell-restore-session-from-transcript=.\n\nSome related values stored in =shell-maker= like =shell-maker-transcript-default-path= and =shell-maker-forget-file-after-clear=.\n\n* Streaming\n\n=chatgpt-shell= can either wait until the entire response is received before displaying, or it can progressively display as chunks arrive (streaming).\n\nStreaming is enabled by default. =(setq chatgpt-shell-streaming nil)= to disable it.\n\n* chatgpt-shell customizations\n\n#+BEGIN_SRC emacs-lisp :results table :colnames '(\"Custom variable\" \"Description\") :exports results\n  (let ((rows))\n    (mapatoms\n     (lambda (symbol)\n       (when (and (string-match \"^chatgpt-shell\"\n                                (symbol-name symbol))\n                  (custom-variable-p symbol))\n         (push `(,symbol\n                 ,(car\n                   (split-string\n                    (or (documentation-property symbol 'variable-documentation)\n                        (get (indirect-variable symbol)\n                             'variable-documentation)\n                        (get symbol 'variable-documentation)\n                        \"\")\n                    \"\\n\")))\n               rows))))\n    rows)\n#+END_SRC\n\n#+RESULTS:\n| Custom variable                                                  | Description                                                                  |\n|------------------------------------------------------------------+------------------------------------------------------------------------------|\n| chatgpt-shell-google-api-url-base                                | Google API’s base URL.                                                       |\n| chatgpt-shell-deepseek-api-url-base                              | DeepSeek API’s base URL.                                                     |\n| chatgpt-shell-perplexity-key                                     | Perplexity API key as a string or a function that loads and returns it.      |\n| chatgpt-shell-anthropic-thinking                                 | When non-nil enable model thinking if available.                             |\n| chatgpt-shell-deepseek-key                                       | DeepSeek key as a string or a function that loads and returns it.            |\n| chatgpt-shell-prompt-header-write-git-commit                     | Prompt header of ‘git-commit‘.                                               |\n| chatgpt-shell-highlight-blocks                                   | Whether or not to highlight source blocks.                                   |\n| chatgpt-shell-prompt-compose-display-action                      | Choose how to display the compose buffer.                                    |\n| chatgpt-shell-display-function                                   | Function to display the shell.  Set to ‘display-buffer’ or custom function.  |\n| chatgpt-shell-prompt-header-generate-unit-test                   | Prompt header of ‘generate-unit-test‘.                                       |\n| chatgpt-shell-prompt-header-refactor-code                        | Prompt header of ‘refactor-code‘.                                            |\n| chatgpt-shell-prompt-header-proofread-region                     | Prompt header used by ‘chatgpt-shell-proofread-region‘.                      |\n| chatgpt-shell-openai-reasoning-effort                            | The amount of reasoning effort to use for OpenAI reasoning models.           |\n| chatgpt-shell-welcome-function                                   | Function returning welcome message or nil for no message.                    |\n| chatgpt-shell-perplexity-api-url-base                            | Perplexity API’s base URL.                                                   |\n| chatgpt-shell-prompt-query-response-style                        | Determines the prompt style when invoking from other buffers.                |\n| chatgpt-shell-model-version                                      | The active model version as either a string.                                 |\n| chatgpt-shell-kagi-key                                           | Kagi API key as a string or a function that loads and returns it.            |\n| chatgpt-shell-logging                                            | Logging disabled by default (slows things down).                             |\n| chatgpt-shell-render-latex                                       | Whether or not to render LaTeX blocks (experimental).                        |\n| chatgpt-shell-swap-model-selector                                | Custom function to select a model during swap.                               |\n| chatgpt-shell-api-url-base                                       | OpenAI API’s base URL.                                                       |\n| chatgpt-shell-google-key                                         | Google API key as a string or a function that loads and returns it.          |\n| chatgpt-shell-ollama-api-url-base                                | Ollama API’s base URL.                                                       |\n| chatgpt-shell-openrouter-key                                     | OpenRouter key as a string or a function that loads and returns it.          |\n| chatgpt-shell-babel-headers                                      | Additional headers to make babel blocks work.                                |\n| chatgpt-shell--pretty-smerge-mode-hook                           | Hook run after entering or leaving ‘chatgpt-shell--pretty-smerge-mode’.      |\n| chatgpt-shell-include-local-file-link-content                    | Non-nil includes linked file content in requests.                            |\n| chatgpt-shell-compose-auto-transient                             | When non-nil automatically display transient menu post compose submission.   |\n| chatgpt-shell-source-block-actions                               | Block actions for known languages.                                           |\n| chatgpt-shell-default-prompts                                    | List of default prompts to choose from.                                      |\n| chatgpt-shell-anthropic-key                                      | Anthropic API key as a string or a function that loads and returns it.       |\n| chatgpt-shell-always-create-new                                  | Non-nil creates a new shell buffer every time ‘chatgpt-shell’ is invoked.    |\n| chatgpt-shell-screenshot-command                                 | The program to use for capturing screenshots.                                |\n| chatgpt-shell-prompt-header-eshell-summarize-last-command-output | Prompt header of ‘eshell-summarize-last-command-output‘.                     |\n| chatgpt-shell-system-prompt                                      | The system prompt ‘chatgpt-shell-system-prompts’ index.                      |\n| chatgpt-shell-transmitted-context-length                         | Controls the amount of context provided to chatGPT.                          |\n| chatgpt-shell-root-path                                          | Root path location to store internal shell files.                            |\n| chatgpt-shell-prompt-header-whats-wrong-with-last-command        | Prompt header of ‘whats-wrong-with-last-command‘.                            |\n| chatgpt-shell-read-string-function                               | Function to read strings from user.                                          |\n| chatgpt-shell-swap-model-filter                                  | Filter models to swap from using this function as a filter.                  |\n| chatgpt-shell-after-command-functions                            | Abnormal hook (i.e. with parameters) invoked after each command.             |\n| chatgpt-shell-system-prompts                                     | List of system prompts to choose from.                                       |\n| chatgpt-shell-openai-key                                         | OpenAI key as a string or a function that loads and returns it.              |\n| chatgpt-shell-proxy                                              | When non-nil, use as a proxy (for example http or socks5).                   |\n| chatgpt-shell-prompt-header-describe-code                        | Prompt header of ‘describe-code‘.                                            |\n| chatgpt-shell-insert-dividers                                    | Whether or not to display a divider between requests and responses.          |\n| chatgpt-shell-models                                             | The list of supported models to swap from.                                   |\n| chatgpt-shell-openrouter-api-url-base                            | OpenRouter API’s base URL.                                                   |\n| chatgpt-shell-language-mapping                                   | Maps external language names to Emacs names.                                 |\n| chatgpt-shell-prompt-compose-view-mode-hook                      | Hook run after entering or leaving ‘chatgpt-shell-prompt-compose-view-mode’. |\n| chatgpt-shell-streaming                                          | Whether or not to stream ChatGPT responses (show chunks as they arrive).     |\n| chatgpt-shell-anthropic-api-url-base                             | Anthropic API’s base URL.                                                    |\n| chatgpt-shell-model-temperature                                  | What sampling temperature to use, between 0 and 2, or nil.                   |\n| chatgpt-shell-anthropic-thinking-budget-tokens                   | The token budget allocated for Anthropic model thinking.                     |\n| chatgpt-shell-request-timeout                                    | How long to wait for a request to time out in seconds.                       |\n| chatgpt-shell-kagi-api-url-base                                  | Kagi API’s base URL.                                                         |\n\nThere are more. Browse via =M-x set-variable=\n\n** =chatgpt-shell-display-function= (with custom function)\n\nIf you'd prefer your own custom display function,\n\n#+begin_src emacs-lisp :lexical no\n  (setq chatgpt-shell-display-function #'my\u002Fchatgpt-shell-frame)\n\n  (defun my\u002Fchatgpt-shell-frame (bname)\n    (let ((cur-f (selected-frame))\n          (f (my\u002Ffind-or-make-frame \"chatgpt\")))\n      (select-frame-by-name \"chatgpt\")\n      (pop-to-buffer-same-window bname)\n      (set-frame-position f (\u002F (display-pixel-width) 2) 0)\n      (set-frame-height f (frame-height cur-f))\n      (set-frame-width f  (frame-width cur-f) 1)))\n\n  (defun my\u002Ffind-or-make-frame (fname)\n    (condition-case\n        nil\n        (select-frame-by-name fname)\n      (error (make-frame `((name . ,fname))))))\n#+end_src\n\nThanks to [[https:\u002F\u002Fgithub.com\u002Ftuhdo][tuhdo]] for the custom display function.\n\n* chatgpt-shell commands\n#+BEGIN_SRC emacs-lisp :results table :colnames '(\"Binding\" \"Command\" \"Description\") :exports results\n  (let ((rows))\n    (mapatoms\n     (lambda (symbol)\n       (when (and (string-match \"^chatgpt-shell\"\n                                (symbol-name symbol))\n                  (commandp symbol))\n         (push `(,(string-join\n                   (seq-filter\n                    (lambda (symbol)\n                      (not (string-match \"menu\" symbol)))\n                    (mapcar\n                     (lambda (keys)\n                       (key-description keys))\n                     (or\n                      (where-is-internal\n                       (symbol-function symbol)\n                       comint-mode-map\n                       nil nil (command-remapping 'comint-next-input))\n                      (where-is-internal\n                       symbol chatgpt-shell-mode-map nil nil (command-remapping symbol))\n                      (where-is-internal\n                       (symbol-function symbol)\n                       chatgpt-shell-mode-map nil nil (command-remapping symbol)))))  \" or \")\n                 ,(symbol-name symbol)\n                 ,(car\n                   (split-string\n                    (or (documentation symbol t) \"\")\n                    \"\\n\")))\n               rows))))\n    rows)\n#+END_SRC\n\n#+RESULTS:\n| Binding              | Command                                                  | Description                                                                     |\n|----------------------+----------------------------------------------------------+---------------------------------------------------------------------------------|\n|                      | chatgpt-shell-japanese-lookup                            | Look Japanese term up.                                                          |\n|                      | chatgpt-shell-next-source-block                          | Move point to the next source block's body.                                     |\n|                      | chatgpt-shell-prompt-compose-request-entire-snippet      | If the response code is incomplete, request the entire snippet.                 |\n|                      | chatgpt-shell-prompt-compose-request-more                | Request more data.  This is useful if you already requested examples.           |\n|                      | chatgpt-shell-google-toggle-grounding-with-google-search | Toggle the `:grounding-search' boolean for the currently-selected model.        |\n|                      | chatgpt-shell-execute-babel-block-action-at-point        | Execute block as org babel.                                                     |\n| C-c C-s              | chatgpt-shell-swap-system-prompt                         | Swap system prompt from `chatgpt-shell-system-prompts'.                         |\n|                      | chatgpt-shell-system-prompts-menu                        | ChatGPT                                                                         |\n|                      | chatgpt-shell-prompt-compose-swap-model-version          | Swap the compose buffer's model version.                                        |\n|                      | chatgpt-shell-describe-code                              | Describe code from region using ChatGPT.                                        |\n| C-\u003Cup> or M-p        | chatgpt-shell-previous-input                             | Cycle backwards through input history, saving input.                            |\n|                      | chatgpt-shell-previous-link                              | Move point to the previous link.                                                |\n|                      | chatgpt-shell-copy-block-at-point                        | Copy code block at point to the kill ring.                                      |\n|                      | chatgpt-shell-prompt-compose-next-item                   | Jump to and select next item (request, response, block, link, interaction).     |\n| C-c C-v              | chatgpt-shell-swap-model                                 | Swap model version from `chatgpt-shell-models'.                                 |\n| C-x C-s              | chatgpt-shell-save-session-transcript                    | Save shell transcript to file.                                                  |\n|                      | chatgpt-shell-proofread-region                           | Proofread text from region or current paragraph using ChatGPT.                  |\n|                      | chatgpt-shell-prompt-compose-quit-and-close-frame        | Quit compose and close frame if it's the last window.                           |\n|                      | chatgpt-shell-prompt-compose-other-buffer                | Jump to the shell buffer (compose's other buffer).                              |\n|                      | chatgpt-shell                                            | Start a ChatGPT shell interactive command.                                      |\n| RET                  | chatgpt-shell-submit                                     | Submit current input.                                                           |\n|                      | chatgpt-shell-prompt-compose-swap-system-prompt          | Swap the compose buffer's system prompt.                                        |\n|                      | chatgpt-shell-describe-image                             | Request OpenAI to describe image.                                               |\n|                      | chatgpt-shell-prompt-compose-search-history              | Search prompt history, select, and insert to current compose buffer.            |\n|                      | chatgpt-shell-prompt-compose-previous-history            | Insert previous prompt from history into compose buffer.                        |\n|                      | chatgpt-shell-delete-interaction-at-point                | Delete interaction (request and response) at point.                             |\n|                      | chatgpt-shell-anthropic-toggle-thinking                  | Toggle Anthropic model, as per `chatgpt-shell-anthropic-thinking'.              |\n|                      | chatgpt-shell-refresh-rendering                          | Refresh markdown rendering by re-applying to entire buffer.                     |\n|                      | chatgpt-shell-prompt-compose-insert-block-at-point       | Insert block at point at last known location.                                   |\n|                      | chatgpt-shell-explain-code                               | Describe code from region using ChatGPT.                                        |\n|                      | chatgpt-shell-execute-block-action-at-point              | Execute block at point.                                                         |\n|                      | chatgpt-shell-load-awesome-prompts                       | Load `chatgpt-shell-system-prompts' from awesome-chatgpt-prompts.               |\n|                      | chatgpt-shell-write-git-commit                           | Write commit from region using ChatGPT.                                         |\n|                      | chatgpt-shell-restore-session-from-transcript            | Restore session from file transcript (or HISTORY).                              |\n|                      | chatgpt-shell-prompt-compose-next-interaction            | Show next interaction (request \u002F response).                                     |\n| \u003Cbacktab> or C-c C-p | chatgpt-shell-previous-item                              | Go to previous item.                                                            |\n|                      | chatgpt-shell-fix-error-at-point                         | Fixes flymake error at point.                                                   |\n|                      | chatgpt-shell-next-link                                  | Move point to the next link.                                                    |\n|                      | chatgpt-shell-prompt-compose-transient                   | ChatGPT Shell Compose Transient.                                                |\n|                      | chatgpt-shell-prompt-compose-clear-history               | Clear compose and associated shell history.                                     |\n|                      | chatgpt-shell-prompt-appending-kill-ring                 | Make a ChatGPT request from the minibuffer appending kill ring.                 |\n|                      | chatgpt-shell-ollama-load-models                         | Query ollama for the locally installed models and add them to                   |\n| C-\u003Cdown> or M-n      | chatgpt-shell-next-input                                 | Cycle forwards through input history.                                           |\n|                      | chatgpt-shell-prompt-compose-view-mode                   | Like `view-mode`, but extended for ChatGPT Compose.                             |\n|                      | chatgpt-shell-clear-buffer                               | Clear the current shell buffer.                                                 |\n|                      | chatgpt-shell-insert-local-file-link                     | Select and insert a link to a local file.                                       |\n|                      | chatgpt-shell-edit-block-at-point                        | Execute block at point.                                                         |\n| \u003Ctab> or C-c C-n     | chatgpt-shell-next-item                                  | Go to next item.                                                                |\n|                      | chatgpt-shell-prompt-compose-send-buffer                 | Send compose buffer content to shell for processing.                            |\n| C-c C-e              | chatgpt-shell-prompt-compose                             | Compose and send prompt from a dedicated buffer.                                |\n|                      | chatgpt-shell-rename-buffer                              | Rename current shell buffer.                                                    |\n|                      | chatgpt-shell-remove-block-overlays                      | Remove block overlays.  Handy for renaming blocks.                              |\n|                      | chatgpt-shell-send-region                                | Send region to ChatGPT.                                                         |\n|                      | chatgpt-shell-send-and-review-region                     | Send region to ChatGPT, review before submitting.                               |\n| C-M-h                | chatgpt-shell-mark-at-point-dwim                         | Mark source block if at point.  Mark all output otherwise.                      |\n|                      | chatgpt-shell-insert-buffer-file-link                    | Select and insert a link to a buffer's local file.                              |\n|                      | chatgpt-shell--pretty-smerge-mode                        | Minor mode to display overlays for conflict markers.                            |\n|                      | chatgpt-shell-mark-block                                 | Mark current block in compose buffer.                                           |\n|                      | chatgpt-shell-prompt-compose-reply                       | Reply as a follow-up and compose another query.                                 |\n|                      | chatgpt-shell-prompt-compose-refresh                     | Refresh compose buffer content with current item from shell.                    |\n|                      | chatgpt-shell-set-as-primary-shell                       | Set as primary shell when there are multiple sessions.                          |\n|                      | chatgpt-shell-google-load-models                         | Query Google for the list of Gemini LLM models available.                       |\n|                      | chatgpt-shell-rename-block-at-point                      | Rename block at point (perhaps a different language).                           |\n|                      | chatgpt-shell-quick-insert                               | Request from minibuffer and insert response into current buffer.                |\n|                      | chatgpt-shell-reload-default-models                      | Reload all available models.                                                    |\n| S-\u003Creturn>           | chatgpt-shell-newline                                    | Insert a newline, and move to left margin of the new line.                      |\n|                      | chatgpt-shell-generate-unit-test                         | Generate unit-test for the code from region using ChatGPT.                      |\n|                      | chatgpt-shell-prompt-compose-view-last                   | Display the last request\u002Fresponse interaction.                                  |\n|                      | chatgpt-shell-prompt-compose-previous-item               | Jump to and select previous item (request, response, block, link, interaction). |\n|                      | chatgpt-shell-prompt-compose-next-history                | Insert next prompt from history into compose buffer.                            |\n| C-c C-c              | chatgpt-shell-ctrl-c-ctrl-c                              | If point in source block, execute it.  Otherwise interrupt.                     |\n|                      | chatgpt-shell-eshell-summarize-last-command-output       | Ask ChatGPT to summarize the last command output.                               |\n| M-r                  | chatgpt-shell-search-history                             | Search previous input history.                                                  |\n|                      | chatgpt-shell-mode                                       | Major mode for ChatGPT shell.                                                   |\n|                      | chatgpt-shell-prompt-compose-mode                        | Major mode for composing ChatGPT prompts from a dedicated buffer.               |\n|                      | chatgpt-shell-previous-source-block                      | Move point to the previous source block's body.                                 |\n|                      | chatgpt-shell-prompt                                     | Make a ChatGPT request from the minibuffer.                                     |\n|                      | chatgpt-shell-japanese-ocr-lookup                        | Select a region of the screen to OCR and look up in Japanese.                   |\n|                      | chatgpt-shell-refactor-code                              | Refactor code from region using ChatGPT.                                        |\n|                      | chatgpt-shell-proofread-paragraph-or-region              | Proofread text from region or current paragraph using ChatGPT.                  |\n|                      | chatgpt-shell-view-block-at-point                        | View code block at point (using language's major mode).                         |\n|                      | chatgpt-shell-japanese-audio-lookup                      | Transcribe audio at current file (buffer or `dired') and look up in Japanese.   |\n|                      | chatgpt-shell-eshell-whats-wrong-with-last-command       | Ask ChatGPT what's wrong with the last eshell command.                          |\n|                      | chatgpt-shell-prompt-compose-cancel                      | Cancel and close compose buffer.                                                |\n|                      | chatgpt-shell-prompt-compose-retry                       | Retry sending request to shell.                                                 |\n|                      | chatgpt-shell-version                                    | Show `chatgpt-shell' mode version.                                              |\n|                      | chatgpt-shell-prompt-compose-previous-interaction        | Show previous interaction (request \u002F response).                                 |\n|                      | chatgpt-shell-interrupt                                  | Interrupt `chatgpt-shell' from any buffer.                                      |\n|                      | chatgpt-shell-view-at-point                              | View prompt and output at point in a separate buffer.                           |\n\nBrowse all available via =M-x=.\n\n* Feature requests\n- Please go through this README to see if the feature is already supported.\n- Need custom behaviour? Check out existing [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002Fissues?q=is%3Aissue+][issues\u002Ffeature requests]]. You may find solutions in discussions.\n\n* Pull requests\nPull requests are super welcome. Please [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002Fissues\u002Fnew][reach out]] before getting started to make sure we're not duplicating effort. Also [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002F][search existing discussions]].\n\n* Reporting bugs\n** Setup isn't working?\nPlease share the entire snippet you've used to set =chatgpt-shell= up (but redact your key). Share any errors you encountered. Read on for sharing additional details.\n** Found runtime\u002Felisp errors?\nPlease enable =M-x toggle-debug-on-error=, reproduce the error, and share the stack trace.\n** Found unexpected behaviour?\nPlease enable logging =(setq chatgpt-shell-logging t)= and share the content of the =*chatgpt-log*= buffer in the bug report.\n** Babel issues?\nPlease also share the entire org snippet.\n* Support my work\n\n👉 Find my work useful? [[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][Support this work via GitHub Sponsors]] or [[https:\u002F\u002Fapps.apple.com\u002Fus\u002Fdeveloper\u002Fxenodium-ltd\u002Fid304568690][buy my iOS apps]].\n\n* My other utilities, packages, apps, writing...\n\n- [[https:\u002F\u002Fxenodium.com\u002F][Blog (xenodium.com)]]\n- [[https:\u002F\u002Flmno.lol\u002Falvaro][Blog (lmno.lol\u002Falvaro)]]\n- [[https:\u002F\u002Fplainorg.com][Plain Org]] (iOS)\n- [[https:\u002F\u002Fflathabits.com][Flat Habits]] (iOS)\n- [[https:\u002F\u002Fapps.apple.com\u002Fus\u002Fapp\u002Fscratch\u002Fid1671420139][Scratch]] (iOS)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fmacosrec][macosrec]] (macOS)\n- [[https:\u002F\u002Fapps.apple.com\u002Fus\u002Fapp\u002Ffresh-eyes\u002Fid6480411697?mt=12][Fresh Eyes]] (macOS)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fdwim-shell-command][dwim-shell-command]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fcompany-org-block][company-org-block]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Forg-block-capf][org-block-capf]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fob-swiftui][ob-swiftui]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell][chatgpt-shell]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fready-player][ready-player]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fsqlite-mode-extras][sqlite-mode-extras]]\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fob-chatgpt-shell][ob-chatgpt-shell]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fdall-e-shell][dall-e-shell]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fob-dall-e-shell][ob-dall-e-shell]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fshell-maker][shell-maker]] (Emacs)\n\n* Contributors\n\n#+HTML: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002Fgraphs\u002Fcontributors\">\n#+HTML:   \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_1323624ecf28.png\" \u002F>\n#+HTML: \u003C\u002Fa>\n\nMade with [[https:\u002F\u002Fcontrib.rocks][contrib.rocks]].\n","👉 [[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][通过 GitHub Sponsors 支持本项目]]\n\n[[https:\u002F\u002Fstable.melpa.org\u002F#\u002Fchatgpt-shell][file:https:\u002F\u002Fstable.melpa.org\u002Fpackages\u002Fchatgpt-shell-badge.svg]] [[https:\u002F\u002Fmelpa.org\u002F#\u002Fchatgpt-shell][file:https:\u002F\u002Fmelpa.org\u002Fpackages\u002Fchatgpt-shell-badge.svg]]\n\n* chatgpt-shell\n\n一个支持多大模型的 Emacs [[https:\u002F\u002Fwww.gnu.org\u002Fsoftware\u002Femacs\u002Fmanual\u002Fhtml_node\u002Femacs\u002FShell-Prompts.html][comint]] shell，由 [[https:\u002F\u002Flmno.lol\u002Falvaro][我]] 开发。\n\n* 相关包\n\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fob-chatgpt-shell][ob-chatgpt-shell]]：将 chatgpt-shell 块作为 Emacs org babel 块执行。\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fob-dall-e-shell][ob-dall-e-shell]]：将 DALL-E shell 块作为 Emacs org babel 块执行。\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fdall-e-shell][dall-e-shell]]：一个用于 OpenAI 的 DALL-E 的 Emacs shell。\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fshell-maker][shell-maker]]：创建由本地或云端服务支持的 Emacs shell。\n\n* 新闻\n\nchatgpt-shell 支持多模型 🎉\n\n请赞助该项目，以确保开发与支持的可持续性。\n\n| 提供商   | 模型         | 支持 | 设置                            |\n|------------+---------------+-----------+----------------------------------|\n| Anthropic  | Claude        | 是       | 设置 =chatgpt-shell-anthropic-key=  |\n| Deepseek   | Chat\u002FReasoner | 是       | 设置 =chatgpt-shell-deepseek-key=   |\n| Google     | Gemini        | 是       | 设置 =chatgpt-shell-google-key=     |\n| Kagi       | Summarizer    | 是       | 设置 =chatgpt-shell-kagi-key=       |\n| Ollama     | Llama         | 是       | 安装 [[https:\u002F\u002Follama.com\u002F][Ollama]]                   |\n| OpenAI     | ChatGPT       | 是       | 设置 =chatgpt-shell-openai-key=     |\n| OpenRouter | Various       | 是       | 设置 =chatgpt-shell-openrouter-key= |\n| Perplexity | Llama Sonar   | 是       | 设置 =chatgpt-shell-perplexity-key= |\n\n注意：除 [[https:\u002F\u002Follama.com\u002F][Ollama]] 外，通常需要为云服务的 API 访问付费。请务必向各 LLM 服务提供商确认。\n\n我最喜欢的模型没有被支持。\n\n| [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002Fissues][提交功能请求]] | [[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][赞助本项目]] |\n\n** 熟悉的 shell\n\nchatgpt-shell 是一个 [[https:\u002F\u002Fwww.gnu.org\u002Fsoftware\u002Femacs\u002Fmanual\u002Fhtml_node\u002Femacs\u002FShell-Prompts.html][comint]] shell。您可以沿用自己熟悉的 Emacs shell 工作流。\n\n#+HTML: \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_bbb9832913bc.gif\" width=\"80%\" \u002F>\n\n** 切换模型\n\n一个 shell 查询所有模型。只需通过 =M-x chatgpt-shell-swap-model= 切换 LLM 提供商，即可继续使用您熟悉的流程。\n\n#+HTML: \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_b4f4bef9d7e9.gif\" width=\"80%\" \u002F>\n\n** 混合型 shell\n\n=chatgpt-shell= 包含一个 compose 缓冲区体验。这是我最喜欢且最常使用的与 LLM 交互的方式。\n\n例如，选择一段文本并调用 =M-x chatgpt-shell-prompt-compose=（=C-c C-e= 是我偏好的快捷键），编辑缓冲区会自动复制选中的文本，并允许您构建更完整的查询。准备好后，使用熟悉的 =C-c C-c= 提交。缓冲区会自动变为只读，并启用单字符绑定。\n\n#+HTML: \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_5d3e63a28197.gif\" width=\"80%\" \u002F>\n\n*** 导航：n\u002Fp（或 TAB\u002Fshift-TAB）\n\n在源代码块之间导航（包括历史记录中的先前提交）。源代码块会自动被选中。\n\n*** 回复：r\n\n使用 =r= 绑定对之前的请求进行回复。\n\n*** 再给我一些：m\n\n想再要一些相同的数据吗？按下 =m= 即可请求更多内容。这对于跟进任何类型的列表（建议、候选、结果等）都非常方便。\n\n*** 快速处理：q\n\n我非常喜欢用 =q= 绑定快速关闭 Emacs 缓冲区。chatgpt-shell 的 compose 缓冲区也不例外。\n\n*** 请求完整片段：e\n\nLLM 返回了部分代码吗？按下 =e= 可以请求完整的代码片段。\n\n*** 使用瞬态菜单快速操作\n\n为了快速访问常用操作，=chatgpt-shell= 提供了一个瞬态菜单，基于优秀的 [[https:\u002F\u002Fgithub.com\u002Fmagit\u002Ftransient][transient]] 包实现。可以把它想象成一个临时的键位映射叠加层，它会弹出显示可用命令及其快捷键，并在您选择一个命令后自动消失。\n\n在 =chatgpt-shell= 缓冲区中，使用 =C-c C-t= 来调用该菜单。\n\n菜单按逻辑分组排列，便于导航：\n\n#+BEGIN_SRC text :exports code\n     ┌──────────────────────────────────────────────────────────────────────────────┐\n     │ 外壳                          通过组合生成提示              内联编辑  │\n     │ b: 切换到外壳缓冲区           e: 专用缓冲区                   q: 快速     │\n     │ N: 创建新外壳                 p: 小缓冲区                      插入\u002F   │\n     │                                 P: 小缓冲区（包含上次          编辑      │\n     │                                    杀掉的内容）               r: 发送      │\n     │                                                                    区域    │\n     │                                                                 R: 发送 &    │\n     │                                                                    审核      │\n     │                                                                    区域    │\n     │                                                                              │\n     │ 会话                          历史记录                        导航       │\n     │ m: 切换模型                   h: 搜索                         n: 下一项 │\n     │ L: 重新加载模型                                                p: 上一项  │\n     │ y: 切换系统提示                                                 项        │\n     │                                                                 TAB: 下一个  │\n     │                                                                      源       │\n     │                                                                      块       │\n     │                                                                 \u003Cbacktab>:   │\n     │                                                                      上一个    │\n     │                                                                      源       │\n     │                                                                      块       │\n     │                                                                              │\n     │ 源代码块                      记录                            代码操作   │\n     │ C-c C-c: 执行                 S: 保存                         d: 描述    │\n     │ E: 编辑                       O: 恢复                           代码      │\n     │ V: 查看                                                       f: 重构     │\n     │                                                                    代码      │\n     │                                                                 g: 写 Git    │\n     │                                                                    提交      │\n     │                                                                 t: 生成      │\n     │                                                                    单元测试  │\n     │                                                                 w: 校对      │\n     │                                                                              │\n     │ 其他                                                                        │\n     │ C: 清空缓冲区                                                              │\n     │ I: 中断                                                                    │\n     │ v: 显示版本                                                                │\n     └──────────────────────────────────────────────────────────────────────────────┘\n   #+END_SRC\n\n   （注：显示的具体命令取决于上下文，例如是否激活了区域，或者你是否位于 =chatgpt-shell= 缓冲区中。）\n\n   如果你更喜欢全局快捷键（在 Emacs 的任何地方都可用），可以在你的个人 Emacs 配置中添加如下内容：\n\n   #+begin_src emacs-lisp :lexical no\n     ;; 在你的 init.el 或等效文件中\n     (global-set-key (kbd \"C-c C-g\") 'chatgpt-shell-transient)\n   #+end_src\n\n   此菜单有助于发现可用的命令并快速执行，而无需记住每一个快捷键或 =M-x= 命令名称。\n\n** 确认内联修改（通过差异）\n\n请求内联修改，并在接受之前明确确认。\n\n#+HTML: \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_9e09c270a5da.gif\" width=\"80%\" \u002F>\n\n** 执行代码片段（类似于 [[https:\u002F\u002Forgmode.org\u002Fworg\u002Forg-contrib\u002Fbabel\u002Fintro.html][org babel]]）\n\n外壳和组合缓冲区都允许用户通过 =C-c C-c= 执行源代码块，利用 [[https:\u002F\u002Forgmode.org\u002Fworg\u002Forg-contrib\u002Fbabel\u002Fintro.html][org babel]] 的功能。\n\n#+HTML: \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_ba149443ad76.gif\" width=\"80%\" \u002F>\n\n** 视觉实验\n\n我一直在尝试使用图像查询（目前仅支持 ChatGPT，请 [[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][赞助]] 以帮助增加对其他模型的支持）。\n\n以下是一个方便的集成，用于提取日语词汇。此外，还有一个通用的图像描述工具，可通过 =M-x chatgpt-shell-describe-image= 调用，适用于任何 Emacs 图像（通过 dired、图像缓冲区、光标指向图像，或选择桌面区域）。\n\n#+HTML: \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_f94f1a5c1453.gif\" width=\"80%\" \u002F>\n\n* 支持这项工作\n\n如果你觉得 =chatgpt-shell= 很有用，请帮助使该项目可持续发展，并考虑 ✨[[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][赞助]]✨。\n\n=chatgpt-shell= 仍在开发中。请报告问题或提交 [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002Fpulls][拉取请求]] 以改进它。\n\n* 喜欢这个包吗？告诉我吧 💙\n\n觉得它有用吗？喜欢这个包吗？我很想听听你的意见。请与我联系（[[https:\u002F\u002Findieweb.social\u002F@xenodium][Mastodon]] \u002F [[https:\u002F\u002Ftwitter.com\u002Fxenodium][Twitter]] \u002F [[https:\u002F\u002Fbsky.app\u002Fprofile\u002Fxenodium.bsky.social][Bluesky]] \u002F [[https:\u002F\u002Fwww.reddit.com\u002Fuser\u002Fxenodium][Reddit]] \u002F [[mailto:me__AT__xenodium.com][电子邮件]])。\n\n* 安装\n\n** MELPA\n\n通过 [[https:\u002F\u002Fgithub.com\u002Fjwiegley\u002Fuse-package][use-package]]，你可以使用 =:ensure t= 进行安装。\n\n#+begin_src emacs-lisp :lexical no\n  (use-package chatgpt-shell\n    :ensure t\n    :custom\n    ((chatgpt-shell-openai-key\n      (lambda ()\n        (auth-source-pass-get 'secret \"openai-key\")))))\n#+end_src\n\n** Straight\n\n#+begin_src emacs-lisp :lexical no\n  (use-package shell-maker\n    :straight (:type git :host github :repo \"xenodium\u002Fshell-maker\"))\n\n  (use-package chatgpt-shell\n    :straight (:type git :host github :repo \"xenodium\u002Fchatgpt-shell\" :files (\"chatgpt-shell*.el\"))\n    :custom\n    ((chatgpt-shell-openai-key\n      (lambda ()\n        (auth-source-pass-get 'secret \"openai-key\")))))\n#+end_src\n\n* 切换模型\n** M-x chatgpt-shell-swap-model\n#+HTML: \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_04d6c689d499.png\" width=\"80%\" \u002F>\n\n* 设置默认模型\n#+begin_src emacs-lisp :lexical no\n  (setq chatgpt-shell-model-version \"llama3.2\")\n#+end_src\n\n* 设置 API 密钥\n\n首先，你需要为每个想要交互的公共大语言模型 API 获取一个 API 密钥。\n\n| 服务    | 模型      | 链接：获取 API 密钥                                                                      |\n|------------|---------------|-------------------------------------------------------------------------------------------|\n| OpenAI     | ChatGPT       | [[https:\u002F\u002Fplatform.openai.com\u002Faccount\u002Fapi-keys][获取 API 密钥]]                          |\n| Anthropic  | Claude        | [[https:\u002F\u002Fconsole.anthropic.com\u002Fdashboard][访问控制台]]                                  |\n| Deepseek   | Chat\u002FReasoner | [[https:\u002F\u002Fplatform.deepseek.com\u002Fapi_keys][获取 API 密钥]]                                |\n| Google     | Gemini        | [[https:\u002F\u002Faistudio.google.com\u002Fapp\u002Fapikey][获取 API 密钥]]                                |\n| Kagi       | Summarizer    | [[https:\u002F\u002Fkagi.com\u002Fsettings?p=api][获取 API 密钥]]                                       |\n| OpenRouter | 多种          | [[https:\u002F\u002Fopenrouter.ai\u002Fsettings\u002Fkeys][管理您的 API 密钥]]                             |\n| Perplexity | Llama Sonar   | [[https:\u002F\u002Fdocs.perplexity.ai\u002Fguides\u002Fgetting-started#generate-an-api-key][获取 API 密钥]] |\n\n\n** 通过函数将 API 密钥提供给 ChatGPT\n\n您可以定义一个 chatgpt-shell 调用的函数来获取 API 密钥。以下示例适用于 OpenAI；对于其他服务，请采用类似的方法。\n\n#+begin_src emacs-lisp\n  ;; 如果您使用的是 \"pass\" 密码管理器\n  (setq chatgpt-shell-openai-key\n        (lambda ()\n          ;; (auth-source-pass-get 'secret \"openai-key\") ; 使用 auth-sources 的 pass 支持作为替代\n          (nth 0 (process-lines \"pass\" \"show\" \"openai-key\"))))\n\n  ;; 或者如果您使用 auth-sources，例如 ~\u002F.authinfo 文件中包含以下行：\n  ;;  machine api.openai.com password OPENAI_KEY\n  (setq chatgpt-shell-openai-key\n        (auth-source-pick-first-password :host \"api.openai.com\"))\n\n  ;; 或者与上一条相同，但采用惰性加载（避免意外弹出密码提示）\n  (setq chatgpt-shell-openai-key\n        (lambda ()\n          (auth-source-pick-first-password :host \"api.openai.com\")))\n#+end_src\n\n** 手动\u002F交互式设置相应变量\n\n=M-x set-variable chatgpt-shell-anthropic-key=\n\n=M-x set-variable chatgpt-shell-deepseek-key=\n\n=M-x set-variable chatgpt-shell-google-key=\n\n...\n\n** 在您的 Emacs 初始化文件中以编程方式设置相应变量\n#+begin_src emacs-lisp\n  ;; 从字符串设置 Anthropic 密钥\n  (setq chatgpt-shell-anthropic-key \"my anthropic key\")\n  ;; 从环境变量设置 OpenAI 密钥\n  (setq chatgpt-shell-openai-key (getenv \"OPENAI_API_KEY\"))\n\n#+end_src\n\n* 通过代理服务使用 ChatGPT\n\n如果您通过代理服务 \"https:\u002F\u002Fapi.chatgpt.domain.com\" 使用 ChatGPT，请设置如下选项：\n\n#+begin_src emacs-lisp :lexical no\n  (use-package chatgpt-shell\n    :ensure t\n    :custom\n    ((chatgpt-shell-api-url-base \"https:\u002F\u002Fapi.chatgpt.domain.com\")\n     (chatgpt-shell-openai-key\n      (lambda ()\n        ;; 此处的 openai-key 应该是代理服务的密钥。\n        (auth-source-pass-get 'secret \"openai-key\")))))\n#+end_src\n\n如果您的代理服务 API 路径不是 OpenAI ChatGPT 的默认路径 \"\u002Fv1\u002Fchat\u002Fcompletions=\"，则可以自定义选项 ~chatgpt-shell-api-url-path~。\n\n* 通过 HTTP(S) 代理使用 ChatGPT\n\n在后台，chatgpt-shell 使用 =curl= 向 OpenAI 服务器发送请求。如果您通过 HTTP 代理使用 ChatGPT（例如您处于企业网络中，HTTP 代理将企业网络与互联网隔开），则需要通过 curl 选项 =-x http:\u002F\u002Fyour_proxy= 告诉 =curl= 使用该代理。为此，请使用 =chatgpt-shell-proxy=。\n\n例如，如果您希望 curl 使用 =-x=http:\u002F\u002Fyour_proxy=，请将 =chatgpt-shell-proxy= 设置为 \"=http:\u002F\u002Fyour_proxy=\"。\n* 启动\n\n通过 =M-x chatgpt-shell= 启动。\n\n注意：=M-x chatgpt-shell= 会保持单个 shell 运行，必要时会重新聚焦。要启动多个 shell，请使用 =C-u M-x chatgpt-shell=。\n\n* 清空缓冲区\n\n在提示符下输入 =clear=。\n\n#+begin_src sh\n  ChatGPT> clear\n#+end_src\n\n或者，您也可以使用 =M-x chatgpt-shell-clear-buffer= 或 =M-x comint-clear-buffer=。\n\n* 保存和恢复\n\n使用 =M-x chatgpt-shell-save-session-transcript= 保存会话记录，并使用 =M-x chatgpt-shell-restore-session-from-transcript= 恢复会话。\n\n一些相关值存储在 =shell-maker= 中，例如 =shell-maker-transcript-default-path= 和 =shell-maker-forget-file-after-clear=。\n\n* 流式传输\n\n=chatgpt-shell= 可以选择等待整个响应接收完毕后再显示，也可以在数据块到达时逐步显示（流式传输）。\n\n流式传输默认启用。若要禁用，请执行 =(setq chatgpt-shell-streaming nil)=。\n\n* chatgpt-shell 自定义设置\n\n#+BEGIN_SRC emacs-lisp :results table :colnames '(\"自定义变量\" \"描述\") :exports results\n  (let ((rows))\n    (mapatoms\n     (lambda (symbol)\n       (when (and (string-match \"^chatgpt-shell\"\n                                (symbol-name symbol))\n                  (custom-variable-p symbol))\n         (push `(,symbol\n                 ,(car\n                   (split-string\n                    (or (documentation-property symbol 'variable-documentation)\n                        (get (indirect-variable symbol)\n                             'variable-documentation)\n                        (get symbol 'variable-documentation)\n                        \"\")\n                    \"\\n\")))\n               rows))))\n    rows)\n#+END_SRC\n\n#+RESULTS:\n| 自定义变量                                                  | 描述                                                                  |\n|------------------------------------------------------------------+------------------------------------------------------------------------------|\n| chatgpt-shell-google-api-url-base                                | Google API 的基础 URL。                                                       |\n| chatgpt-shell-deepseek-api-url-base                              | DeepSeek API 的基础 URL。                                                     |\n| chatgpt-shell-perplexity-key                                     | Perplexity API 密钥，可以是字符串，也可以是加载并返回该密钥的函数。      |\n| chatgpt-shell-anthropic-thinking                                 | 当非 nil 时，启用模型思考功能（如果可用）。                             |\n| chatgpt-shell-deepseek-key                                       | DeepSeek 密钥，可以是字符串，也可以是加载并返回该密钥的函数。            |\n| chatgpt-shell-prompt-header-write-git-commit                     | ‘git-commit’ 提示语的头部。                                               |\n| chatgpt-shell-highlight-blocks                                   | 是否高亮显示源代码块。                                                   |\n| chatgpt-shell-prompt-compose-display-action                      | 选择如何显示撰写缓冲区。                                                |\n| chatgpt-shell-display-function                                   | 用于显示 shell 的函数。可设置为 ‘display-buffer’ 或自定义函数。          |\n| chatgpt-shell-prompt-header-generate-unit-test                   | ‘generate-unit-test’ 提示语的头部。                                       |\n| chatgpt-shell-prompt-header-refactor-code                        | ‘refactor-code’ 提示语的头部。                                            |\n| chatgpt-shell-prompt-header-proofread-region                     | 由 ‘chatgpt-shell-proofread-region’ 使用的提示语头部。                    |\n| chatgpt-shell-openai-reasoning-effort                            | 用于 OpenAI 推理模型的推理力度。                                         |\n| chatgpt-shell-welcome-function                                   | 返回欢迎消息的函数，或返回 nil 表示不显示消息。                          |\n| chatgpt-shell-perplexity-api-url-base                            | Perplexity API 的基础 URL。                                                 |\n| chatgpt-shell-prompt-query-response-style                        | 决定从其他缓冲区调用时的提示语风格。                                    |\n| chatgpt-shell-model-version                                      | 活跃模型版本，可以是字符串。                                             |\n| chatgpt-shell-kagi-key                                           | Kagi API 密钥，可以是字符串，也可以是加载并返回该密钥的函数。            |\n| chatgpt-shell-logging                                            | 默认禁用日志记录（会降低速度）。                                         |\n| chatgpt-shell-render-latex                                       | 是否渲染 LaTeX 块（实验性功能）。                                        |\n| chatgpt-shell-swap-model-selector                                | 在切换模型时使用的自定义函数。                                           |\n| chatgpt-shell-api-url-base                                       | OpenAI API 的基础 URL。                                                     |\n| chatgpt-shell-google-key                                         | Google API 密钥，可以是字符串，也可以是加载并返回该密钥的函数。        |\n| chatgpt-shell-ollama-api-url-base                                | Ollama API 的基础 URL。                                                     |\n| chatgpt-shell-openrouter-key                                     | OpenRouter 密钥，可以是字符串，也可以是加载并返回该密钥的函数。        |\n| chatgpt-shell-babel-headers                                      | 使 Babel 块正常工作的附加头信息。                                        |\n| chatgpt-shell--pretty-smerge-mode-hook                           | 进入或离开 ‘chatgpt-shell--pretty-smerge-mode’ 后执行的钩子。            |\n| chatgpt-shell-include-local-file-link-content                    | 非 nil 时，将在请求中包含链接文件的内容。                                |\n| chatgpt-shell-compose-auto-transient                             | 当非 nil 时，撰写提交后自动显示临时菜单。                                |\n| chatgpt-shell-source-block-actions                               | 已知语言的代码块操作。                                                   |\n| chatgpt-shell-default-prompts                                    | 可供选择的默认提示语列表。                                               |\n| chatgpt-shell-anthropic-key                                      | Anthropic API 密钥，可以是字符串，也可以是加载并返回该密钥的函数。       |\n| chatgpt-shell-always-create-new                                  | 非 nil 时，每次调用 ‘chatgpt-shell’ 都会创建一个新的 shell 缓冲区。       |\n| chatgpt-shell-screenshot-command                                 | 用于截屏的程序。                                                         |\n| chatgpt-shell-prompt-header-eshell-summarize-last-command-output | ‘eshell-summarize-last-command-output’ 提示语的头部。                     |\n| chatgpt-shell-system-prompt                                      | ‘chatgpt-shell-system-prompts’ 系统提示语索引。                           |\n| chatgpt-shell-transmitted-context-length                         | 控制提供给 ChatGPT 的上下文长度。                                        |\n| chatgpt-shell-root-path                                          | 存储内部 shell 文件的根路径位置。                                        |\n| chatgpt-shell-prompt-header-whats-wrong-with-last-command        | ‘whats-wrong-with-last-command’ 提示语的头部。                            |\n| chatgpt-shell-read-string-function                               | 从用户读取字符串的函数。                                                 |\n| chatgpt-shell-swap-model-filter                                  | 使用此函数作为过滤器来筛选可切换的模型。                                |\n| chatgpt-shell-after-command-functions                            | 每次命令执行后调用的异常钩子（即带有参数的钩子）。                       |\n| chatgpt-shell-system-prompts                                     | 可供选择的系统提示语列表。                                               |\n| chatgpt-shell-openai-key                                         | OpenAI 密钥，可以是字符串，也可以是加载并返回该密钥的函数。            |\n| chatgpt-shell-proxy                                              | 当非 nil 时，用作代理（例如 http 或 socks5）。                           |\n| chatgpt-shell-prompt-header-describe-code                        | ‘describe-code’ 提示语的头部。                                            |\n| chatgpt-shell-insert-dividers                                    | 是否在请求和响应之间显示分隔线。                                         |\n| chatgpt-shell-models                                             | 可供切换的支持模型列表。                                                 |\n| chatgpt-shell-openrouter-api-url-base                            | OpenRouter API 的基础 URL。                                                 |\n| chatgpt-shell-language-mapping                                   | 将外部语言名称映射到 Emacs 中的语言名称。                                |\n| chatgpt-shell-prompt-compose-view-mode-hook                      | 进入或离开 ‘chatgpt-shell-prompt-compose-view-mode’ 后执行的钩子。        |\n| chatgpt-shell-streaming                                          | 是否流式传输 ChatGPT 的响应（随到随显 chunks）。                         |\n| chatgpt-shell-anthropic-api-url-base                             | Anthropic API 的基础 URL。                                                 |\n| chatgpt-shell-model-temperature                                  | 采样温度，范围在 0 到 2 之间，或返回 nil。                               |\n| chatgpt-shell-anthropic-thinking-budget-tokens                   | 分配给 Anthropic 模型思考的 token 预算。                                 |\n| chatgpt-shell-request-timeout                                    | 请求超时等待时间，单位为秒。                                             |\n| chatgpt-shell-kagi-api-url-base                                  | Kagi API 的基础 URL。                                                      |\n\n还有更多。可通过 =M-x set-variable= 浏览。\n\n** =chatgpt-shell-display-function=（使用自定义函数）\n\n如果你更倾向于使用自己的自定义显示函数，\n\n#+begin_src emacs-lisp :lexical no\n  (setq chatgpt-shell-display-function #'my\u002Fchatgpt-shell-frame)\n\n  (defun my\u002Fchatgpt-shell-frame (bname)\n    (let ((cur-f (selected-frame))\n          (f (my\u002Ffind-or-make-frame \"chatgpt\")))\n      (select-frame-by-name \"chatgpt\")\n      (pop-to-buffer-same-window bname)\n      (set-frame-position f (\u002F (display-pixel-width) 2) 0)\n      (set-frame-height f (frame-height cur-f))\n      (set-frame-width f  (frame-width cur-f) 1)))\n\n  (defun my\u002Ffind-or-make-frame (fname)\n    (condition-case\n        nil\n        (select-frame-by-name fname)\n      (error (make-frame `((name . ,fname))))))\n#+end_src\n\n感谢 [[https:\u002F\u002Fgithub.com\u002Ftuhdo][tuhdo]] 提供的自定义显示函数。\n\n* chatgpt-shell 命令\n#+BEGIN_SRC emacs-lisp :results table :colnames '(\"绑定\" \"命令\" \"描述\") :exports results\n  (let ((rows))\n    (mapatoms\n     (lambda (symbol)\n       (when (and (string-match \"^chatgpt-shell\"\n                                (symbol-name symbol))\n                  (commandp symbol))\n         (push `(,(string-join\n                   (seq-filter\n                    (lambda (symbol)\n                      (not (string-match \"menu\" symbol)))\n                    (mapcar\n                     (lambda (keys)\n                       (key-description keys))\n                     (or\n                      (where-is-internal\n                       (symbol-function symbol)\n                       comint-mode-map\n                       nil nil (command-remapping 'comint-next-input))\n                      (where-is-internal\n                       symbol chatgpt-shell-mode-map nil nil (command-remapping symbol))\n                      (where-is-internal\n                       (symbol-function symbol)\n                       chatgpt-shell-mode-map nil nil (command-remapping symbol)))))  \" 或 \")\n                 ,(symbol-name symbol)\n                 ,(car\n                   (split-string\n                    (or (documentation symbol t) \"\")\n                    \"\\n\")))\n               rows))))\n    rows)\n#+END_SRC\n\n#+RESULTS:\n| 绑定              | 命令                                                  | 描述                                                                     |\n|----------------------+----------------------------------------------------------+---------------------------------------------------------------------------------|\n|                      | chatgpt-shell-japanese-lookup                            | 查找日语术语。                                                          |\n|                      | chatgpt-shell-next-source-block                          | 将光标移动到下一个源代码块的主体。                                     |\n|                      | chatgpt-shell-prompt-compose-request-entire-snippet      | 如果响应代码不完整，请求整个代码片段。                                 |\n|                      | chatgpt-shell-prompt-compose-request-more                | 请求更多数据。这在您已经请求过示例时很有用。                           |\n|                      | chatgpt-shell-google-toggle-grounding-with-google-search | 切换当前所选模型的 `:grounding-search' 布尔值。                        |\n|                      | chatgpt-shell-execute-babel-block-action-at-point        | 以 Org Babel 格式执行代码块。                                            |\n| C-c C-s              | chatgpt-shell-swap-system-prompt                         | 从 `chatgpt-shell-system-prompts' 中切换系统提示词。                     |\n|                      | chatgpt-shell-system-prompts-menu                        | ChatGPT                                                                         |\n|                      | chatgpt-shell-prompt-compose-swap-model-version          | 切换撰写缓冲区的模型版本。                                              |\n|                      | chatgpt-shell-describe-code                              | 使用 ChatGPT 描述区域内的代码。                                         |\n| C-\u003Cup> 或 M-p        | chatgpt-shell-previous-input                             | 循环浏览输入历史，并保存输入。                                           |\n|                      | chatgpt-shell-previous-link                              | 将光标移动到上一个链接。                                                 |\n|                      | chatgpt-shell-copy-block-at-point                        | 将光标处的代码块复制到剪贴板。                                          |\n|                      | chatgpt-shell-prompt-compose-next-item                   | 跳转并选择下一个项目（请求、响应、代码块、链接、交互）。                 |\n| C-c C-v              | chatgpt-shell-swap-model                                 | 从 `chatgpt-shell-models' 中切换模型版本。                               |\n| C-x C-s              | chatgpt-shell-save-session-transcript                    | 将会话记录保存到文件中。                                                 |\n|                      | chatgpt-shell-proofread-region                           | 使用 ChatGPT 校对区域或当前段落中的文本。                               |\n|                      | chatgpt-shell-prompt-compose-quit-and-close-frame        | 如果是最后一个窗口，则退出撰写并关闭框架。                             |\n|                      | chatgpt-shell-prompt-compose-other-buffer                | 跳转到 Shell 缓冲区（撰写缓冲区的另一个缓冲区）。                       |\n|                      | chatgpt-shell                                            | 启动 ChatGPT Shell 交互式命令。                                          |\n| RET                  | chatgpt-shell-submit                                     | 提交当前输入。                                                           |\n|                      | chatgpt-shell-prompt-compose-swap-system-prompt          | 切换撰写缓冲区的系统提示词。                                            |\n|                      | chatgpt-shell-describe-image                             | 请求 OpenAI 描述图像。                                                   |\n|                      | chatgpt-shell-prompt-compose-search-history              | 搜索提示词历史，选择并插入到当前撰写缓冲区。                           |\n|                      | chatgpt-shell-prompt-compose-previous-history            | 将历史中的上一条提示词插入到撰写缓冲区。                                |\n|                      | chatgpt-shell-delete-interaction-at-point                | 删除光标处的交互（请求和响应）。                                        |\n|                      | chatgpt-shell-anthropic-toggle-thinking                  | 切换 Anthropic 模型，根据 `chatgpt-shell-anthropic-thinking' 进行操作。   |\n|                      | chatgpt-shell-refresh-rendering                          | 通过重新应用到整个缓冲区来刷新 Markdown 渲染。                         |\n|                      | chatgpt-shell-prompt-compose-insert-block-at-point       | 在已知位置将代码块插入到光标处。                                       |\n|                      | chatgpt-shell-explain-code                               | 使用 ChatGPT 描述区域内的代码。                                          |\n|                      | chatgpt-shell-execute-block-action-at-point              | 在光标处执行代码块。                                                    |\n|                      | chatgpt-shell-load-awesome-prompts                       | 从 awesome-chatgpt-prompts 加载 `chatgpt-shell-system-prompts'。           |\n|                      | chatgpt-shell-write-git-commit                           | 使用 ChatGPT 从区域编写提交信息。                                        |\n|                      | chatgpt-shell-restore-session-from-transcript            | 从文件会话记录（或 HISTORY）中恢复会话。                                 |\n|                      | chatgpt-shell-prompt-compose-next-interaction            | 显示下一次交互（请求\u002F响应）。                                            |\n| \u003Cbacktab> 或 C-c C-p | chatgpt-shell-previous-item                              | 跳转到上一个项目。                                                       |\n|                      | chatgpt-shell-fix-error-at-point                         | 修复光标处的 flymake 错误。                                             |\n|                      | chatgpt-shell-next-link                                  | 将光标移动到下一个链接。                                                 |\n|                      | chatgpt-shell-prompt-compose-transient                   | ChatGPT Shell Compose 临时模式。                                          |\n|                      | chatgpt-shell-prompt-compose-clear-history               | 清除撰写及关联的 Shell 历史记录。                                        |\n|                      | chatgpt-shell-prompt-appending-kill-ring                 | 从 minibuffer 发起 ChatGPT 请求，并将其添加到剪贴板。                    |\n|                      | chatgpt-shell-ollama-load-models                         | 查询 Ollama 获取本地安装的模型，并将其添加到                   |\n| C-\u003Cdown> 或 M-n      | chatgpt-shell-next-input                                 | 循环浏览输入历史。                                                       |\n|                      | chatgpt-shell-prompt-compose-view-mode                   | 类似于 `view-mode`，但专为 ChatGPT Compose 扩展。                         |\n|                      | chatgpt-shell-clear-buffer                               | 清空当前 Shell 缓冲区。                                                  |\n|                      | chatgpt-shell-insert-local-file-link                     | 选择并插入指向本地文件的链接。                                          |\n|                      | chatgpt-shell-edit-block-at-point                        | 在光标处执行代码块。                                                    |\n| \u003Ctab> 或 C-c C-n     | chatgpt-shell-next-item                                  | 跳转到下一个项目。                                                       |\n|                      | chatgpt-shell-prompt-compose-send-buffer                 | 将撰写缓冲区内容发送到 Shell 进行处理。                                 |\n| C-c C-e              | chatgpt-shell-prompt-compose                             | 从专用缓冲区撰写并发送提示词。                                          |\n|                      | chatgpt-shell-rename-buffer                              | 重命名当前 Shell 缓冲区。                                                |\n|                      | chatgpt-shell-remove-block-overlays                      | 移除代码块覆盖层。对于重命名代码块非常有用。                           |\n|                      | chatgpt-shell-send-region                                | 将区域发送到 ChatGPT。                                                   |\n|                      | chatgpt-shell-send-and-review-region                     | 将区域发送到 ChatGPT，在提交前进行审查。                                 |\n| C-M-h                | chatgpt-shell-mark-at-point-dwim                         | 如果光标在源代码块上，则标记该块；否则标记所有输出。                   |\n|                      | chatgpt-shell-insert-buffer-file-link                    | 选择并插入指向缓冲区本地文件的链接。                                   |\n|                      | chatgpt-shell--pretty-smerge-mode                        | 用于显示冲突标记覆盖的小模式。                                           |\n|                      | chatgpt-shell-mark-block                                 | 在撰写缓冲区中标记当前代码块。                                          |\n|                      | chatgpt-shell-prompt-compose-reply                       | 作为后续回复并撰写另一条查询。                                           |\n|                      | chatgpt-shell-prompt-compose-refresh                     | 使用 Shell 中的当前内容刷新撰写缓冲区。                                  |\n|                      | chatgpt-shell-set-as-primary-shell                       | 当有多个会话时，将其设置为主 Shell。                                     |\n|                      | chatgpt-shell-google-load-models                         | 查询 Google 获取可用的 Gemini LLM 模型列表。                            |\n|                      | chatgpt-shell-rename-block-at-point                      | 重命名光标处的代码块（可能使用不同语言）。                             |\n|                      | chatgpt-shell-quick-insert                               | 从 minibuffer 发起请求，并将响应插入到当前缓冲区。                      |\n|                      | chatgpt-shell-reload-default-models                      | 重新加载所有可用模型。                                                   |\n| S-\u003Creturn>           | chatgpt-shell-newline                                    | 插入一个新行，并将光标移动到新行的左边界。                            |\n|                      | chatgpt-shell-generate-unit-test                         | 使用 ChatGPT 为区域内的代码生成单元测试。                                |\n|                      | chatgpt-shell-prompt-compose-view-last                   | 显示最后的请求\u002F响应交互。                                                |\n|                      | chatgpt-shell-prompt-compose-previous-item               | 跳转并选择上一个项目（请求、响应、代码块、链接、交互）。               |\n|                      | chatgpt-shell-prompt-compose-next-history                | 将历史中的下一条提示词插入到撰写缓冲区。                                |\n| C-c C-c              | chatgpt-shell-ctrl-c-ctrl-c                              | 如果光标在源代码块内，则执行该块；否则中断。                           |\n|                      | chatgpt-shell-eshell-summarize-last-command-output       | 请求 ChatGPT 总结上次命令的输出。                                        |\n| M-r                  | chatgpt-shell-search-history                             | 搜索之前的输入历史。                                                     |\n|                      | chatgpt-shell-mode                                       | ChatGPT Shell 的主模式。                                                   |\n|                      | chatgpt-shell-prompt-compose-mode                        | 从专用缓冲区撰写 ChatGPT 提示词的主模式。                               |\n|                      | chatgpt-shell-previous-source-block                      | 将光标移动到上一个源代码块的主体。                                     |\n|                      | chatgpt-shell-prompt                                     | 从 minibuffer 发起 ChatGPT 请求。                                         |\n|                      | chatgpt-shell-japanese-ocr-lookup                        | 选择屏幕上的一个区域进行 OCR，并用日语查找。                           |\n|                      | chatgpt-shell-refactor-code                              | 使用 ChatGPT 重构区域内的代码。                                          |\n|                      | chatgpt-shell-proofread-paragraph-or-region              | 使用 ChatGPT 校对区域或当前段落中的文本。                               |\n|                      | chatgpt-shell-view-block-at-point                        | 在单独的缓冲区中查看光标处的代码块（使用相应语言的主模式）。           |\n|                      | chatgpt-shell-japanese-audio-lookup                      | 转录当前文件（缓冲区或 `dired'）中的音频，并用日语查找。                |\n|                      | chatgpt-shell-eshell-whats-wrong-with-last-command       | 询问 ChatGPT 上次 eshell 命令出了什么问题。                              |\n|                      | chatgpt-shell-prompt-compose-cancel                      | 取消并关闭撰写缓冲区。                                                   |\n|                      | chatgpt-shell-prompt-compose-retry                       | 重试向 Shell 发送请求。                                                   |\n|                      | chatgpt-shell-version                                    | 显示 `chatgpt-shell' 模式的版本。                                        |\n|                      | chatgpt-shell-prompt-compose-previous-interaction        | 显示上一次交互（请求\u002F响应）。                                            |\n|                      | chatgpt-shell-interrupt                                  | 从任何缓冲区中断 `chatgpt-shell'。                                      |\n|                      | chatgpt-shell-view-at-point                              | 在单独的缓冲区中查看光标处的提示词和输出。                             |\n\n通过 =M-x= 浏览所有可用选项。\n\n* 功能请求\n- 请先查看此 README，确认所需功能是否已支持。\n- 需要自定义行为吗？请查看现有的 [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002Fissues?q=is%3Aissue+][问题\u002F功能请求]]。您可能会在讨论中找到解决方案。\n\n* 拉取请求\n非常欢迎提交拉取请求。请在开始之前[[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002Fissues\u002Fnew][联系一下]]，以确保我们不会重复工作。同时，请[[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002F][搜索现有的讨论]]。\n\n* 报告 bug\n** 设置不生效？\n请分享您用于设置 =chatgpt-shell= 的完整代码片段（但需遮盖您的密钥）。同时请附上遇到的任何错误信息。继续阅读以了解如何提供更多详细信息。\n** 发现运行时或 Elisp 错误？\n请启用 =M-x toggle-debug-on-error=，重现错误，并分享堆栈跟踪信息。\n** 发现意外行为？\n请启用日志记录 =(setq chatgpt-shell-logging t)=，并在 bug 报告中分享 =*chatgpt-log*= 缓冲区的内容。\n** Babel 相关问题？\n请一并分享完整的 Org 代码片段。\n* 支持我的工作\n\n👉 觉得我的工作有用吗？[[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][通过 GitHub Sponsors 支持这项工作]]，或[[https:\u002F\u002Fapps.apple.com\u002Fus\u002Fdeveloper\u002Fxenodium-ltd\u002Fid304568690][购买我的 iOS 应用程序]]。\n\n* 我的其他工具、包、应用及写作...\n\n- [[https:\u002F\u002Fxenodium.com\u002F][博客 (xenodium.com)]]\n- [[https:\u002F\u002Flmno.lol\u002Falvaro][博客 (lmno.lol\u002Falvaro)]]\n- [[https:\u002F\u002Fplainorg.com][Plain Org]] (iOS)\n- [[https:\u002F\u002Fflathabits.com][Flat Habits]] (iOS)\n- [[https:\u002F\u002Fapps.apple.com\u002Fus\u002Fapp\u002Fscratch\u002Fid1671420139][Scratch]] (iOS)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fmacosrec][macosrec]] (macOS)\n- [[https:\u002F\u002Fapps.apple.com\u002Fus\u002Fapp\u002Ffresh-eyes\u002Fid6480411697?mt=12][Fresh Eyes]] (macOS)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fdwim-shell-command][dwim-shell-command]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fcompany-org-block][company-org-block]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Forg-block-capf][org-block-capf]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fob-swiftui][ob-swiftui]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell][chatgpt-shell]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fready-player][ready-player]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fsqlite-mode-extras][sqlite-mode-extras]]\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fob-chatgpt-shell][ob-chatgpt-shell]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fdall-e-shell][dall-e-shell]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fob-dall-e-shell][ob-dall-e-shell]] (Emacs)\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fshell-maker][shell-maker]] (Emacs)\n\n* 贡献者\n\n#+HTML: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002Fgraphs\u002Fcontributors\">\n#+HTML:   \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_readme_1323624ecf28.png\" \u002F>\n#+HTML: \u003C\u002Fa>\n\n由 [[https:\u002F\u002Fcontrib.rocks][contrib.rocks]] 制作。","# chatgpt-shell 快速上手指南\n\n`chatgpt-shell` 是一个强大的 Emacs 多模型 LLM 交互终端（基于 `comint`），支持在 Emacs 内直接调用 ChatGPT、Claude、Gemini、Ollama 等多种大语言模型。它提供了类似 Shell 的交互体验，并支持代码块执行、图片识别及组合提示词编辑等功能。\n\n## 环境准备\n\n*   **系统要求**: GNU Emacs (建议最新版本)。\n*   **前置依赖**:\n    *   需安装 `shell-maker` 包（通常作为依赖自动安装）。\n    *   **API Key**: 根据你想使用的模型服务商（如 OpenAI, Anthropic, Google, DeepSeek 等），需提前注册并获取对应的 API Key。\n    *   **本地模型 (可选)**: 若使用 Ollama，需先在本地安装并运行 [Ollama](https:\u002F\u002Follama.com\u002F)。\n\n## 安装步骤\n\n推荐使用 `use-package` 进行安装管理。你可以选择从 MELPA 仓库安装，或通过 `straight.el` 直接从 GitHub 安装。\n\n### 方式一：通过 MELPA 安装（推荐）\n\n确保你的 Emacs 已配置 MELPA 源，然后在配置文件（`init.el` 或 `.emacs`）中添加以下内容：\n\n```elisp\n(use-package chatgpt-shell\n  :ensure t\n  :custom\n  ;; 示例：从密码管理器获取 OpenAI Key，也可直接设置为字符串 \"sk-...\"\n  ((chatgpt-shell-openai-key\n    (lambda ()\n      (auth-source-pass-get 'secret \"openai-key\")))))\n```\n\n### 方式二：通过 Straight.el 安装\n\n如果你偏好直接从源码安装：\n\n```elisp\n(use-package shell-maker\n  :straight (:type git :host github :repo \"xenodium\u002Fshell-maker\"))\n\n(use-package chatgpt-shell\n  :straight (:type git :host github :repo \"xenodium\u002Fchatgpt-shell\" :files (\"chatgpt-shell*.el\"))\n  :custom\n  ((chatgpt-shell-openai-key\n    (lambda ()\n      (auth-source-pass-get 'secret \"openai-key\")))))\n```\n\n安装完成后，重启 Emacs 或重新加载配置文件。\n\n## 基本使用\n\n### 1. 配置 API Key\n\n在使用前，必须设置对应模型的 API Key。你可以在 `init.el` 中全局设置，或在运行时通过变量设置。\n\n**全局设置示例 (OpenAI):**\n```elisp\n(setq chatgpt-shell-openai-key \"你的-sk-开头的-API-Key\")\n```\n\n**切换默认模型:**\n```elisp\n;; 设置默认模型版本，例如 llama3.2\n(setq chatgpt-shell-model-version \"llama3.2\")\n```\n\n> **注意**: 不同厂商的 Key 变量名不同，例如 `chatgpt-shell-anthropic-key`, `chatgpt-shell-google-key`, `chatgpt-shell-deepseek-key` 等。\n\n### 2. 启动会话\n\n在 Emacs 中执行以下命令启动一个新的 Shell 会话：\n\n```text\nM-x chatgpt-shell\n```\n\n这将打开一个类似于普通终端的缓冲区，你可以直接输入自然语言与 AI 对话。\n\n### 3. 切换模型\n\n`chatgpt-shell` 支持在一个会话中随时切换后端模型。执行以下命令并在提示中选择提供商和模型：\n\n```text\nM-x chatgpt-shell-swap-model\n```\n\n### 4. 高级交互：组合提示词 (Compose Prompt)\n\n这是最高效的使用方式。选中一段文本（或光标位于某处），然后调用组合模式来构建更复杂的请求：\n\n```text\nM-x chatgpt-shell-prompt-compose\n```\n*(建议绑定快捷键，例如 `C-c C-e`)*\n\n在弹出的编辑缓冲区中完善你的提示词，完成后按下 `C-c C-c` 提交。该模式支持以下快捷操作：\n*   `n` \u002F `p`: 上下切换历史源块。\n*   `r`: 基于当前结果进行追问 (Reply)。\n*   `m`: 请求更多同类内容 (Give me more)。\n*   `e`: 请求完整的代码片段 (Request entire snippets)。\n*   `q`: 关闭当前缓冲区。\n\n### 5. 使用瞬态菜单 (Transient Menu)\n\n为了方便记忆命令，在 `chatgpt-shell` 缓冲区中按下 `C-c C-t` 可呼出功能菜单。你可以通过按键快速执行以下操作：\n*   **Shells**: 切换\u002F新建 Shell (`b`, `N`)\n*   **Session**: 切换模型 (`m`)\n*   **Code Actions**: 描述代码 (`d`)、重构代码 (`f`)、生成单元测试 (`t`) 等。\n*   **History**: 搜索历史 (`h`)\n\n### 6. 执行代码块\n\n如果 AI 返回了代码块，你可以将光标移至代码块内，直接按下 `C-c C-c` 执行该代码（类似 Org Babel 的行为），结果将直接显示在下方。","一位资深 Emacs 用户正在重构遗留的 Python 代码库，需要频繁调用不同大模型进行代码解释、优化建议及生成单元测试。\n\n### 没有 chatgpt-shell 时\n- **切换模型繁琐**：想对比 Claude 的逻辑推理与 DeepSeek 的代码能力时，必须离开编辑器，在浏览器中打开多个标签页并重复粘贴上下文，打断心流。\n- **上下文割裂**：在网页对话框中修改长段代码提示词极其不便，无法利用 Emacs 强大的编辑功能（如宏、正则替换）来精细化调整提问内容。\n- **交互效率低下**：想要基于上一轮回答继续追问（如“再多给两个方案”或“解释这段逻辑”），往往需要手动复制粘贴历史对话，操作机械且易出错。\n- **工作流不统一**：AI 交互与本地开发环境完全隔离，无法像操作终端一样通过快捷键快速导航历史记录或清理临时缓冲区。\n\n### 使用 chatgpt-shell 后\n- **一键切换模型**：在同一个 Shell 缓冲区中，通过 `M-x chatgpt-shell-swap-model` 即可瞬间从 ChatGPT 切换到 Ollama 本地模型，无需中断编码节奏。\n- **沉浸式组合编辑**：选中代码区域后调用 `chatgpt-shell-prompt-compose`，直接在可编辑的 Buffer 中打磨提示词，享受完整的 Emacs 编辑体验后再提交。\n- **高效快捷交互**：利用内置单键命令，按 `r` 直接追问后续问题，按 `m` 请求更多类似结果，按 `n\u002Fp` 快速浏览历史对话块，交互如呼吸般自然。\n- **原生工作流整合**：AI 对话完全融入 Comint Shell 机制，支持标准快捷键关闭缓冲区、自动高亮代码块，让 AI 辅助成为开发闭环的一部分。\n\nchatgpt-shell 将分散的网页 AI 交互收束为统一的 Emacs 原生工作流，让开发者在熟悉的编辑环境中无缝驾驭多模型能力。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_chatgpt-shell_b4f4bef9.gif","xenodium",null,"https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fxenodium_81b55036.jpg","London, UK","xenodium.com","https:\u002F\u002Fgithub.com\u002Fxenodium",[83],{"name":84,"color":85,"percentage":86},"Emacs Lisp","#c065db",100,1202,106,"2026-03-30T12:01:04","GPL-3.0","未说明","非必需（本地运行 Ollama 时需根据所选模型配置相应 GPU，云端 API 模式无需本地 GPU）",{"notes":94,"python":95,"dependencies":96},"该工具是 Emacs Lisp 包，需在 Emacs 环境中运行。支持多种 LLM 提供商：云端 API（OpenAI, Anthropic, Google 等，需各自 API Key）和本地服务（Ollama，需单独安装 Ollama 软件）。除 Ollama 外，其他服务通常需付费。可通过 MELPA 或 Straight 安装。","不适用",[97,98,99],"Emacs","shell-maker","transient (可选)",[15,36],[102,103,104,105],"chatgpt","dall-e","emacs","org-mode","2026-03-27T02:49:30.150509","2026-04-06T05:35:28.124348",[109,114,119,123,128,132],{"id":110,"question_zh":111,"answer_zh":112,"source_url":113},11999,"如何配置 chatgpt-shell 以支持本地 Ollama 模型？","你需要将 API 基础 URL 指向本地 Ollama 端点，并设置可用的模型列表。此外，可能需要重写上下文长度估算函数以适配不同模型。配置示例如下：\n\n1. 设置 API 地址：\n(setq chatgpt-shell-api-url-base \"http:\u002F\u002F127.0.0.1:11434\")\n\n2. 设置已拉取的模型版本：\n(setq chatgpt-shell-model-versions\n      '(\"gemma:2b-instruct\"\n        \"zephry:latest\"\n        \"codellama:instruct\"\n        \"mistral:7b-instruct\"))\n\n3. (可选) 自定义上下文长度估算函数 `chatgpt-shell--approximate-context-length` 以匹配特定模型的 token 限制。","https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002Fissues\u002F201",{"id":115,"question_zh":116,"answer_zh":117,"source_url":118},12000,"为什么我安装了新版 curl 但仍然提示需要 curl 7.76 或更高版本？","这通常是因为 Emacs 调用的 curl 路径与你系统默认的路径不一致，或者版本检查逻辑存在旧版 Bug。请尝试以下步骤：\n1. 确保已应用最新的代码修复（commit 0eddee87ad66f66d8940ea699cfc87915cef5740）。\n2. 重新加载库并重置默认模型：\n   M-x find-library RET chatgpt-shell-openai RET\n   M-x eval-buffer\n   M-x chatgpt-shell-reload-default-models\n3. 如果问题依旧，检查 Emacs 内部调用的 curl 具体路径，确保其版本符合要求。","https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002Fissues\u002F264",{"id":120,"question_zh":121,"answer_zh":122,"source_url":118},12001,"遇到 \"You exceeded your current quota\" (429 错误) 该怎么办？","此错误表示你的 OpenAI API 密钥配额已用尽或账户未付费。注意：虽然网页版可能免费提供部分模型（如 GPT-3.5），但通过 API 调用通常需要具备有效的付费计划。\n解决方案：\n1. 登录 OpenAI 平台检查账单和配额状态。\n2. 如果需要使用免费方案，可以考虑切换到本地模型后端（如 Ollama）。\n3. 确认 `.authinfo` 文件或配置中的 API Key 有效且未过期。",{"id":124,"question_zh":125,"answer_zh":126,"source_url":127},12002,"为什么在启动 Emacs 后首次使用 compose 功能会报错 \"Symbol's function definition is void\"？","这是因为相关的命令定义尚未加载。解决方法是必须先启动一次 chatgpt-shell 会话以触发自动加载机制。\n操作步骤：\n1. 运行 `M-x chatgpt-shell` 启动一个会话。\n2. 之后即可正常使用 compose 功能。\n长期解决方案：检查你的 `use-package` 配置，确保使用 `:commands` 正确声明了相关命令，或者等待维护者将命令移动到正确的加载文件中。","https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002Fissues\u002F280",{"id":129,"question_zh":130,"answer_zh":131,"source_url":113},12003,"如何在 Windows (Msys2\u002FCygwin) 环境下调试 Ollama 连接问题？","如果在 Windows 上使用 Ollama 遇到连接错误或 JSON 解析失败，可以通过开启日志记录来查看底层 curl 命令及其输出。\n调试步骤：\n1. 启用日志：`(setq shell-maker-logging t)`\n2. 重现错误，然后查看生成的日志缓冲区。\n3. 检查 `curl-data` 文件的内容以及 curl 命令的 stderr 输出。常见错误包括 URL 格式问题（如范围错误）或返回的 JSON 格式无效。\n4. 确保 Ollama 服务监听地址允许来自该端口的访问（例如 `172.18.x.x` 或 `127.0.0.1`）。",{"id":133,"question_zh":134,"answer_zh":135,"source_url":136},12004,"chatgpt-shell 现在支持哪些非 OpenAI 的模型后端？","除了默认的 OpenAI 接口外，该项目目前已实现了对多种模型后端的支持，包括：\n1. Claude (Anthropic)\n2. Gemini (Google)\n3. Ollama (本地运行各类开源模型)\n你可以通过 `M-x chatgpt-shell-swap-model` 命令在不同模型提供商之间切换，或在配置中预设 `chatgpt-shell-model-version` 来选择默认模型。","https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fchatgpt-shell\u002Fissues\u002F217",[]]