aide没有openai key或改成deepseek后报错400 status code (no body)的解决方法

更换成DeepSeek

步骤:

1、注册deepseek获取apikey

2、修改aide配置

OpenAIModel一定要修改成deepseek-coder,否则会报错400格式错误,详细可以看文档里,如果不改的话请求参数就错了

### HTTP 429 Too Many Requests The HTTP 429 status code indicates that the user has sent too many requests in a given amount of time ("rate limiting") [^1]. This response is generated by servers to prevent clients from overloading the server with excessive or repeated requests. When a client receives an HTTP 429 response, it should understand this as an indication that further attempts at using the service will fail until sufficient time passes. The server may include information about when new requests can be made successfully through headers like `Retry-After`. #### Handling HTTP 429 Responses Without Response Body In cases where there is no response body provided alongside the HTTP 429 status code: - Clients must respect rate limits imposed by the server. - Applications should implement backoff strategies to reduce request frequency gradually after encountering such responses. - Developers might consider implementing exponential backoff algorithms which increase waiting intervals exponentially between retries following each failed attempt due to hitting these limits. For example, here’s how one could handle retry logic programmatically in Python: ```python import time from requests.exceptions import RequestException def fetch_with_retry(url, max_retries=5): delay = 1 # Initial wait time before first retry for i in range(max_retries + 1): try: response = requests.get(url) if response.status_code == 429: print(f"Hit rate limit on {url}. Retrying...") # Check Retry-After header if present retry_after = int(response.headers.get('retry-after', '0')) if retry_after > 0: time.sleep(retry_after) else: time.sleep(delay * (2 ** i)) # Exponential Backoff continue return response except RequestException as e: print(f"Request error occurred: {e}") raise Exception("Max retries exceeded") ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值