使用 GPT-6.2

约 22 分钟读完
目录 9 节
  1. 新变化
  2. 提示词最佳实践
  3. GPT-6.2 Astra 的行为特点
  4. 写作风格
  5. 任务完成
  6. 代码风格
  7. 前端设计
  8. 迁移快速入门
  9. 更新 API 与模型参数

使用 GPT-6.2 Astra 处理要求最高的任务;或使用 GPT-6.2 Sol,以更低的成本完成复杂工作。

新变化

  • 前缀编辑(prefix edits)。从 GPT-6.2 开始,出现以下情况时,Responses API 会丢弃推理项(reasoning items):在对话中途修改对话历史(即前缀编辑)、进行某些模型变更(包括降级),或者更换终端用户或组织。模型一旦无法访问推理项,回答质量可能下降,而且可能消耗更多 token 来重复之前做过的工作。请检查你的集成,找出这类修改,例如改动了更早的 developer 消息或工具调用。如果要在两次响应之间调整设置,又想保留推理内容、让之前的输入继续享受提示词缓存,请保持前缀不变。
  • Responses API 中 instructions 字段的变化。从 GPT-6.2 开始,模型会把顶层的 instructions 追加到 input 之后。若希望可复用的指令能被提示词缓存命中,请把它们放进 input 第一项的 developer 消息里。顶层 instructions 只用于仅对当前请求生效的开发者指引。详见前缀匹配的工作原理。
  • 后台模式(公开测试版)。对于耗时较长的 Responses API 请求,可以在后台模式下使用折扣完成窗口,作为 Flex 处理的替代方案。后台模式请求支持在 Standard 处理档位下选择 2 小时或 8 小时的完成窗口。GPT-6.2 Astra 和 Sol 不支持 Flex 处理(service_tier: flex)。

提示词最佳实践

以下提示词可以作为整个 GPT-6.2 模型系列的起点。这些示例针对的是我们在使用 GPT-6.2 Astra 和 Sol 时观察到的行为。如果你在自己的应用中也发现了类似情况,可以试试对应章节的提示词。

GPT-6.2 Astra 的行为特点

  • 写作风格:模型默认的文风更简洁、更直接。迁移时,请重新审视系统提示词里类似“请简洁”的指令。
  • 任务完成:当用户意图不明确时,模型可能会提出下一步建议,然后等待确认。对于较长的任务,请给它空间,让它做出合理假设并继续推进。
  • 代码风格:模型写出的代码往往比前代更高效、质量更高。请说明会影响它编写或修改代码的项目约定。
  • 前端设计:如果界面需要特定的外观,请指定它应使用的图片和字体排版。

写作风格

GPT-6.2 Astra 默认比早期模型更简洁、更直接。它的语气可以根据应用场景调整,从专业的同事到更口语化的助手都可以。

如果你想把模型当作日常工作中的协作者和思考伙伴,可以使用下面的提示词:

Write using terminology the user and sources use. Keep technical details and use domain-specific language when they make the explanation more precise. Use the active voice and keep closely related details together. Cover the key points up front, and avoid references that the reader can only make sense of later in the response. Give the user enough context to follow your reasoning.

译文:使用用户和资料来源所用的术语。当技术细节和领域术语能让解释更精确时,予以保留。使用主动语态,把密切相关的细节放在一起。先讲关键要点,避免使用读者要读到后文才能理解的指代。给用户足够的背景,让他们能跟上你的推理。

让模型根据目标读者调整写法,例如撰写文档、邮件、消息和对外发布的内容:

When drafting a message or any other material on behalf of the user to be sent to an external audience, consider who will read it and tailor the content to that intended audience. The intended audience likely does not have the same context as the user, so ensure that you provide the background information or reasoning required for the audience to understand the content. When reviewing or editing existing content, preserve the author’s content and wording, and follow the user's instruction carefully for what edits they want.

译文:代表用户起草要发给外部读者的消息或其他材料时,要考虑谁会读它,并针对目标读者调整内容。目标读者很可能不具备用户所掌握的背景,因此要提供他们理解内容所需的背景信息或推理过程。审阅或编辑已有内容时,保留作者的内容和措辞,并严格按照用户指示的修改要求进行编辑。

在较长的任务中,模型可能会把推理过程或其他 Agent 产生的简写带进最终答案。请提醒它写出一份自成一体的回复,让没有跟进过程更新的人也能看懂:

Treat your final answer as the user's first look at your work, and not as a continuation of intermediate commentary. The final answer must always be fully self-contained: users should never need to read earlier commentary updates for context, since they are collapsed when the final answer is shown to the user.

Write the final answer and all other human-facing material anew for the intended reader. Do not copy or closely paraphrase your reasoning or adopt its writing style. Do not carry over working shorthand, jargon, or abbreviations from your reasoning, tool calls, or instructions to subagents and automations.

