You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Unauthenticated model-info lookup still emits GET /v1/model/info when key is None #5454
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).
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
fromunittest.mockimportpatch, MagicMockfromopenhands.sdk.llm.utils.model_infoimport_get_model_info_from_litellm_proxywithpatch("openhands.sdk.llm.utils.model_info.httpx.get") asm:
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,
)
assertm.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.
The following comments were added by the OpenHands AI agent.
Decision needed
_get_model_info_from_litellm_proxy sends GET /v1/model/info even when no key is present, as reported. The proposed fix — skip the request whenever no key is available — is broader than the scope defined in the linked predecessor #4098, which requires that unauthenticated discovery keep working for generic litellm_proxy/* configurations and arbitrary custom proxy URLs, and would skip only for the managed OpenHands proxy (default/recognized llm-proxy.app.all-hands.dev). The repro here uses a custom proxy URL and expects zero calls, which contradicts that requirement, so the intended scope needs to be confirmed before acceptance criteria can be written.
Should the skip apply to all litellm_proxy/* lookups with no key (blanket), or only when the target is the managed OpenHands proxy with no key, leaving generic/custom proxies unchanged?
Should the skip trigger only when the key is None, or also when it is an empty/blank string?
Decision on the two scope questions — agreed with #4098's defined scope:
Managed-proxy-only, not blanket. You are right: a blanket skip would change behavior for open generic proxies that legitimately serve model info without credentials. The skip now applies only when no key is available and the target is the managed proxy (via the existing is_openhands_proxy_base_url helper, which covers both recognized base-URL forms). Generic/custom URLs keep the exact previous behavior (request still attempted). Issue body and repro updated accordingly.
None, empty, and blank all count as keyless. None of them can authenticate, and the current code already treats "" as absent for header purposes (if secret_api_key:), so treating blank the same way for the skip is consistent.
PR #5456 updated to match (6 tests: managed None/empty/blank/v1-suffixed skipped, managed keyed sends Authorization, generic keyless still attempted).
Confirming this is still reproducible on a current build that already includes the refresh-on-401 work (#5218 / #5222), with one additional variant that's worth folding into the fix scope.
Variant: present-but-invalid key, not just key is None
This issue is scoped to "when key is None," but the same GET /v1/model/info → 401 → silent fallback also happens when a key is sent but the managed proxy rejects it (type: token_not_found_in_db, "Unable to find token in cache or LiteLLM_VerificationTokenTable"). In that case headers["Authorization"] is populated, so a guard that only checks key is None won't skip the request. The meaningful distinction is "proxy can't authenticate this key," which covers both the absent-key and the stale/invalid-key cases.
Observed behavior (matches the described mechanism)
A steady, continuous rate of GET /v1/model/info returning 401, with no functional impact — chat/completions was 100% 200 over the same window. This corroborates the "SDK silently falls back to static LiteLLM metadata" path.
The 401s fan out across every process that constructs an LLM without a proxy-valid key (app server, runtime sandboxes, and a periodic cleanup job), consistent with the per-process hourly lru_cache multiplying the request.
Adjacent symptom (possibly a separate issue)
The same stale/absent token also surfaces as delete_key / delete_verification_tokens → 404 {'error': 'No keys found'} from cleanup paths trying to delete a token that is no longer in LiteLLM_VerificationTokenTable. Same root (a token referenced after it's gone from the table), different call path.
Suggested scope
Skip the /v1/model/info probe — and/or treat a 401 as a cache-miss without re-emitting the request — whenever the proxy cannot authenticate the key, i.e. when the key is Noneor present-but-not-in-db, rather than only when the key is absent.
Filed via an AI agent (OpenHands) on behalf of a maintainer.
Activity
all-hands-bot commentedon Oct 2, 2026
The following comments were added by the OpenHands AI agent.
Decision needed
_get_model_info_from_litellm_proxysendsGET /v1/model/infoeven when no key is present, as reported. The proposed fix — skip the request whenever no key is available — is broader than the scope defined in the linked predecessor #4098, which requires that unauthenticated discovery keep working for genericlitellm_proxy/*configurations and arbitrary custom proxy URLs, and would skip only for the managed OpenHands proxy (default/recognizedllm-proxy.app.all-hands.dev). The repro here uses a custom proxy URL and expects zero calls, which contradicts that requirement, so the intended scope needs to be confirmed before acceptance criteria can be written.litellm_proxy/*lookups with no key (blanket), or only when the target is the managed OpenHands proxy with no key, leaving generic/custom proxies unchanged?None, or also when it is an empty/blank string?daviskay75 commentedon Oct 2, 2026
Decision on the two scope questions — agreed with #4098's defined scope:
is_openhands_proxy_base_urlhelper, which covers both recognized base-URL forms). Generic/custom URLs keep the exact previous behavior (request still attempted). Issue body and repro updated accordingly.""as absent for header purposes (if secret_api_key:), so treating blank the same way for the skip is consistent.PR #5456 updated to match (6 tests: managed None/empty/blank/v1-suffixed skipped, managed keyed sends
Authorization, generic keyless still attempted).aivong-openhands commentedon Oct 2, 2026
Confirming this is still reproducible on a current build that already includes the refresh-on-401 work (#5218 / #5222), with one additional variant that's worth folding into the fix scope.
Variant: present-but-invalid key, not just
key is NoneThis issue is scoped to "when key is None," but the same
GET /v1/model/info → 401 → silent fallbackalso happens when a key is sent but the managed proxy rejects it (type: token_not_found_in_db, "Unable to find token in cache orLiteLLM_VerificationTokenTable"). In that caseheaders["Authorization"]is populated, so a guard that only checkskey is Nonewon't skip the request. The meaningful distinction is "proxy can't authenticate this key," which covers both the absent-key and the stale/invalid-key cases.Observed behavior (matches the described mechanism)
GET /v1/model/inforeturning401, with no functional impact —chat/completionswas 100%200over the same window. This corroborates the "SDK silently falls back to static LiteLLM metadata" path.lru_cachemultiplying the request.Adjacent symptom (possibly a separate issue)
The same stale/absent token also surfaces as
delete_key/delete_verification_tokens → 404 {'error': 'No keys found'}from cleanup paths trying to delete a token that is no longer inLiteLLM_VerificationTokenTable. Same root (a token referenced after it's gone from the table), different call path.Suggested scope
Skip the
/v1/model/infoprobe — and/or treat a401as a cache-miss without re-emitting the request — whenever the proxy cannot authenticate the key, i.e. when the key isNoneor present-but-not-in-db, rather than only when the key is absent.Filed via an AI agent (OpenHands) on behalf of a maintainer.