当前位置: 首页 > wzjs >正文

个人做论坛网站夸克作文网站

个人做论坛网站,夸克作文网站,小榄网站开发,网站设计跟网站开发区别文章目录 关于max_tokens参数max_tokens改max-completion-tokens?控制 OpenAI 模型响应的长度 关于max_tokens参数 大模型 API(比如 OpenAI、DeepSeek、Moonshot 等)都是按照“Token 数量”来计费。 控制内容:控制一次请求返回的…

文章目录

    • 关于max_tokens参数
    • max_tokens改max-completion-tokens?
    • 控制 OpenAI 模型响应的长度

关于max_tokens参数

大模型 API(比如 OpenAI、DeepSeek、Moonshot 等)都是按照“Token 数量”来计费。
控制内容:控制一次请求返回的“全部 token 数量”上限,包括提示(prompt)和生成的内容(completion)。
举例:你发送一个 100 tokens 的 prompt,max_tokens 设为 200,则最多会生成 100 tokens 的回答(100 prompt + 100 completion = 200)。

如果需要输出的内容超出Max_Tokens的最大值,那就需要做好可能被聊天大模型主动截断的准备。

一般,在多轮对话中,历史对话的输入输出都会作为新一轮的模型输入 token 进行计费。

Context Length(上下文长度):
定义:“context length”指的是模型在进行一次特定的推理时可以考虑的最大令牌数。换句话说,它是模型在生成响应之前可以“回顾”和“理解”的输入内容的长度。

作用:这个参数决定了模型能够记住和参考多少先前的信息。较长的上下文长度允许模型在生成响应时利用更多的历史信息。

OpenAI 官方解释更名是为了让参数含义更加清晰,max_completion_tokens 明确表示只限制“生成内容(completion)”部分,而不是输入(prompt)+输出(completion)的总token数,避免长期因 max_tokens 命名带来的困惑。过去,有用户常误解 max_tokens 的精确作用,导致不必要的Bug和支持请求。

max_tokens改max-completion-tokens?

openapi开发者官方论坛:https://community.openai.com/t/why-was-max-tokens-changed-to-max-completion-tokens/938077/1

We are doing this because max_tokens previously meant both the number of tokens we generated (and billed you for) and the number of tokens you got back in your response. With the o1 models, this is no longer true — we generate more tokens than we return, as reasoning tokens are not visible. Some clients may have depended on the previous behavior and written code that assumes that max_tokens equals usage.completion_tokens or the number of tokens they received. To avoid breaking these clients, we are requiring you opt-in to the new behavior by using a new parameter.
我们这样做是因为 max_tokens 之前既表示我们生成的 tokens 数量(以及您为此支付的费用),也表示您在响应中收到的 tokens 数量。对于 o1 模型,情况已不再如此——我们生成的 tokens 比返回的 tokens 多,因为推理 tokens 是不可见的。某些客户端可能依赖于之前的行为,并编写了假设 max_tokens 等于 usage.completion_tokens 或他们收到的 tokens 数量的代码。为了避免破坏这些客户端,我们要求您通过使用一个新参数来选择启用新行为。

More documentation here: https://platform.openai.com/docs/guides/reasoning/controlling-costs
更多信息请参考: https://platform.openai.com/docs/guides/reasoning/controlling-costs

兼容性影响
讨论区用户认为,仅仅为了术语准确就引入breaking change,确实带来定制代码或第三方工具的兼容问题,特别是自动化构建和API适配方面。
但OpenAI表示如此改动是为了长远的API直观性、预期一致性和文档优化。

token限制机制
技术讨论还涉及token配额的计数方式,OpenAI进一步clarify:模型的实际生成token不会超过指定的max_completion_tokens数量。输入太长时会提示报错而不是截断生成。

控制 OpenAI 模型响应的长度

官网文档:https://help.openai.com/en/articles/5072518-controlling-the-length-of-openai-model-responses

You can control the length of a model’s output using several techniques depending on your goals and the model you’re working with.
您可以使用多种技术来控制模型输出的长度,具体取决于您的目标和您正在使用的模型。

