17 points · by waldekm · 1y ago · 3 comments
import tiktoken enc = tiktoken.encoding_for_model('o1-mini') len(enc.encode('some string'))
Calculate the number of language model tokens for a string
Here
Waldek Mastykarz