Skip to content

Issue #23 Fix: Use logged in hf token using huggingface_hub.get_token() instead of requiring env variable#34

Open
vortezwohl wants to merge 4 commits intohuggingface:mainfrom
vortezwohl:issue-23-0427
Open

Issue #23 Fix: Use logged in hf token using huggingface_hub.get_token() instead of requiring env variable#34
vortezwohl wants to merge 4 commits intohuggingface:mainfrom
vortezwohl:issue-23-0427

Conversation

@vortezwohl
Copy link
Copy Markdown

@vortezwohl vortezwohl commented Apr 18, 2026

Summary

  • Add a shared Hugging Face token helper that keeps HF_TOKEN as the first local token source and falls back to huggingface_hub.get_token()
  • Reuse the helper in CLI and backend session creation so users logged in with huggingface-cli login do not need to set HF_TOKEN
  • Update the README quick start notes to document the login-cache fallback while keeping the existing environment variable flow

Test plan

  • Run python -m py_compile agent\utils\hf_auth.py agent\main.py backend\routes\agent.py
  • Verify HF_TOKEN takes precedence over huggingface_hub.get_token()
  • Confirm README changes are limited to the HF token setup note

Fixes #23

吴子豪 added 2 commits April 18, 2026 18:02
Add a shared Hugging Face token helper that keeps HF_TOKEN as the first local token source and then falls back to huggingface_hub.get_token().

Reuse the helper in the CLI and backend session creation so local HF login works without duplicating cache lookup logic.
Update the quick start token setup notes to mention that HF_TOKEN is optional when a Hugging Face CLI login token is available.

Keep the existing environment variable flow while documenting the new login-cache fallback behavior.
@vortezwohl vortezwohl changed the title Use logged-in HF token fallback Issue #23 Fix: Use logged in hf token using huggingface_hub.get_token() instead of requiring env variable Apr 18, 2026
@vortezwohl vortezwohl marked this pull request as draft April 24, 2026 09:22
@vortezwohl vortezwohl marked this pull request as ready for review April 24, 2026 09:22
@vortezwohl
Copy link
Copy Markdown
Author

conflict resolved

@akseljoonas
Copy link
Copy Markdown
Collaborator

@claude please review this PR. Focus on correctness, security, LiteLLM/Bedrock routing impact, and whether it's safe to merge against current main. Keep it concise and prefer inline comments where it matters.

@claude
Copy link
Copy Markdown

claude Bot commented Apr 24, 2026

Claude Code is working…

I'll analyze this and get back to you.

View job run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use logged in hf token using huggingface_hub.get_token() instead of requiring env variable

2 participants