能力标签
Chak AI 轻量级LLM网关
🛠
AI工具

Chak AI 轻量级LLM网关

基于 Python · 开源免费,本地部署,数据完全自主可控
英文名:chak-ai
⭐ 203 Stars 🍴 2 Forks 💻 Python 📄 MIT 🏷 AI 7.8分
7.8AI 综合评分
LLM网关接口统一Python工具
✦ AI Skill Hub 推荐

AI Skill Hub 推荐使用:Chak AI 轻量级LLM网关 是一款优质的AI工具。AI 综合评分 7.8 分,在同类工具中表现稳健。如果你正在寻找可靠的AI工具解决方案,这是一个值得深入了解的选择。

📚 深度解析

Chak AI 轻量级LLM网关 是一款基于 Python 的开源工具,在 GitHub 上收获 0k+ Star,是LLM网关、接口统一、Python工具领域中的优质开源项目。开源工具的最大优势在于代码完全透明,你可以审计每一行代码的安全性,也可以根据自身需求进行二次开发和定制。

**为什么要使用开源工具而非商业 SaaS?**
对于个人开发者和有隐私需求的用户,本地部署的开源工具意味着数据不离本机,不受第三方服务商的数据政策约束。同时,开源工具通常没有使用次数限制和月度费用,一次安装即可长期使用,对于高频使用场景的总拥有成本(TCO)远低于订阅制商业工具。

**安装与环境准备**
Chak AI 轻量级LLM网关 依赖 Python 运行环境。建议通过 pyenv(Python)或 nvm(Node.js)管理 Python 版本,避免全局环境污染。对于新手用户,推荐先创建虚拟环境(python -m venv venv && source venv/bin/activate),再安装依赖,这样即使出现问题也可以随时删除虚拟环境重新开始,不影响系统稳定性。

**社区与维护**
GitHub Issue 和 Discussion 是获取帮助的最快渠道。在提问前建议先检查 Closed Issues(已关闭的问题),大多数常见问题都已有解答。遇到 Bug 时,提供 pip list 的输出、完整错误堆栈和最小可复现示例,能显著提高开发者响应速度。AI Skill Hub 将持续追踪 Chak AI 轻量级LLM网关 的版本更新,及时通知重要功能变化。

📋 工具概览

一个简洁且实用的开源大模型网关工具,旨在为开发者提供统一的LLM接口管理。它支持多模型调度与请求转发,简化了不同AI服务商的接入流程,非常适合需要快速集成多种大模型且追求轻量化部署的开发者。

Chak AI 轻量级LLM网关 是一款基于 Python 开发的开源工具,专注于 LLM网关、接口统一、Python工具 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

GitHub Stars
⭐ 203
开发语言
Python
支持平台
Windows / macOS / Linux
维护状态
轻量级项目,按需更新
开源协议
MIT
AI 综合评分
7.8 分
工具类型
AI工具
Forks
2

📖 中文文档

以下内容由 AI Skill Hub 根据项目信息自动整理,如需查看完整原始文档请访问底部「原始来源」。

一个简洁且实用的开源大模型网关工具,旨在为开发者提供统一的LLM接口管理。它支持多模型调度与请求转发,简化了不同AI服务商的接入流程,非常适合需要快速集成多种大模型且追求轻量化部署的开发者。

Chak AI 轻量级LLM网关 是一款基于 Python 开发的开源工具,专注于 LLM网关、接口统一、Python工具 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

📌 核心特色
  • 开源免费,支持本地部署,数据完全自主可控
  • 活跃的 GitHub 开源社区,持续迭代更新
  • 提供详细文档和使用示例,新手友好
  • 支持自定义配置,灵活适配不同使用环境
  • 可作为基础组件集成进现有技术栈或进行二次开发
🎯 主要使用场景
  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发
以下安装命令基于项目开发语言和类型自动生成,实际以官方 README 为准。
安装命令
# 方式一:pip 安装(推荐)
pip install chak-ai

# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install chak-ai

# 方式三:从源码安装(获取最新功能)
git clone https://github.com/zhixiangxue/chak-ai
cd chak-ai
pip install -e .

# 验证安装
python -c "import chak_ai; print('安装成功')"
📋 安装步骤说明
  1. 访问 GitHub 仓库页面
  2. 按照 README 文档完成依赖安装
  3. 根据系统环境完成初始化配置
  4. 参考官方示例或文档开始使用
  5. 遇到问题可在 GitHub Issues 中查找解答
