> For the complete documentation index, see [llms.txt](https://yeasy.gitbook.io/claude_guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yeasy.gitbook.io/claude_guide/fu-lu/12_appendix/12.2_faq.md).

# 附录 B：常见问题解答

整理自 Anthropic 开发者社区和 Discord 的高频问题。

## 12.2.1 模型能力与选择

### Q: Claude Sonnet 4.6 和 Opus 到底该选谁？

**A**:

* 90% 的场景：**选 Sonnet**。它比 Opus 档（4.8）输出速度快约 2 倍、价格不到 Opus 的 2/3，速度-质量平衡最好（“Sonnet 编程更强”是 Sonnet 4.5 对比 Opus 4.1 时代的旧结论——自 Opus 4.7/4.8 起，Opus 档在编程基准上重回领先）。
* 10% 的场景：**选 Opus**。包括高难度长程编程任务、极度复杂的创意写作、边缘 Case 处理，或者当发现 Sonnet 无论如何都无法遵循某个极其复杂的长指令时。

### Q: Claude 可以联网吗？

**A**:

* 模型本身（Base Model）是离线的，训练数据截止至某个时间点。
* 但通过 **Tool Use**，可以给它挂载官方 Web Search / Web Fetch 或自定义搜索工具，此时它可以访问实时网页内容。Claude.ai 与 API 的可用工具和计费方式不同，应按对应产品文档核对。

### Q: Claude 会训练我的数据吗？

**A**:

* **API / Team / Enterprise（商业产品）**: 默认不会。这是商业承诺。
* **消费级订阅（Free / Pro / Max）**: 是否用于改进 Claude 取决于用户是否允许相关设置和产品条款；处理敏感数据前，应在账号设置与官方隐私说明中确认当前状态。

## 12.2.2 调试与优化

### Q: 为什么 Claude 总是拒绝我的请求？

**A**: 可能是触发了 Constitutional AI 的安全边界。

* **误判？**: 尝试给它更多合法 Context。例如，不要只说“写一个攻击脚本”，而是说明防御教学目标、授权边界、隔离实验环境和期望的安全输出范围。
* **不要绕过安全拒答**: Prefill 不应作为绕过安全边界的技巧；在新模型上它也不再可用。正确做法是重写任务，使其明确落在授权、防御、教学或合规场景内。

### Q: 为什么 Claude 甚至连简单的算术题都做错？

**A**: LLM 是基于概率预测下一个 Token 的，它本质上不擅长计算。

* **解决方案**: 不要让它心算。给它一个 `Calculator` 工具，或者要求它写 Python 代码来计算。

### Q: 如何解决 “Output Cutoff”（输出中断）？

**A**:

* 原因：达到了 `max_tokens` 限制。
* **解决方案**:
  1. 调用 API 时调大 `max_tokens`。
  2. 如果已经最大，将用户的 `Continue` 作为下一轮 User Message 发送，它会接着写。

## 12.2.3 Tool Use 常见问题

### Q: 为什么 Claude 总是填错 JSON 参数？

**A**:

* 你的 JSON Schema `description` 写得不够清楚。
* 把枚举值（Enum）明确写在 Schema 里。
* 在 System Prompt 中添加几个 Few-Shot Examples。

### Q: Tool Use 是串行还是并行的？

**A**: Claude 支持 **Parallel Tool Use**。它可以一次性生成多个工具调用请求（比如同时查询 3 个城市的天气），需要并发执行这些请求并将结果一次性回传。

## 12.2.4 计费与限流

### Q: 遇到 429 Rate Limit 怎么办？

**A**:

* **先查当前限制**: 在 Console 的 Limits 页面或 Rate Limits API 中核对组织、workspace、模型和 endpoint 的 RPM / ITPM / OTPM 限制。不要把某个历史充值金额写成固定升级规则。
* **指数退避**: 代码必须实现 `Exponential Backoff` 重试逻辑，并区分瞬时速率限制、月度使用限制和合同配额不足。

### Q: Prompt Caching 为什么没生效？

**A**:

* 确保 `cache_control` 参数位置正确。
* 确保前缀完全一致（哪怕差一个空格也会导致 Cache Miss）。
* 缓存必须“热”才能生效。如果请求间隔超过 5 分钟，缓存可能已被清理。

## 12.2.5 其他

### Q: Claude 支持微调吗？

**A**: Anthropic 对微调的支持比较谨慎，主要针对特定的企业大客户开放。对于大多数用户，**Prompt Engineering + RAG** 通常能达到微调 90% 的效果且维护成本更低。

### Q: 什么是 “Prompt Generator（提示词生成器）”？

**A**: Anthropic 在 Console 里提供的一项功能，可以帮你自动生成高质量的 Prompt 模板。在 Console 里输入简单任务描述，它会输出一个结构清晰、包含 XML 标签的复杂 Prompt。详见 2.7 节《工具化调试》。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://yeasy.gitbook.io/claude_guide/fu-lu/12_appendix/12.2_faq.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
