|
1 | 1 | # OpenAI Proxy Docker
|
2 | 2 |
|
3 |
| -OpenAI will block API access in some countries from July 2024. |
4 |
| -The `openai-proxy-docker` provides an OpenAI API proxy server image by [Docker](https://hub.docker.com/r/aiql/openai-proxy-docker) |
| 3 | +This repository provides a Dockerized proxy for accessing the OpenAI API, allowing for simplified and streamlined interaction with the model. |
| 4 | + |
| 5 | +With the [Docker image](https://hub.docker.com/r/aiql/openai-proxy-docker), you can easily deploy a proxy instance to serve as a gateway between your application and the OpenAI API, reducing the complexity of API interactions and enabling more efficient development. |
| 6 | + |
| 7 | +## Use case |
| 8 | + |
| 9 | +1. For users who are restricted from direct access to the OpenAI API, particularly those in countries where OpenAI will be blocking API access starting July 2024 |
| 10 | +2. For users who need to access private APIs that lack Cross-Origin Resource Sharing (CORS) headers, this solution provides a proxy to bypass CORS restrictions and enable seamless API interactions. |
5 | 11 |
|
6 | 12 | ## Demo
|
7 | 13 |
|
@@ -64,10 +70,27 @@ Normally, the step should be:
|
64 | 70 |
|
65 | 71 | ## Docker Compose
|
66 | 72 |
|
67 |
| -This is an example if you want to use this for your own domain with HTTPS: |
| 73 | +### Example 1 |
| 74 | +You can apply this approach to other APIs, such as Nvidia NIM: |
| 75 | +- The proxied Nvidia NIM Completion API will be: `YOURIP:9101/v1/chat/completions` |
| 76 | + > For convenience, a readily available API is provided for those who prefer not to deploy it independently: `https://nvidia.aiql.com/v1/chat/completions` |
| 77 | +
|
| 78 | +```DOCKERFILE |
| 79 | +nvidia-proxy: |
| 80 | + image: aiql/openai-proxy-docker:latest |
| 81 | + container_name: nvidia-proxy |
| 82 | + environment: |
| 83 | + PORT: "9101" |
| 84 | + TARGET: "https://integrate.api.nvidia.com" |
| 85 | + restart: always |
| 86 | + network_mode: host |
| 87 | +``` |
| 88 | + |
| 89 | +### Example 2 |
| 90 | +You can apply this approach with your own domain over HTTPS: |
68 | 91 | - `YOUREMAILADDR@example.com` will be used to get certification notification from ACME server
|
69 |
| -- `api.example.com` will be your URL |
70 |
| - > e.g.: the proxied OpenAI Chat Completion API will be: `api.example.com/v1/chat/completions` |
| 92 | +- The proxied OpenAI Chat Completion API will be: `api.example.com/v1/chat/completions` |
| 93 | + > `api.example.com` should be replaced by your domain name |
71 | 94 |
|
72 | 95 | ```DOCKERFILE
|
73 | 96 | services:
|
|
0 commit comments