Registry / ai-ml / infini-gram

infini-gram

JSON →
library2.6.0pypypiunverified

A Python package for querying and analyzing the Infini-gram dataset, which provides n-gram statistics over a massive web corpus. Version 2.6.0 supports Python >=3.11 and offers tools for tokenization, n-gram counting, and corpus insights. Active development, with updates targeting performance improvements.

pip install infini-gram
INSTALL
IMPORT
SIG · INFINI-GRAM
I
infini-gram
ai-mlpythonv2.6.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

InfiniteGram
from infini_gram import InfiniteGram
from infinigram import InfiniteGram

Initialize InfiniteGram with an API token and query n-gram counts.

import os from infinigram import InfiniteGram # Get API key from environment variable api_key = os.environ.get('INFINIGRAM_TOKEN', '') if not api_key: raise ValueError('Please set INFINIGRAM_TOKEN environment variable.') # Initialize with token inf = InfiniteGram(token=api_key, model='v4') # Query n-gram frequency result = inf.ngrams(['hello', 'world']) print(result)
Debug
Known issues
breakingIn version 2.0+, the package was renamed from 'infini_gram' to 'infinigram' internally. Old imports ('from infini_gram import ...') will break.
fix
Use 'from infinigram import InfiniteGram' instead.
affects: >=2.0.0
gotchaThe API token is required and must be set via environment variable INFINIGRAM_TOKEN or passed directly. Commonly forgotten, leading to authentication errors.
fix
Set INFINIGRAM_TOKEN environment variable or pass token='your_token' to InfiniteGram.
affects: all
gotchaModel argument is required and must be one of the supported models (e.g., 'v4', 'v1'). Using an unsupported model name results in a ValueError.
fix
Check the list of valid models in the official documentation and pass a supported model string.
affects: all
Upgrade
Version history
2.6.0latest on PyPI · released May 15, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
26 hits · last 30 days
node
22
Resources

No resource links recorded.

infini-gram — pip install infini-gram · libregistry