以下用法示例由 AI Skill Hub 整理,涵盖最常见的使用场景。
常用命令 / 代码示例
# 命令行使用
chak-ai --help

# 基本用法
chak-ai input_file -o output_file

# Python 代码中调用
import chak_ai

# 示例
result = chak_ai.process("input")
print(result)
以下配置示例基于典型使用场景生成,具体参数请参照官方文档调整。
配置示例
# chak-ai 配置文件示例(config.yml)
app:
  name: "chak-ai"
  debug: false
  log_level: "INFO"

# 运行时指定配置文件
chak-ai --config config.yml

# 或通过环境变量配置
export CHAK_AI_API_KEY="your-key"
export CHAK_AI_OUTPUT_DIR="./output"
📑 README 深度解析 真实文档 完整度 87/100 查看 GitHub 原文 →
以下内容由系统直接从 GitHub README 解析整理,保留代码块、表格与列表结构。

简介

<a href="https://youtube.com/watch?v=xOKQ7EQcggw"><img src="https://raw.githubusercontent.com/zhixiangxue/chak-ai/main/docs/assets/logo.png" alt="Demo Video" width="120"></a>

PyPI version Python Version License Downloads GitHub Stars

A multi-model LLM client with built-in context management and flexible tool calling.

chak is not another liteLLM, one-api, or OpenRouter, but a client library that actively manages conversation context and tool calls for you. Just focus on building your application, let chak handle the complexity.

</div>

Demo Video

</div>

---

🌵 What's New

  • 2026-07-22 | v0.5.0 - Inspector debug viewer + before_send/after_send hooks + Context Handler turn/round scopes + OpenAI prompt cache + unified usage/token semantics.
  • 2026-06-02 | v0.4.0 - Resilient provider failover: Configure fallbacks to route requests through ordered backup LLM providers whenever the current provider fails. Use fallback_on=FallbackOn.RETRYABLE_ERRORS for the conservative timeout/rate-limit/server-error policy. See example.
  • 2026-04-28 | v0.3.5 - SQL & Excel tools:
  • SQL tool: Query and modify SQLite / PostgreSQL / MySQL databases. Zero extra deps for SQLite.
  • Excel tool: Read and write .xlsx and .csv spreadsheets. Requires pip install chakpy[tools].
  • FileSystem enhancements: New move, find, grep methods for full file management.
  • 2026-04-27 | v0.3.4 - e2b Sandbox:
  • Sandbox tool: New Sandbox built-in tool — run code in an isolated e2b cloud VM. See Built-in Standard Tools.
  • 2026-04-22 | v0.3.2 - Built-in standard tools:
  • Built-in standard tools: 7 atomic-level tools now ship with chak — Bash, Python, FileSystem, Web, Search, Http, Pdf. Drop them directly into tools=[] to give any agent baseline capabilities. See Built-in Standard Tools.
  • 2026-04-08 | v0.3.1 - Human-in-the-Loop upgrade & built-in execution tools:
  • Human-in-the-Loop upgrade (⚠️ Breaking change): Replaced tool_approval_handler (bool) with hitl_handler (HITLDecision) — three outcomes: abort, allow, allow(overrides={...}). See Human-in-the-Loop.
  • Built-in execution tools: Bash (shell) and Python (code interpreter) for agentic workflows.
  • ClaudeSkill: Native integration for Anthropic's community skill packs with 3-layer progressive disclosure. See Anthropic Agent Skills.
  • 2026-02-02 | v0.3.0 - Major update:
  • Skill-based progressive disclosure for tool calling - prevent overwhelming LLMs with too many tools. See Skill-based Tools.
  • Turn ID tracking & message filtering - fine-grained conversation history management. See examples examples/turn_id_tracking.py and examples/message_filtering_demo.py.
  • Reasoning support - compatible with OpenAI gpt-5/o1/o3 and Bailian QwQ models. See examples examples/chat_reasoning.py.
  • Context handler refactoring - replaced strategies with handlers for better clarity (⚠️ Breaking change). See Pluggable Context Management.
  • 2026-01-29 | v0.2.7 - Added human-in-the-loop tool approval via tool_approval_handler, with CLI and browser/WebSocket support. See Human-in-the-loop Approval in Tool Calling.
  • 2026-01-12 | v0.2.6 - Added event stream support for real-time tool call observability. Use event=True to observe tool execution in your UI. See Tool Call Observability
  • 2026-01-09 | v0.2.5 - Added configurable tool executor for CPU-intensive tasks. Use tool_executor parameter to control execution mode. See Tool Calling
  • 2026-01-07 | v0.2.3 - Conversation now supports structured outputs via returns parameter. See Structured Output
  • 2025-12-02 | v0.2.2 - Conversation now supports multimodal inputs. See Multimodal Support

