不知道大家都拿到Github Models的白嫖资格了没?
Github Models提供的API格式是不带v1前缀的,因此无法直接在one-api等客户端中直接使用(大家默认都是用的v1/chat/completions), 这里提供一个简单的方法来实现,Nginx做转发:
server {
listen 80;
server_name yourdomain.com;
location /v1/chat/completions {
proxy_pass https://models.inference.ai.azure.com/chat/completions;
proxy_set_header Host models.inference.ai.azure.com;
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;
# Optional: If you need to handle SSL certificates, add the following lines
proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1.2 TLSv1.3;
proxy_ssl_verify off; # This is not recommended for production, use proper SSL verification instead
}
}
=====