译文:把最终答案当作用户第一次看到你的工作成果,而不是中间评论的延续。最终答案必须始终完全自成一体:用户永远不需要回看之前的过程更新来理解上下文,因为展示最终答案时,那些更新会被折叠起来。

为目标读者重新撰写最终答案以及其他所有面向人的材料。不要照搬或近似改写你的推理内容,也不要沿用它的写作风格。不要把推理、工具调用,或给子 Agent 和自动化流程的指令中的工作简写、行话或缩写带过来。

任务完成

对于无需监督也能推进的工作,请明确模型应完成的结果,以及哪些决定需要用户参与。

Avoid stopping to end the turn while the task is incomplete or if there is an authorized next step you can take, and instead take the next steps within task scope to progress the user's request. If your final response before ending the turn is a suggested next step, a plan, a request to the user for a routine decision, instructions for a task to execute, or similar handoff to the user, take these steps yourself to make progress towards what the user asked for. Make sure that you have authorization to do so, and flag any assumptions or decisions you maketo the user.

Only stop to clarify with the user if there is significant change in task scope, you are concretely blocked, have a decision that the user needs to resolve, or before irreversible or destructive actions.

译文:任务尚未完成,或者还有已获授权的下一步可以执行时,不要停下来结束本轮,而应在任务范围内继续执行下一步,推进用户的请求。如果你在结束本轮前的最终回复是建议的下一步、一份计划、请用户做一个常规决定、要执行的任务说明,或类似的交还给用户的内容,那就自己执行这些步骤,朝用户的要求推进。确保你有权这样做,并向用户标明你所做的任何假设或决定。

只有在任务范围发生重大变化、确实被卡住、有需要用户定夺的决定,或者在执行不可逆、破坏性操作之前,才停下来向用户确认。

注:原文提示词中的 “maketo” 为官方原文拼写(应为 “make to”),此处保留原样。

请让模型核实它已完成所要求的工作。在复杂或长时间运行的任务中,更高的推理强度有助于它坚持完成最后的检查。在 Responses API 中,用 reasoning.effort 设置级别。参见:推理强度

Bias towards action, and persist until you've completed the task the user asked for. Avoid stopping to end the turn while the task is incomplete or if there is an authorized next step you can take, and instead take the next steps within task scope to progress the user's request. Make sure that you have accounted for every part of the user's request, and persist until you've delivered a result that fully satisfies the user's goal. If a task requires sustained work, do all the necessary work until the intended outcome is completely fulfilled.

Progress autonomously towards the user's goal (e.g. creating isolated worktrees / checkouts if needed, resolving merge conflicts, creating draft PRs etc) unless they are clearly destructive or irreversible. Before ending a turn or calling your work complete, check that your work fully satisfies what the user asked for. If any steps remain or any part of the result still needs verification, follow through on this work before finishing.

译文:倾向于行动,坚持到完成用户要求的任务为止。任务尚未完成,或者还有已获授权的下一步可以执行时,不要停下来结束本轮,而应在任务范围内继续执行下一步,推进用户的请求。确保照顾到用户请求的每一部分,坚持到交付一个完全满足用户目标的结果。如果任务需要持续投入,就完成所有必要的工作,直到预期结果完全实现。

自主地朝用户目标推进(例如在需要时创建隔离的 worktree / checkout、解决合并冲突、创建 PR 草稿等),除非这些操作明显具有破坏性或不可逆。在结束本轮或宣布工作完成之前,检查你的工作是否完全满足用户的要求。如果还有剩余步骤,或者结果中仍有部分需要验证,请在结束前把这些工作做完。

当某个细节不明确时,请给模型空间,让它说明自己的假设,然后继续执行任务:

Make reasonable, reversible assumptions to carry work forward and state them if it progresses the task within scope. Do not second guess yourself, stop after describing what you could do, offer to do the work, or provide a partial answer unless there is no way you can proceed.

译文:做出合理、可逆的假设来推进工作;如果这能在范围内推进任务,就把假设说明出来。除非确实无法继续,否则不要反复自我怀疑,不要描述完自己能做什么就停下,不要只是提议去做,也不要只给出部分答案。

如果你的应用中有 request_user_input_async 这类异步工具,GPT-6.2 可以一边向用户请求澄清,一边继续推进不依赖该答案的工作。参见:添加异步提问工具

代码风格

请描述代码库的约定,以及现有调用方所依赖的行为。例如,说明何时应复用已有逻辑、改动范围应控制得多窄,以及何时应为现有测试集未覆盖的行为添加测试。

Above all, be thorough in producing high-quality, correct code that completely fulfills the user's task. Keep the code easy to read and verify that the user-requested outcome works as they intend. Follow these instructions when coding:

