PHhTTPS's picture
Fix: Restore missing
6b0a772
from flask import Flask, request, jsonify
import os
import logging
app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG)
@app.route('/health', methods=['GET'])
def health():
return jsonify({"status": "ok", "service": "freeapis-proxy"})
@app.route('/v1/chat/completions', methods=['POST'])
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)