• Stars
    star
    1,337
  • Rank 35,156 (Top 0.7 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 1 year ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Azure OpenAI Service Proxy. Convert OpenAI official API request to Azure OpenAI API request. Support GPT-4,Embeddings,Langchain. Adapter from OpenAI to Azure OpenAI.

azure-openai-proxy

License GitHub release Go Report Card CI Release PRs Welcome

English|中文

Azure OpenAI Service Proxy, convert OpenAI official API request to Azure OpenAI API request, support all models, support GPT-4,Embeddings.

aoai-proxy.jpg

Verified support projects:

Name Status
chatgpt-web
chatbox
langchain

Get Start

Retrieve key and endpoint

To successfully make a call against Azure OpenAI, you'll need the following:

Name Desc Default
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/. N
AZURE_OPENAI_API_VER See here or Azure OpenAI Studio 2023-03-15-preview
AZURE_OPENAI_MODEL_MAPPER 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-3.5-turbo=gpt-35-turbo

AZURE_OPENAI_MODEL_MAPPER is a mapping from Azure OpenAI deployed model names to official OpenAI model names. You can use commas to separate multiple mappings.

Format:

AZURE_OPENAI_MODEL_MAPPER: <OpenAI Model Name>=<Azure OpenAI deployment model name>

OpenAI Model Names: https://platform.openai.com/docs/models

Azure Deployment Names: Resource Management > Deployments

Example:

AZURE_OPENAI_MODEL_MAPPER: gpt-3.5-turbo=azure-gpt-35

Screenshot of the overview UI for an OpenAI Resource in the Azure portal with the endpoint & access keys location circled in red.

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.

Use Docker

# config by environment 
docker run -d -p 8080:8080 --name=azure-openai-proxy \
  --env AZURE_OPENAI_ENDPOINT=your_azure_endpoint \
  --env AZURE_OPENAI_API_VER=your_azure_api_ver \
  --env AZURE_OPENAI_MODEL_MAPPER=your_azure_deploy_mapper \
  stulzq/azure-openai-proxy:latest

# config by file
docker run -d -p 8080:8080 --name=azure-openai-proxy \
  -v /path/to/config-file.yaml:/app/config/config.yaml \
  stulzq/azure-openai-proxy:latest

Call API:

curl --location --request POST 'localhost:8080/v1/chat/completions' \
-H 'Authorization: Bearer <Azure OpenAI Key>' \
-H 'Content-Type: application/json' \
-d '{
    "max_tokens": 1000,
    "model": "gpt-3.5-turbo",
    "temperature": 0.8,
    "top_p": 1,
    "presence_penalty": 1,
    "messages": [
        {
            "role": "user",
            "content": "Hello"
        }
    ],
    "stream": true
}'

Use ChatGPT-Web

ChatGPT Web: https://github.com/Chanzhaoyu/chatgpt-web

chatgpt-web

Envs:

  • OPENAI_API_KEY Azure OpenAI API Key
  • AZURE_OPENAI_ENDPOINT Azure OpenAI API Endpoint
  • AZURE_OPENAI_MODEL_MAPPER Azure OpenAI API Deployment Name Mappings

docker-compose.yml:

version: '3'

services:
  chatgpt-web:
    image: chenzhaoyu94/chatgpt-web
    ports:
      - 3002:3002
    environment:
      OPENAI_API_KEY: <Azure OpenAI API Key>
      OPENAI_API_BASE_URL: http://azure-openai:8080
      # OPENAI_API_MODEL: gpt-4
      AUTH_SECRET_KEY: ""
      MAX_REQUEST_PER_HOUR: 1000
      TIMEOUT_MS: 60000
    depends_on:
      - azure-openai
    links:
      - azure-openai
    networks:
      - chatgpt-ns

  azure-openai:
    image: stulzq/azure-openai-proxy
    ports:
      - 8080:8080
    environment:
      AZURE_OPENAI_ENDPOINT: <Azure OpenAI API Endpoint>
      AZURE_OPENAI_MODEL_MAPPER: <Azure OpenAI API Deployment Mapper>
      AZURE_OPENAI_API_VER: 2023-03-15-preview
    networks:
      - chatgpt-ns

networks:
  chatgpt-ns:
    driver: bridge

Run:

docker compose up -d

More Repositories

1

IdentityServer4.Samples

Samples for IdentityServer4,use .net core 2.0
JavaScript
610
star
2

Alipay.Demo.PCPayment

支付宝PC网站支付、扫码支付 演示项目,实现支付、支付同步回调、支付异步通知、订单查询、退款、退款查询、订单关闭、扫码支付功能。采用支付宝服务端SDK:Alipay.AopSdk.Core,使用ASP.NET Core MVC 。
HTML
282
star
3

RSAUtil

.NET Core RSA algorithm using the help tool.It supports data encryption, decryption, signature and verification signature.It supports three key formats, namely: xml, pkcs1, pkcs8.It also supports key conversion for these three formats.Last also support pem formatting.
C#
281
star
4

dotnet-cnblogs-tool

博客园文章快捷发布工具
C#
173
star
5

IPTools

Querying IP address information, support longitude and latitude. 快速查询IP信息,支持国内和国外IP信息查询,支持查询经纬度。
C#
168
star
6

