ctxlen 2026.10.11.dev2__tar.gz → 2026.10.11.dev4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.4
2
+ Name: ctxlen
3
+ Version: 2026.10.11.dev4
4
+ Summary: max_input and max_output for any litellm model id, with no dependencies and no network
5
+ Keywords: llm,litellm,context window,tokens,models.dev
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Typing :: Typed
10
+ Requires-Python: >=3.9
11
+ Project-URL: Repository, https://github.com/michaeltheologitis/ctxlen
12
+ Description-Content-Type: text/markdown
13
+
14
+ # ctxlen
15
+
16
+ A simple library to look up the context limits (input and output tokens) of LLMs.
17
+
18
+ ```shell
19
+ uv add ctxlen
20
+ ```
21
+
22
+ ```pycon
23
+ >>> import ctxlen
24
+ >>> ctxlen.ctxlen("claude-opus-5-5")
25
+ 1000000
26
+ >>> ctxlen.ctxlen("anthropic/claude-sonnet-5-5")
27
+ 1000000
28
+ >>> ctxlen.ctxlen("gpt-6-sol")
29
+ 1050000
30
+ >>> ctxlen.ctxlen("openai/gpt-6-luna")
31
+ 1050000
32
+ >>> ctxlen.max_input("gpt-6-sol"), ctxlen.max_output("gpt-6-sol")
33
+ (922000, 128000)
34
+
35
+ ```
36
+
37
+ The numbers come from litellm and models.dev; their notices are in [LICENSE](LICENSE).
@@ -0,0 +1,24 @@
1
+ # ctxlen
2
+
3
+ A simple library to look up the context limits (input and output tokens) of LLMs.
4
+
5
+ ```shell
6
+ uv add ctxlen
7
+ ```
8
+
9
+ ```pycon
10
+ >>> import ctxlen
11
+ >>> ctxlen.ctxlen("claude-opus-5-5")
12
+ 1000000
13
+ >>> ctxlen.ctxlen("anthropic/claude-sonnet-5-5")
14
+ 1000000
15
+ >>> ctxlen.ctxlen("gpt-6-sol")
16
+ 1050000
17
+ >>> ctxlen.ctxlen("openai/gpt-6-luna")
18
+ 1050000
19
+ >>> ctxlen.max_input("gpt-6-sol"), ctxlen.max_output("gpt-6-sol")
20
+ (922000, 128000)
21
+
22
+ ```
23
+
24
+ The numbers come from litellm and models.dev; their notices are in [LICENSE](LICENSE).
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ctxlen"
3
- version = "2026.10.11.dev2"
3
+ version = "2026.10.11.dev4"
4
4
  description = "max_input and max_output for any litellm model id, with no dependencies and no network"
5
5
  requires-python = ">=3.9"
6
6
  dependencies = []
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ctxlen"
3
- version = "2026.10.11.dev2"
3
+ version = "2026.10.11.dev4"
4
4
  description = "max_input and max_output for any litellm model id, with no dependencies and no network"
5
5
  requires-python = ">=3.9"
6
6
  dependencies = []
@@ -1,10 +1,22 @@
1
- """max_input and max_output for any litellm model id, from bundled data, with no network."""
1
+ """The context limits of any litellm model id, from bundled data, with no network."""
2
2
 
3
3
  import typing as _typing
4
4
 
5
5
  from ctxlen import _resolve
6
6
 
7
- __all__ = ["max_input", "max_output"]
7
+ __all__ = ["ctxlen", "max_input", "max_output"]
8
+
9
+
10
+ def ctxlen(model: str) -> _typing.Optional[int]: # noqa: FA100
11
+ """The total context window, input and output tokens together, or None.
12
+
13
+ `model` is any id you would pass to litellm.completion ("gpt-4o",
14
+ "anthropic/claude-sonnet-4-5", "bedrock/us.anthropic..."), resolved as
15
+ litellm resolves it. The number is models.dev's for the same provider's
16
+ model; where models.dev has none, litellm's input limit (or its output
17
+ limit, where that is larger), which is never larger than the true total.
18
+ """
19
+ return _resolve.limits(model, "ctxlen")[2]
8
20
 
9
21
 
10
22
  def max_input(model: str) -> _typing.Optional[int]: # noqa: FA100 (help() shows Optional[int] on 3.9)