coze-dev / coze-py

The Python SDK for the Coze API
https://pypi.org/project/cozepy/
MIT License
88 stars 13 forks source link

Retrieve the tokens spent on the request. #81

Closed MSITETOP closed 1 month ago

MSITETOP commented 1 month ago

I couldn't retrieve the tokens spent on the request. How can I obtain this information in the SDK?

chyroc commented 1 month ago

there are four oauth auth examples in examples folder,are you finding it?

MSITETOP commented 1 month ago

Yes, of course. But I don't understand how this relates to my question? I need to obtain the number of spent coze tokens in the conversation using the method coze.chat.create_and_poll(), for example. Previously, I received this in the "conversation.chat.completed" event with data['usage']['token_count']. I couldn't find similar data in the SDK.

chyroc commented 1 month ago

fixed by https://github.com/coze-dev/coze-py/pull/82

MSITETOP commented 1 month ago

it's amaising