Set a Maximum Token Limit
设置最大令牌限制
Use the max_completion_tokens parameter to limit how many tokens the model will generate.
使用 max_completion_tokens 参数来限制模型将生成的令牌数量。

Playground: This is labeled as “Maximum Length”.
Playground:标记为 “Maximum Length”。

API: 应用程序接口 :

For reasoning models like o3, o4-mini, and gpt-4.1, use max_completion_tokens.
对于 o3、o4-mini 和 gpt-4.1 等推理模型 ,请使用 max_completion_tokens

For earlier models, max_tokens still works and behaves the same as before.
对于早期的模型 ,max_tokens 的工作方式和行为与以前相同。

Important: 重要 :
max_tokens is deprecated for newer reasoning models.
max_tokens 对于较新的推理模型已弃用 。

You can review the model reference page for the token behavior of specific models.
您可以查看模型参考页面 ,了解特定模型的令牌行为。


文章转载自:

http://d0VZ9KsE.pyjLb.cn
http://iVIjaN0u.pyjLb.cn
http://qvpN9sZv.pyjLb.cn
http://J80kmxhP.pyjLb.cn
http://HQor60j0.pyjLb.cn
http://G2WDayz2.pyjLb.cn
http://TDUvMMKS.pyjLb.cn
http://3B3S0ALT.pyjLb.cn
http://wTteD5E3.pyjLb.cn
http://tjgZgSKT.pyjLb.cn
http://jKcJtMi7.pyjLb.cn
http://VtwEoB8e.pyjLb.cn
http://Yb08HQAg.pyjLb.cn
http://zcE82jii.pyjLb.cn
http://xiY45MuF.pyjLb.cn
http://dfNJjMKy.pyjLb.cn
http://NItJ8DKn.pyjLb.cn
http://KPzERMul.pyjLb.cn
http://Th1ZrowZ.pyjLb.cn
http://SA8A21NB.pyjLb.cn
http://KPS8ljEg.pyjLb.cn
http://RmVamyHb.pyjLb.cn
http://XSZqPTys.pyjLb.cn
http://d6HZMwfW.pyjLb.cn
http://B6Tdv8j7.pyjLb.cn
http://lxF6Q9kl.pyjLb.cn
http://xebLMwce.pyjLb.cn
http://h1JvZrxC.pyjLb.cn
http://bEXvOIlz.pyjLb.cn
http://6F0x4ZAF.pyjLb.cn
http://www.dtcms.com/wzjs/729661.html

相关文章:

  • 手机网站建设软件有哪些山东东营市地图
  • 温州网站建设选择乐云seo标识标牌制作设计
  • 开发php网站建设网站建设与管理教材
  • 成都网站开发外包公司如何用Python网站开发
  • 怎样建设网站优化网站关键词优化代理
  • 男女这样做那个网站wordpress中接入支付宝
  • 申请免费网站哪个好手机如何开发软件
  • 中国做网站找谁网页设计免费网站推荐
  • 健康网站模版长沙建设网站公司
  • 杭州市下城区建设局门户网站罗湖住房和建设局网站官网
  • 怎么做网站的搜索引擎做网站维护有没有前途
  • 沅江市住房和建设局网站宁海网站建设
  • 网站漂浮特效怎么做论坛网站前置审批
  • 手机免费永久建立网站网站制作公司多少钱一年
  • 网站视频管理系统机构改革网站建设
  • 如何建国际商城网站电商分销主要做什么
  • 运营网站挣钱方法南昌高端网站制作
  • 爱淘宝网页网站建设电子商务是最差的专业吗
  • wix网站做seo如何网页站点的用途
  • 大型网站开发像天猫类的写过太原的网站
  • 网站开发Z亿玛酷1订制网站建设工作目标
  • 网站建设职业发展前景山西网站建设 哪家好
  • idea 做网站登录微信公众平台设计
  • 网页设计作品网站北京seo推广优化
  • 佛山做网站业务工资wordpress linux位置
  • 做空闲时间的网站外贸开发模板网站模板
  • 汽车保险网站网站psd模版
  • 网站推广具体内容简要说明腾讯云网站免费建设
  • 做网站需要什么硬件公共资源交易中心网站建设汇报
  • 池州做网站公司湖北网站设计流程