|
1 | 1 | # azure-openai-proxy
|
2 | 2 | Azure OpenAI Service Proxy. Convert Azure OpenAI API(aoai) to the official OpenAI API(oai) standard.
|
| 3 | + |
| 4 | +## Get Start |
| 5 | + |
| 6 | +### Retrieve key and endpoint |
| 7 | + |
| 8 | +To successfully make a call against Azure OpenAI, you'll need the following: |
| 9 | + |
| 10 | +| Name | Desc | Example | |
| 11 | +| --------------------- | ------------------------------------------------------------ | ----------------------------- | |
| 12 | +| AZURE_OPENAI_ENDPOINT | This value can be found in the **Keys & Endpoint** section when examining your resource from the Azure portal. Alternatively, you can find the value in **Azure OpenAI Studio** > **Playground** > **Code View**. An example endpoint is: `https://docs-test-001.openai.azure.com/`. | https://test.openai.azure.com | |
| 13 | +| AZURE_OPENAI_API_VER | [See here](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/quickstart?tabs=command-line&pivots=rest-api) or Azure OpenAI Studio | 2023-03-15-preview | |
| 14 | +| AZURE_OPENAI_DEPLOY | This value will correspond to the custom name you chose for your deployment when you deployed a model. This value can be found under **Resource Management** > **Deployments** in the Azure portal or alternatively under **Management** > **Deployments** in Azure OpenAI Studio. | gpt-35-turbo | |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +API Key: This value can be found in the **Keys & Endpoint** section when examining your resource from the Azure portal. You can use either `KEY1` or `KEY2`. |
| 19 | + |
| 20 | +> Use api key when call http api like Offical OpenAI. |
| 21 | +
|
| 22 | +### Use Docker |
| 23 | + |
| 24 | +````shell |
| 25 | +docker run -d --name=azure-openai-proxy stulzq/azure-openai-proxy |
| 26 | +```` |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +### Use ChatGPT-Web |
| 31 | + |
| 32 | +ChatGPT Web: https://github.com/Chanzhaoyu/chatgpt-web |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +Envs: |
| 37 | + |
| 38 | +- `OPENAI_API_KEY` Auzre OpenAI API Key |
| 39 | +- `OPENAI_API_BASE_URL` Proxy addr |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +docker-compose.yml: |
| 44 | + |
| 45 | +````yaml |
| 46 | +version: '3' |
| 47 | + |
| 48 | +services: |
| 49 | + chatgpt-web: |
| 50 | + image: chenzhaoyu94/chatgpt-web |
| 51 | + ports: |
| 52 | + - 3002:3002 |
| 53 | + environment: |
| 54 | + OPENAI_API_KEY: <Auzre OpenAI API Key> |
| 55 | + OPENAI_API_BASE_URL: http://azure-openai:8080 |
| 56 | + AUTH_SECRET_KEY: "" |
| 57 | + MAX_REQUEST_PER_HOUR: 1000 |
| 58 | + TIMEOUT_MS: 60000 |
| 59 | + depends_on: |
| 60 | + - azure-openai |
| 61 | + links: |
| 62 | + - azure-openai |
| 63 | + networks: |
| 64 | + - chatgpt-ns |
| 65 | + |
| 66 | + azure-openai: |
| 67 | + image: stulzq/azure-openai-proxy |
| 68 | + ports: |
| 69 | + - 8080:8080 |
| 70 | + environment: |
| 71 | + AZURE_OPENAI_ENDPOINT: <Auzre OpenAI API Endpoint> |
| 72 | + AZURE_OPENAI_DEPLOY: <Auzre OpenAI API Deployment> |
| 73 | + AZURE_OPENAI_API_VER: 2023-03-15-preview |
| 74 | + networks: |
| 75 | + - chatgpt-ns |
| 76 | + |
| 77 | +networks: |
| 78 | + chatgpt-ns: |
| 79 | + driver: bridge |
| 80 | +```` |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +## Proxy Api |
| 85 | + |
| 86 | +| Api | Status | |
| 87 | +| -------------------- | ------ | |
| 88 | +| /v1/chat/completions | Ok | |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
0 commit comments