> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hitheo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Theo 对比其他方案

> Theo 与模型代理、LangChain 以及直接调用模型 API 相比有何不同。

## 开发者的选择

你想在产品中加入 AI 能力。你有以下几种选择：

1. **直接调用模型 API** — 直接调用单一供应商
2. **模型代理** — 使用统一网关实现多模型访问
3. **框架** — 用 LangChain / LangGraph 自建管线
4. **编排 API** — 使用 Theo，一次调用即可完成分类、路由、技能、工具和计费

## 对比

| 能力 | 直接调用 API | 模型代理 | LangChain | **Theo** |
| - | - | - | - | - |
| 模型访问 | 1 家供应商 | 300+ 个模型 | 任意（自行配置） | 300+ 个模型 |
| 意图分类 | ❌ | ❌ | 自行构建 | ✅ 内置 |
| 模型路由 | ❌ | 手动 | 自行构建 | ✅ 自动 |
| 自动故障切换 | ❌ | ✅ | 自行构建 | ✅ 内置 |
| 工具执行 | 取决于供应商 | ❌ | 自行构建 | ✅ Agent 循环 |
| 技能 / 领域专长 | ❌ | ❌ | ❌ | ✅ 应用市场 |
| 自定义角色（E.V.I.） | 自行构建 | ❌ | 自行构建 | ✅ 一个参数即可 |
| 记忆 | ❌ | ❌ | 自行构建 | ✅ 跨会话 |
| 流式 | ✅ | ✅ | 自行构建 | ✅ SSE |
| 计费 / 额度 | 供应商计费 | ✅ | ❌ | ✅ 按令牌计费 |
| 语义缓存 | ❌ | ❌ | 自行构建 | ✅ 内置 |
| 审计追踪 | ❌ | ❌ | 自行构建 | ✅ 不可篡改 |
| 上线所需时间 | 数周 | 数天 | 数月 | **数小时** |

## 代码对比

### DIY 方案 — 一切自己处理

```typescript theme={null}
const model = pickModelForTask(prompt);          // you build this
const skills = loadDomainKnowledge(userContext);  // you build this
const tools = resolveToolDefinitions(skills);     // you build this
const systemPrompt = buildPrompt(persona, skills, tools); // you build this
const response = await llmProvider.complete({ model, messages, tools });
const toolResults = await executeTools(response.tool_calls); // you build this
const finalResponse = await llmProvider.complete({ model, messages: [..., toolResults] });
await debitCredits(user, response.usage);        // you build this
await logAudit(user, response);                  // you build this
```

### Theo — 一次调用即可

```typescript theme={null}
import { Theo } from "@hitheo/sdk";

const theo = new Theo({ apiKey: "theo_sk_..." });
const response = await theo.complete({
  prompt: "Check inventory across all warehouses",
  skills: ["inventory-check"],
  persona: { system_prompt: "You are Nova..." },
});
```

## 该如何选择

**适合使用 Theo 的场景：**

* 你想要 AI 功能，但不想自建编排基础设施
* 你需要具备自动故障切换的多模型路由
* 你想通过可安装的技能获得领域专长
* 你正在构建一个 E.V.I.（带自定义角色的嵌入式 AI）
* 你需要内置的计费、缓存与审计能力

**适合使用模型代理的场景：**

* 你只是需要统一计费的模型访问
* 你正在自建编排层

**适合使用 LangChain 的场景：**

* 你需要对管线中的每一个决策拥有完全控制权
* 你的场景需要自定义的 Agent 架构
* 你拥有足够的工程团队来构建并维护这套基础设施

**适合直接调用 API 的场景：**

* 你只需要来自一家供应商的一个模型
* 你有特定的供应商要求（SLA、数据驻留等）


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.