Skip to main content

langchain-tokenusage-dev

Four read-only LangChain tools for tokenusage.dev's public Codex reset announcements and Nerf Watch scores and history. No tokenusage.dev API key, account or subscription is required.

Python 3.10 or newer is required. The only direct runtime dependency is langchain-core>=1.0,<2; HTTP uses Python's standard library.

Install

pip install langchain-tokenusage-dev

Example

This example calls all four tools without a model or model-provider credentials.

import json

from langchain_tokenusage_dev import TokenUsageToolkit

tools = {tool.name: tool for tool in TokenUsageToolkit().get_tools()}


def show(result):
    if isinstance(result, str):
        raise RuntimeError(result)
    print(json.dumps(result, indent=2))
    print(f"[Data: tokenusage.dev]({result['source']})")
    if "qualifier" in result:
        print(result["qualifier"])
    return result


show(tools["get_codex_reset_announcements"].invoke({"limit": 3}))
show(tools["get_codex_reset_calendar"].invoke({"month": "2026-10"}))
scores = show(tools["get_nerfwatch_scores"].invoke({}))

if scores["models"]:
    show(
        tools["get_nerfwatch_history"].invoke(
            {"model": scores["models"][0]["model"]}
        )
    )

Individual tools can also be constructed directly:

from langchain_tokenusage_dev import GetCodexResetAnnouncementsTool

tool = GetCodexResetAnnouncementsTool(timeout=10.0)
result = tool.invoke({"limit": 3})

Pass the toolkit's BaseTool instances to your configured LangChain agent. An agent's model package and provider credentials are separate from these tools.

Tools

Tool Arguments Result
get_codex_reset_announcements Optional integer limit, 1–50, default 10 Recorded announcements, newest first
get_codex_reset_calendar Optional UTC month, YYYY-MM Recorded announcements grouped by UTC date, newest dates first
get_nerfwatch_scores None Latest scores, previous runs, changes and baselines
get_nerfwatch_history Required model id from the scores tool Retained history, oldest first

All argument objects reject extra keys. Explicit null is not a valid argument. Model ids contain 1–64 lowercase letters, digits, dots, underscores or hyphens, starting with a letter or digit.

Successful calls return JSON-serialisable dictionaries. Each contains source. Nerf Watch calls also contain qualifier. HTTP failures, timeouts, invalid responses, invalid arguments and unknown model ids return tool error strings through invoke and ainvoke.

The tools preserve the MCP projections and values. The sole additional result field is qualifier on the two Nerf Watch results. Only stable public fields are projected; private evidence, test questions and answers are excluded.

Caching and scope

Tools share one in-process cache per canonical endpoint: 15 seconds for resets, 300 seconds for Nerf Watch. TTL starts when a request starts. Failed reads are cached for the same interval. Concurrent calls share the read. There is no background polling or automatic retry.

Please poll no faster than these intervals and use canonical URLs without cache-busting query strings. Requests identify this package and its repository in the User-Agent. The default HTTP timeout is 10 seconds.

Only announcements recorded from @thsottiaux on X are available, at most the 50 newest. This is not a complete history. A date without an entry does not mean no reset was announced. A banked reset grant saves a reset for eligible users to apply later and does not itself refill limits. An announcement is not proof that any account's limit was reset; open its source post for wording and eligibility.

Nerf Watch preserves missing days and suite versions. Scores and changes are already rounded by the API; this package does not recalculate them. Read the returned baseline and retention settings rather than assuming fixed values.

Reuse and credit

When showing reset data to other people, display Data: tokenusage.dev on the same screen or in the same message.

When showing Nerf Watch scores, changes, history or metadata to other people, display Data: tokenusage.dev on the same screen or in the same message. Personal use needs no visible credit.

API and other relays must retain each dataset's source URL and pass on its credit condition. Anyone displaying the data must show the applicable credit.

Retain this qualification when displaying Nerf Watch scores or changes:

A lower score is a lower score on this suite, not proof that a provider changed a model: runs are noisy, and a provider's defaults, the endpoint or the runner itself can change.

The MIT licence covers this package's code. Reused service data remains subject to the credit conditions above.

tokenusage.dev is unofficial and not affiliated with OpenAI or Anthropic.

Development

python -m pip install -e ".[test]"
python -m pytest
python -m build
python -m twine check --strict dist/*

Unit tests use local JSON fixtures and mock HTTP. Production integration tests are marked and skipped unless explicitly enabled:

python -m pytest --run-integration -m integration tests/integration_tests

Metadata

Release files for langchain-tokenusage-dev 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-tokenusage-dev 0.1.0
File Size Uploaded Provenance Actions
langchain_tokenusage_dev-0.1.0.tar.gz 14.8 kB With provenance Details for langchain_tokenusage_dev-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-tokenusage-dev 0.1.0
File Interpreter ABI Platform Actions
langchain_tokenusage_dev-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_tokenusage_dev-0.1.0-py3-none-any.whl

Total release size: 25.7 kB

Release files / langchain_tokenusage_dev-0.1.0.tar.gz

Download URL langchain_tokenusage_dev-0.1.0.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c1137a7f5d773e2ef660d058ae9049bb2ca1265f2c1ba57afd18f42bf9f571f4
BLAKE2b-256 checksum
How to use checksums
de3c7f9032f0e1757a5ffe3e09cab2c2adcaa343eab5ec7f7f5bd53c6f986054
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / langchain_tokenusage_dev-0.1.0-py3-none-any.whl

Download URL langchain_tokenusage_dev-0.1.0-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
613414bdbdc5aafc16afc939e85dfcc7603383247b7320e6b066571c45f5ef81
BLAKE2b-256 checksum
How to use checksums
efed3a4b0c0f38273f467eda9bad90f7df1cc33306a9b40d5b2810d468db2395
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Security for langchain-tokenusage-dev 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for langchain_tokenusage_dev-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page