[Bug] Unauthenticated model-info lookup still emits GET /v1/model/info when key is None
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
Research direction
Start in openhands-sdk/openhands/sdk/llm/utils/model_info.py at _get_model_info_from_litellm_proxy and run the provided mocked repro. Confirm that keyless requests to recognized managed OpenHands proxy URLs make no HTTP call and use the existing local fallback, while keyed requests and generic proxies still attempt model-info lookup.
Written by the indexing model from the issue text.
Description
[Bug] Unauthenticated model-info lookup still emits GET /v1/model/info when key is None
Follow-up to #4098 (closed by stale-bot, still present on main @ cc97bf23).
Current behavior
LLM._post_init() → _init_model_info_and_caps() → get_litellm_model_info() →
_get_model_info_from_litellm_proxy() (openhands-sdk/openhands/sdk/llm/utils/model_info.py):
headers = {}
if isinstance(secret_api_key, SecretStr):
secret_api_key = secret_api_key.get_secret_value()
if secret_api_key:
headers["Authorization"] = f"Bearer {secret_api_key}"
response = httpx.get(f"{base_url}/v1/model/info", headers=headers)
When no key is available, headers stays empty but the request is still sent. The
managed proxy answers 401, the SDK silently falls back to static LiteLLM
metadata — and every LLM construction / profile load / validation /
deserialization without credentials emits another unauthenticated request
(hourly lru_cache key per process, so fan-out still multiplies it).
Scope (per #4098)
Skip the request only when no key is available and the target is the managed
OpenHands proxy (is_openhands_proxy_base_url, i.e. recognized
llm-proxy.app.all-hands.dev base URLs). Generic/custom proxies are unchanged:
an open proxy may legitimately serve model info without credentials, so those
lookups must still be attempted. None, empty, and blank keys all count as
keyless (none of them can authenticate).
Repro
from unittest.mock import patch, MagicMock
from openhands.sdk.llm.utils.model_info import _get_model_info_from_litellm_proxy
with patch("openhands.sdk.llm.utils.model_info.httpx.get") as m:
m.return_value.json.return_value = {"data": []}
_get_model_info_from_litellm_proxy(
secret_api_key=None, base_url="https://llm-proxy.app.all-hands.dev",
model="litellm_proxy/some-model", cache_key=1,
)
assert m.call_count == 0 # FAILS: called once with headers={}
Proposed fix
Skip the request under the scope above and fall through to the existing local
fallbacks (get_model_info variants in get_litellm_model_info). Keyed
requests — including invalid keys, whose real 401 stays visible — unchanged.
PR incoming, referencing this issue.
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 797
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 354
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenHands/software-agent-sdk
-
[Bug]: `list_directory` reports a complete listing as truncated when a directory has exactly 500 entriesPossibly taken @balabommablock-cpu claimed this 29 days ago. Openbug priority:low ready-for-dev
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
OpenHands/software-agent-sdk#6133 ·
Maintainers usually reply within 1 day
-
[Bug]: Command hook that exits 1 is treated as blocking when its stdout is a JSON `deny` or `continue: false`Possibly taken A pull request linked to this issue is open or already merged. Openbug priority:low ready-for-dev
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OpenHands/software-agent-sdk#6116 · 3 comments ·
Maintainers usually reply within 1 day
-
[Bug]: TypeScript GET-with-body requests remain pending after a truncated responsePossibly taken @BlueRaddish claimed this 34 days ago. Openbug priority:low ready-for-dev
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
OpenHands/software-agent-sdk#6059 ·
Maintainers usually reply within 1 day
-
[Bug]: Document whether `prompt_tokens` includes `cache_read_tokens` in accumulated token usagePossibly taken @Jaxon1216 claimed this 36 days ago. Openpriority:low ready-for-dev
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenHands/software-agent-sdk#5975 ·
Maintainers usually reply within 1 day
-
priority:low
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenHands/software-agent-sdk#5708 · 1 comment ·
Maintainers usually reply within 1 day
All issues in OpenHands/software-agent-sdk
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
trycua/hermes-cua-spaces#17 ·
-
area:codegen backend:hip bug direction:output good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
status:waiting-for-triage type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
microsoftgraph/msgraph-sdk-python#1628 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
nautechsystems/nautilus_trader#5718 ·
Maintainers usually reply within 1 day
-
[Bug]: reme CLI crashes when the running server used a relative config pathPossibly taken @nurlanmnn claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
agentscope-ai/ReMe#770 ·
Maintainers usually reply within 1 day