---

Core Features

Install all optional dependencies

pip install chakpy[all] ```

ExtraWhat it installs
toolspymupdf4llm, beautifulsoup4, readability-lxml, ddgs, e2b (and optional API clients for Firecrawl/Tavily)
serverfastapi, uvicorn, websockets, pyyaml
webbeautifulsoup4, readability-lxml, firecrawl-py, tavily-python, ddgs
alleverything above

Installation

```bash

Basic installation (SDK only)

pip install chakpy

Build an Agent in 3 Lines

Drop in tools, describe your task — chak drives the multi-step loop automatically.

```python import chak from chak.tools.std import Python, FileSystem

conv = chak.Conversation( "anthropic/claude-sonnet-4-6", api_key="...", tools=[Python(), FileSystem()], )

await conv.asend( "Analyse sales.csv: top 10 products by revenue. Write a Markdown report to report.md" )

🌖 Quick Start

Usage - exactly like regular tools

tools = [MegaSkill()] conv = Conversation("bailian/qwen-plus", tools=tools)

Basic Usage

Simple Data Extraction

```python from pydantic import BaseModel, Field from chak import Conversation

class User(BaseModel): """User information""" name: str = Field(description="User's full name") email: str = Field(description="User's email address") age: int = Field(description="User's age")

conv = Conversation("openai/gpt-4o", api_key="YOUR_KEY")

Complete Example

See full working examples: - Basic Structured Output: examples/structured_output_simple.py - Multimodal Structured Output: examples/structured_output_multimodal.py

Basic Usage

Single Image

```python from chak import Conversation, Image

conv = Conversation("openai/gpt-4o", api_key="YOUR_KEY")

Complete Examples

See full working examples:

  • Documents: examples/multimodal_chat_documents.py
  • PDF document analysis
  • Word document processing
  • Plain text and markdown files
  • CSV data analysis
  • Excel spreadsheet processing
  • Web link content analysis
  • Streaming with documents

Basic Usage

```python from chak import Conversation

conv = Conversation("openai/gpt-4o-mini", api_key="YOUR_KEY")

Use Cases

The custom field is completely flexible - use it however your application needs:

  • Frontend rendering: Pass UI instructions (forms, charts, widgets)
  • Tracking: Store session IDs, user IDs, request metadata
  • Routing: Add routing hints or processing flags
  • Analytics: Attach tracking data for logging
  • Anything else: It's your data, structure it your way

Example: examples/custom_payload_demo.py - Demo showing custom data used for dynamic form rendering

---

Logging Configuration

Control log output at runtime:

import chak

chak.set_log_level("DISABLE") # Disable all logs (production)
chak.set_log_level("ERROR")   # Only errors
chak.set_log_level("WARNING") # Warnings + errors
chak.set_log_level("INFO")    # Default, shows tool execution
chak.set_log_level("DEBUG")   # Detailed logs with file:line

Or use environment variables (set before importing):

export CHAK_LOG_LEVEL=ERROR
export CHAK_LOG_TO_FILE=true      # Optional: enable file logging
export CHAK_LOG_FILE=logs/chak.log

Local Server Mode (Optional)

⚠️ chak is primarily an SDK. The built-in local server is intended for local development and prototyping only, and is not recommended or hardened for production use.

Start a local gateway service with 2 lines of code:

1. Create Configuration File

```yaml

chak-config.yaml

api_keys: # Simple format - use default base_url openai: ${OPENAI_API_KEY} # Read from environment variable (recommended) bailian: "sk-your-api-key-here" # Plain text (for development/testing) # Custom base_url (requires quotes) "ollama@http://localhost:11434": "ollama" "vllm@http://192.168.1.100:8000": "dummy-key"

server: host: "0.0.0.0" port: 8000 ```

🌱 Minimalist API Design

No complex configurations, no learning curve. chak is designed to be intuitive:

```python

Use as SDK - connect to any LLM with a simple URI

conv = chak.Conversation( "openai/gpt-4o-mini", api_key="YOUR_KEY", event=True, # Enable event streaming for real-time tool call observability reasoning=True # Enable reasoning mode for compatible models ) response = conv.send("Hello!")

Default: best for IO-bound tasks (API calls, DB queries)

conv = chak.Conversation( "openai/gpt-4o", tools=[...], tool_executor=chak.ToolExecutor.ASYNCIO # default )

Compare multiple images

response = await conv.asend( "What are the differences between these images?", attachments=[ Image("https://example.com/image1.jpg"), Image("./local/image2.png", MimeType.PNG), Image("data:image/webp;base64,...", MimeType.WEBP) ] )


#### Audio Files
python from chak import Audio, MimeType

response = await conv.asend( "What is being said in this audio?", attachments=[Audio("https://example.com/speech.wav", MimeType.WAV)] )


#### Documents
python from chak import PDF, DOC, Excel, CSV, TXT

Send image with question

response = await conv.asend( "What's in this image?", attachments=[Image("photo.jpg")] # local path, URL, or base64 )

🇨🇳 中文文档镜像 AI 翻译 2026-07-09
英文原文章节由系统翻译为中文摘要,便于快速理解。完整原文见上方 "📑 README 深度解析"。
📌 简介

chak-ai 是一个轻量级且功能强大的 AI Agent 开发框架。它旨在简化 LLM Agent 的构建流程,通过直观的接口让开发者能够轻松集成各种工具,实现自动化的多步任务循环,让 AI 不仅仅能对话,更能通过工具执行复杂的实际操作。

⚡ 功能介绍

最新版本已引入 Notebook 工具,通过内置的 seeka 向量数据库实现 LLM Agent 的持久化记忆,支持跨对话的知识 `note()` 与 `recall()`,无需���外配置外部数据库。此外,框架还具备强大的 Provider 故障转移机制,确保在模型服务不稳定时依然保持业务的韧性。

📋 环境依赖

基础安装仅需 Python 环境。若需使用高级功能,建议通过 `pip install chakpy[all]` 安装所有可选依赖。这包括用于文档解析的 `tools` 扩展(如 pymupdf4llm、beautifulsoup4 等)以及用于构建 Web 服务的 `server` 扩展(如 fastapi、uvicorn 等)。

🛠 安装步骤(Docker/pip/源码)

安装非常简单。基础 SDK 版本可以通过 `pip install chakpy` 直接安装。开发者只需几行代码即可构建一个具备工具调用能力的 Agent,通过指定模型 URI 和工具列表,chak 会自动驱动多步推理循环,实现从任务描述到结果生成的自动化过程。

🚀 使用教程

chak 的设计遵循直觉化原则,工具使用方式与常规工具完全一致。开发者可以像使用普通函数一样定义自定义工具(如 MegaSkill),并将其注入到 Conversation 对象中。同时,框架也支持通过 Pydantic 模型进行结构化数据提取,方便从非结构化文本中精准获取用户信息。

⚙️ 配置说明(含 MCP / env)

框架提供了灵活的日志控制机制,开发者可以通过 `chak.set_log_level` 在运行时动态调整日志级别,从生产环境的 `DISABLE` 到开发环境的 `DEBUG` 均可覆盖。此外,虽然 chak 主要作为 SDK 使用,但也提供了轻量级的本地 Server 模式,方便开发者进行快速原型开发与本地调试。

🔌 API 说明

chak 采用了极简主义的 API 设计,几乎没有学习成本。开发者可以通过简单的 URI 格式连接任何 LLM(如 `openai/gpt-4o`)。框架原生支持事件流(event streaming)以实现实时工具调用观测,并支持异步 `tool_executor` 模式,非常适合处理 API 调用或数据库查询等 IO 密集型任务。

❓ FAQ 摘要

针对常见问题,chak 支持在发送消息时通过 `attachments` 参数携带图片附件。无论是本地路径、URL 还是 base64 编码,开发者都可以通过 `Image` 类轻松实现多模态交互,让 Agent 具备理解图像内容的能力。

🎯 aiskill88 AI 点评 A 级 2026-07-09

aiskill88点评:定位精准,解决了多模型接入的碎片化痛点,代码简洁,是轻量级AI基础设施的优秀选择。

📚 实用指南(长尾问题)
适合谁
  • 需要让 Claude / Cursor 操作本地工具的 AI 工程师
  • 构建多智能体协作系统的 Agent 开发者
  • 需要从图片、PDF 提取文字的文档自动化场景
  • 做语音类 AI 产品的开发者
最佳实践
  • 配置 MCP 服务器时建议使用 stdio 传输 + JSON-RPC,避免暴露公网
  • 本地部署优先选 GGUF 量化模型,节省显存并保持响应速度
  • Agent 任务先做 dry-run 验证工具调用链,再开启自主执行
常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • MCP 配置路径拼错或权限不足,重启 Claude Desktop 才生效
  • 显存不足直接 OOM — 优先降低 context 或换更小的量化模型
  • Python 依赖冲突:建议用 venv / uv 隔离环境
部署方案
  • CLI:直接 npm install -g / pip install,命令行调用
  • 本地部署:CPU 8GB 起,GPU 推荐 16GB+ 显存
  • 云端托管:可放在 Vercel / Railway / Fly.io 等 PaaS 平台
相关搜索
chak-ai 中文教程chak-ai 安装报错怎么办chak-ai MCP 配置chak-ai Agent 工作流chak-ai 与同类工具对比chak-ai 最佳实践chak-ai 适合谁用

⚡ 核心功能

👥 适合谁
  • 需要让 Claude / Cursor 操作本地工具的 AI 工程师
  • 构建多智能体协作系统的 Agent 开发者
  • 需要从图片、PDF 提取文字的文档自动化场景
  • 做语音类 AI 产品的开发者
⭐ 最佳实践
  • 配置 MCP 服务器时建议使用 stdio 传输 + JSON-RPC,避免暴露公网
  • 本地部署优先选 GGUF 量化模型,节省显存并保持响应速度
  • Agent 任务先做 dry-run 验证工具调用链,再开启自主执行
⚠️ 常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • MCP 配置路径拼错或权限不足,重启 Claude Desktop 才生效
  • 显存不足直接 OOM — 优先降低 context 或换更小的量化模型
  • Python 依赖冲突:建议用 venv / uv 隔离环境

👥 适合人群

AI 技术爱好者研究人员和学生开发者和工程师技术创业者

🎯 使用场景

  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发

⚖️ 优点与不足

✅ 优点
  • +MIT 协议,可免费商用
  • +完全开源免费,无授权费用
  • +本地部署,数据完全自主可控
  • +开发者社区支持,遇问题可查可问
⚠️ 不足
  • 安装和初始配置可能需要一定技术基础
  • 功能完整性通常不如成熟商业产品
  • 技术支持主要依赖开源社区,响应速度不稳定
⚠️ 使用须知

AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。

建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。

📄 License 说明

✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。

🔗 相关工具推荐

📰 相关 AI 新闻
🍿 AI 圈相关吃瓜
🗺️ 相关解决方案
🧩 你可能还需要
基于当前 Skill 的能力图谱,自动补全的工具组合

❓ 常见问题 FAQ

它主打简洁轻量,适合中小型项目或个人开发者,而非超大规模企业级流量调度。
💡 AI Skill Hub 点评

总体来看,Chak AI 轻量级LLM网关 是一款质量良好的AI工具,在同类工具中具备一定竞争力。AI Skill Hub 将持续追踪其更新动态,建议收藏备用,结合自身场景选择合适时机引入使用。

📚 深入学习 Chak AI 轻量级LLM网关
查看分步骤安装教程和完整使用指南,快速上手这款工具
🌐 原始信息
原始名称 chak-ai
原始描述 开源AI工具:A simple, yet handy, LLM gateway.。⭐203 · Python
Topics LLM网关接口统一Python工具
GitHub https://github.com/zhixiangxue/chak-ai
License MIT
语言 Python
🔗 原始来源
🐙 GitHub 仓库  https://github.com/zhixiangxue/chak-ai

收录时间:2026-07-09 · 更新时间:2026-07-09 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。

📺 订阅 AI Skill Hub Daily Telegram 频道
每天 8 条精选 AI Skill、MCP、Agent 与自动化工具推送
加入频道 →