HonestAI / HF_SPACES_URL_GUIDE.md
JatsTheAIGen's picture
Security Enhancements: Production WSGI, Rate Limiting, Security Headers, Secure Logging
79ea999

Hugging Face Spaces URL Format Guide

Correct URL Format

For the space JatinAutonomousLabs/HonestAI, the correct URL format is:

Primary URL (with hyphens):

https://jatinautonomouslabs-honestai.hf.space

Alternative URL (if hyphens don't work):

https://jatinautonomouslabs-honest_ai.hf.space

How to Find Your Exact URL

  1. Visit your Space page:

  2. Check the Space Settings:

    • Look for "Public URL" or "Space URL" in the settings
    • The URL format is typically: {username}-{spacename}.hf.space
    • Spaces convert underscores to hyphens in the URL
  3. Test both formats:

    # Try with hyphens (most common)
    curl https://jatinautonomouslabs-research-ai-assistant-api.hf.space/
    
    # Try with underscores (if hyphens don't work)
    curl https://jatinautonomouslabs-research_ai_assistant_api.hf.space/
    

URL Format Rules

  • Username: JatinAutonomousLabsjatinautonomouslabs (lowercase)
  • Space Name: HonestAIhonestai or honest-ai (lowercase)
  • Domain: .hf.space

Quick Test Script

import requests

# Try both URL formats
urls = [
    "https://jatinautonomouslabs-honestai.hf.space",
    "https://jatinautonomouslabs-honest-ai.hf.space"
]

for url in urls:
    try:
        response = requests.get(f"{url}/", timeout=5)
        if response.status_code == 200:
            print(f"✅ Working URL: {url}")
            print(f"Response: {response.json()}")
            break
        else:
            print(f"❌ {url} returned {response.status_code}")
    except Exception as e:
        print(f"❌ {url} failed: {e}")

Common Issues

  1. 404 Error:

    • Space might still be building (check Space page)
    • URL format might be wrong (try both formats)
    • Space might not be public
  2. 503 Error:

    • Space is running but API is initializing
    • Wait 30-60 seconds and retry
  3. CORS Errors:

    • API has CORS enabled, but verify the URL is correct

Verification Steps

  1. ✅ Check Space is built and running
  2. ✅ Verify Space is public
  3. ✅ Test root endpoint first: GET /
  4. ✅ Test health endpoint: GET /api/health
  5. ✅ Use the working URL in your application