mirror of
https://github.com/AgentOps-AI/tokencost.git
synced 2024-06-22 04:30:40 +03:00
Update README.md
This commit is contained in:
44
README.md
44
README.md
@@ -1,52 +1,50 @@
|
||||
TokenCost
|
||||
# TokenCost
|
||||
|
||||
Overview
|
||||
## Overview
|
||||
|
||||
TokenCost is a specialized tool designed for calculating the token count and associated cost of strings and messages used in Large Language Models (LLMs). This utility is particularly useful for developers and researchers working with language models, enabling them to estimate the computational resources required for processing various inputs.
|
||||
|
||||
Features
|
||||
## Features
|
||||
|
||||
• Token Counting: Accurately counts the number of tokens in a given string or message.
|
||||
• Cost Calculation: Computes the cost of processing based on the token count, considering the specific pricing model of the LLM in use.
|
||||
• Support for Multiple LLMs: Compatible with various Large Language Models.
|
||||
• Easy Integration: Simple API for integrating with existing projects or workflows.
|
||||
- **Token Counting**: Accurately counts the number of tokens in a given string or message.
|
||||
- **Cost Calculation**: Computes the cost of processing based on the token count, considering the specific pricing model of the LLM in use.
|
||||
- **Support for Multiple LLMs**: Compatible with various Large Language Models.
|
||||
- **Easy Integration**: Simple API for integrating with existing projects or workflows.
|
||||
|
||||
Installation
|
||||
## Installation
|
||||
|
||||
To install TokenCost, use the following command:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/yourusername/tokencost.git
|
||||
cd tokencost
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
Usage
|
||||
|
||||
## Usage
|
||||
|
||||
To use TokenCost, follow these steps:
|
||||
|
||||
1. Import the module:
|
||||
1. Import the module:
|
||||
|
||||
```python
|
||||
from tokencost import TokenCalculator
|
||||
```
|
||||
|
||||
2. Initialize the calculator with your LLM’s specifics:
|
||||
|
||||
calculator = TokenCalculator(model_name='gpt-3')
|
||||
|
||||
3. Calculate tokens and cost:
|
||||
|
||||
3. Calculate tokens and cost:
|
||||
```python
|
||||
text = "Your sample text here"
|
||||
token_count, cost = calculator.calculate(text)
|
||||
print(f"Token Count: {token_count}, Cost: {cost}")
|
||||
```
|
||||
|
||||
Contributing
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions to TokenCost are welcome! Please refer to our Contribution Guidelines for more details.
|
||||
|
||||
License
|
||||
## License
|
||||
|
||||
TokenCost is released under the MIT License.
|
||||
|
||||
Contact
|
||||
|
||||
For any queries or suggestions, please open an issue in the GitHub repository, or contact us directly at email.
|
||||
|
||||
Remember to replace placeholders like yourusername, your_email@example.com, and other specifics with your actual repository and contact information. Also, ensure that the installation and usage instructions match the actual implementation of your tool.
|
||||
Reference in New Issue
Block a user