Expand description
WebAssembly bindings for the tiktoken BPE tokenizer.
Provides browser-compatible wrappers around the core tiktoken crate,
enabling high-performance token encoding, decoding, counting, and
cost estimation directly in JavaScript/TypeScript applications.
All encoding instances are cached globally via OnceLock, so repeated
calls to getEncoding() with the same name return the same underlying data.
Structs§
Functions§
- all_
models - List all supported models with pricing info.
- encoding_
for_ model - Get an encoding for a model name (e.g.
"gpt-4o","o3-mini","llama-4","deepseek-r1"). - estimate_
cost - Estimate cost in USD for a given model, input token count, and output token count.
- get_
encoding - Get an encoding by name.
- get_
model_ info - Get model pricing and metadata.
- list_
encodings - List all available encoding names.
- model_
to_ encoding - Map a model name to its encoding name without loading the encoding.
- models_
by_ provider - List models filtered by provider name.