[package]
name = "gproxy-tokenize"
version = "2.5.1"
edition = "2024"
authors = ["LeenHawk <leenhawk@leenhawk.com>"]
license = "MIT"
description = "Offline token counting for LLM request bodies: tiktoken, Hugging Face vocabularies, character estimate"
homepage = "https://gproxy.leenhawk.com"
repository = "https://github.com/LeenHawk/gproxy"
readme = "README.md"
keywords = ["llm", "tokenizer", "tiktoken", "tokens", "bpe"]
categories = ["text-processing", "api-bindings"]
[package.metadata.docs.rs]
features = ["count-local"]
[dependencies]
serde_json = "1"
anyhow = { version = "1", optional = true }
async-trait = { version = "0.1", optional = true }
bytes = { version = "1", optional = true }
dashmap = { version = "6", optional = true }
http = { version = "1", optional = true }
tiktoken-rs = { version = "0.12", optional = true }
tokenizers = { version = "0.23", optional = true, default-features = false, features = ["onig"] }
tokio = { version = "1", optional = true, features = ["rt"] }
tracing = { version = "0.1", optional = true }
[features]
default = []
tiktoken = ["dep:tiktoken-rs"]
hf-registry = [
"dep:anyhow",
"dep:async-trait",
"dep:bytes",
"dep:dashmap",
"dep:http",
"dep:tokenizers",
"dep:tokio",
"dep:tracing",
]
bundled-fallback = ["hf-registry"]
count-local = ["tiktoken", "hf-registry", "bundled-fallback"]
[dev-dependencies]
tokio = { version = "1", features = ["macros", "rt"] }