Skip to content

Feature Request: Integrate Token Usage Cost Calculation Based on OpenAI's Pricing #375

@prdai

Description

@prdai

Hello,

Token Usage Cost Calculation:
I would like to request the addition of a feature that calculates the cost of token usage based on OpenAI's current pricing. This feature would allow developers to estimate the cost directly while using Tiktoken for tokenization.

Real-Time Pricing API:
While I understand that real-time pricing information was discussed in a separate issue (openai/openai-python#2074), I believe it would be valuable to integrate this information into Tiktoken as soon as OpenAI provides an official API for retrieving current pricing.

Benefits:

  • Cost Management: Helps developers manage their budget by providing instant token usage cost estimation.
  • Optimization: Guides developers in optimizing token usage to avoid unnecessary costs.
  • Convenience: Provides a seamless experience by consolidating tokenization and cost calculation in one place.

Thank you for considering this suggestion, and I look forward to any potential discussions!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions