Anthropic MaaS API
-
Anthropic Beta Flags笔记Anthropic Beta Flags最后核实:2026-07-17。以 Anthropic direct API 为主;SDK enum 是兼容性并集,不等于当前模型、账号或第三方平台一定支持。 · Anthropic MaaS API · Anthropic FAQ · | date | flag | status | feature key / notes |打开:/notes/ai/maas/anthropic/beta-flags
-
Anthropic FAQ笔记Anthropic FAQ通常不保留。 · Structured outputs 已迁移到 ,不再需要 。 · Fine-grained tool streaming 使用 tool-level ,不再需要旧 header。 · Tool search 已 GA,使用 / 和 。打开:/notes/ai/maas/anthropic/faq
-
Anthropic API
-
SDK
-
Postman collection
-
Pricing
Messages API
- Anthropic 使用 Messages API 作为主要对话接口。
- Raw HTTP 必须发送
anthropic-version: 2023-06-01;beta 能力另用anthropic-beta。 - Streaming 使用 SSE named events;不要依赖 OpenAI 风格的
data: [DONE]作为结束标志。 max_tokens对应 OpenAI 常见的max_completion_tokens。- tool result 通常以
userrole 回传,而不是 OpenAI 新版的toolrole。
| OpenAI | Anthropic | 说明 |
|---|---|---|
parallel_tool_calls | disable_parallel_tool_use | 并行工具调用控制,语义方向相反 |
max_completion_tokens | max_tokens | 输出 token 上限 |
tool role | user role + tool result block | 工具结果回传方式不同 |
Extended thinking
- 新模型优先使用 adaptive thinking:
thinking: {type: "adaptive"}。 output_config.effort控制整体 token 投入,影响 thinking、正文和 tool call;默认通常为high,但支持的 level 取决于模型。thinking: {type: "enabled", budget_tokens: N}是旧模型和部分过渡模型的 manual thinking 形式;不能假设所有新模型仍接受。- Thinking block 与生成它的模型绑定。切换模型时应移除历史
thinking/redacted_thinkingblock;同模型多轮则按文档要求原样回传。 - 参考:platform.claude.com/docs/en/build-with-claude/extended-thinking
- 参考:platform.claude.com/docs/en/build-with-claude/adaptive-thinking
- 参考:platform.claude.com/docs/en/build-with-claude/effort
Interleaved thinking
- 思考过程可以与 tool call 交错。
- 新模型的 adaptive thinking 自动支持 interleaved thinking,不需要历史 beta header。
- 仍使用 manual thinking 的旧模型是否需要
interleaved-thinking-2025-05-14,按具体模型文档核实。 - 该能力基于 Messages API 的 thinking/tool content block 顺序。
Prompt caching
- Anthropic prompt cache 细节见 cache笔记MaaS Prompt Cache| 模型 / 场景 | 最小缓存 Token 数 | · | Claude Opus 4.5 | 4096 | · | Claude Opus 4.1, 4 | 1024 | · | Claude Sonnet 4.5, 4, 3.7 | 1024 |打开:/notes/ai/maas/spec/cache。
cache_control: {type: "ephemeral"}默认 TTL 为 5 分钟;需要 1 小时时设置ttl: "1h"。- 通过
usage.cache_creation_input_tokens和usage.cache_read_input_tokens判断 cache write/hit,不要只看是否发送了cache_control。 - 参考:platform.claude.com/docs/en/build-with-claude/prompt-caching
Data residency
inference_geo: "global" | "us"控制单次 Messages 请求的推理地域;us有额外价格 multiplier。- 仅适用于 Anthropic direct API,并且需要模型支持;Bedrock/Vertex 的地域由 endpoint 或 inference profile 决定。
- Managed Agents 不接受每次请求的
inference_geo,而是遵循 workspace geo。 - 参考:platform.claude.com/docs/en/build-with-claude/data-residency
错误码
关联信息
反向链接、本文链接的其他页面和外部资料。
反向链接
- Anthropic Beta Flags笔记 · Anthropic MaaS API
最后核实:2026-07-17。以 Anthropic direct API 为主;SDK enum 是兼容性并集,不等于当前模型、账号或第三方平台一定支持。 · Anthropic MaaS API · Anthropic FAQ · | date | flag | status | feature key / notes |
站内链接
- Anthropic Beta Flags笔记 · Anthropic Beta Flags
最后核实:2026-07-17。以 Anthropic direct API 为主;SDK enum 是兼容性并集,不等于当前模型、账号或第三方平台一定支持。 · Anthropic MaaS API · Anthropic FAQ · | date | flag | status | feature key / notes |
- Anthropic FAQ笔记 · Anthropic FAQ
通常不保留。 · Structured outputs 已迁移到 ,不再需要 。 · Fine-grained tool streaming 使用 tool-level ,不再需要旧 header。 · Tool search 已 GA,使用 / 和 。
- MaaS Prompt Cache笔记 · cache
| 模型 / 场景 | 最小缓存 Token 数 | · | Claude Opus 4.5 | 4096 | · | Claude Opus 4.1, 4 | 1024 | · | Claude Sonnet 4.5, 4, 3.7 | 1024 |
参考资料
GitHub2 条
- anthropics/anthropic-sdk-typescriptgithub.com/anthropics/anthropic-sdk-typescript
- anthropics/anthropic-sdk-typescript/src/resources/beta/messages/messages.tsgithub.com/anthropics/anthropic-sdk-typescript/blob/main/src/resources/beta/messages/messages.ts
其他外链9 条
- platform.claude.com/docs/en/about-claude/pricingplatform.claude.com/docs/en/about-claude/pricing
- platform.claude.com/docs/en/api/errorsplatform.claude.com/docs/en/api/errors
- platform.claude.com/docs/en/api/overviewplatform.claude.com/docs/en/api/overview
- platform.claude.com/docs/en/build-with-claude/adaptive-thinkingplatform.claude.com/docs/en/build-with-claude/adaptive-thinking
- platform.claude.com/docs/en/build-with-claude/data-residencyplatform.claude.com/docs/en/build-with-claude/data-residency
- platform.claude.com/docs/en/build-with-claude/effortplatform.claude.com/docs/en/build-with-claude/effort
- platform.claude.com/docs/en/build-with-claude/extended-thinkingplatform.claude.com/docs/en/build-with-claude/extended-thinking
- platform.claude.com/docs/en/build-with-claude/prompt-cachingplatform.claude.com/docs/en/build-with-claude/prompt-caching
- www.postman.com/postman/anthropic-apis/documentation/dhus72s/claude-apiwww.postman.com/postman/anthropic-apis/documentation/dhus72s/claude-api