gpt4 book ai didi

openai-api - 获取当前余额 $$/代币的 API

转载 作者:行者123 更新时间:2023-12-02 05:47:14 24 4
gpt4 key购买 nike

如何使用 API 获取屏幕截图中显示的当前余额?我浏览了 OpenAI 网站上的每一页,找不到任何相关内容。

openai account page screenshot

最佳答案

您的 token 状态通过每个响应传递。


来自 OpenAI API 常见问题解答:

How do I check my token usage? [link]

  1. Usage dashboard
    ...

  2. Usage data from the API response

    You can also access token usage data through the API. Token usage information is now included in responses from completions, edits, and embeddings endpoints. Information on prompt and completion tokens is contained in the "usage" key:


因此,示例响应可能包含以下 usage 键:

"usage": {
"prompt_tokens":5,
"completion_tokens":5,
"total_tokens":10
}

关于openai-api - 获取当前余额 $$/代币的 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75703189/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com