yym68686 commited on
Commit
1934075
·
1 Parent(s): 805409f

📖 Docs: Update documentation

Browse files
Files changed (2) hide show
  1. README.md +22 -20
  2. README_CN.md +3 -3
README.md CHANGED
@@ -37,36 +37,36 @@ Using the api.yaml configuration file, multiple models can be configured, and ea
37
 
38
  ```yaml
39
  providers:
40
- - provider: provider_name # Service provider name, such as openai, anthropic, gemini, openrouter, deepbricks, can be any name, required
41
  base_url: https://api.your.com/v1/chat/completions # Backend service API address, required
42
  api: sk-YgS6GTi0b4bEabc4C # Provider's API Key, required
43
- model: # At least one model is required
44
  - gpt-4o # Usable model name, required
45
  - claude-3-5-sonnet-20240620: claude-3-5-sonnet # Rename model, claude-3-5-sonnet-20240620 is the provider's model name, claude-3-5-sonnet is the renamed name, you can use a concise name instead of the original complex name, optional
46
  - dall-e-3
47
 
48
  - provider: anthropic
49
  base_url: https://api.anthropic.com/v1/messages
50
- api: # Supports multiple API Keys, multiple keys automatically enable round-robin load balancing, at least one key, required
51
  - sk-ant-api03-bNnAOJyA-xQw_twAA
52
  - sk-ant-api02-bNnxxxx
53
  model:
54
  - claude-3-5-sonnet-20240620: claude-3-5-sonnet # Rename model, claude-3-5-sonnet-20240620 is the provider's model name, claude-3-5-sonnet is the renamed name, you can use a concise name instead of the original complex name, optional
55
- tools: true # Whether to support tools, such as code generation, document generation, etc., default is true, optional
56
 
57
  - provider: gemini
58
  base_url: https://generativelanguage.googleapis.com/v1beta # base_url supports v1beta/v1, only for Gemini models, required
59
  api: AIzaSyAN2k6IRdgw
60
  model:
61
  - gemini-1.5-pro
62
- - gemini-1.5-flash-exp-0827: gemini-1.5-flash # After renaming, the original model name gemini-1.5-flash-exp-0827 cannot be used, if you want to use the original name, you can add the original name in the model, just add the line below to use the original name
63
  - gemini-1.5-flash-exp-0827 # Add this line, both gemini-1.5-flash-exp-0827 and gemini-1.5-flash can be requested
64
  tools: true
65
 
66
  - provider: vertex
67
- project_id: gen-lang-client-xxxxxxxxxxxxxx # Description: Your Google Cloud Project ID. Format: String, usually consists of lowercase letters, numbers, and hyphens. How to get it: You can find your project ID in the project selector of the Google Cloud Console.
68
- private_key: "-----BEGIN PRIVATE KEY-----\nxxxxx\n-----END PRIVATE" # Description: Private key of Google Cloud Vertex AI service account. Format: A JSON formatted string containing the private key information of the service account. How to get it: Create a service account in the Google Cloud Console, generate a JSON formatted key file, and then set its content as the value of this environment variable.
69
- client_email: [email protected] # Description: Email address of the Google Cloud Vertex AI service account. Format: Usually a string like "[email protected]". How to get it: Generated when creating the service account, can also be found in the "IAM & admin" section of the Google Cloud Console.
70
  model:
71
  - gemini-1.5-pro
72
  - gemini-1.5-flash
@@ -75,14 +75,14 @@ providers:
75
  - claude-3-sonnet@20240229: claude-3-sonnet
76
  - claude-3-haiku@20240307: claude-3-haiku
77
  tools: true
78
- notes: https://xxxxx.com/ # You can put the service provider's website, notes, official documentation, optional
79
 
80
  - provider: cloudflare
81
  api: f42b3xxxxxxxxxxq4aoGAh # Cloudflare API Key, required
82
  cf_account_id: 8ec0xxxxxxxxxxxxe721 # Cloudflare Account ID, required
83
  model:
84
- - '@cf/meta/llama-3.1-8b-instruct': llama-3.1-8b # Rename model, @cf/meta/llama-3.1-8b-instruct is the provider's original model name, must be enclosed in quotes, otherwise a yaml syntax error, llama-3.1-8b is the renamed name, you can use a concise name instead of the original complex name, optional
85
- - '@cf/meta/llama-3.1-8b-instruct' # Must be enclosed in quotes, otherwise a yaml syntax error
86
 
87
  - provider: other-provider
88
  base_url: https://api.xxx.com/v1/messages
@@ -91,34 +91,36 @@ providers:
91
  - causallm-35b-beta2ep-q6k: causallm-35b
92
  - anthropic/claude-3-5-sonnet
93
  tools: false
94
- engine: openrouter # Force the use of a specific message format, currently supports gpt, claude, gemini, openrouter native format, optional
95
 
96
  api_keys:
97
- - api: sk-KjjI60Yf0JFWtfgRmXqFWyGtWUd9GZnmi3KlvowmRWpWpQRo # API Key, users need an API key to use this service, required
98
  model: # Models that this API Key can use, required
99
  - gpt-4o # Usable model name, can use all gpt-4o models provided by providers
100
  - claude-3-5-sonnet # Usable model name, can use all claude-3-5-sonnet models provided by providers
101
  - gemini/* # Usable model name, can only use all models provided by the provider named gemini, where gemini is the provider name, * represents all models
102
  role: admin
103
 
104
- - api: sk-pkhf60Yf0JGyJygRmXqFQyTgWUd9GZnmi3KlvowmRWpWqrhy
105
  model:
106
- - anthropic/claude-3-5-sonnet # Usable model name, can only use the claude-3-5-sonnet model provided by the provider named anthropic. This method will not match the model named anthropic/claude-3-5-sonnet provided by other-provider.
107
- - <anthropic/claude-3-5-sonnet> # By adding angle brackets on both sides of the model name, it will not look for the claude-3-5-sonnet model under the channel named anthropic, but will take the entire anthropic/claude-3-5-sonnet as the model name. This method can match the model named anthropic/claude-3-5-sonnet provided by other-provider. But it will not match the claude-3-5-sonnet model under anthropic.
 
108
  preferences:
109
- USE_ROUND_ROBIN: true # Whether to use round-robin load balancing, true to use, false to not use, default is true. When enabled, each request to the model will be made in sequence according to the model configuration. It has nothing to do with the original channel order in providers. Therefore, you can set a different request order for each API key.
110
  AUTO_RETRY: true # Whether to automatically retry, automatically retry the next provider, true to automatically retry, false to not automatically retry, default is true
111
- RATE_LIMIT: 2/min # Supports rate limiting, maximum number of requests per minute, can be set to an integer, such as 2/min, 2 times per minute, 5/hour, 5 times per hour, 10/day, 10 times per day, 10/month, 10 times per month, 10/year, 10 times per year. Default is 60/min, optional
 
112
 
113
  # Channel-level weighted load balancing configuration example
114
- - api: sk-KjjI60Yf0JFWtxxxxxxxxxxxxxxwmRWpWpQRo
115
  model:
116
  - gcp1/*: 5 # The number after the colon is the weight, the weight only supports positive integers.
117
  - gcp2/*: 3 # The larger the number, the greater the probability of the request.
118
  - gcp3/*: 2 # In this example, there are a total of 10 weights for all channels, and 5 out of 10 requests will request the gcp1/* model, 2 requests will request the gcp2/* model, and 3 requests will request the gcp3/* model.
119
 
120
  preferences:
121
- USE_ROUND_ROBIN: true # When USE_ROUND_ROBIN must be true and there is no weight after the above channels, it will request according to the original channel order, if there is weight, it will request according to the weighted order.
122
  AUTO_RETRY: true
123
  ```
