Spaces:
Running
Running
Download patch_auth_test5.py from Leon4gr45/llama-gemma: direct link, hf CLI and curl.
- Browser
- Download file 839 Bytes
-
https://huggingface.co/spaces/Leon4gr45/llama-gemma/resolve/main/patch_auth_test5.py
- Command line
-
hf download hf://spaces/Leon4gr45/llama-gemma/patch_auth_test5.py
-
curl -L -o patch_auth_test5.py https://huggingface.co/spaces/Leon4gr45/llama-gemma/resolve/main/patch_auth_test5.py
839 Bytes
| with open("gateway.py", "r") as f: | |
| code = f.read() | |
| # Wait, does llama-swap itself require an API key? | |
| # llama-swap docs say: | |
| # "It passes requests matching /v1/models and /v1/chat/completions to the appropriate model..." | |
| # Does llama-swap pass the Authorization header it receives down to the model? | |
| # Yes. | |
| # Does llama-swap validate the API key? | |
| # Maybe llama-swap passes the Authorization header to the model, and the model (llama-server) validates it? | |
| # Yes! And because I hit the API with `Authorization: Bearer optional_key`, the request hit gateway.py, which called: | |
| # `client.post(..., headers=llama_auth_headers())` | |
| # Wait, if `llama_auth_headers()` is `{}`, then `httpx` sends NO Authorization header! | |
| # But then why does `llama-server` complain about Invalid API Key? | |
| # Let's print out what `LLAMA_API_KEY` is in the space. | |