📖 Docs: Update documentation
Browse files- README.md +21 -0
- README_CN.md +21 -0
README.md
CHANGED
@@ -399,6 +399,27 @@ The channel-level timeout setting has higher priority than the global model time
|
|
399 |
|
400 |
By adjusting the model timeout time, you can avoid the error of some channels timing out. If you encounter the error `{'error': '500', 'details': 'fetch_response_stream Read Response Timeout'}`, please try to increase the model timeout time.
|
401 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
## ⭐ Star History
|
403 |
|
404 |
<a href="https://github.com/yym68686/uni-api/stargazers">
|
|
|
399 |
|
400 |
By adjusting the model timeout time, you can avoid the error of some channels timing out. If you encounter the error `{'error': '500', 'details': 'fetch_response_stream Read Response Timeout'}`, please try to increase the model timeout time.
|
401 |
|
402 |
+
- How does api_key_rate_limit work? How do I set the same rate limit for multiple models?
|
403 |
+
|
404 |
+
If you want to set the same frequency limit for the four models gemini-1.5-pro-latest, gemini-1.5-pro, gemini-1.5-pro-001, gemini-1.5-pro-002 simultaneously, you can set it like this:
|
405 |
+
|
406 |
+
```yaml
|
407 |
+
api_key_rate_limit:
|
408 |
+
gemini-1.5-pro: 1000/min
|
409 |
+
```
|
410 |
+
|
411 |
+
This will match all models containing the gemini-1.5-pro string. The frequency limit for these four models, gemini-1.5-pro-latest, gemini-1.5-pro, gemini-1.5-pro-001, gemini-1.5-pro-002, will all be set to 1000/min. The logic for configuring the api_key_rate_limit field is as follows, here is a sample configuration file:
|
412 |
+
|
413 |
+
```yaml
|
414 |
+
api_key_rate_limit:
|
415 |
+
gemini-1.5-pro: 1000/min
|
416 |
+
gemini-1.5-pro-002: 500/min
|
417 |
+
```
|
418 |
+
|
419 |
+
At this time, if there is a request using the model gemini-1.5-pro-002.
|
420 |
+
|
421 |
+
First, the uni-api will attempt to precisely match the model in the api_key_rate_limit. If the rate limit for gemini-1.5-pro-002 is set, then the rate limit for gemini-1.5-pro-002 is 500/min. If the requested model at this time is not gemini-1.5-pro-002, but gemini-1.5-pro-latest, since the api_key_rate_limit does not have a rate limit set for gemini-1.5-pro-latest, it will look for any model with the same prefix as gemini-1.5-pro-latest that has been set, thus the rate limit for gemini-1.5-pro-latest will be set to 1000/min.
|
422 |
+
|
423 |
## ⭐ Star History
|
424 |
|
425 |
<a href="https://github.com/yym68686/uni-api/stargazers">
|
README_CN.md
CHANGED
@@ -399,6 +399,27 @@ api_keys:
|
|
399 |
|
400 |
通过调整模型超时时间,可以避免出现某些渠道请求超时报错的情况。如果你遇到 `{'error': '500', 'details': 'fetch_response_stream Read Response Timeout'}` 错误,请尝试增加模型超时时间。
|
401 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
## ⭐ Star 历史
|
403 |
|
404 |
<a href="https://github.com/yym68686/uni-api/stargazers">
|
|
|
399 |
|
400 |
通过调整模型超时时间,可以避免出现某些渠道请求超时报错的情况。如果你遇到 `{'error': '500', 'details': 'fetch_response_stream Read Response Timeout'}` 错误,请尝试增加模型超时时间。
|
401 |
|
402 |
+
- api_key_rate_limit 是怎么工作的?我如何给多个模型设置相同的频率限制?
|
403 |
+
|
404 |
+
如果你想同时给 gemini-1.5-pro-latest,gemini-1.5-pro,gemini-1.5-pro-001,gemini-1.5-pro-002 这四个模型设置相同的频率限制,可以这样设置:
|
405 |
+
|
406 |
+
```yaml
|
407 |
+
api_key_rate_limit:
|
408 |
+
gemini-1.5-pro: 1000/min
|
409 |
+
```
|
410 |
+
|
411 |
+
这会匹配所有含有 gemini-1.5-pro 字符串的模型。gemini-1.5-pro-latest,gemini-1.5-pro,gemini-1.5-pro-001,gemini-1.5-pro-002 这四个模型频率限制都会设置为 1000/min。api_key_rate_limit 字段配置的逻辑如下,这是一个示例配置文件:
|
412 |
+
|
413 |
+
```yaml
|
414 |
+
api_key_rate_limit:
|
415 |
+
gemini-1.5-pro: 1000/min
|
416 |
+
gemini-1.5-pro-002: 500/min
|
417 |
+
```
|
418 |
+
|
419 |
+
此时如果有一个使用模型 gemini-1.5-pro-002 的请求。
|
420 |
+
|
421 |
+
首先,uni-api 会尝试精确匹配 api_key_rate_limit 的模型。如果刚好设置了 gemini-1.5-pro-002 的频率限制,则 gemini-1.5-pro-002 的频率限制则为 500/min,如果此时请求的模型不是 gemini-1.5-pro-002,而是 gemini-1.5-pro-latest,由于 api_key_rate_limit 没有设置 gemini-1.5-pro-latest 的频率限制,因此会寻找有没有前缀和 gemini-1.5-pro-latest 相同的模型被设置了,因此 gemini-1.5-pro-latest 的频率限制会被设置为 1000/min。
|
422 |
+
|
423 |
## ⭐ Star 历史
|
424 |
|
425 |
<a href="https://github.com/yym68686/uni-api/stargazers">
|