chatgpt4o api流式输出如何计算消耗的tokens数量?
如何不是流式输出会输出总的消耗token数量,那么流式模式下呢?
这是非流式模式下输出tokens数量:
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "\n\nHello there, how may I assist you today?",
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}流式模式下api接口没有统计消耗的tokens{
"id":"chatcmpl76y3gsGmxYfioodOWIFgxxxxxV",
"object":"chat.completion.chunk",
"created":1681895111,
"model":"gpt-3.5-turbo-0301",
"choices":[
{
"delta":{"content":"xx""},
"index":0,
"finish_reason":null
}
]
}网友回复
如何让ai帮我自动在小红书或抖音上自动根据需求截流与潜在客户聊天拉客?
如果用go编写一个在virtualbox中启动的简单操作系统?
go如何搭建一个零信任网络?
如何用python实现一个公网代理访问软件?
如何用go实现一个公网代理访问软件?
如何用python实现一个内网穿透打洞程序,实现内网的80端口暴露到公网上可以访问?
如何用go实现一个内网穿透打洞程序,实现内网的80端口暴露到公网上可以访问?
何为Shadowsocks 代理?
python如何实现类似php的opendir目录相互隔离的fastcgi多租户虚拟空间?
nodejs如何实现类似php的opendir目录相互隔离的fastcgi多租户虚拟空间?


