使用 OpenAI Responses API
James Chapman
AI Curriculum Manager, DataCamp
response = client.responses.create(
model="gpt-5.4-mini",
input="What is recursion?",
)
response = client.responses.create(
model="gpt-5.4-mini",
input="What is recursion?",
)
| 模型 | 速度 | 成本 | 最适合 |
|---|---|---|---|
| gpt-5.4-mini | 快 | 低 | 简单任务、问答 |
| gpt-5.5 | 中等 | 较高 | 复杂推理 |
$$



response = client.responses.create( model="gpt-5.4-mini", input="Explain LLMs to a 6yr old.",reasoning={"effort": "none"})
response = client.responses.create(
model="gpt-5.4-mini",
input="Explain LLMs to a 6yr old.",
reasoning={"effort": "none"}
)
| 强度 | 最适合 |
|---|---|
| none | 琐碎或机械性任务。 |
| low | 以速度和成本为先的简单任务。 |
| medium | 默认:兼顾推理与效率。 |
| high | 复杂、多步或逻辑性强的任务。 |
| xhigh | 最艰难、逼近极限的任务。 |
response = client.responses.create( model="gpt-5.4-mini", input="Explain LLMs to a 6yr old.", reasoning={ "effort": "medium","summary": "auto"} )
response = client.responses.create( model="gpt-5.4-mini", input="Explain LLMs to a 6yr old.", reasoning={"effort": "none"},max_output_tokens=500)
max_output_tokens 也计入"推理词元"
使用 OpenAI Responses API