124
 
 
37
 
38
  ```yaml
39
  providers:
40
+ - provider: provider_name # Service provider name, such as openai, anthropic, gemini, openrouter, deepbricks, any name is fine, required
41
  base_url: https://api.your.com/v1/chat/completions # Backend service API address, required
42
  api: sk-YgS6GTi0b4bEabc4C # Provider's API Key, required
43
+ model: # At least one model must be filled in
44
  - gpt-4o # Usable model name, required
45
  - claude-3-5-sonnet-20240620: claude-3-5-sonnet # Rename model, claude-3-5-sonnet-20240620 is the provider's model name, claude-3-5-sonnet is the renamed name, you can use a concise name instead of the original complex name, optional
46
  - dall-e-3
47
 
48
  - provider: anthropic
49
  base_url: https://api.anthropic.com/v1/messages
50
+ api: # Supports multiple API Keys, multiple keys automatically enable polling load balancing, at least one key, required
51
  - sk-ant-api03-bNnAOJyA-xQw_twAA
52
  - sk-ant-api02-bNnxxxx
53
  model:
54
  - claude-3-5-sonnet-20240620: claude-3-5-sonnet # Rename model, claude-3-5-sonnet-20240620 is the provider's model name, claude-3-5-sonnet is the renamed name, you can use a concise name instead of the original complex name, optional
55
+ tools: true # Whether to support tools, such as generating code, generating documents, etc., default is true, optional
56
 
57
  - provider: gemini
58
  base_url: https://generativelanguage.googleapis.com/v1beta # base_url supports v1beta/v1, only for Gemini models, required
59
  api: AIzaSyAN2k6IRdgw
60
  model:
61
  - gemini-1.5-pro
62
+ - gemini-1.5-flash-exp-0827: gemini-1.5-flash # After renaming, the original model name gemini-1.5-flash-exp-0827 cannot be used. If you want to use the original name, you can add the original name in the model, just add the following line to use the original name.
63
  - gemini-1.5-flash-exp-0827 # Add this line, both gemini-1.5-flash-exp-0827 and gemini-1.5-flash can be requested
64
  tools: true
65
 
66
  - provider: vertex
67
+ project_id: gen-lang-client-xxxxxxxxxxxxxx # Description: Your Google Cloud project ID. Format: String, usually composed of lowercase letters, numbers, and hyphens. How to obtain: You can find your project ID in the project selector of the Google Cloud Console.
68
+ private_key: "-----BEGIN PRIVATE KEY-----\nxxxxx\n-----END PRIVATE" # Description: Private key of the Google Cloud Vertex AI service account. Format: A JSON formatted string containing the private key information of the service account. How to obtain: Create a service account in the Google Cloud Console, generate a JSON formatted key file, and then set its content as the value of this environment variable.
69
+ client_email: [email protected] # Description: Email address of the Google Cloud Vertex AI service account. Format: Usually a string like "[email protected]". How to obtain: Generated when creating the service account, you can also view the service account details in the "IAM & Admin" section of the Google Cloud Console.
70
  model:
71
  - gemini-1.5-pro
72
  - gemini-1.5-flash
 
75
  - claude-3-sonnet@20240229: claude-3-sonnet
76
  - claude-3-haiku@20240307: claude-3-haiku
77
  tools: true
78
+ notes: https://xxxxx.com/ # You can put the provider's website, notes, official documentation, optional
79
 
80
  - provider: cloudflare
81
  api: f42b3xxxxxxxxxxq4aoGAh # Cloudflare API Key, required
82
  cf_account_id: 8ec0xxxxxxxxxxxxe721 # Cloudflare Account ID, required
83
  model:
84
+ - '@cf/meta/llama-3.1-8b-instruct': llama-3.1-8b # Rename model, @cf/meta/llama-3.1-8b-instruct is the provider's original model name, the model name must be enclosed in quotes, otherwise yaml syntax error, llama-3.1-8b is the renamed name, you can use a concise name instead of the original complex name, optional
85
+ - '@cf/meta/llama-3.1-8b-instruct' # The model name must be enclosed in quotes, otherwise yaml syntax error
86
 
87
  - provider: other-provider
88
  base_url: https://api.xxx.com/v1/messages
 
91
  - causallm-35b-beta2ep-q6k: causallm-35b
92
  - anthropic/claude-3-5-sonnet
93
  tools: false
94
+ engine: openrouter # Force to use a specific message format, currently supports gpt, claude, gemini, openrouter native format, optional
95
 
96
  api_keys:
97
+ - api: sk-KjjI60Yf0JFWxfgRmXqFWyGtWUd9GZnmi3KlvowmRWpWpQRo # API Key, users need an API key to use this service, required
98
  model: # Models that this API Key can use, required
99
  - gpt-4o # Usable model name, can use all gpt-4o models provided by providers
100
  - claude-3-5-sonnet # Usable model name, can use all claude-3-5-sonnet models provided by providers
101
  - gemini/* # Usable model name, can only use all models provided by the provider named gemini, where gemini is the provider name, * represents all models
102
  role: admin
103
 
104
+ - api: sk-pkhf60Yf0JGyJxgRmXqFQyTgWUd9GZnmi3KlvowmRWpWqrhy
105
  model:
106
+ - anthropic/claude-3-5-sonnet # Usable model name, can only use the claude-3-5-sonnet model provided by the provider named anthropic. Other providers' claude-3-5-sonnet models cannot be used. This way of writing will not match the model named anthropic/claude-3-5-sonnet provided by other-provider.
107
+ - <anthropic/claude-3-5-sonnet> # By adding angle brackets on both sides of the model name, it will not look for the claude-3-5-sonnet model under the channel named anthropic, but will treat the entire anthropic/claude-3-5-sonnet as the model name. This way of writing can match the model named anthropic/claude-3-5-sonnet provided by other-provider. But it will not match the claude-3-5-sonnet model under anthropic.
108
+ - openai-test/text-moderation-latest # When message moderation is enabled, you can use the text-moderation-latest model under the channel named openai-test for moderation.
109
  preferences:
110
+ USE_ROUND_ROBIN: true # Whether to use polling load balancing, true to use, false to not use, default is true. When polling is enabled, each request will be made in the order configured in the model. It is not related to the original channel order in providers. Therefore, you can set different request orders for each API key.
111
  AUTO_RETRY: true # Whether to automatically retry, automatically retry the next provider, true to automatically retry, false to not automatically retry, default is true
112
+ RATE_LIMIT: 2/min # Supports rate limiting, the maximum number of requests per minute, can be set to an integer, such as 2/min, 2 times per minute, 5/hour, 5 times per hour, 10/day, 10 times per day, 10/month, 10 times per month, 10/year, 10 times per year. Default is 60/min, optional
113
+ ENABLE_MODERATION: true # Whether to enable message moderation, true to enable, false to not enable, default is false. When enabled, it will conduct moderation on the user's message, if inappropriate messages are found, it will return an error message.
114
 
115
  # Channel-level weighted load balancing configuration example
116
+ - api: sk-KjjI60Yd0JFWtxxxxxxxxxxxxxxwmRWpWpQRo
117
  model:
118
  - gcp1/*: 5 # The number after the colon is the weight, the weight only supports positive integers.
119
  - gcp2/*: 3 # The larger the number, the greater the probability of the request.
120
  - gcp3/*: 2 # In this example, there are a total of 10 weights for all channels, and 5 out of 10 requests will request the gcp1/* model, 2 requests will request the gcp2/* model, and 3 requests will request the gcp3/* model.
121
 
122
  preferences:
123
+ USE_ROUND_ROBIN: true # When USE_ROUND_ROBIN must be true and there is no weight after the above channels, it will request in the original channel order, if there is weight, it will request in the weighted order.
124
  AUTO_RETRY: true
125
  ```
