metadata
title: Copilot
emoji: 📊
colorFrom: gray
colorTo: pink
sdk: docker
pinned: false
Required Secret
This app requires two secrets at startup.
Set one of these Hugging Face Space Secrets:
GH_TOKEN(preferred)GITHUB_TOKEN(fallback)API_TOKEN(required for incoming API requests)
The container will fail fast if GH_TOKEN/GITHUB_TOKEN or API_TOKEN is missing.
Hugging Face Setup
- Open your Space.
- Go to
Settings->Variables and secrets. - Add a Secret named
GH_TOKEN. - Add a Secret named
API_TOKEN. - Paste your token values.
- Save and restart/redeploy the Space.
Notes
- Do not hardcode tokens in code or Dockerfile.
- Startup only logs token length, never token value.
- If
/v1/modelsstill returnsNot authenticated, the token likely lacks Copilot entitlement/permissions. - Requests to
/v1/*withoutAuthorization: Bearer <API_TOKEN>(orX-API-Key: <API_TOKEN>) return401.
Example
curl https://kaballas-copilot.hf.space/copilot/v1/models \
-H "Authorization: Bearer $API_TOKEN"
curl -X POST https://kaballas-copilot.hf.space/copilot/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_TOKEN" \
-d '{
"model": "gpt-4.1",
"messages": [
{"role": "user", "content": "Hello"}
]
}'
Configuration reference: https://huggingface.co/docs/hub/spaces-config-reference