If you want to add the Nginx proxy for OpenAI API

You can use the following nginx configs.

 location /v1/chat/completions {
        proxy_pass https://api.openai.com/v1/chat/completions;
        proxy_ssl_name api.openai.com; 
        proxy_ssl_server_name on;
        # Forward all headers
        proxy_pass_request_headers on;
        # proxy_http_version 1.1;
    }

And then restart the Nginx server

sudo nginx -t
sudo systemctl restart nginx
Nginx Proxy for OpenAI API
Tagged on:         

2 thoughts on “Nginx Proxy for OpenAI API

  • November 9, 2023 at 10:09 pm
    Permalink

    这个nginx必须是墙外服务器吧?

    Reply
    • November 18, 2023 at 11:24 am
      Permalink

      是的

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.