Skip to content

Unofficial bindings / ports in other languages #97

Open

Description

@hauntsaninja

The following projects are not maintained by OpenAI. I cannot vouch that any of them are correct or safe to use. Use at your own risk.

Note that if a tokeniser fails to exactly match tiktoken's behaviour, you may get worse results when sampling from models, with no warning.

Javascript

Rust

Java

Ruby

C#

Go

PHP

Kotlin

Thanks to everyone for building useful things!

I'm happy to link to other projects in this comment.

Activity

  1. changed the title [-]Unofficial bindings in other languages[/-] [+]Unofficial bindings / ports in other languages[/+] on Apr 5, 2023
  2. pinned this issue on Apr 5, 2023
  3. bluescreen10 commented on Apr 6, 2023

    @bluescreen10

    👋,

    I built a port for go that you can find in the link below

    https://github.com/tiktoken-go/tokenizer

  4. fang2hou commented on Apr 9, 2023

    @fang2hou

    I am currently using a another port in Go.
    https://github.com/pkoukk/tiktoken-go

  5. rex-remind101 commented on May 13, 2023

    @rex-remind101

    Hello @hauntsaninja , I was looking at https://github.com/openai/tiktoken/blob/main/src/lib.rs and it appears to be written in Rust. Could this be open sourced into a crate of its own?

  6. hauntsaninja commented on May 13, 2023

    @hauntsaninja
    CollaboratorAuthor

    See the FAQ #98

  7. danielcompton commented on May 15, 2023

    @danielcompton

    @hauntsaninja would it be possible to publish the full test suite publicly? That would make it easier to tell whether a given implementation matches (or is close to) the official implementation.

  8. niieani commented on Jun 1, 2023

    @niieani

    Here's a pure JavaScript / TypeScript port of tiktoken: https://github.com/niieani/gpt-tokenizer
    Playground online: https://gpt-tokenizer.dev

  9. ShylockWu commented on Sep 4, 2023

    @ShylockWu
  10. niieani commented on Sep 5, 2023

    @niieani

    @ShylockWu they're not incorrect. You've set gpt-tokenizer to tokenize using GPT-3.5/GPT-4 encoding, whereas the official openAI token calculator uses the older GPT-3. If you switch the playground to use the older model, you'll get the same result.

  11. danny50610 commented on Sep 11, 2023

    @danny50610

    👋

    I ported a version of PHP, link here

    https://github.com/danny50610/bpe-tokeniser

  12. aallam commented on Oct 11, 2023

    @aallam

    I have built and published a port for Kotlin: https://github.com/aallam/ktoken :)

  13. Gabriella439 commented on Aug 31, 2024

    @Gabriella439

    Pure Haskell implementation of tiktoken: https://hackage.haskell.org/package/tiktoken

  14. riyas686 commented on Sep 17, 2026

    @riyas686
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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