forked from KenyonY/openai-forward
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.env
60 lines (42 loc) · 2.24 KB
/
.env
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Sample and explanation can be found in .env.example
# `LOG_CHAT`: Whether to log the chat
LOG_CHAT=true
# `CACHE_BACKEND`: Options (MEMORY, LMDB, LevelDB)
CACHE_BACKEND=LMDB
CACHE_CHAT_COMPLETION=true
DEFAULT_REQUEST_CACHING_VALUE=false
#LOG_CACHE_DB_INFO=true
#BENCHMARK_MODE=true
# `OPENAI_BASE_URL`: Forward any service address in the style of OpenAI; multiple can be specified, separated by commas.
# If more than one is specified, neither OPENAI_ROUTE_PREFIX nor EXTRA_ROUTE_PREFIX can be the root route/
OPENAI_BASE_URL=https://api.openai.com
# `OPENAI_ROUTE_PREFIX`: Specify the forwarding route prefix for all services in OpenAI style (for logging purposes)
OPENAI_ROUTE_PREFIX=/
#OPENAI_API_KEY=
#FORWARD_KEY=
CHAT_COMPLETION_ROUTE=/v1/chat/completions
COMPLETION_ROUTE=/v1/completions
# `EXTRA_BASE_URL`: Specify any service for forwarding
#EXTRA_BASE_URL=
# `EXTRA_ROUTE_PREFIX`: Route prefix matching EXTRA_BASE_URL
#EXTRA_ROUTE_PREFIX=
# `REQ_RATE_LIMIT`: i.e., Request rate limit for specified routes, user specific
# format: {route: ratelimit-string}
# ratelimit-string format [count] [per|/] [n (optional)] [second|minute|hour|day|month|year] :ref:`ratelimit-string`: https://limits.readthedocs.io/en/stable/quickstart.html#rate-limit-string-notation
REQ_RATE_LIMIT={"/v1/chat/completions":"100/2minutes", "/v1/completions":"60/minute;600/hour"}
# Backend for rate limiting: [memory, redis, memcached, ...] :ref: https://limits.readthedocs.io/en/stable/storage.html#
#REQ_RATE_LIMIT_BACKEND=redis://localhost:6379
# `GLOBAL_RATE_LIMIT`: Limits all routes not specified by `REQ_RATE_LIMIT`. If not set, there's no limit by default.
GLOBAL_RATE_LIMIT=100/minute
#`RATE_LIMIT_STRATEGY` Options: (fixed-window, fixed-window-elastic-expiry, moving-window) :ref: https://limits.readthedocs.io/en/latest/strategies.html
# `fixed-window`: most memory efficient strategy; `moving-window`:most effective for preventing bursts but has higher memory cost.
RATE_LIMIT_STRATEGY=moving-window
# Rate limit for returned tokens
TOKEN_RATE_LIMIT={"/v1/chat/completions":"60/second","/v1/completions":"60/second"}
# TCP connection timeout duration (in seconds)
TIMEOUT=6
ITER_CHUNK_TYPE=one-by-one
#ITER_CHUNK_TYPE=efficiency
#IP_BLACKLIST=
# Set timezone
TZ=Asia/Shanghai