{"repo":"AgentOps-AI/tokencost","free":true,"listed":false,"github":"https://github.com/AgentOps-AI/tokencost","clone":"git clone https://github.com/AgentOps-AI/tokencost.git","description":"Easy token price estimates for 400+ LLMs. TokenOps.","language":"Python","stars":2003,"topics":["analytics","claude","large-language-models","llm","observability","openai","price","price-tracker","token","tokenization"],"license":"MIT","category":"ai-agents","readme_excerpt":"Clientside token counting + price estimation for LLM apps and AI agents. 🐦 Twitter &nbsp;&nbsp;•&nbsp;&nbsp; 📢 Discord &nbsp;&nbsp;•&nbsp;&nbsp; 🖇️ AgentOps TokenCost Tokencost helps calculate the USD cost of using major Large Language Model (LLMs) APIs by calculating the estimated cost of prompts and completions. Building AI agents? Check out AgentOps Features LLM Price Tracking Major LLM providers frequently add new models and update pricing. This repo helps track the latest price changes Token counting Accurately count prompt tokens before sending OpenAI requests Easy integration Get the cost of a prompt or completion with a single function Example usage: Installation Recommended: PyPI: Usage Cost estimates Calculating the cost of prompts and completions from OpenAI requests Calculating cost using string prompts instead of messages: Counting tokens How tokens are counted Under the hood, strings and ChatML messages are tokenized using Tiktoken, OpenAI's official tokenizer. Tiktoken splits text into tokens (which can be parts of words or individual characters) and handles both raw strings and message formats with additional tokens for message formatting and roles. For Anthropic models above version 3 (i.e. Sonnet 3.5, Haiku 3.5, and Opus 3), we use the Anthropic beta token counting API to ensure accurate token counts. For older Claude models, we approximate using Tiktoken with the cl100k base encoding. Cost table Units denominated in USD. All prices can be located here. M","default_branch":null,"files":null,"tree":[],"storefront":"/r/AgentOps-AI","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/AgentOps-AI/tokencost/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}