From cf09067c156b581db6cde07728cce849b7a971e3 Mon Sep 17 00:00:00 2001 From: ben Date: Sat, 1 Feb 2025 13:54:25 +0100 Subject: Expose OpenAI API compatibility using aichat --- src/nginx/nginx.conf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/nginx/nginx.conf') diff --git a/src/nginx/nginx.conf b/src/nginx/nginx.conf index 2dc6d52..5e411a9 100644 --- a/src/nginx/nginx.conf +++ b/src/nginx/nginx.conf @@ -58,4 +58,21 @@ http { proxy_set_header Connection "upgrade"; } } + server { + listen 8002; + set $deny 1; + if ($http_authorization = "Bearer $API_KEY") { + set $deny 0; + } + if ($deny) { + return 403; + } + location / { + proxy_pass http://aichat:8000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + } } -- cgit v1.2.3