slug
SDK 是什么
type
Post
status
Published
date
Jun 27, 2026
tags
推荐
文字
summary
category
技术分享与前沿技术域认知
icon
password
把 JSON 的 HTTP 请求封装好 → 再把返回内容变成 Python 能直接读取的对象
去程封装、回程解析,两头都包。这就是 SDK 的全部本质
无论是 OpenAI 还是 Anthropic 的 SDK 都是同样的道理,它们只是两种不同的方言,但是干的事情都是同样的一件事情。

SDK 到底是什么
SDK = Software Development Kit。但在我们这个场景里,它更准确的名字是客户端库(client library)——一包别人替你写好的 Python 代码。你做两件事就能用:pip install openai 把它下载下来,from openai import OpenAI 把它导进你的程序。它们是两个不同的库,各自匹配各自公司服务器听得懂的"方言"。你不用想象这个区别——你今天亲手经历过:我们就是因为换 SDK,把
agent.py 里一堆字段名改了一遍。这就是全部区别:同一件事 | Anthropic SDK 的说法 | OpenAI SDK 的说法 |
发起对话 | client.messages.create() | client.chat.completions.create() |
"还要不要工具"的信号 | stop_reason == "tool_use" | finish_reason == "tool_calls" |
模型想调工具 | tool_use 块 | tool_calls 列表 |
工具参数 schema | input_schema | parameters(外面还套 function) |
工具结果喂回去 | tool_result 块 | 一条 role: "tool" 消息 |
骨架(那个
while 循环)一模一样,因为两家干的是同一件事;不同的只是字段名、方法名、数据的包装形状。就像同一份合同,一个用中文写、一个用英文写——内容相同,词不同。- Author:盛溪
- URL:https://tangly1024.com/article/SDK%20%E6%98%AF%E4%BB%80%E4%B9%88
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
Relate Posts



.jpg?table=block&id=26f7c1d5-a1e9-80d7-a52b-e71bb7079501&t=26f7c1d5-a1e9-80d7-a52b-e71bb7079501)



