最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How do I convert Firebase Vertex AI's totalTokens and totalBillableTokens into monetary cost? - Stack Overflow

programmeradmin5浏览0评论

I'm using Vertex AI's generative model API, and after a request it returns two fields: totalTokens and totalBillableCharacters. According to the Gemini Flash 2.0 Lite pricing page, input tokens cost $0.075 per 1M tokens and output text tokens cost $0.30 per 1M tokens.

However, I'm confused about the relationship between these four terms:

  • totalTokens
  • totalBillableCharacters (because I send an image as base64 string for analysis)
  • Input tokens
  • Output text tokens

Specifically:

  1. How do totalTokens and totalBillableCharacters relate to input tokens and output text tokens?
  2. Given the pricing, how can I calculate the total monetary cost for a request if I only have the API's totalTokens and totalBillableCharacters?

For example, if my API call returns a combined token count, how can I determine the number of input tokens versus output tokens, and then apply the pricing rates to compute the cost?

Any guidance or code examples for converting these token counts to a dollar amount would be appreciated.

发布评论

评论列表(0)

  1. 暂无评论