126
 
README_CN.md CHANGED
@@ -94,14 +94,14 @@ providers:
94
  engine: openrouter # 强制使用某个消息格式,目前支持 gpt,claude,gemini,openrouter 原生格式,选填
95
 
96
  api_keys:
97
- - api: sk-KjjI60Yf0JFWtfgRmXqFWyGtWUd9GZnmi3KlvowmRWpWpQRo # API Key,用户使用本服务需要 API key,必填
98
  model: # 该 API Key 可以使用的模型,必填
99
  - gpt-4o # 可以使用的模型名称,可以使用所有提供商提供的 gpt-4o 模型
100
  - claude-3-5-sonnet # 可以使用的模型名称,可以使用所有提供商提供的 claude-3-5-sonnet 模型
101
  - gemini/* # 可以使用的模型名称,仅可以使用名为 gemini 提供商提供的所有模型,其中 gemini 是 provider 名称,* 代表所有模型
102
  role: admin
103
 
104
- - api: sk-pkhf60Yf0JGyJygRmXqFQyTgWUd9GZnmi3KlvowmRWpWqrhy
105
  model:
106
  - anthropic/claude-3-5-sonnet # 可以使用的模型名称,仅可以使用名为 anthropic 提供商提供的 claude-3-5-sonnet 模型。其他提供商的 claude-3-5-sonnet 模型不可以使用。这种写法不会匹配到other-provider提供的名为anthropic/claude-3-5-sonnet的模型。
107
  - <anthropic/claude-3-5-sonnet> # 通过在模型名两侧加上尖括号,这样就不会去名为anthropic的渠道下去寻找claude-3-5-sonnet模型,而是将整个 anthropic/claude-3-5-sonnet 作为模型名称。这种写法可以匹配到other-provider提供的名为 anthropic/claude-3-5-sonnet 的模型。但不会匹配到anthropic下面的claude-3-5-sonnet模型。
@@ -113,7 +113,7 @@ api_keys:
113
  ENABLE_MODERATION: true # 是否开启消息道德审查,true 为开启,false 为不开启,默认为 false,当开启后,会对用户的消息进行道德审查,如果发现不当的消息,会返回错误信息。
114
 
115
  # 渠道级加权负载均衡配置示例
116
- - api: sk-KjjI60Yf0JFWtxxxxxxxxxxxxxxwmRWpWpQRo
117
  model:
118
  - gcp1/*: 5 # 冒号后面就是权重,权重仅支持正整数。
119
  - gcp2/*: 3 # 数字的大小代表权重,数字越大,请求的概率越大。
 
94
  engine: openrouter # 强制使用某个消息格式,目前支持 gpt,claude,gemini,openrouter 原生格式,选填
95
 
96
  api_keys:
97
+ - api: sk-KjjI60Yf0JFWxfgRmXqFWyGtWUd9GZnmi3KlvowmRWpWpQRo # API Key,用户使用本服务需要 API key,必填
98
  model: # 该 API Key 可以使用的模型,必填
99
  - gpt-4o # 可以使用的模型名称,可以使用所有提供商提供的 gpt-4o 模型
100
  - claude-3-5-sonnet # 可以使用的模型名称,可以使用所有提供商提供的 claude-3-5-sonnet 模型
101
  - gemini/* # 可以使用的模型名称,仅可以使用名为 gemini 提供商提供的所有模型,其中 gemini 是 provider 名称,* 代表所有模型
102
  role: admin
103
 
104
+ - api: sk-pkhf60Yf0JGyJxgRmXqFQyTgWUd9GZnmi3KlvowmRWpWqrhy
105
  model:
106
  - anthropic/claude-3-5-sonnet # 可以使用的模型名称,仅可以使用名为 anthropic 提供商提供的 claude-3-5-sonnet 模型。其他提供商的 claude-3-5-sonnet 模型不可以使用。这种写法不会匹配到other-provider提供的名为anthropic/claude-3-5-sonnet的模型。
107
  - <anthropic/claude-3-5-sonnet> # 通过在模型名两侧加上尖括号,这样就不会去名为anthropic的渠道下去寻找claude-3-5-sonnet模型,而是将整个 anthropic/claude-3-5-sonnet 作为模型名称。这种写法可以匹配到other-provider提供的名为 anthropic/claude-3-5-sonnet 的模型。但不会匹配到anthropic下面的claude-3-5-sonnet模型。
 
113
  ENABLE_MODERATION: true # 是否开启消息道德审查,true 为开启,false 为不开启,默认为 false,当开启后,会对用户的消息进行道德审查,如果发现不当的消息,会返回错误信息。
114
 
115
  # 渠道级加权负载均衡配置示例
116
+ - api: sk-KjjI60Yd0JFWtxxxxxxxxxxxxxxwmRWpWpQRo
117
  model:
118
  - gcp1/*: 5 # 冒号后面就是权重,权重仅支持正整数。
119
  - gcp2/*: 3 # 数字的大小代表权重,数字越大,请求的概率越大。