- 
                Notifications
    You must be signed in to change notification settings 
- Fork 836
Description
Describe the bug
I’ve deployed a FastAPI backend to HuggingFace Spaces (Docker SDK, public Space) that needs to make outbound HTTPS POST requests to Ollama Cloud API for embeddings.
What Works:
Space builds and starts successfully
Health check endpoint returns 200 OK
Requests from frontend reach the backend
Same exact API call works from my local machine and other environments
What Fails:
Outbound POST to https://api.ollama.cloud/v1/embeddings returns 404 error: “model ‘nomic-embed-text’ not found”
This succeeds from my local machine:
curl -X POST https://api.ollama.cloud/v1/embeddings
-H “Authorization: Bearer [API_KEY]”
-H “Content-Type: application/json”
-d ‘{“model”: “nomic-embed-text”, “input”: [“test”]}’
Returns: 768-dimension embedding successfully
Same request from HF Space Docker container: 404 error
Space Configuration:
SDK: Docker
Port: 7860
Dockerfile: Python 3.10-slim, uvicorn running FastAPI
OLLAMA_API_KEY stored as repository secret
Question:
Is there a network restriction or firewall rule on HF Spaces that blocks/modifies requests to api.ollama.cloud? Or is there a known issue with certain external APIs? The same code works perfectly locally but fails only when deployed to HF Spaces.
Any guidance would be appreciated!
Reproduction
No response
Logs
System info
- huggingface_hub version: 0.32.2
     - Platform: Windows-11-10.0.26200-SP0
     - Python version: 3.13.5
     - Running in iPython ?: No
     - Running in notebook ?: No
     - Running in Google Colab ?: No
     - Running in Google Colab Enterprise ?: No
     - Token path ?: C:\Users\indid\.cache\huggingface\token
     - Has saved token ?: False
     - Configured git credential helpers: manager
     - FastAI: N/A
     - Tensorflow: N/A
     - Torch: 2.7.0
     - Jinja2: 3.1.6
     - Graphviz: N/A
     - keras: N/A
     - Pydot: N/A
     - Pillow: 11.2.1
     - hf_transfer: N/A
     - gradio: N/A
     - tensorboard: N/A
     - numpy: 2.2.5
     - pydantic: 2.11.5
     - aiohttp: 3.11.18
     - hf_xet: N/A
     - ENDPOINT: https://huggingface.co
     - HF_HUB_CACHE: C:\Users\indid\.cache\huggingface\hub
     - HF_ASSETS_CACHE: C:\Users\indid\.cache\huggingface\assets
     - HF_TOKEN_PATH: C:\Users\indid\.cache\huggingface\token
     - HF_STORED_TOKENS_PATH: C:\Users\indid\.cache\huggingface\stored_tokens
     - HF_HUB_OFFLINE: False
     - HF_HUB_DISABLE_TELEMETRY: False
     - HF_HUB_DISABLE_PROGRESS_BARS: None
     - HF_HUB_DISABLE_SYMLINKS_WARNING: False
     - HF_HUB_DISABLE_EXPERIMENTAL_WARNING: False
     - HF_HUB_DISABLE_IMPLICIT_TOKEN: False
     - HF_HUB_ENABLE_HF_TRANSFER: False
     - HF_HUB_ETAG_TIMEOUT: 10
     - HF_HUB_DOWNLOAD_TIMEOUT: 10