Utilities

AI Dev Kit provides utility functions for tokenization, token counting, and billing.

Available Utilities

Tokenization

Convert text to token IDs:

int[] tokens = await "Hello, world!"
    .Tokenize()
    .ExecuteAsync();

Debug.Log($"Token count: {tokens.Length}");

Token Counting

Count tokens without getting IDs:

int count = await "Long text content..."
    .CountTokens()
    .ExecuteAsync();

Debug.Log($"Tokens: {count}");

Credits / Billing

Check account credits:

Common Use Cases

Check Cost Before Request

Token Budget Management

Billing Monitor

Next Steps

Last updated