{"id":28320855,"url":"https://github.com/bzp2010/lua-tiktoken","last_synced_at":"2026-05-04T22:43:44.782Z","repository":{"id":213530956,"uuid":"734302951","full_name":"bzp2010/lua-tiktoken","owner":"bzp2010","description":"OpenAI tiktoken for Lua","archived":false,"fork":false,"pushed_at":"2024-06-08T16:12:49.000Z","size":7,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-04T22:43:24.256Z","etag":null,"topics":["lua","openai","rust","tokenizer"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bzp2010.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-12-21T10:54:42.000Z","updated_at":"2025-01-02T07:41:00.000Z","dependencies_parsed_at":"2023-12-21T15:40:36.721Z","dependency_job_id":"361a53fc-7cfe-4100-8f07-35d484da07ca","html_url":"https://github.com/bzp2010/lua-tiktoken","commit_stats":null,"previous_names":["bzp2010/lua-tiktoken"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bzp2010/lua-tiktoken","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bzp2010%2Flua-tiktoken","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bzp2010%2Flua-tiktoken/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bzp2010%2Flua-tiktoken/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bzp2010%2Flua-tiktoken/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bzp2010","download_url":"https://codeload.github.com/bzp2010/lua-tiktoken/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bzp2010%2Flua-tiktoken/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32628211,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lua","openai","rust","tokenizer"],"created_at":"2025-05-25T12:12:38.223Z","updated_at":"2026-05-04T22:43:44.776Z","avatar_url":"https://github.com/bzp2010.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenAI tiktoken for Lua\n\nThe `tiktoken-rs` is a rust library for tokenizing text with OpenAI models using tiktoken.\n\nThis project provides `tiktoken-rs` bindings on the Lua, which enables out-of-the-box text tokenization for AI-related projects such as Apache APISIX.\n\n## Installation\n\nThe preferred way to install this library is to use Luarocks:\n\n```shell\nluarocks install https://github.com/bzp2010/lua-tiktoken/raw/main/rockspec/lua-tiktoken-main-0.rockspec\n\n```\n\n## Synopsis\n\n```lua\nlocal tiktoken = require(\"tiktoken\")\nlocal models = tiktoken.models()   -- {\"r50k_base\", \"p50k_base\", \"p50k_edit\", \"cl100k_base\"}\nlocal count = tiktoken.count(\"cl100k_base\", \"Here is a message\")\n```\n\n## Modules\n\n### tiktoken\n\nTo load this module:\n\n```lua\nlocal tiktoken = require(\"tiktoken\")\n```\n\n#### models\n\n**syntax:** *models = tiktoken.models()*\n\nIt returns a string table containing all the tokenizer models.\n\n#### count\n\n**syntax:** *count = tiktoken.count(model_name, text)*\n\n`model_name` is the tokenizer model to be used, and it should be one of the tables returned by `models()`.\n\n`message` is the text to be tokenized.\n\nIt returns the number of tokens.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbzp2010%2Flua-tiktoken","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbzp2010%2Flua-tiktoken","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbzp2010%2Flua-tiktoken/lists"}