mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
Add token refresh handling for 401 responses across clients
- Implemented `RefreshTokens` method in client interfaces and Gemini clients. - Updated handlers to call `RefreshTokens` on 401 responses and retry requests if token refresh succeeds. - Enhanced error handling and retry logic to accommodate token refresh flow. Update README to include Qwen login instructions - Added Qwen OAuth login command instructions in both English and Chinese README files. - Made minor updates to existing command examples for consistency.
This commit is contained in:
10
README.md
10
README.md
@@ -431,10 +431,16 @@ Run the following command to login (OpenAI OAuth on port 1455):
|
||||
docker run --rm -p 1455:1455 -v /path/to/your/config.yaml:/CLIProxyAPI/config.yaml -v /path/to/your/auth-dir:/root/.cli-proxy-api eceasy/cli-proxy-api:latest /CLIProxyAPI/CLIProxyAPI --codex-login
|
||||
```
|
||||
|
||||
Run the following command to login (Claude OAuth on port 54545):
|
||||
Run the following command to logi (Claude OAuth on port 54545):
|
||||
|
||||
```bash
|
||||
docker run --rm -p 54545:54545 -v /path/to/your/config.yaml:/CLIProxyAPI/config.yaml -v /path/to/your/auth-dir:/root/.cli-proxy-api eceasy/cli-proxy-api:latest /CLIProxyAPI/CLIProxyAPI --claude-login
|
||||
docker run -rm -p 54545:54545 -v /path/to/your/config.yaml:/CLIProxyAPI/config.yaml -v /path/to/your/auth-dir:/root/.cli-proxy-api eceasy/cli-proxy-api:latest /CLIProxyAPI/CLIProxyAPI --claude-login
|
||||
```
|
||||
|
||||
Run the following command to login (Qwen OAuth):
|
||||
|
||||
```bash
|
||||
docker run -it -rm -v /path/to/your/config.yaml:/CLIProxyAPI/config.yaml -v /path/to/your/auth-dir:/root/.cli-proxy-api eceasy/cli-proxy-api:latest /CLIProxyAPI/CLIProxyAPI --qwen-login
|
||||
```
|
||||
|
||||
Run the following command to start the server:
|
||||
|
||||
@@ -433,6 +433,13 @@ docker run --rm -p 1455:1455 -v /path/to/your/config.yaml:/CLIProxyAPI/config.ya
|
||||
docker run --rm -p 54545:54545 -v /path/to/your/config.yaml:/CLIProxyAPI/config.yaml -v /path/to/your/auth-dir:/root/.cli-proxy-api eceasy/cli-proxy-api:latest /CLIProxyAPI/CLIProxyAPI --claude-login
|
||||
```
|
||||
|
||||
运行以下命令进行登录(Qwen OAuth):
|
||||
|
||||
```bash
|
||||
docker run -it -rm -v /path/to/your/config.yaml:/CLIProxyAPI/config.yaml -v /path/to/your/auth-dir:/root/.cli-proxy-api eceasy/cli-proxy-api:latest /CLIProxyAPI/CLIProxyAPI --qwen-login
|
||||
```
|
||||
|
||||
|
||||
运行以下命令启动服务器:
|
||||
|
||||
```bash
|
||||
|
||||
@@ -263,6 +263,7 @@ func StartService(cfg *config.Config, configPath string) {
|
||||
for {
|
||||
select {
|
||||
case <-ctxRefresh.Done():
|
||||
log.Debugf("refreshing tokens stopped...")
|
||||
return
|
||||
case <-ticker.C:
|
||||
checkAndRefresh()
|
||||
|
||||
Reference in New Issue
Block a user