"""
API key creation guide component
"""
import gradio as gr
def create_api_guide():
"""Create API key creation guide with expandable sections"""
with gr.Accordion("Need help creating API keys?", open=False):
gr.Markdown("### Step-by-Step API Key Creation Guide")
with gr.Tabs():
# Groq API Key Guide
with gr.Tab("Groq API Key"):
groq_guide = '''
Creating a Groq API Key
- Go to Groq Console
- Sign up or log in to your account
- Navigate to API Keys section
- Click on Create API Key
- Give your key a descriptive name
- Copy the generated key (starts with
gsk_)
- Paste it in the Groq API Key field above
info
Keep your API key secure and never share it publicly.
'''
gr.HTML(groq_guide)
# Hugging Face Token Guide
with gr.Tab("Hugging Face Token"):
hf_guide = '''
Creating a Hugging Face Token
- Go to Hugging Face
- Sign up or log in to your account
- Click on your profile picture → Settings
- Navigate to Access Tokens
- Click on New Token
- Select token type: Write
- Give your token a descriptive name
- Copy the generated token (starts with
hf_)
- Paste it in the Hugging Face Token field above
warning
Write token is required for creating and updating Spaces.
'''
gr.HTML(hf_guide)
# Best Practices
with gr.Tab("Best Practices"):
practices_guide = '''
API Key Security Best Practices
lock
Key Rotation
Regularly rotate your API keys (every 90 days recommended).
visibility_off
Never Expose Keys
Never commit API keys to version control or share in public forums.
shield
Use Environment Variables
Store keys in environment variables instead of hardcoding.
notifications
Monitor Usage
Regularly check API usage and set up alerts for unusual activity.
delete
Revoke Unused Keys
Immediately revoke keys that are no longer needed.
'''
gr.HTML(practices_guide)
return None