mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-09 13:21:42 +00:00
fix(credential_pool): match Anthropic OAuth tokens by sk-ant-oat prefix
This commit is contained in:
parent
b5267671f2
commit
18966b6244
1 changed files with 11 additions and 1 deletions
|
|
@ -2162,7 +2162,17 @@ def _seed_from_env(provider: str, entries: List[PooledCredential]) -> Tuple[bool
|
|||
if _is_source_suppressed(provider, source):
|
||||
continue
|
||||
active_sources.add(source)
|
||||
auth_type = AUTH_TYPE_OAUTH if provider == "anthropic" and not token.startswith("sk-ant-api") else AUTH_TYPE_API_KEY
|
||||
# Claude Code OAuth tokens are the only Anthropic credentials that should
|
||||
# flow into the OAuth refresh path. Match the `sk-ant-oat` prefix
|
||||
# positively — matching by negation (everything not `sk-ant-api`) wrongly
|
||||
# tagged admin keys (`sk-ant-admin*`) and any future API-key prefix as
|
||||
# OAuth, which then got immediately marked exhausted on first use because
|
||||
# they have no refresh token.
|
||||
auth_type = (
|
||||
AUTH_TYPE_OAUTH
|
||||
if provider == "anthropic" and token.startswith("sk-ant-oat")
|
||||
else AUTH_TYPE_API_KEY
|
||||
)
|
||||
base_url = env_url or pconfig.inference_base_url
|
||||
if provider == "kimi-coding":
|
||||
base_url = _resolve_kimi_base_url(token, pconfig.inference_base_url, env_url)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue