Skip to main content

ctxlen 📏

A super minimal-dependency, always-fresh, project to look up the context limits (input and output tokens) of LLMs. 🤔

  • 🔄 New models checked every 6 hours, and your install picks them up within the hour: no upgrade needed.
  • 🪶 Just httpx and certifi as dependencies, and it still works offline, with the numbers it shipped with.
  • 🧰 Just three functions.

Install

uv add ctxlen

Or with pip:

pip install ctxlen

Usage

Ask for a model's whole context window:

import ctxlen

ctxlen.ctxlen("claude-opus-5-5")  # 1_000_000
ctxlen.ctxlen("gpt-6-sol")        # 1_050_000

You can also put the provider in front, like litellm does:

ctxlen.ctxlen("anthropic/claude-sonnet-5-5")  # 1_000_000
ctxlen.ctxlen("openai/gpt-6-luna")            # 1_050_000

Or ask for the input and output limits on their own:

ctxlen.max_input("gpt-6-sol")   # 922_000
ctxlen.max_output("gpt-6-sol")  # 128_000

The numbers come from litellm and models.dev; their notices are in LICENSE.

Offline

ctxlen.ctxlen("gpt-6-sol", live=False) uses only the numbers that came with your version, and CTXLEN_OFFLINE=1 does that for the whole process. ctxlen asks GitHub for fresh numbers at most once an hour and keeps them in ~/.cache/ctxlen/.

Metadata

Release files for ctxlen 2026.12.4.3

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

Source distribution (sdist)

Source distribution for ctxlen 2026.12.4.3
File Size Uploaded Provenance Actions
ctxlen-2026.12.4.3.tar.gz 80.9 kB With provenance Details for ctxlen-2026.12.4.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ctxlen 2026.12.4.3
File Interpreter ABI Platform Actions
ctxlen-2026.12.4.3-py3-none-any.whl Python 3 none any Details for ctxlen-2026.12.4.3-py3-none-any.whl

Total release size: 162.3 kB

Release files / ctxlen-2026.12.4.3.tar.gz

Download URL ctxlen-2026.12.4.3.tar.gz
Size 80.9 kB
Tags Source
SHA-256 checksum
How to use checksums
38fc821d3fdea81aa002c4e58b7e6b255061dbf77c4eb4b11564ee85993ecb73
BLAKE2b-256 checksum
How to use checksums
784cb133f4c42d8cfab6a9c73945f53a88706a0f7392e221568c7d21fda51440
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Dec 4, 2026.

Transparency log

Release files / ctxlen-2026.12.4.3-py3-none-any.whl

Download URL ctxlen-2026.12.4.3-py3-none-any.whl
Size 81.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
881879024a8c1e27c7e54e2931accb7f4830669a5dbaf97bdfefc33d4d9d73e3
BLAKE2b-256 checksum
How to use checksums
f53ec85fcb1abbbf98afc94d29a19f8a8d9ffc81e5f0f55edf96585b1355e5ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Dec 4, 2026.

Transparency log

Security for ctxlen 2026.12.4.3

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 ctxlen-2026.12.4.3.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 Dec 4, 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
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