ctxlen 2026.10.11.dev3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ctxlen
3
- Version: 2026.10.11.dev3
3
+ Version: 2026.10.11.dev4
4
4
  Summary: max_input and max_output for any litellm model id, with no dependencies and no network
5
5
  Keywords: llm,litellm,context window,tokens,models.dev
6
6
  License-Expression: MIT
@@ -21,14 +21,16 @@ uv add ctxlen
21
21
 
22
22
  ```pycon
23
23
  >>> import ctxlen
24
- >>> ctxlen.max_input("claude-opus-5-5"), ctxlen.max_output("claude-opus-5-5")
25
- (1000000, 128000)
26
- >>> ctxlen.max_input("anthropic/claude-sonnet-5-5")
24
+ >>> ctxlen.ctxlen("claude-opus-5-5")
27
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
28
32
  >>> ctxlen.max_input("gpt-6-sol"), ctxlen.max_output("gpt-6-sol")
29
33
  (922000, 128000)
30
- >>> ctxlen.max_input("openai/gpt-6-luna")
31
- 922000
32
34
 
33
35
  ```
34
36
 
@@ -8,14 +8,16 @@ uv add ctxlen
8
8
 
9
9
  ```pycon
10
10
  >>> import ctxlen
11
- >>> ctxlen.max_input("claude-opus-5-5"), ctxlen.max_output("claude-opus-5-5")
12
- (1000000, 128000)
13
- >>> ctxlen.max_input("anthropic/claude-sonnet-5-5")
11
+ >>> ctxlen.ctxlen("claude-opus-5-5")
14
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
15
19
  >>> ctxlen.max_input("gpt-6-sol"), ctxlen.max_output("gpt-6-sol")
16
20
  (922000, 128000)
17
- >>> ctxlen.max_input("openai/gpt-6-luna")
18
- 922000
19
21
 
20
22
  ```
21
23
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ctxlen"
3
- version = "2026.10.11.dev3"
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.dev3"
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)