tokenpal


Nametokenpal JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryYour friendly token counting pal for OpenAI, Anthropic, and Google LLM models. Simple, accurate, fast.
upload_time2025-08-27 03:44:00
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords tokens tokenizer openai anthropic google llm chatgpt gpt claude gemini ai machine-learning nlp
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # token-count

A simple, practical Python package for counting tokens across OpenAI, Anthropic, and Google (Gemini) models using their official tokenizers and APIs.

## Features

- **OpenAI**: Local, offline token counting via `tiktoken` (official tokenizer)
- **Anthropic**: Official `messages.count_tokens` API
- **Google (Gemini)**: Official `models.countTokens` via `google-genai` SDK
- Provider-agnostic message format
- Robust model name handling with fallbacks
- Optional dependencies for each provider

## Installation

```bash
# Basic installation (OpenAI support only)
pip install token-count

# With Anthropic support
pip install 'token-count[anthropic]'

# With Google support  
pip install 'token-count[google]'

# With all providers
pip install 'token-count[anthropic,google]'

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tokenpal",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "tokens, tokenizer, openai, anthropic, google, llm, chatgpt, gpt, claude, gemini, ai, machine-learning, nlp",
    "author": null,
    "author_email": "TokenPal Team <contact@tokenpal.dev>",
    "download_url": "https://files.pythonhosted.org/packages/4c/57/fc9ffdaf98ebc5b26e9320e72d0fabf2997cf8a60eb0861daca645b45ec0/tokenpal-0.1.0.tar.gz",
    "platform": null,
    "description": "# token-count\n\nA simple, practical Python package for counting tokens across OpenAI, Anthropic, and Google (Gemini) models using their official tokenizers and APIs.\n\n## Features\n\n- **OpenAI**: Local, offline token counting via `tiktoken` (official tokenizer)\n- **Anthropic**: Official `messages.count_tokens` API\n- **Google (Gemini)**: Official `models.countTokens` via `google-genai` SDK\n- Provider-agnostic message format\n- Robust model name handling with fallbacks\n- Optional dependencies for each provider\n\n## Installation\n\n```bash\n# Basic installation (OpenAI support only)\npip install token-count\n\n# With Anthropic support\npip install 'token-count[anthropic]'\n\n# With Google support  \npip install 'token-count[google]'\n\n# With all providers\npip install 'token-count[anthropic,google]'\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Your friendly token counting pal for OpenAI, Anthropic, and Google LLM models. Simple, accurate, fast.",
    "version": "0.1.0",
    "project_urls": {
        "Bug Reports": "https://github.com/tokenpal/tokenpal/issues",
        "Documentation": "https://github.com/tokenpal/tokenpal#readme",
        "Homepage": "https://github.com/tokenpal/tokenpal",
        "Repository": "https://github.com/tokenpal/tokenpal"
    },
    "split_keywords": [
        "tokens",
        " tokenizer",
        " openai",
        " anthropic",
        " google",
        " llm",
        " chatgpt",
        " gpt",
        " claude",
        " gemini",
        " ai",
        " machine-learning",
        " nlp"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "79333b6bae36ddc6f841ca2a878360db68879ca0891a29e031d5246fb81f0085",
                "md5": "6ab2bd0707aa6702981aeb6e20ca83fd",
                "sha256": "b445352706d30524a21df38a1785803a90a3b98a7ca171d9019603b605a72cde"
            },
            "downloads": -1,
            "filename": "tokenpal-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6ab2bd0707aa6702981aeb6e20ca83fd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 5602,
            "upload_time": "2025-08-27T03:43:58",
            "upload_time_iso_8601": "2025-08-27T03:43:58.713058Z",
            "url": "https://files.pythonhosted.org/packages/79/33/3b6bae36ddc6f841ca2a878360db68879ca0891a29e031d5246fb81f0085/tokenpal-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4c57fc9ffdaf98ebc5b26e9320e72d0fabf2997cf8a60eb0861daca645b45ec0",
                "md5": "1febfc32680a701078570f72a70214f5",
                "sha256": "4a3beabcec232ebb6b1ab22b322b92dba0768bb8ffc4c5b001ca87df1f4785b0"
            },
            "downloads": -1,
            "filename": "tokenpal-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1febfc32680a701078570f72a70214f5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 5714,
            "upload_time": "2025-08-27T03:44:00",
            "upload_time_iso_8601": "2025-08-27T03:44:00.043781Z",
            "url": "https://files.pythonhosted.org/packages/4c/57/fc9ffdaf98ebc5b26e9320e72d0fabf2997cf8a60eb0861daca645b45ec0/tokenpal-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-27 03:44:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tokenpal",
    "github_project": "tokenpal",
    "github_not_found": true,
    "lcname": "tokenpal"
}
        
Elapsed time: 0.50640s