AI 热点

Anthropic 将 Messages API 从 Python 重写为 Rust,CPU 使用量降低约 70%

Analytics India Magazine更新于 12月1日 17:20

Anthropic Ditches Python for Rust in Messages API, Cuts CPU Usage by 70% and Memory by Over 80%

AI 导读

Anthropic 将 Messages API 从 Python 重写为 Rust,使单次请求的 CPU 使用量降低约 70%,内存消耗降低超过 80%。新实现虽通过 98% 的现有集成测试,但与生产流量对照时最初仅匹配约 25% 的输入。该迁移于 9 月完成,涵盖客户及 Claude Code、Cowork 使用的核心请求处理基础设施。

推荐理由

AI 评分 65

迁移同时呈现资源降幅与测试盲区,为评估 AI 生成代码在生产重构中的可靠性提供了具体案例。

主题

标签

正文

Anthropic has rewritten its Messages API from Python to Rust, cutting CPU usage per request by around 70% and memory consumption by more than 80%.

However, the migration exposed a significant problem with AI-generated code: despite passing 98% of its existing integration tests, the new implementation initially matched only around 25% of inputs when tested against live production traffic.

The migration, completed in September, involved rebuilding the core request-processing infrastructure through which customers access Claude, including Anthropic's own products such as Claude Code and Cowork. The company detailed the project in a recent engineering blog post.

Anthropic said API traffic on its platform grew roughly 1,800 times between early 2024 and autumn 2026. The original Python service, built in 2023 as a relatively simple request-forwarding system, had become increasingly expensive to operate as it took on additional responsibilities.

来源

Analytics India Magazine