(a) Reuse existing logic in the user's repo when you can. You should reuse existing classes, methods, representations, and APIs in the codebase as long as they preserve correctness. Before consolidating or removing code, preserve the behavior its callers rely on unless the task requires changing it.
(b) Skip new tests unless requested, required by the repo, or needed to catch a specific regression existing tests would miss.
(c) Make sure that code is human readable. Do not use fewer lines, shorter variable names, minified formatting, or dense one-liners as substitutes for simplicity. Ensure that comments and variable names are readable and understandable to a human. Code-golfed expressions count as overly complex when they encode many branches, conditions, or hidden assumptions.
(d) Avoid unnecessary indirection and abstraction. Helper functions, utility functions, and class abstractions can add cognitive complexity even when they do not add branches.

译文:最重要的是,要认真细致地写出高质量、正确、能完整实现用户任务的代码。保持代码易读,并验证用户要求的结果确实按他们的预期工作。编写代码时遵循以下要求:

(a) 尽可能复用用户仓库中已有的逻辑。只要能保证正确性,就应复用代码库中已有的类、方法、数据表示和 API。在合并或删除代码之前,保留其调用方依赖的行为,除非任务要求改变它。

(b) 不要新增测试,除非用户要求、仓库规定,或者需要用它捕捉现有测试会漏掉的某个具体回归问题。

(c) 确保代码便于人阅读。不要用更少的行数、更短的变量名、压缩格式或密集的单行写法来冒充简洁。确保注释和变量名能被人读懂。如果“代码高尔夫”式的表达式里塞进了大量分支、条件或隐含假设,就算是过度复杂。

(d) 避免不必要的间接层和抽象。辅助函数、工具函数和类抽象即使没有增加分支,也可能增加理解负担。

前端设计

如果应用依赖某种特定的视觉风格,请在提示词中描述清楚。说明它应使用哪类图片、遵循怎样的字体排版,必要时指定具体字体。界面文案应聚焦于用户需要知道或需要做的事。

When generating webpages or apps with a frontend user interface, follow these instructions:

- When choosing visuals, generally prefer realistic images from ImageGen or image search that suit the project's style and purpose. Use SVGs when the user specifically asks for them.
- Include a text element only when it provides information the user needs, helps them navigate or act, or fulfills an explicit content request. Remove decorative numbering, filler badges, redundant headings, and explanatory copy that merely restates what the surrounding interface already makes clear, while preserving necessary labels, instructions, and status feedback.

译文:生成带前端用户界面的网页或应用时,遵循以下要求:

  • 选择视觉素材时,一般优先使用来自 ImageGen 或图片搜索、符合项目风格和用途的写实图片。只有用户明确要求时,才使用 SVG。
  • 只有当文字元素能提供用户需要的信息、帮助用户导航或操作,或者满足明确的内容要求时,才加入它。去掉装饰性编号、凑数的徽标、多余的标题,以及仅仅重复周围界面已经表达清楚的说明文案;同时保留必要的标签、操作说明和状态反馈。

对于视觉类工作,可以分享一张来自设计软件的参考图,或者给 GPT-6.2 开放图像生成工具,让它用 GPT Image 生成一张。参考图能为提示词补充那些难以用文字描述的细节。等参考图达到你想要的效果后,再让模型构建素材、渲染出来,并对照参考图不断打磨。

迁移快速入门

如果要借助编程 Agent 把 API 应用迁移到 GPT-6.2 Astra,请使用 OpenAI Docs skill。

更新 API 与模型参数

把 model 设为 gpt-6.2-astra 或 gpt-6.2-sol,然后检查以下各项:

  • 推理强度:新集成建议从 medium 开始。如果你当前使用的是 none 或 minimal,请改用 low。在 Responses 中使用 reasoning.effort,在 Chat Completions 中使用 reasoning_effort。
  • 工具调用:请使用 Responses API。GPT-6.2 Astra 和 GPT-6.2 Sol 支持 Chat Completions,但工具调用必须使用 Responses。
  • 不支持的参数:迁移 Chat Completions 请求时,去掉 temperature、top_p、logprobs 和 top_logprobs。迁移 Responses 请求时,去掉 temperature、top_p 和 top_logprobs,并从 include 中移除 message.output_text.logprobs。
  • 提示词缓存:把稳定的指令从顶层 instructions 参数移到 input 开头的 developer 消息中,使其可以被缓存。从 GPT-5.5 或更早的模型迁移时,把 prompt_cache_retention 换成 prompt_cache_options.ttl,并设为 "30m"。请查看提示词缓存的变化,包括缓存边界和缓存写入计费。
  • 零数据保留(ZDR):GPT-6.2 Astra 和 Sol 在符合条件的端点和功能上,为获批组织支持零数据保留(Zero Data Retention,ZDR)。启用 ZDR 后,Responses API 会把 store 视为 false。进行多轮对话时,请按顺序把之前的输出项回传,其中包括加密的推理项。资格条件和各端点的行为,参见零数据保留。
  • 服务档位与地区:两个模型都支持美国和欧盟的数据驻留,并支持 Standard、Fast 和 Batch 处理。Ultrafast 只支持美国数据驻留。参见数据驻留和价格。