[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-Amm1rr--WebAI-to-API":3,"tool-Amm1rr--WebAI-to-API":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},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 真正成长为懂上",144730,2,"2026-04-07T23:26:32",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107888,"2026-04-06T11:32:50",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":76,"owner_location":77,"owner_email":78,"owner_twitter":79,"owner_website":76,"owner_url":80,"languages":81,"stars":94,"forks":95,"last_commit_at":96,"license":97,"difficulty_score":32,"env_os":98,"env_gpu":99,"env_ram":98,"env_deps":100,"category_tags":107,"github_topics":108,"view_count":32,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":128,"updated_at":129,"faqs":130,"releases":166},5319,"Amm1rr\u002FWebAI-to-API","WebAI-to-API","Gemini to API (Don't need API KEY) (ChatGPT, Claude, DeeepSeek, Grok and more)","WebAI-to-API 是一个基于 FastAPI 构建的模块化本地服务器，旨在将浏览器中的大语言模型（如 Gemini）转化为标准的 API 接口供开发者调用。它核心解决了用户在不拥有官方 API 密钥或希望规避付费限制的情况下，如何低成本、灵活地接入主流 AI 模型的问题。\n\n该工具提供两种运行模式：主模式通过读取浏览器 Cookie 直接连接 Gemini 网页版，实现轻量级、高效率的个人化 API 部署；备用模式则集成 gpt4free 库，支持 ChatGPT、Claude、DeepSeek、Grok 等多种模型的访问，为服务提供了冗余保障。其技术亮点在于完全兼容 OpenAI 风格的 `\u002Fv1\u002Fchat\u002Fcompletions` 接口，使得现有应用无需修改代码即可切换后端模型，同时支持会话保持与系统提示词设置。\n\n鉴于项目声明仅用于研究与教育目的，WebAI-to-API 特别适合开发人员、技术研究人员及 AI 爱好者使用。它非常适合用于本地原型开发、自动化脚本测试或学习大模型接口机制，但不建议用于商业生产环境。通过简单的配置与启动，用户即可在本地搭建起一个功能完备的 A","WebAI-to-API 是一个基于 FastAPI 构建的模块化本地服务器，旨在将浏览器中的大语言模型（如 Gemini）转化为标准的 API 接口供开发者调用。它核心解决了用户在不拥有官方 API 密钥或希望规避付费限制的情况下，如何低成本、灵活地接入主流 AI 模型的问题。\n\n该工具提供两种运行模式：主模式通过读取浏览器 Cookie 直接连接 Gemini 网页版，实现轻量级、高效率的个人化 API 部署；备用模式则集成 gpt4free 库，支持 ChatGPT、Claude、DeepSeek、Grok 等多种模型的访问，为服务提供了冗余保障。其技术亮点在于完全兼容 OpenAI 风格的 `\u002Fv1\u002Fchat\u002Fcompletions` 接口，使得现有应用无需修改代码即可切换后端模型，同时支持会话保持与系统提示词设置。\n\n鉴于项目声明仅用于研究与教育目的，WebAI-to-API 特别适合开发人员、技术研究人员及 AI 爱好者使用。它非常适合用于本地原型开发、自动化脚本测试或学习大模型接口机制，但不建议用于商业生产环境。通过简单的配置与启动，用户即可在本地搭建起一个功能完备的 AI 网关，自由探索不同模型的能力。","## Disclaimer\n\n> **This project is intended for research and educational purposes only.**  \n> Please refrain from any commercial use and act responsibly when deploying or modifying this tool.\n\n---\n\n# WebAI-to-API\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FAmm1rr_WebAI-to-API_readme_992386c70f9d.png\" alt=\"WebAI-to-API Server\" height=\"160\" \u002F>\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FAmm1rr_WebAI-to-API_readme_a8e2adbc2644.png\" alt=\"gpt4free Server\" height=\"160\" \u002F>\n\u003C\u002Fp>\n\n**WebAI-to-API** is a modular web server built with FastAPI that allows you to expose your preferred browser-based LLM (such as Gemini) as a local API endpoint.\n\n---\n\nThis project supports **two operational modes**:\n\n1. **Primary Web Server**\n\n   > WebAI-to-API\n\n   Connects to the Gemini web interface using your browser cookies and exposes it as an API endpoint. This method is lightweight, fast, and efficient for personal use.\n\n2. **Fallback Web Server (gpt4free)**\n\n   > [gpt4free](https:\u002F\u002Fgithub.com\u002Fxtekky\u002Fgpt4free)\n\n   A secondary server powered by the `gpt4free` library, offering broader access to multiple LLMs beyond Gemini, including:\n\n   - ChatGPT\n   - Claude\n   - DeepSeek\n   - Copilot\n   - HuggingFace Inference\n   - Grok\n   - ...and many more.\n\nThis design provides both **speed and redundancy**, ensuring flexibility depending on your use case and available resources.\n\n---\n\n## Features\n\n- 🌐 **Available Endpoints**:\n\n  - **WebAI Server**:\n\n    - `\u002Fv1\u002Fchat\u002Fcompletions`\n    - `\u002Fgemini`\n    - `\u002Fgemini-chat`\n    - `\u002Ftranslate`\n    - `\u002Fv1beta\u002Fmodels\u002F{model}` (Google Generative AI v1beta API)\n\n  - **gpt4free Server**:\n    - `\u002Fv1`\n    - `\u002Fv1\u002Fchat\u002Fcompletions`\n\n- 🔄 **Server Switching**: Easily switch between servers in terminal.\n\n- 🛠️ **Modular Architecture**: Organized into clearly defined modules for API routes, services, configurations, and utilities, making development and maintenance straightforward.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FAmm1rr_WebAI-to-API_readme_3ac037ba8eee.png\" alt=\"Endpoints\" height=\"280\" \u002F>\n\u003C\u002Fp>\n\n---\n\n## Installation\n\n1. **Clone the repository:**\n\n   ```bash\n   git clone https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API.git\n   cd WebAI-to-API\n   ```\n\n2. **Install dependencies using Poetry:**\n\n   ```bash\n   poetry install\n   ```\n\n3. **Create and update the configuration file:**\n\n   ```bash\n   cp config.conf.example config.conf\n   ```\n\n   Then, edit `config.conf` to adjust service settings and other options.\n\n4. **Run the server:**\n\n   ```bash\n   poetry run python src\u002Frun.py\n   ```\n\n---\n\n## Usage\n\nSend a POST request to `\u002Fv1\u002Fchat\u002Fcompletions` (or any other available endpoint) with the required payload.\n\n### Supported Models\n\n| Model | Description |\n|-------|-------------|\n| `gemini-3.0-pro` | Latest and most powerful model |\n| `gemini-2.5-pro` | Advanced reasoning model |\n| `gemini-2.5-flash` | Fast and efficient model (default) |\n\n### Example Request (Basic)\n\n```json\n{\n  \"model\": \"gemini-3.0-pro\",\n  \"messages\": [{ \"role\": \"user\", \"content\": \"Hello!\" }]\n}\n```\n\n### Example Request (With System Prompt & Conversation History)\n\n```json\n{\n  \"model\": \"gemini-2.5-pro\",\n  \"messages\": [\n    { \"role\": \"system\", \"content\": \"You are a helpful assistant.\" },\n    { \"role\": \"user\", \"content\": \"What is Python?\" },\n    { \"role\": \"assistant\", \"content\": \"Python is a programming language.\" },\n    { \"role\": \"user\", \"content\": \"Is it easy to learn?\" }\n  ]\n}\n```\n\n### Example Response\n\n```json\n{\n  \"id\": \"chatcmpl-12345\",\n  \"object\": \"chat.completion\",\n  \"created\": 1693417200,\n  \"model\": \"gemini-3.0-pro\",\n  \"choices\": [\n    {\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"Hi there!\"\n      },\n      \"finish_reason\": \"stop\",\n      \"index\": 0\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": 0,\n    \"completion_tokens\": 0,\n    \"total_tokens\": 0\n  }\n}\n```\n\n---\n\n## Documentation\n\n### WebAI-to-API Endpoints\n\n> `POST \u002Fgemini`\n\nInitiates a new conversation with the LLM. Each request creates a **fresh session**, making it suitable for stateless interactions.\n\n> `POST \u002Fgemini-chat`\n\nContinues a persistent conversation with the LLM without starting a new session. Ideal for use cases that require context retention between messages.\n\n> `POST \u002Ftranslate`\n\nDesigned for quick integration with the [Translate It!](https:\u002F\u002Fgithub.com\u002FiSegaro\u002FTranslate-It) browser extension.\nFunctionally identical to `\u002Fgemini-chat`, meaning it **maintains session context** across requests.\n\n> `POST \u002Fv1\u002Fchat\u002Fcompletions`\n\n**OpenAI-compatible endpoint** with full support for:\n- **System prompts**: Set behavior and context for the assistant\n- **Conversation history**: Maintain context across multiple turns (user\u002Fassistant messages)\n- **Streaming**: Optional streaming response support\n\nBuilt for seamless integration with clients that expect the OpenAI API format.\n\n> `POST \u002Fv1beta\u002Fmodels\u002F{model}`\n\n**Google Generative AI v1beta API** compatible endpoint.\nProvides access to the latest Google Generative AI models with standard Google API format including safety ratings and structured responses.\n\n---\n\n### gpt4free Endpoints\n\nThese endpoints follow the **OpenAI-compatible structure** and are powered by the `gpt4free` library.  \nFor detailed usage and advanced customization, refer to the official documentation:\n\n- 📄 [Provider Documentation](https:\u002F\u002Fgithub.com\u002Fgpt4free\u002Fg4f.dev\u002Fblob\u002Fmain\u002Fdocs\u002Fselecting_a_provider.md)\n- 📄 [Model Documentation](https:\u002F\u002Fgithub.com\u002Fgpt4free\u002Fg4f.dev\u002Fblob\u002Fmain\u002Fdocs\u002Fproviders-and-models.md)\n\n#### Available Endpoints (gpt4free API Layer)\n\n```\nGET  \u002F                              # Health check\nGET  \u002Fv1                            # Version info\nGET  \u002Fv1\u002Fmodels                     # List all available models\nGET  \u002Fapi\u002F{provider}\u002Fmodels         # List models from a specific provider\nGET  \u002Fv1\u002Fmodels\u002F{model_name}        # Get details of a specific model\n\nPOST \u002Fv1\u002Fchat\u002Fcompletions           # Chat with default configuration\nPOST \u002Fapi\u002F{provider}\u002Fchat\u002Fcompletions\nPOST \u002Fapi\u002F{provider}\u002F{conversation_id}\u002Fchat\u002Fcompletions\n\nPOST \u002Fv1\u002Fresponses                  # General response endpoint\nPOST \u002Fapi\u002F{provider}\u002Fresponses\n\nPOST \u002Fapi\u002F{provider}\u002Fimages\u002Fgenerations\nPOST \u002Fv1\u002Fimages\u002Fgenerations\nPOST \u002Fv1\u002Fimages\u002Fgenerate            # Generate images using selected provider\n\nPOST \u002Fv1\u002Fmedia\u002Fgenerate             # Media generation (audio\u002Fvideo\u002Fetc.)\n\nGET  \u002Fv1\u002Fproviders                  # List all providers\nGET  \u002Fv1\u002Fproviders\u002F{provider}       # Get specific provider info\n\nPOST \u002Fapi\u002F{path_provider}\u002Faudio\u002Ftranscriptions\nPOST \u002Fv1\u002Faudio\u002Ftranscriptions       # Audio-to-text\n\nPOST \u002Fapi\u002Fmarkitdown                # Markdown rendering\n\nPOST \u002Fapi\u002F{path_provider}\u002Faudio\u002Fspeech\nPOST \u002Fv1\u002Faudio\u002Fspeech               # Text-to-speech\n\nPOST \u002Fv1\u002Fupload_cookies             # Upload session cookies (browser-based auth)\n\nGET  \u002Fv1\u002Ffiles\u002F{bucket_id}          # Get uploaded file from bucket\nPOST \u002Fv1\u002Ffiles\u002F{bucket_id}          # Upload file to bucket\n\nGET  \u002Fv1\u002Fsynthesize\u002F{provider}      # Audio synthesis\n\nPOST \u002Fjson\u002F{filename}               # Submit structured JSON data\n\nGET  \u002Fmedia\u002F{filename}              # Retrieve media\nGET  \u002Fimages\u002F{filename}             # Retrieve images\n```\n\n---\n\n## Roadmap\n\n- ✅ Maintenance\n\n---\n\n\u003Cdetails>\n  \u003Csummary>\n    \u003Ch2>Configuration ⚙️\u003C\u002Fh2>\n  \u003C\u002Fsummary>\n\n### Key Configuration Options\n\n| Section     | Option     | Description                                | Example Value           |\n| ----------- | ---------- | ------------------------------------------ | ----------------------- |\n| [AI]        | default_ai | Default service for `\u002Fv1\u002Fchat\u002Fcompletions` | `gemini`                |\n| [Browser]   | name       | Browser for cookie-based authentication    | `firefox`               |\n| [EnabledAI] | gemini     | Enable\u002Fdisable Gemini service              | `true`                  |\n| [Proxy]     | http_proxy | Proxy for Gemini connections (optional)    | `http:\u002F\u002F127.0.0.1:2334` |\n\nThe complete configuration template is available in [`WebAI-to-API\u002Fconfig.conf.example`](WebAI-to-API\u002Fconfig.conf.example).  \nIf the cookies are left empty, the application will automatically retrieve them using the default browser specified.\n\n---\n\n### Sample `config.conf`\n\n```ini\n[AI]\n# Default AI service.\ndefault_ai = gemini\n\n# Default model for Gemini (options: gemini-3.0-pro, gemini-2.5-pro, gemini-2.5-flash)\ndefault_model_gemini = gemini-2.5-flash\n\n# Gemini cookies (leave empty to use browser_cookies3 for automatic authentication).\ngemini_cookie_1psid =\ngemini_cookie_1psidts =\n\n[EnabledAI]\n# Enable or disable AI services.\ngemini = true\n\n[Browser]\n# Default browser options: firefox, brave, chrome, edge, safari.\nname = firefox\n\n# --- Proxy Configuration ---\n# Optional proxy for connecting to Gemini servers.\n# Useful for fixing 403 errors or restricted connections.\n[Proxy]\nhttp_proxy =\n```\n\n\u003C\u002Fdetails>\n\n---\n\n## Project Structure\n\nThe project now follows a modular layout that separates configuration, business logic, API endpoints, and utilities:\n\n```plaintext\nsrc\u002F\n├── app\u002F\n│   ├── __init__.py\n│   ├── main.py                # FastAPI app creation, configuration, and lifespan management.\n│   ├── config.py              # Global configuration loader\u002Fupdater.\n│   ├── logger.py              # Centralized logging configuration.\n│   ├── endpoints\u002F             # API endpoint routers.\n│   │   ├── __init__.py\n│   │   ├── gemini.py          # Endpoints for Gemini (e.g., \u002Fgemini, \u002Fgemini-chat).\n│   │   ├── chat.py            # Endpoints for translation and OpenAI-compatible requests.\n│   │   └── google_generative.py  # Google Generative AI v1beta API endpoints.\n│   ├── services\u002F              # Business logic and service wrappers.\n│   │   ├── __init__.py\n│   │   ├── gemini_client.py   # Gemini client initialization, content generation, and cleanup.\n│   │   └── session_manager.py # Session management for chat and translation.\n│   └── utils\u002F                 # Helper functions.\n│       ├── __init__.py\n│       └── browser.py         # Browser-based cookie retrieval.\n├── models\u002F                    # Models and wrappers (e.g., MyGeminiClient).\n│   └── gemini.py\n├── schemas\u002F                   # Pydantic schemas for request\u002Fresponse validation.\n│   └── request.py\n├── config.conf                # Application configuration file.\n└── run.py                     # Entry point to run the server.\n```\n\n---\n\n## Developer Documentation\n\n### Overview\n\nThe project is built on a modular architecture designed for scalability and ease of maintenance. Its primary components are:\n\n- **app\u002Fmain.py:** Initializes the FastAPI application, configures middleware, and manages application lifespan (startup and shutdown routines).\n- **app\u002Fconfig.py:** Handles the loading and updating of configuration settings from `config.conf`.\n- **app\u002Flogger.py:** Sets up a centralized logging system.\n- **app\u002Fendpoints\u002F:** Contains separate modules for handling API endpoints. Each module (e.g., `gemini.py` and `chat.py`) manages routes specific to their functionality.\n- **app\u002Fservices\u002F:** Encapsulates business logic, including the Gemini client wrapper (`gemini_client.py`) and session management (`session_manager.py`).\n- **app\u002Futils\u002Fbrowser.py:** Provides helper functions, such as retrieving cookies from the browser for authentication.\n- **models\u002F:** Holds model definitions like `MyGeminiClient` for interfacing with the Gemini Web API.\n- **schemas\u002F:** Defines Pydantic models for validating API requests.\n\n### How It Works\n\n1. **Application Initialization:**  \n   On startup, the application loads configurations and initializes the Gemini client and session managers. This is managed via the `lifespan` context in `app\u002Fmain.py`.\n\n2. **Routing:**  \n   The API endpoints are organized into dedicated routers under `app\u002Fendpoints\u002F`, which are then included in the main FastAPI application.\n\n3. **Service Layer:**  \n   The `app\u002Fservices\u002F` directory contains the logic for interacting with the Gemini API and managing user sessions, ensuring that the API routes remain clean and focused on request handling.\n\n4. **Utilities and Configurations:**  \n   Helper functions and configuration logic are kept separate to maintain clarity and ease of updates.\n\n---\n\n## 🐳 Docker Deployment Guide\n\nFor Docker setup and deployment instructions, please refer to the [Docker.md](Docker.md) documentation.\n\n---\n\n## Star History\n\n[![Star History Chart](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FAmm1rr_WebAI-to-API_readme_59bfbdc0c5f9.png)](https:\u002F\u002Fwww.star-history.com\u002F#Amm1rr\u002FWebAI-to-API&Date)\n\n## License 📜\n\nThis project is open source under the [MIT License](LICENSE).\n\n---\n\n> **Note:** This is a research project. Please use it responsibly, and be aware that additional security measures and error handling are necessary for production deployments.\n\n\u003Cbr>\n\n[![](https:\u002F\u002Fvisitcount.itsvg.in\u002Fapi?id=amm1rr&label=V&color=0&icon=2&pretty=true)](https:\u002F\u002Fgithub.com\u002FAmm1rr\u002F)\n","## 免责声明\n\n> **本项目仅用于研究和教育目的。**  \n> 请勿进行任何商业用途，并在部署或修改此工具时保持负责任的态度。\n\n---\n\n# WebAI-to-API\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FAmm1rr_WebAI-to-API_readme_992386c70f9d.png\" alt=\"WebAI-to-API Server\" height=\"160\" \u002F>\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FAmm1rr_WebAI-to-API_readme_a8e2adbc2644.png\" alt=\"gpt4free Server\" height=\"160\" \u002F>\n\u003C\u002Fp>\n\n**WebAI-to-API** 是一个基于 FastAPI 构建的模块化 Web 服务器，允许你将你喜欢的基于浏览器的 LLM（如 Gemini）暴露为本地 API 端点。\n\n---\n\n该项目支持 **两种运行模式**：\n\n1. **主 Web 服务器**\n\n   > WebAI-to-API\n\n   使用你的浏览器 Cookie 连接到 Gemini 的网页界面，并将其暴露为 API 端点。这种方法轻量、快速且高效，适合个人使用。\n\n2. **备用 Web 服务器（gpt4free）**\n\n   > [gpt4free](https:\u002F\u002Fgithub.com\u002Fxtekky\u002Fgpt4free)\n\n   由 `gpt4free` 库驱动的备用服务器，提供对多种 LLM 的更广泛访问，除了 Gemini 外，还包括：\n\n   - ChatGPT\n   - Claude\n   - DeepSeek\n   - Copilot\n   - HuggingFace Inference\n   - Grok\n   - …以及更多。\n\n这种设计提供了 **速度与冗余性**，确保根据你的使用场景和可用资源灵活切换。\n\n---\n\n## 特性\n\n- 🌐 **可用端点**：\n\n  - **WebAI 服务器**：\n\n    - `\u002Fv1\u002Fchat\u002Fcompletions`\n    - `\u002Fgemini`\n    - `\u002Fgemini-chat`\n    - `\u002Ftranslate`\n    - `\u002Fv1beta\u002Fmodels\u002F{model}`（Google Generative AI v1beta API）\n\n  - **gpt4free 服务器**：\n    - `\u002Fv1`\n    - `\u002Fv1\u002Fchat\u002Fcompletions`\n\n- 🔄 **服务器切换**：可在终端中轻松切换服务器。\n\n- 🛠️ **模块化架构**：按 API 路由、服务、配置和工具等明确划分模块，便于开发和维护。\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FAmm1rr_WebAI-to-API_readme_3ac037ba8eee.png\" alt=\"Endpoints\" height=\"280\" \u002F>\n\u003C\u002Fp>\n\n---\n\n## 安装\n\n1. **克隆仓库：**\n\n   ```bash\n   git clone https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API.git\n   cd WebAI-to-API\n   ```\n\n2. **使用 Poetry 安装依赖：**\n\n   ```bash\n   poetry install\n   ```\n\n3. **创建并更新配置文件：**\n\n   ```bash\n   cp config.conf.example config.conf\n   ```\n\n   然后编辑 `config.conf` 以调整服务设置和其他选项。\n\n4. **运行服务器：**\n\n   ```bash\n   poetry run python src\u002Frun.py\n   ```\n\n---\n\n## 使用\n\n向 `\u002Fv1\u002Fchat\u002Fcompletions`（或其他可用端点）发送包含所需负载的 POST 请求。\n\n### 支持的模型\n\n| 模型 | 描述 |\n|-------|-------------|\n| `gemini-3.0-pro` | 最新、最强大的模型 |\n| `gemini-2.5-pro` | 高级推理模型 |\n| `gemini-2.5-flash` | 快速高效的模型（默认） |\n\n### 示例请求（基本）\n\n```json\n{\n  \"model\": \"gemini-3.0-pro\",\n  \"messages\": [{ \"role\": \"user\", \"content\": \"Hello!\" }]\n}\n```\n\n### 示例请求（带系统提示与对话历史）\n\n```json\n{\n  \"model\": \"gemini-2.5-pro\",\n  \"messages\": [\n    { \"role\": \"system\", \"content\": \"你是一个有用的助手。\" },\n    { \"role\": \"user\", \"content\": \"Python 是什么？\" },\n    { \"role\": \"assistant\", \"content\": \"Python 是一种编程语言。\" },\n    { \"role\": \"user\", \"content\": \"它容易学习吗？\" }\n  ]\n}\n```\n\n### 示例响应\n\n```json\n{\n  \"id\": \"chatcmpl-12345\",\n  \"object\": \"chat.completion\",\n  \"created\": 1693417200,\n  \"model\": \"gemini-3.0-pro\",\n  \"choices\": [\n    {\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"你好！\"\n      },\n      \"finish_reason\": \"stop\",\n      \"index\": 0\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": 0,\n    \"completion_tokens\": 0,\n    \"total_tokens\": 0\n  }\n}\n```\n\n---\n\n## 文档\n\n### WebAI-to-API 端点\n\n> `POST \u002Fgemini`\n\n启动与 LLM 的新对话。每次请求都会创建一个 **全新会话**，因此适用于无状态交互。\n\n> `POST \u002Fgemini-chat`\n\n继续与 LLM 的持久对话，而不启动新会话。非常适合需要在消息之间保留上下文的场景。\n\n> `POST \u002Ftranslate`\n\n专为与 [Translate It!](https:\u002F\u002Fgithub.com\u002FiSegaro\u002FTranslate-It) 浏览器扩展快速集成而设计。功能上与 `\u002Fgemini-chat` 完全相同，即在多次请求之间 **保持会话上下文**。\n\n> `POST \u002Fv1\u002Fchat\u002Fcompletions`\n\n**兼容 OpenAI 的端点**，全面支持：\n- **系统提示**：设定助手的行为和上下文\n- **对话历史**：在多轮对话中保持上下文（用户\u002F助手消息）\n- **流式传输**：可选的流式响应支持\n\n专为期望 OpenAI API 格式的客户端无缝集成而设计。\n\n> `POST \u002Fv1beta\u002Fmodels\u002F{model}`\n\n**兼容 Google Generative AI v1beta API** 的端点。提供对最新 Google Generative AI 模型的访问，采用标准 Google API 格式，包括安全评级和结构化响应。\n\n---\n\n### gpt4free 终端节点\n\n这些终端节点遵循 **与 OpenAI 兼容的结构**，并由 `gpt4free` 库提供支持。  \n有关详细用法和高级自定义，请参阅官方文档：\n\n- 📄 [提供商文档](https:\u002F\u002Fgithub.com\u002Fgpt4free\u002Fg4f.dev\u002Fblob\u002Fmain\u002Fdocs\u002Fselecting_a_provider.md)\n- 📄 [模型文档](https:\u002F\u002Fgithub.com\u002Fgpt4free\u002Fg4f.dev\u002Fblob\u002Fmain\u002Fdocs\u002Fproviders-and-models.md)\n\n#### 可用终端节点（gpt4free API 层）\n\n```\nGET  \u002F                              # 健康检查\nGET  \u002Fv1                            # 版本信息\nGET  \u002Fv1\u002Fmodels                     # 列出所有可用模型\nGET  \u002Fapi\u002F{provider}\u002Fmodels         # 列出特定提供商的模型\nGET  \u002Fv1\u002Fmodels\u002F{model_name}        # 获取特定模型的详细信息\n\nPOST \u002Fv1\u002Fchat\u002Fcompletions           # 使用默认配置进行对话\nPOST \u002Fapi\u002F{provider}\u002Fchat\u002Fcompletions\nPOST \u002Fapi\u002F{provider}\u002F{conversation_id}\u002Fchat\u002Fcompletions\n\nPOST \u002Fv1\u002Fresponses                  # 通用响应端点\nPOST \u002Fapi\u002F{provider}\u002Fresponses\n\nPOST \u002Fapi\u002F{provider}\u002Fimages\u002Fgenerations\nPOST \u002Fv1\u002Fimages\u002Fgenerations\nPOST \u002Fv1\u002Fimages\u002Fgenerate            # 使用选定提供商生成图片\n\nPOST \u002Fv1\u002Fmedia\u002Fgenerate             # 媒体生成（音频\u002F视频等）\n\nGET  \u002Fv1\u002Fproviders                  # 列出所有提供商\nGET  \u002Fv1\u002Fproviders\u002F{provider}       # 获取特定提供商的信息\n\nPOST \u002Fapi\u002F{path_provider}\u002Faudio\u002Ftranscriptions\nPOST \u002Fv1\u002Faudio\u002Ftranscriptions       # 音频转文本\n\nPOST \u002Fapi\u002Fmarkitdown                # Markdown 渲染\n\nPOST \u002Fapi\u002F{path_provider}\u002Faudio\u002Fspeech\nPOST \u002Fv1\u002Faudio\u002Fspeech               # 文本转语音\n\nPOST \u002Fv1\u002Fupload_cookies             # 上传会话 Cookie（基于浏览器的身份验证）\n\nGET  \u002Fv1\u002Ffiles\u002F{bucket_id}          # 从存储桶中获取上传的文件\nPOST \u002Fv1\u002Ffiles\u002F{bucket_id}          # 向存储桶上传文件\n\nGET  \u002Fv1\u002Fsynthesize\u002F{provider}      # 音频合成\n\nPOST \u002Fjson\u002F{filename}               # 提交结构化 JSON 数据\n\nGET  \u002Fmedia\u002F{filename}              # 检索媒体\nGET  \u002Fimages\u002F{filename}             # 检索图片\n```\n\n---\n\n## 路线图\n\n- ✅ 维护\n\n---\n\n\u003Cdetails>\n  \u003Csummary>\n    \u003Ch2>配置 ⚙️\u003C\u002Fh2>\n  \u003C\u002Fsummary>\n\n### 关键配置选项\n\n| 部分     | 选项     | 描述                                | 示例值           |\n| ----------- | ---------- | ------------------------------------------ | ----------------------- |\n| [AI]        | default_ai | `\u002Fv1\u002Fchat\u002Fcompletions` 的默认服务 | `gemini`                |\n| [浏览器]   | name       | 用于基于 Cookie 认证的浏览器    | `firefox`               |\n| [EnabledAI] | gemini     | 启用或禁用 Gemini 服务              | `true`                  |\n| [代理]     | http_proxy | 用于连接 Gemini 的代理（可选）    | `http:\u002F\u002F127.0.0.1:2334` |\n\n完整的配置模板可在 [`WebAI-to-API\u002Fconfig.conf.example`](WebAI-to-API\u002Fconfig.conf.example) 中找到。  \n如果 Cookie 留空，应用程序将使用指定的默认浏览器自动获取它们。\n\n---\n\n### `config.conf` 示例\n\n```ini\n[AI]\n# 默认 AI 服务。\ndefault_ai = gemini\n\n# Gemini 的默认模型（选项：gemini-3.0-pro、gemini-2.5-pro、gemini-2.5-flash）\ndefault_model_gemini = gemini-2.5-flash\n\n# Gemini 的 Cookie（留空以使用 browser_cookies3 自动认证）。\ngemini_cookie_1psid =\ngemini_cookie_1psidts =\n\n[EnabledAI]\n# 启用或禁用 AI 服务。\ngemini = true\n\n[Browser]\n# 默认浏览器选项：firefox、brave、chrome、edge、safari。\nname = firefox\n\n# --- 代理配置 ---\n# 连接 Gemini 服务器的可选代理。\n# 有助于解决 403 错误或受限连接问题。\n[Proxy]\nhttp_proxy =\n```\n\n\u003C\u002Fdetails>\n\n---\n\n## 项目结构\n\n该项目现在采用模块化布局，将配置、业务逻辑、API 终端节点和实用工具分开：\n\n```plaintext\nsrc\u002F\n├── app\u002F\n│   ├── __init__.py\n│   ├── main.py                # 创建 FastAPI 应用程序、配置及生命周期管理。\n│   ├── config.py              # 全局配置加载\u002F更新。\n│   ├── logger.py              # 集中式日志配置。\n│   ├── endpoints\u002F             # API 终端节点路由。\n│   │   ├── __init__.py\n│   │   ├── gemini.py          # Gemini 的终端节点（例如 \u002Fgemini、\u002Fgemini-chat）。\n│   │   ├── chat.py            # 用于翻译和兼容 OpenAI 请求的终端节点。\n│   │   └── google_generative.py  # Google Generative AI v1beta API 终端节点。\n│   ├── services\u002F              # 业务逻辑和服务封装。\n│   │   ├── __init__.py\n│   │   ├── gemini_client.py   # Gemini 客户端初始化、内容生成和清理。\n│   │   └── session_manager.py # 对话和翻译的会话管理。\n│   └── utils\u002F                 # 辅助函数。\n│       ├── __init__.py\n│       └── browser.py         # 基于浏览器的 Cookie 获取。\n├── models\u002F                    # 模型和封装类（例如 MyGeminiClient）。\n│   └── gemini.py\n├── schemas\u002F                   # 用于请求\u002F响应验证的 Pydantic 模式。\n│   └── request.py\n├── config.conf                # 应用程序配置文件。\n└── run.py                     # 启动服务器的入口点。\n```\n\n---\n\n## 开发者文档\n\n### 概述\n\n该项目基于模块化架构构建，旨在实现可扩展性和易于维护。其主要组件包括：\n\n- **app\u002Fmain.py:** 初始化 FastAPI 应用程序，配置中间件，并管理应用程序的生命周期（启动和关闭流程）。\n- **app\u002Fconfig.py:** 处理从 `config.conf` 加载和更新配置设置。\n- **app\u002Flogger.py:** 设置集中式日志系统。\n- **app\u002Fendpoints\u002F:** 包含用于处理 API 终端节点的独立模块。每个模块（例如 `gemini.py` 和 `chat.py`）管理与其功能相关的路由。\n- **app\u002Fservices\u002F:** 封装业务逻辑，包括 Gemini 客户端封装（`gemini_client.py`）和会话管理（`session_manager.py`）。\n- **app\u002Futils\u002Fbrowser.py:** 提供辅助函数，例如从浏览器获取 Cookie 用于身份验证。\n- **models\u002F:** 存放模型定义，如 `MyGeminiClient`，用于与 Gemini Web API 交互。\n- **schemas\u002F:** 定义用于验证 API 请求的 Pydantic 模型。\n\n### 工作原理\n\n1. **应用初始化：**  \n   在启动时，应用程序会加载配置并初始化 Gemini 客户端和会话管理器。这一过程通过 `app\u002Fmain.py` 中的 `lifespan` 上下文管理器来完成。\n\n2. **路由：**  \n   API 端点被组织在 `app\u002Fendpoints\u002F` 目录下的专用路由器中，随后这些路由器会被包含到主 FastAPI 应用程序中。\n\n3. **服务层：**  \n   `app\u002Fservices\u002F` 目录包含了与 Gemini API 交互以及管理用户会话的逻辑，从而确保 API 路由保持简洁，专注于请求处理。\n\n4. **工具与配置：**  \n   辅助函数和配置逻辑被单独存放，以保持代码的清晰性和易于更新性。\n\n---\n\n## 🐳 Docker 部署指南\n\n有关 Docker 的设置和部署说明，请参阅 [Docker.md](Docker.md) 文档。\n\n---\n\n## 星标历史\n\n[![星标历史图表](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FAmm1rr_WebAI-to-API_readme_59bfbdc0c5f9.png)](https:\u002F\u002Fwww.star-history.com\u002F#Amm1rr\u002FWebAI-to-API&Date)\n\n## 许可证 📜\n\n本项目采用 [MIT 许可证](LICENSE) 开源。\n\n---\n\n> **注意：** 这是一个研究项目。请负责任地使用，并请注意，在生产环境中部署时需要额外的安全措施和错误处理机制。\n\n\u003Cbr>\n\n[![](https:\u002F\u002Fvisitcount.itsvg.in\u002Fapi?id=amm1rr&label=V&color=0&icon=2&pretty=true)](https:\u002F\u002Fgithub.com\u002FAmm1rr\u002F)","# WebAI-to-API 快速上手指南\n\nWebAI-to-API 是一个基于 FastAPI 构建的模块化 Web 服务器，旨在将浏览器端的大语言模型（如 Google Gemini）暴露为本地 API 接口。它支持两种运行模式：轻量级的 **WebAI 主服务**（基于浏览器 Cookie 连接 Gemini）和 **gpt4free 备用服务**（支持 ChatGPT、Claude 等多种模型）。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**：Windows、macOS 或 Linux。\n*   **Python 版本**：推荐 Python 3.9 及以上版本。\n*   **包管理工具**：必须安装 [Poetry](https:\u002F\u002Fpython-poetry.org\u002F) 用于依赖管理。\n    *   安装命令：`curl -sSL https:\u002F\u002Finstall.python-poetry.org | python3 -` (Linux\u002FmacOS) 或参考官方文档安装。\n*   **浏览器**：需安装主流浏览器（Firefox, Chrome, Edge, Brave 等），用于自动提取认证 Cookie。\n*   **网络环境**：由于目标服务（如 Gemini）可能涉及海外访问，建议配置好系统代理或在配置文件中设置代理。\n\n> **国内加速提示**：若在安装 Poetry 或拉取依赖时速度较慢，可配置国内镜像源。\n> ```bash\n> poetry config repositories.ali https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n> # 或在安装依赖时指定源\n> poetry install --source ali\n> ```\n\n## 安装步骤\n\n### 1. 克隆项目\n将代码仓库克隆到本地并进入项目目录：\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API.git\ncd WebAI-to-API\n```\n\n### 2. 安装依赖\n使用 Poetry 安装项目所需的所有依赖包：\n\n```bash\npoetry install\n```\n\n### 3. 配置服务\n复制示例配置文件并根据需要修改（例如设置默认浏览器或代理）：\n\n```bash\ncp config.conf.example config.conf\n```\n\n*编辑 `config.conf` 文件（可选）：*\n- `[Browser] name`: 设置用于提取 Cookie 的浏览器（如 `firefox`, `chrome`）。\n- `[Proxy] http_proxy`: 如果直接访问受限，可在此填入代理地址（如 `http:\u002F\u002F127.0.0.1:7890`）。\n- *注：若留空 Cookie 相关字段，程序将尝试自动从默认浏览器获取。*\n\n### 4. 启动服务器\n运行启动脚本开启服务：\n\n```bash\npoetry run python src\u002Frun.py\n```\n\n启动成功后，终端将显示 API 文档地址（通常为 `http:\u002F\u002F127.0.0.1:8000` 或类似端口）。\n\n## 基本使用\n\n服务启动后，您可以通过发送 HTTP POST 请求调用 API。以下是最基础的调用示例。\n\n### 接口地址\n- **OpenAI 兼容接口**: `POST \u002Fv1\u002Fchat\u002Fcompletions`\n- **Gemini 专用接口**: `POST \u002Fgemini` 或 `POST \u002Fgemini-chat`\n\n### 最简单的使用示例\n\n使用 `curl` 或任何 HTTP 客户端向 `\u002Fv1\u002Fchat\u002Fcompletions` 发送请求。\n\n**请求命令 (curl):**\n\n```bash\ncurl -X POST \"http:\u002F\u002F127.0.0.1:8000\u002Fv1\u002Fchat\u002Fcompletions\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"model\": \"gemini-2.5-flash\",\n    \"messages\": [\n      { \"role\": \"user\", \"content\": \"你好，请用中文介绍你自己。\" }\n    ]\n  }'\n```\n\n**预期响应:**\n\n```json\n{\n  \"id\": \"chatcmpl-12345\",\n  \"object\": \"chat.completion\",\n  \"created\": 1693417200,\n  \"model\": \"gemini-2.5-flash\",\n  \"choices\": [\n    {\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"你好！我是由 WebAI-to-API 驱动的助手，基于 Google Gemini 模型...\"\n      },\n      \"finish_reason\": \"stop\",\n      \"index\": 0\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": 10,\n    \"completion_tokens\": 25,\n    \"total_tokens\": 35\n  }\n}\n```\n\n### 支持的主要模型\n在请求的 `model` 字段中可使用以下标识：\n- `gemini-2.5-flash` (默认，速度快)\n- `gemini-2.5-pro` (推理能力强)\n- `gemini-3.0-pro` (最新最强模型)\n\n> **注意**：本项目仅供研究和教育用途。请勿用于商业场景，并在部署时遵守相关法律法规及服务条款。","一位独立开发者正在构建一个本地化的多语言客服机器人原型，需要频繁调用大模型进行测试，但受限于预算无法购买昂贵的 API 密钥。\n\n### 没有 WebAI-to-API 时\n- **高昂的测试成本**：每次调试代码或测试新提示词都需要消耗真实的 API 额度，导致开发者在迭代初期就面临资金压力。\n- **复杂的鉴权流程**：需要在代码中硬编码或管理多个不同厂商的 API Key，不仅繁琐还存在密钥泄露的安全隐患。\n- **模型切换困难**：若想对比 Gemini、Claude 或 Grok 的回答效果，必须分别注册账号、申请密钥并修改代码中的接口地址，效率极低。\n- **依赖网络稳定性**：直接连接官方网页版无法通过程序自动化交互，只能手动复制粘贴，无法集成到现有的自动化测试脚本中。\n\n### 使用 WebAI-to-API 后\n- **零成本无限调用**：利用浏览器 Cookie 将免费的网页版 Gemini 或其他模型转化为本地 API，无需任何密钥即可实现近乎零成本的无限次测试。\n- **统一的接入标准**：WebAI-to-API 提供了标准的 `\u002Fv1\u002Fchat\u002Fcompletions` 接口，开发者只需维护一套代码逻辑，即可无缝切换底层模型。\n- **灵活的模型热切换**：通过在终端简单配置或在请求中更改模型名称，即可瞬间在 Gemini、DeepSeek、Grok 等多个模型间切换，快速验证最佳效果。\n- **完美的自动化集成**：将原本只能手动操作的网页聊天窗口变成了可编程的本地服务，轻松嵌入 Python 脚本或 CI\u002FCD 流程中实现全自动回归测试。\n\nWebAI-to-API 通过“桥接”网页端与大模型接口，让开发者在不花费一分钱的情况下，拥有了企业级的多模型调度与自动化测试能力。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FAmm1rr_WebAI-to-API_3ac037ba.png","Amm1rr","Mohammad","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FAmm1rr_899f31b7.jpg",null,"UK","m.khani2810@gmail.com","m_Khani65","https:\u002F\u002Fgithub.com\u002FAmm1rr",[82,86,90],{"name":83,"color":84,"percentage":85},"Python","#3572A5",98.3,{"name":87,"color":88,"percentage":89},"Makefile","#427819",1.1,{"name":91,"color":92,"percentage":93},"Dockerfile","#384d54",0.6,991,181,"2026-04-07T16:56:43","MIT","未说明","不需要 GPU",{"notes":101,"python":102,"dependencies":103},"该项目是一个基于浏览器的 API 桥接工具，不运行本地大模型，因此无 GPU 和显存需求。主要依赖浏览器（如 Firefox, Chrome, Edge 等）进行 Cookie 认证以访问 Gemini 等服务。使用 Poetry 管理依赖。配置文件中可设置代理以解决连接问题。","未说明 (需支持 Poetry)",[104,105,106],"FastAPI","gpt4free","browser_cookies3",[13,16,14,15,52,35],[109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127],"ai","api","fastapi","free","google-bard-api","python","webserver","webservice","chatbot","bard","gemini","gemini-api","api-less","llm","uvicorn","chatgpt","claude","deepseek","grok","2026-03-27T02:49:30.150509","2026-04-08T10:01:06.864746",[131,136,141,146,151,156,161],{"id":132,"question_zh":133,"answer_zh":134,"source_url":135},24113,"为什么 Claude 到 ChatGPT 的流式传输（streaming）不工作？","这是一个已知问题，主要原因是代码中错误地使用了 \"return\" 而不是 \"yield\"。维护者已修复此问题，但需要注意：\n1. 仅仅将所有的 \"return\" 替换为 \"yield\" 是不够的，这会导致运行时错误（如 'async_generator' object is not iterable）。\n2. 需要确保服务器端正确实现了异步生成器逻辑。\n3. 对于 Bard 和 ChatGPT 已确认修复，Claude 的流式功能可能仍需进一步测试。\n如果遇到类似 `Error : __enter__` 或 `unexpected keyword argument 'stream'` 的错误，请拉取最新代码并检查相关实现。","https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API\u002Fissues\u002F5",{"id":137,"question_zh":138,"answer_zh":139,"source_url":140},24114,"遇到 Bard 响应错误 \"Check the Bard session\" 或 \"Session not found\" 怎么办？","此错误通常由配置文件中的 Cookie 设置不当引起。解决方法如下：\n1. 检查 `Config.conf` 文件中是否正确设置了 `SESSION_ID` 和 `SESSION_IDTS`。\n2. 如果您有多个登录会话，请尝试更换不同的 Cookie（例如 `__Secure-3PSID`）。\n3. 注意：示例脚本 `example_bard.py` 能正常工作，但通过 curl 直接请求可能会失败，请确保 Cookie 是从正常登录的浏览器会话中完整复制的。\n4. 如果修改配置后仍报错，请检查代码中是否存在缩进错误（IndentationError）或未定义的变量（如 `_cookies`）。","https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API\u002Fissues\u002F7",{"id":142,"question_zh":143,"answer_zh":144,"source_url":145},24115,"为什么所有示例脚本（如 example_bard.py, example_claude.py）都无法产生流式输出？","这是因为主文件（main.py）中存在一个常见错误：在应该使用 \"yield\" 的地方错误地使用了 \"return\"。\n解决方案：\n1. 维护者已提交修复，将关键的 \"return\" 语句更改为 \"yield\" 以支持异步生成器。\n2. 注意：不能简单地进行全局替换，必须确保上下文逻辑支持异步迭代，否则会引发 `TypeError: 'async_generator' object is not iterable` 错误。\n3. 更新到最新版本后，Bard 和 ChatGPT 的流式功能应恢复正常，Claude 可能需要额外验证。","https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API\u002Fissues\u002F11",{"id":147,"question_zh":148,"answer_zh":149,"source_url":150},24116,"访问 ChatGPT 或 Claude 时出现 500 错误或 \"Unable to load site\" 是怎么回事？","这通常是因为 OpenAI 使用 Cloudflare 阻止了非浏览器发起的请求。\n具体原因与解决方案：\n1. 普通 HTTP 请求会被 Cloudflare 识别并拦截，导致 500 错误或页面无法加载。\n2. 唯一的解决方法是模拟浏览器行为来获取会话（例如使用 Playwright 等工具）。\n3. 由于模拟浏览器实现复杂且耗时，项目维护者计划暂时切换到其他更简单的提供商，或者等待后续版本更新支持浏览器模拟方案。\n4. 如果您使用了 VPN，尝试关闭它也可能有所帮助，但核心问题通常是请求头缺乏浏览器特征。","https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API\u002Fissues\u002F19",{"id":152,"question_zh":153,"answer_zh":154,"source_url":155},24117,"如何获取 Claude 的 Session Cookie？遇到 DBUS 或密钥存储错误怎么办？","获取 Claude Cookie 的步骤及常见错误处理：\n1. **获取方法**：在浏览器中登录 Claude 官网，打开开发者工具（F12），在 Application\u002FStorage 标签页找到 Cookie，复制关键值（如 session key）到配置文件。\n2. **常见错误**：在 Linux 环境下运行时常遇到 `KeyError: 'DBUS_SESSION_BUS_ADDRESS'` 或 `secretstorage` 相关错误。这是因为 `browser_cookie3` 库试图访问系统的密钥环服务。\n3. **解决方案**：\n   - 确保环境变量 `DBUS_SESSION_BUS_ADDRESS` 已正确设置（适用于 Linux GUI 环境）。\n   - 如果在无头服务器或 Docker 中运行，建议手动提取 Cookie 并直接填入配置文件，避免让程序自动读取浏览器 Cookie。\n   - 确保运行环境与登录 Cookie 的设备\u002FIP 一致，因为 Cookie 可能绑定了首次登录时的设备指纹。","https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API\u002Fissues\u002F13",{"id":157,"question_zh":158,"answer_zh":159,"source_url":160},24118,"项目是否支持发送图片附件或多模态消息？","是的，新版本已经更新支持图片附件功能。\n注意事项：\n1. 请确保您使用的是最新的 `master` 分支代码。\n2. 早期版本可能存在 `GeminiClient` 未定义或 Cookie 加载失败的问题，已在后续提交中修复。\n3. 如果在使用过程中遇到重复加载客户端或其他异常，请检查配置文件格式是否正确，并参考最新的文档说明进行配置。","https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API\u002Fissues\u002F34",{"id":162,"question_zh":163,"answer_zh":164,"source_url":165},24119,"在使用 Claude3 时遇到权限错误（Permission error）如何解决？","权限错误通常与 Cookie 的设备绑定机制有关。\n详细分析与解决：\n1. **根本原因**：Cookie 在您首次登录的设备（或 IP 地址）上进行了绑定。如果尝试在其他设备或不同网络环境下使用该 Cookie，服务器会拒绝访问并抛出权限错误。\n2. **解决方法**：\n   - 确保运行 WebAI Server 的设备与获取 Cookie 时登录的设备在同一网络环境下，或者直接在该设备上登录获取 Cookie。\n   - 不要随意将在手机或家用电脑上获取的 Cookie 直接用于云服务器，除非它们共享相同的网络出口 IP。\n3. **关于有效期**：Cookie 的具体过期时间取决于 Anthropic 的策略，通常较短，建议定期重新获取以保持连接稳定。","https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API\u002Fissues\u002F29",[167,172,177,182,187,192,197,202,207,212,217],{"id":168,"version":169,"summary_zh":170,"released_at":171},145694,"v0.4.0","### WebAI 转 API v0.4.0 - 发布说明\n\n#### v0.4.0 – 2025年6月27日\n\n##### 新增\n\n- 显示用户提示，说明如何使用 `gpt4free` 服务器。\n\n##### 修复\n\n- 解决了在 Windows 11 上的执行问题。\n- 改进了错误处理，并提供了适当的用户友好型提示信息。\n\n##### 变更\n\n- 更新了内部库和依赖项。\n\n---\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API\u002Fcompare\u002Fv0.3.0...v0.4.0","2025-06-27T18:39:29",{"id":173,"version":174,"summary_zh":175,"released_at":176},145695,"v0.3.0","### WebAI 转 API v0.3.0 - 发布说明\n\n#### v0.3.0 – 2025-06-25\n\n##### 新增功能\n\n- 改进了服务器启动信息的显示，包括可用的服务和 API 端点。\n- 添加了一种使用 [gpt4free v0.5.5.5](https:\u002F\u002Fgithub.com\u002Fgpt4free\u002Fg4f.dev) 库的新方法，该方法也可用作备用方案。\n- 引入了在终端中通过键盘快捷键（按键 `1` 和 `2`）切换模型的支持。\n- WebAI-to-API 现在仅在调用 Gemini 时使用您的浏览器和 Cookie，从而提升了运行速度。\n- 通过集成 `gpt4free`，用户可以访问多个提供商（ChatGPT、Gemini、Claude、DeepSeek 等），确保各类模型的持续可用性。\n\n##### 变更\n\n- 更新了内部依赖库。\n- 升级至 [Gemini API v1.14.0](https:\u002F\u002Fgithub.com\u002FHanaokaYuzu\u002FGemini-API)。\n\n##### 修复\n\n- 确保与 Windows 系统的兼容性（已在 Windows 11 上测试通过）。\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API\u002Fcompare\u002Fv0.2.3...v0.3.0","2025-06-25T02:40:35",{"id":178,"version":179,"summary_zh":180,"released_at":181},145696,"v0.2.3","## WebAI to API v0.2.3 - 发行说明\r\n\r\n- **新增 Docker 支持：** 引入了 Docker 配置，以便更轻松地进行部署和环境搭建。\r\n- **修复 Poetry 安装问题：** 解决了使用 Poetry 安装项目时出现的 bug。\r\n\r\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API\u002Fcompare\u002Fv0.2.2...v0.2.3","2025-06-02T11:58:01",{"id":183,"version":184,"summary_zh":185,"released_at":186},145697,"v0.2.2","## WebAI to API v0.2.2 - 发行说明\n\n- **移除 AI 模型：** 移除了对 Claude 和 Deepseek API 的支持。\n- **增强 Cookie 处理：** 改进了多 Cookie 的管理。\n- **新增 API 端点：** 引入了 `\u002Ftranslate`、`\u002Fgemini-chat` 和 `\u002Ftranslate` 端点。\n- **维护工作：** 清理了项目，移除了未使用的文件，并更新了 `.gitignore`。\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API\u002Fcompare\u002Fv0.2.1...v0.2.2","2025-01-28T21:31:47",{"id":188,"version":189,"summary_zh":190,"released_at":191},145698,"v0.2.1","本次发布为 FastAPI 应用程序添加了 CORS 中间件，以支持来自不同域名的跨域请求。这一更改使得前端能够轻松与 API 进行通信，并避免因浏览器安全策略而导致的错误。\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API\u002Fcompare\u002Fv0.2.0...v0.2.1","2025-03-15T04:47:12",{"id":193,"version":194,"summary_zh":195,"released_at":196},145699,"v0.1.5","## WebAI to API v0.1.5 新增内容\n\n+ **项目重构**：体验焕然一新的模块化项目结构，导航更加便捷。\n+ **更新示例**：探索经过刷新的示例，展示最新功能与特性。\n+ **文档更清晰**：获取更明确的说明和文档，指引您完成每一步操作。\n\n### 变更内容\n* 优化：在对话创建中添加重试和等待机制，由 @linkedlist771 在 https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API\u002Fpull\u002F31 中实现。\n\n### 新贡献者\n* @linkedlist771 在 https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API\u002Fpull\u002F31 中完成了首次贡献。\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FWebAI-to-API\u002Fcompare\u002Fv0.1.4...v0.1.5","2024-05-22T01:17:44",{"id":198,"version":199,"summary_zh":200,"released_at":201},145700,"v0.1.4","## WebAI to API v0.1.4 新增内容\n\n+ 更新了 Google Gemini\n+ 更新了 Claude 3\n+ 移除了 ChatGPT\n+ 为 Claude 和 Gemini 添加了流式响应功能\n+ 修复了文档和使用说明\n","2024-04-06T07:10:37",{"id":203,"version":204,"summary_zh":205,"released_at":206},145701,"v0.1.3","## WebAI to API v0.1.3 新增内容\r\n\r\n本次发布是首个稳定版本，新增对 Claude 和 Bard 服务近期增强功能的支持。\n\n### 新特性\n\n- **ChatGPT 代码评审集成**：新增 `\u002FCodeReview` 端点，以支持 [ChatGPT 代码评审](https:\u002F\u002Fgithub.com\u002FAmm1rr\u002FChatGPT-Code-Review) 功能。用户现在可以通过本地服务器获得 AI 辅助的代码评审服务。\n\n- **ShellGPT 端点**：新增 `\u002FShellGPT` 端点，用于支持 [ShellGPT](https:\u002F\u002Fgithub.com\u002FTheR1D\u002Fshell_gpt)。\n\n- **稳定性提升**：进行了多项修复和优化，进一步提升了系统的整体稳定性和健壮性。\n\n- **Bard 性能优化**：通过请求会话池优化与 Bard 的连接性能，避免每次请求都建立新连接，从而提高整体性能。","2023-08-13T05:33:03",{"id":208,"version":209,"summary_zh":210,"released_at":211},145702,"v0.1.2","__新功能__：\n实现了Bard的自动登录功能，无需手动配置。","2023-08-05T20:38:31",{"id":213,"version":214,"summary_zh":215,"released_at":216},145703,"v0.1.1","__近期更新：\r\n-----__\r\n\r\n+ 添加了无需配置即可自动登录Claude的功能。","2023-08-05T03:42:30",{"id":218,"version":219,"summary_zh":220,"released_at":221},145704,"v0.1.0","# Free Chatbot API\r\n\r\nThis project implements a Python web API that offers free access to three leading AI chatbots **ChatGPT**, **Google Bard**, and **Claude** through a single interface.\r\n\r\n**Key features:**\r\n\r\n-   Unified API endpoints allow seamlessly querying ChatGPT, Google Bard, and Claude from one integration.\r\n-   Leverages the free web\u002Fbrowser versions of each AI service by managing cookies and sessions. Avoid costs of paid API access.\r\n-   Simple API for text completion, question answering, and conversational queries. Integrate AI capabilities easily.\r\n-   Lightweight Python server using FastAPI. Easily self-host locally or on your own infrastructure.\r\n-   Full support for streaming responses.\r\n\r\n","2023-08-04T01:08:47"]