In Drupal 6, you use [`hook_token_values()`][1]. 

This hook will allow you to create tokens. You can create them in the global scope or you can use an object like a node, or a user to seed the values.

You should also use [`hook_token_list()`][2] to explain what your tokens are.

The [token.api][3] documentation is quite clear. 

    function my_user_token_values($type, $object = NULL, $options = array()) {
      if ($type == 'user') {
        $user = $object;
        $tokens['name']      = $user->name;
        $tokens['mail']      = $user->mail;
        return $tokens;
      }
    }

I won't X post the whole thing but that should give you a high level idea.


  [1]: http://api.lullabot.com/hook_token_values
  [2]: http://api.lullabot.com/hook_token_list
  [3]: http://api.lullabot.com/file/contrib/token/API.txt/6/source