TimeoutError: Timeout (60.00999999999663 secs): rate limit for key: ('client', 'gpt-5.2-2025-12-11')
Author: kirillkonchaCreated Jan 2, 2026Updated Apr 29, 2026
Labelsbug
Hi, again!
I am trying to use the library with the latest GPT model. Here is my config:
llm_openai = "gpt-5.2-2025-12-11"
settings = Settings(
llm=llm_openai,
llm_config={
"model_list": [
{
"model_name": llm_openai,
"litellm_params": {
"model": llm_openai,
"temperature": 0.1,
"max_tokens": 4096,
},
}
],
"rate_limit": {
llm_openai: "100000 per 1 minute",
},
},
summary_llm=llm_openai,
summary_llm_config={
"rate_limit": {
llm_openai: "100000 per 1 minute",
},
},
embedding="text-embedding-3-small",
embedding_config={},
temperature=0.1,
batch_size=1,
verbosity=1,
answer=AnswerSettings(
evidence_k=10,
evidence_retrieval=True,
evidence_summary_length="about 200 words",
evidence_skip_summary=False,
answer_max_sources=10,
max_answer_attempts=None,
answer_length="must not exceed approximately 1000 words",
max_concurrent_requests=10,
),
parsing=ParsingSettings(
reader_config={"chunk_chars": 7000, "overlap": 250},
citation_prompt=citation_prompt,
structured_citation_prompt=structured_citation_prompt,
),
prompts=PromptSettings(
summary=summary_prompt,
qa=qa_prompt,
select=select_paper_prompt,
pre=None,
post=None,
system=default_system_prompt,
use_json=True,
summary_json=summary_json_prompt,
summary_json_system=summary_json_system_prompt,
context_outer=CONTEXT_OUTER_PROMPT,
context_inner=CONTEXT_INNER_PROMPT,
),
agent=AgentSettings(
agent_llm=llm_openai,
agent_llm_config={
"model_list": [
{
"model_name": llm_openai,
"litellm_params": {
"model": llm_openai,
},
}
],
"rate_limit": {
llm_openai: "100000 per 1 minute",
},
},
agent_prompt=env_reset_prompt,
agent_system_prompt=env_system_prompt,
search_count=8,
index=IndexSettings(
paper_directory=pathlib.Path.cwd().joinpath("papers"),
manifest_file=None,
index_directory=pathlib.Path.cwd().joinpath("papers/index"),
),
timeout=10000
),
)However, I got each time TimeOut error, independent of rate_limit params in settings.
python3
session = await docs.aquery(q, settings=settings)File ~/.venv/lib/python3.13/site-packages/lmi/llms.py:536, in rate_limited.<locals>.wrapper(self, *args, **kwargs)
533 else:
534 token_count = 0 # Default if method is unknown
--> 536 await self.check_rate_limit(token_count)
538 # If wrapping a generator, count the tokens for each
539 # portion before yielding
540 if isasyncgenfunction(func):
File ~/.venv/lib/python3.13/site-packages/lmi/llms.py:865, in LiteLLMModel.check_rate_limit(self, token_count, **kwargs)
863 async def check_rate_limit(self, token_count: float, **kwargs) -> None:
864 if "rate_limit" in self.config:
--> 865 await GLOBAL_LIMITER.try_acquire(
866 ("client", self.name),
867 self.config["rate_limit"].get(self.name, None),
868 weight=max(int(token_count), 1),
869 **kwargs,
870 )
File ~/.venv/lib/python3.13/site-packages/lmi/rate_limiter.py:416, in GlobalRateLimiter.try_acquire(self, namespace_and_key, rate_limit, machine_id, acquire_timeout, weight, raise_impossible_limits)
414 elapsed += self.WAIT_INCREMENT
415 if elapsed >= acquire_timeout:
--> 416 raise TimeoutError(
417 f"Timeout ({elapsed} secs): rate limit for key: {namespace_and_key}"
418 )
420 # If the rate limit hit is False, then we're violating the limit, so we
421 # need to wait again. This can happen in race conditions.
422 if await self.rate_limiter.hit(
423 rate_limit,
424 new_namespace,
(...) 427 ):
428 # we need to keep trying when we have an "impossible" limit
TimeoutError: Timeout (60.00999999999663 secs): rate limit for key: ('client', 'gpt-5.2-2025-12-11')Source: Future-House/paper-qa