3 comments

[ 4.2 ms ] story [ 20.8 ms ] thread

  import tiktoken
  enc = tiktoken.encoding_for_model('o1-mini')
  len(enc.encode('some string'))
Does that work on anything other than openai?
No but most models have their own libs you can use