Gemini 2.0 Flash Thinking window is wrong (1M, not 32k) and Bedrock provider resolves Claude 2.1 to 100k
Description
Two context-window values in the provider tables are wrong or unreachable:
- gemini-2.0-flash-thinking is a 1M-token model, not 32k. Both
LLM_CONTEXT_WINDOW_SIZES("gemini-2.0-flash-thinking-exp-01-21": 32768) and the Gemini native provider ("gemini-2.0-flash-thinking": 32768) carry the 32,768 figure, but that belonged to the Decemberexp-1219snapshot. Theexp-01-21refresh raised the window to 1,048,576 tokens (see Google's long-context documentation and coverage of the January upgrade). WithLLM(model="gemini-2.0-flash-thinking-exp-01-21", is_litellm=True)the litellm path currently returns 32768 × ratio. - The Gemini native provider's 32k entry is also unreachable.
"gemini-2.0-flash-thinking": 32768sits after"gemini-2.0-flash": 1048576in a first-matchstartswithloop, sogemini-2.0-flash-thinking-exp-01-21resolves through the plaingemini-2.0-flashprefix and returns 1M. The two paths disagree with each other. - The Bedrock provider table has no
anthropic.claude-v2:1entry, so Claude 2.1 resolves through theanthropic.claude-v2prefix (Claude 2.0) and returns 100k instead of the 200k window llm.py's shared table already assigns to the:1model id.
Steps to Reproduce
from crewai import LLM
# litellm path: returns 32768 * 0.85, expected 1048576 * 0.85
LLM(model="gemini-2.0-flash-thinking-exp-01-21", is_litellm=True).get_context_window_size()
# native gemini path: returns 1048576 * 0.85 (accidentally correct, table entry dead)
LLM(model="google/gemini-2.0-flash-thinking-exp-01-21").get_context_window_size()
# native bedrock path: returns 100000 * 0.85, expected 200000 * 0.85
LLM(model="bedrock/anthropic.claude-v2:1").get_context_window_size()
Expected behavior
All three paths return the model's official window. Related to #7436 / #7437 (the lookup-order issue in the shared table); this issue is about the stale values and the missing Bedrock entry.
Thanks for splitting this out of #7436 and for the three-path repro, @Theater-ahyeon. It made checking the Bedrock half quick, and I only looked at that half.
I can confirm the lookup on main (7a01af2): bedrock/anthropic.claude-v2:1 returns 85000 because the provider table only carries the anthropic.claude-v2 prefix (llms/providers/bedrock/completion.py:2139) and the loop at :2149 takes the first startswith hit. One thing worth weighing before adding a 200k row, though: in us-east-1 and us-west-2, Bedrock reports both Claude 2.x ids as end-of-life. GetFoundationModel answers "reached the end of its life" for each, and ListFoundationModels returns zero claude-v2 entries. Since Vidit-Ostwal asked in #7340 to drop retired models from these maps, removing the two anthropic.claude-v2* rows may be the tidier fix for this part, and #7340 still carries both with # TODO(verify). Happy to leave it with you either way.
| Model id (native path) | main 7a01af2 | Bedrock GetFoundationModel (2026-09-17) |
|---|---|---|
bedrock/anthropic.claude-v2:1 |
85000 (100000 × 0.85) | EOL |
bedrock/anthropic.claude-v2 |
85000 | EOL |
$ python repro.py
bedrock/anthropic.claude-v2:1 BedrockCompletion 85000 (ratio=0.85)
bedrock/anthropic.claude-v2 BedrockCompletion 85000 (ratio=0.85)
$ aws bedrock get-foundation-model --region us-east-1 --model-identifier anthropic.claude-v2:1
An error occurred (ResourceNotFoundException) when calling the GetFoundationModel operation:
This model version has reached the end of its life. Use an active model version instead.
Details: where the PRs touch this and how I checked
- #7442 (yours) and #7446 both add
"anthropic.claude-v2:1": 200000to the same Bedrock table inllms/providers/bedrock/completion.py, and both editllm.pyand the Gemini table that #7340 moves intollms/context_window.py, so all three will conflict with whichever lands first. - #7340 as of today keeps
"anthropic.claude-v2": 100000, # TODO(verify)and"anthropic.claude-v2:1": 200000, # TODO(verify)in the newBEDROCK_CONTEXT_WINDOWSmap. - Same
GetFoundationModelerror foranthropic.claude-v2in us-east-1 and us-west-2. In eu-west-1 both ids come backValidationException: The provided model identifier is invalid. aws bedrock list-foundation-models --region us-east-1 --by-provider Anthropic --query "length(modelSummaries[?contains(modelId,'claude-v2')])"prints0.- Repro script:
from crewai import LLM
from crewai.llm import CONTEXT_WINDOW_USAGE_RATIO
for m in ["bedrock/anthropic.claude-v2:1", "bedrock/anthropic.claude-v2"]:
llm = LLM(model=m)
print(m, type(llm).__name__, llm.get_context_window_size(), f"(ratio={CONTEXT_WINDOW_USAGE_RATIO})")
Gemini 2.0 model are retired.