Download freeapis-proxy/server.py from PHhTTPS/ProxyCLI: direct link, hf CLI and curl.
- Browser
- Download file 1 kB
-
https://huggingface.co/spaces/PHhTTPS/ProxyCLI/resolve/main/freeapis-proxy/server.py
- Command line
-
hf download hf://spaces/PHhTTPS/ProxyCLI/freeapis-proxy/server.py
-
curl -L -o server.py https://huggingface.co/spaces/PHhTTPS/ProxyCLI/resolve/main/freeapis-proxy/server.py
1 kB
| from flask import Flask, request, jsonify | |
| import os | |
| import logging | |
| app = Flask(__name__) | |
| logging.basicConfig(level=logging.DEBUG) | |
| def health(): | |
| return jsonify({"status": "ok", "service": "freeapis-proxy"}) | |
| def chat_completions(): | |
| # Placeholder for actual g4f/freeapis integration | |
| return jsonify({ | |
| "id": "chatcmpl-freeapis", | |
| "object": "chat.completion", | |
| "created": 1234567890, | |
| "model": "gpt-3.5-turbo", | |
| "choices": [{ | |
| "index": 0, | |
| "message": { | |
| "role": "assistant", | |
| "content": "This is a response from the Free APIs Proxy (Placeholder)." | |
| }, | |
| "finish_reason": "stop" | |
| }] | |
| }) | |
| if __name__ == '__main__': | |
| # Ignore 'PORT' env var to avoid conflict with HF Space default (7860) | |
| port = int(os.environ.get("FREEAPIS_PORT", 5001)) | |
| app.run(host='0.0.0.0', port=port) | |