HttpCode.Core

简单、易用、高效 一个有态度的开源.Net Http请求框架!可以用制作爬虫,api请求等等。
C#
162
star
7

RSAExtensions

.NET Core >=3.0 & .NET Standard >=2.2, RSA Enhanced Extension. Provide XML format key import and export. Unified export and import of PKCS # 1, PKCS # 8, and XML formats. Supports PKCS # 1, PKCS # 8 PEM import and export.
C#
155
star
8

SolutionRenamer

Fast rename solution,using .net core 2.0
C#
145
star
9

Hangfire.MySql.Core

Hangfire Mysql storage components, support for. NET core 1.1,. NET core 2.0,. NET standard 2.0. Based on Hangfire.MySqlStorage, some bugs were fixed and .NET standard 2.0 support was provided.
C#
85
star
10

ToolGood.Words.Core

一款高性能敏感词(非法词/脏字)检测过滤组件,附带繁体简体互换,支持全角半角互换,汉字转拼音,模糊搜索等功能。支持.net standard 2.0
C#
73
star
11

DotnetCore.RSA

.NET Core use RSA examples,implement RSA/RSA2's Encrypt,Decrypt,Sign,Verify Sign.Use OpenSsl's private/public key.
C#
71
star
12

UrlFirewall

UrlFirewall is a lightweight, fast filtering middleware for http request urls.It supports blacklist, whitelist mode.Supports persisting filter rules to any media.You can use it in webapi, gateway, etc.
C#
66
star
13

BlogDemos

C#
63
star
14

NConsul

.NET API for Consul (http://www.consul.io/)
C#
61
star
15

BlogTools

博文快速多渠道发布工具包,支持博客园、阿里云栖社区、腾讯云+社区、慕课网手记 4种渠道。
C#
38
star
16

AspNetCore.Authentication.ApiToken

A asp.net core webapi token authentication & generator open source library.
C#
32
star
17

DotnetRSA

DotnetRSA is a .NET Core Global Tool.Dotnet RSA Tool can help you generate xml pkcs1, pkcs8 three kinds of format keys, and supports three types of mutual conversion.
C#
30
star
18

dotnetcore-image

Solution of .NET Core GDI+(Image) on Linux/Docker
C#
22
star
19

QRConsole

Print QRCode to console.
C#
18
star
20

NZookeeper

A zookeeper client library based on ZookeeperEx,easily use for Zookeeper.
C#
15
star
21

ClickHouse.DapperExtensions

Make ClickHouse available to Dapper
C#
15
star
22

FreeCert

Fast and easy generation of HTTPS certificate library (Let's Encrypt ACME).
C#
13
star
23

EntityFrameworkCore2Demo

.NET Core控制台、ASP.NET Core程序使用EntityFrameworkCore 2.0示例,包括CodeFirst、DBFirst。详细文章介绍请看:http://www.cnblogs.com/stulzq/p/7717873.html
C#
13
star
24

Influxdb.BulkInsert

Influxdb asynchronous, fast and bulk insert components.Using HTTP or UDP protocol.Influxdb 异步、快速、批量插入组件,支持http和udp协议。
C#
12
star
25

CnBlogSubscribeTool

CnBlogSubscribeTool can crawl blog home page data at regular intervals.
C#
11
star
26

DynamicDns

动态DNS,支持多个云厂商。
C#
10
star
27

ChinaRegionCode

中华人民共和国县以上行政区划代码数据
C#
10
star
28

AspNetCoreHighConcurrency.Sample

AspNetCore High Concurrency Simple Code.Describes how to use distributed locking based on redis. Lock-free and queued commodity inventory operations.
C#
9
star
29

go-linecount

Fast text file line count tool.
Go
9
star
30

kong-plugin-rate-limiting-ex

Rate Limiting Ex is the rate limit plugin for kong gateway.Based on official rate-limiting plugin, I added a property that can be customized to get the request header for the ip address.
Lua
9
star
31

hexo-deploy-agent

Go
9
star
32

ClientUpdate

Update you c/s software
C#
8
star
33

EntityFramework-Core-Migrator

EntityFramework Core Migrator
C#
7
star
34

StudyRoad

7
star
35

MonitoringSystem

prometheus & grafana help doc.
6
star
36

JenkinsSharedLibraries

Jenkins Shared Libraries
Groovy
4
star
37

hexo-statistics

Go
4
star
38

DotNetActionsExample

.NET Github Action Example
C#
4
star
39

Damocles

Open source permission system.Under development now.
C#
4
star
40

MailHelper

C#
3
star
41

blog-demo-go

my blog's article demo
Go
3
star
42

WhoisClient

A simple domain whois lookup library.
C#
3
star
43

Visual-Studio-2013-Theme-Editor

Visual Studio 2013 Theme Editor
C#
2
star
44

TestJenkins

2
star
45

Zeta

A mysterious code repository.
C#
2
star
46

stulzq

2
star
47

WindowsRemoteDesktopCleanTool

Clean up windows remote desktop records
C#
2
star
48

leetcode

1
star
49

Algorithms

C#
1
star
50

vuepress-sample

JavaScript
1
star
51

add-license--header

Easily add a License header to the source code.
1
star