Skip to content

[tiny-agents] Configure inference API key from inputs #1632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 18, 2025

Conversation

hanouticelina
Copy link
Contributor

@hanouticelina hanouticelina commented Jul 16, 2025

Same PR as huggingface/huggingface_hub#3226.

with this PR, the apiKey will be requested from the user via a prompt if not set as an environment variable, this was already implemented for server-specific credentials and env variables, this PR extends this for high-level credentials configuration. a config like this should work:

{
    "model": "gpt-4o",
    "provider": "openai",
    "apiKey": "${input:openai-api-key}",
    "inputs": [
		{
			"type": "promptString",
			"id": "hf-token",
			"description": "Your Hugging Face Token",
			"password": true
		},
		{
            "type": "promptString",
            "id": "openai-api-key",
            "description": "OpenAI API Key",
            "password": true
        }
		
	],
	"servers": [
		{
			"type": "http",
			"url": "https://huggingface.co/mcp",
			"headers": {
				"Authorization": "Bearer ${input:hf-token}"
			}
		}
	]
}

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@hanouticelina hanouticelina merged commit 91725fa into main Jul 18, 2025
5 checks passed
@hanouticelina hanouticelina deleted the fix-api-key-handling branch July 18, 2025 08:34
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.

2 participants