Spaces:
Paused
Paused
**refactor(middleware): extract request logging logic and optimize condition checks**
Browse files- Added `shouldLogRequest` helper to simplify path-based request logging logic.
- Updated middleware to skip management endpoints for improved security.
- Introduced an explicit `nil` logger check for minimal overhead.
- Updated dependencies in `go.mod`.
**feat(auth): add handling for 404 response with retry logic**
- Introduced support for 404 `not_found` status with a 12-hour backoff period.
- Updated `manager.go` to align state and status messages for 404 scenarios.
**refactor(translator): comment out debug logging in Gemini responses request**
go.mod
CHANGED
|
@@ -3,6 +3,7 @@ module github.com/router-for-me/CLIProxyAPI/v6
|
|
| 3 |
go 1.24.0
|
| 4 |
|
| 5 |
require (
|
|
|
|
| 6 |
github.com/fsnotify/fsnotify v1.9.0
|
| 7 |
github.com/gin-gonic/gin v1.10.1
|
| 8 |
github.com/go-git/go-git/v6 v6.0.0-20251009132922-75a182125145
|
|
@@ -28,7 +29,6 @@ require (
|
|
| 28 |
cloud.google.com/go/compute/metadata v0.3.0 // indirect
|
| 29 |
github.com/Microsoft/go-winio v0.6.2 // indirect
|
| 30 |
github.com/ProtonMail/go-crypto v1.3.0 // indirect
|
| 31 |
-
github.com/andybalholm/brotli v1.0.6 // indirect
|
| 32 |
github.com/bytedance/sonic v1.11.6 // indirect
|
| 33 |
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
| 34 |
github.com/cloudflare/circl v1.6.1 // indirect
|
|
|
|
| 3 |
go 1.24.0
|
| 4 |
|
| 5 |
require (
|
| 6 |
+
github.com/andybalholm/brotli v1.0.6
|
| 7 |
github.com/fsnotify/fsnotify v1.9.0
|
| 8 |
github.com/gin-gonic/gin v1.10.1
|
| 9 |
github.com/go-git/go-git/v6 v6.0.0-20251009132922-75a182125145
|
|
|
|
| 29 |
cloud.google.com/go/compute/metadata v0.3.0 // indirect
|
| 30 |
github.com/Microsoft/go-winio v0.6.2 // indirect
|
| 31 |
github.com/ProtonMail/go-crypto v1.3.0 // indirect
|
|
|
|
| 32 |
github.com/bytedance/sonic v1.11.6 // indirect
|
| 33 |
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
| 34 |
github.com/cloudflare/circl v1.6.1 // indirect
|
internal/api/middleware/request_logging.go
CHANGED
|
@@ -19,13 +19,13 @@ import (
|
|
| 19 |
// logger, the middleware has minimal overhead.
|
| 20 |
func RequestLoggingMiddleware(logger logging.RequestLogger) gin.HandlerFunc {
|
| 21 |
return func(c *gin.Context) {
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
shouldLog = true
|
| 26 |
}
|
| 27 |
|
| 28 |
-
|
|
|
|
| 29 |
c.Next()
|
| 30 |
return
|
| 31 |
}
|
|
@@ -101,3 +101,13 @@ func captureRequestInfo(c *gin.Context) (*RequestInfo, error) {
|
|
| 101 |
Body: body,
|
| 102 |
}, nil
|
| 103 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
// logger, the middleware has minimal overhead.
|
| 20 |
func RequestLoggingMiddleware(logger logging.RequestLogger) gin.HandlerFunc {
|
| 21 |
return func(c *gin.Context) {
|
| 22 |
+
if logger == nil {
|
| 23 |
+
c.Next()
|
| 24 |
+
return
|
|
|
|
| 25 |
}
|
| 26 |
|
| 27 |
+
path := c.Request.URL.Path
|
| 28 |
+
if !shouldLogRequest(path) {
|
| 29 |
c.Next()
|
| 30 |
return
|
| 31 |
}
|
|
|
|
| 101 |
Body: body,
|
| 102 |
}, nil
|
| 103 |
}
|
| 104 |
+
|
| 105 |
+
// shouldLogRequest determines whether the request should be logged.
|
| 106 |
+
// It skips management endpoints to avoid leaking secrets but allows
|
| 107 |
+
// all other routes, including module-provided ones, to honor request-log.
|
| 108 |
+
func shouldLogRequest(path string) bool {
|
| 109 |
+
if strings.HasPrefix(path, "/v0/management") || strings.HasPrefix(path, "/management") {
|
| 110 |
+
return false
|
| 111 |
+
}
|
| 112 |
+
return true
|
| 113 |
+
}
|
internal/registry/model_definitions.go
CHANGED
|
@@ -3,8 +3,6 @@
|
|
| 3 |
// when registering their supported models.
|
| 4 |
package registry
|
| 5 |
|
| 6 |
-
import "time"
|
| 7 |
-
|
| 8 |
// GetClaudeModels returns the standard Claude model definitions
|
| 9 |
func GetClaudeModels() []*ModelInfo {
|
| 10 |
return []*ModelInfo{
|
|
@@ -426,7 +424,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 426 |
{
|
| 427 |
ID: "gpt-5",
|
| 428 |
Object: "model",
|
| 429 |
-
Created:
|
| 430 |
OwnedBy: "openai",
|
| 431 |
Type: "openai",
|
| 432 |
Version: "gpt-5-2025-08-07",
|
|
@@ -439,7 +437,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 439 |
{
|
| 440 |
ID: "gpt-5-minimal",
|
| 441 |
Object: "model",
|
| 442 |
-
Created:
|
| 443 |
OwnedBy: "openai",
|
| 444 |
Type: "openai",
|
| 445 |
Version: "gpt-5-2025-08-07",
|
|
@@ -452,7 +450,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 452 |
{
|
| 453 |
ID: "gpt-5-low",
|
| 454 |
Object: "model",
|
| 455 |
-
Created:
|
| 456 |
OwnedBy: "openai",
|
| 457 |
Type: "openai",
|
| 458 |
Version: "gpt-5-2025-08-07",
|
|
@@ -465,7 +463,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 465 |
{
|
| 466 |
ID: "gpt-5-medium",
|
| 467 |
Object: "model",
|
| 468 |
-
Created:
|
| 469 |
OwnedBy: "openai",
|
| 470 |
Type: "openai",
|
| 471 |
Version: "gpt-5-2025-08-07",
|
|
@@ -478,7 +476,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 478 |
{
|
| 479 |
ID: "gpt-5-high",
|
| 480 |
Object: "model",
|
| 481 |
-
Created:
|
| 482 |
OwnedBy: "openai",
|
| 483 |
Type: "openai",
|
| 484 |
Version: "gpt-5-2025-08-07",
|
|
@@ -491,7 +489,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 491 |
{
|
| 492 |
ID: "gpt-5-codex",
|
| 493 |
Object: "model",
|
| 494 |
-
Created:
|
| 495 |
OwnedBy: "openai",
|
| 496 |
Type: "openai",
|
| 497 |
Version: "gpt-5-2025-09-15",
|
|
@@ -504,7 +502,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 504 |
{
|
| 505 |
ID: "gpt-5-codex-low",
|
| 506 |
Object: "model",
|
| 507 |
-
Created:
|
| 508 |
OwnedBy: "openai",
|
| 509 |
Type: "openai",
|
| 510 |
Version: "gpt-5-2025-09-15",
|
|
@@ -517,7 +515,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 517 |
{
|
| 518 |
ID: "gpt-5-codex-medium",
|
| 519 |
Object: "model",
|
| 520 |
-
Created:
|
| 521 |
OwnedBy: "openai",
|
| 522 |
Type: "openai",
|
| 523 |
Version: "gpt-5-2025-09-15",
|
|
@@ -530,7 +528,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 530 |
{
|
| 531 |
ID: "gpt-5-codex-high",
|
| 532 |
Object: "model",
|
| 533 |
-
Created:
|
| 534 |
OwnedBy: "openai",
|
| 535 |
Type: "openai",
|
| 536 |
Version: "gpt-5-2025-09-15",
|
|
@@ -543,7 +541,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 543 |
{
|
| 544 |
ID: "gpt-5-codex-mini",
|
| 545 |
Object: "model",
|
| 546 |
-
Created:
|
| 547 |
OwnedBy: "openai",
|
| 548 |
Type: "openai",
|
| 549 |
Version: "gpt-5-2025-11-07",
|
|
@@ -556,7 +554,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 556 |
{
|
| 557 |
ID: "gpt-5-codex-mini-medium",
|
| 558 |
Object: "model",
|
| 559 |
-
Created:
|
| 560 |
OwnedBy: "openai",
|
| 561 |
Type: "openai",
|
| 562 |
Version: "gpt-5-2025-11-07",
|
|
@@ -569,7 +567,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 569 |
{
|
| 570 |
ID: "gpt-5-codex-mini-high",
|
| 571 |
Object: "model",
|
| 572 |
-
Created:
|
| 573 |
OwnedBy: "openai",
|
| 574 |
Type: "openai",
|
| 575 |
Version: "gpt-5-2025-11-07",
|
|
@@ -582,7 +580,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 582 |
{
|
| 583 |
ID: "gpt-5.1",
|
| 584 |
Object: "model",
|
| 585 |
-
Created:
|
| 586 |
OwnedBy: "openai",
|
| 587 |
Type: "openai",
|
| 588 |
Version: "gpt-5.1-2025-11-12",
|
|
@@ -595,7 +593,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 595 |
{
|
| 596 |
ID: "gpt-5.1-none",
|
| 597 |
Object: "model",
|
| 598 |
-
Created:
|
| 599 |
OwnedBy: "openai",
|
| 600 |
Type: "openai",
|
| 601 |
Version: "gpt-5.1-2025-11-12",
|
|
@@ -608,7 +606,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 608 |
{
|
| 609 |
ID: "gpt-5.1-low",
|
| 610 |
Object: "model",
|
| 611 |
-
Created:
|
| 612 |
OwnedBy: "openai",
|
| 613 |
Type: "openai",
|
| 614 |
Version: "gpt-5.1-2025-11-12",
|
|
@@ -621,7 +619,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 621 |
{
|
| 622 |
ID: "gpt-5.1-medium",
|
| 623 |
Object: "model",
|
| 624 |
-
Created:
|
| 625 |
OwnedBy: "openai",
|
| 626 |
Type: "openai",
|
| 627 |
Version: "gpt-5.1-2025-11-12",
|
|
@@ -634,7 +632,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 634 |
{
|
| 635 |
ID: "gpt-5.1-high",
|
| 636 |
Object: "model",
|
| 637 |
-
Created:
|
| 638 |
OwnedBy: "openai",
|
| 639 |
Type: "openai",
|
| 640 |
Version: "gpt-5.1-2025-11-12",
|
|
@@ -647,7 +645,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 647 |
{
|
| 648 |
ID: "gpt-5.1-codex",
|
| 649 |
Object: "model",
|
| 650 |
-
Created:
|
| 651 |
OwnedBy: "openai",
|
| 652 |
Type: "openai",
|
| 653 |
Version: "gpt-5.1-2025-11-12",
|
|
@@ -660,7 +658,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 660 |
{
|
| 661 |
ID: "gpt-5.1-codex-low",
|
| 662 |
Object: "model",
|
| 663 |
-
Created:
|
| 664 |
OwnedBy: "openai",
|
| 665 |
Type: "openai",
|
| 666 |
Version: "gpt-5.1-2025-11-12",
|
|
@@ -673,7 +671,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 673 |
{
|
| 674 |
ID: "gpt-5.1-codex-medium",
|
| 675 |
Object: "model",
|
| 676 |
-
Created:
|
| 677 |
OwnedBy: "openai",
|
| 678 |
Type: "openai",
|
| 679 |
Version: "gpt-5.1-2025-11-12",
|
|
@@ -686,7 +684,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 686 |
{
|
| 687 |
ID: "gpt-5.1-codex-high",
|
| 688 |
Object: "model",
|
| 689 |
-
Created:
|
| 690 |
OwnedBy: "openai",
|
| 691 |
Type: "openai",
|
| 692 |
Version: "gpt-5.1-2025-11-12",
|
|
@@ -699,7 +697,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 699 |
{
|
| 700 |
ID: "gpt-5.1-codex-mini",
|
| 701 |
Object: "model",
|
| 702 |
-
Created:
|
| 703 |
OwnedBy: "openai",
|
| 704 |
Type: "openai",
|
| 705 |
Version: "gpt-5.1-2025-11-12",
|
|
@@ -712,7 +710,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 712 |
{
|
| 713 |
ID: "gpt-5.1-codex-mini-medium",
|
| 714 |
Object: "model",
|
| 715 |
-
Created:
|
| 716 |
OwnedBy: "openai",
|
| 717 |
Type: "openai",
|
| 718 |
Version: "gpt-5.1-2025-11-12",
|
|
@@ -725,7 +723,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 725 |
{
|
| 726 |
ID: "gpt-5.1-codex-mini-high",
|
| 727 |
Object: "model",
|
| 728 |
-
Created:
|
| 729 |
OwnedBy: "openai",
|
| 730 |
Type: "openai",
|
| 731 |
Version: "gpt-5.1-2025-11-12",
|
|
@@ -739,7 +737,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 739 |
{
|
| 740 |
ID: "gpt-5.1-codex-max",
|
| 741 |
Object: "model",
|
| 742 |
-
Created:
|
| 743 |
OwnedBy: "openai",
|
| 744 |
Type: "openai",
|
| 745 |
Version: "gpt-5.1-max",
|
|
@@ -752,7 +750,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 752 |
{
|
| 753 |
ID: "gpt-5.1-codex-max-low",
|
| 754 |
Object: "model",
|
| 755 |
-
Created:
|
| 756 |
OwnedBy: "openai",
|
| 757 |
Type: "openai",
|
| 758 |
Version: "gpt-5.1-max",
|
|
@@ -765,7 +763,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 765 |
{
|
| 766 |
ID: "gpt-5.1-codex-max-medium",
|
| 767 |
Object: "model",
|
| 768 |
-
Created:
|
| 769 |
OwnedBy: "openai",
|
| 770 |
Type: "openai",
|
| 771 |
Version: "gpt-5.1-max",
|
|
@@ -778,7 +776,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 778 |
{
|
| 779 |
ID: "gpt-5.1-codex-max-high",
|
| 780 |
Object: "model",
|
| 781 |
-
Created:
|
| 782 |
OwnedBy: "openai",
|
| 783 |
Type: "openai",
|
| 784 |
Version: "gpt-5.1-max",
|
|
@@ -791,7 +789,7 @@ func GetOpenAIModels() []*ModelInfo {
|
|
| 791 |
{
|
| 792 |
ID: "gpt-5.1-codex-max-xhigh",
|
| 793 |
Object: "model",
|
| 794 |
-
Created:
|
| 795 |
OwnedBy: "openai",
|
| 796 |
Type: "openai",
|
| 797 |
Version: "gpt-5.1-max",
|
|
@@ -810,7 +808,7 @@ func GetQwenModels() []*ModelInfo {
|
|
| 810 |
{
|
| 811 |
ID: "qwen3-coder-plus",
|
| 812 |
Object: "model",
|
| 813 |
-
Created:
|
| 814 |
OwnedBy: "qwen",
|
| 815 |
Type: "qwen",
|
| 816 |
Version: "3.0",
|
|
@@ -823,7 +821,7 @@ func GetQwenModels() []*ModelInfo {
|
|
| 823 |
{
|
| 824 |
ID: "qwen3-coder-flash",
|
| 825 |
Object: "model",
|
| 826 |
-
Created:
|
| 827 |
OwnedBy: "qwen",
|
| 828 |
Type: "qwen",
|
| 829 |
Version: "3.0",
|
|
@@ -836,7 +834,7 @@ func GetQwenModels() []*ModelInfo {
|
|
| 836 |
{
|
| 837 |
ID: "vision-model",
|
| 838 |
Object: "model",
|
| 839 |
-
Created:
|
| 840 |
OwnedBy: "qwen",
|
| 841 |
Type: "qwen",
|
| 842 |
Version: "3.0",
|
|
@@ -852,38 +850,38 @@ func GetQwenModels() []*ModelInfo {
|
|
| 852 |
// GetIFlowModels returns supported models for iFlow OAuth accounts.
|
| 853 |
|
| 854 |
func GetIFlowModels() []*ModelInfo {
|
| 855 |
-
created := time.Now().Unix()
|
| 856 |
entries := []struct {
|
| 857 |
ID string
|
| 858 |
DisplayName string
|
| 859 |
Description string
|
|
|
|
| 860 |
}{
|
| 861 |
-
{ID: "tstars2.0", DisplayName: "TStars-2.0", Description: "iFlow TStars-2.0 multimodal assistant"},
|
| 862 |
-
{ID: "qwen3-coder-plus", DisplayName: "Qwen3-Coder-Plus", Description: "Qwen3 Coder Plus code generation"},
|
| 863 |
-
{ID: "qwen3-coder", DisplayName: "Qwen3-Coder-480B-A35B", Description: "Qwen3 Coder 480B A35B"},
|
| 864 |
-
{ID: "qwen3-max", DisplayName: "Qwen3-Max", Description: "Qwen3 flagship model"},
|
| 865 |
-
{ID: "qwen3-vl-plus", DisplayName: "Qwen3-VL-Plus", Description: "Qwen3 multimodal vision-language"},
|
| 866 |
-
{ID: "qwen3-max-preview", DisplayName: "Qwen3-Max-Preview", Description: "Qwen3 Max preview build"},
|
| 867 |
-
{ID: "kimi-k2-0905", DisplayName: "Kimi-K2-Instruct-0905", Description: "Moonshot Kimi K2 instruct 0905"},
|
| 868 |
-
{ID: "glm-4.6", DisplayName: "GLM-4.6", Description: "Zhipu GLM 4.6 general model"},
|
| 869 |
-
{ID: "kimi-k2", DisplayName: "Kimi-K2", Description: "Moonshot Kimi K2 general model"},
|
| 870 |
-
{ID: "kimi-k2-thinking", DisplayName: "Kimi-K2-Thinking", Description: "Moonshot Kimi K2 general model"},
|
| 871 |
-
{ID: "deepseek-v3.2", DisplayName: "DeepSeek-V3.2-Exp", Description: "DeepSeek V3.2 experimental"},
|
| 872 |
-
{ID: "deepseek-v3.1", DisplayName: "DeepSeek-V3.1-Terminus", Description: "DeepSeek V3.1 Terminus"},
|
| 873 |
-
{ID: "deepseek-r1", DisplayName: "DeepSeek-R1", Description: "DeepSeek reasoning model R1"},
|
| 874 |
-
{ID: "deepseek-v3", DisplayName: "DeepSeek-V3-671B", Description: "DeepSeek V3 671B"},
|
| 875 |
-
{ID: "qwen3-32b", DisplayName: "Qwen3-32B", Description: "Qwen3 32B"},
|
| 876 |
-
{ID: "qwen3-235b-a22b-thinking-2507", DisplayName: "Qwen3-235B-A22B-Thinking", Description: "Qwen3 235B A22B Thinking (2507)"},
|
| 877 |
-
{ID: "qwen3-235b-a22b-instruct", DisplayName: "Qwen3-235B-A22B-Instruct", Description: "Qwen3 235B A22B Instruct"},
|
| 878 |
-
{ID: "qwen3-235b", DisplayName: "Qwen3-235B-A22B", Description: "Qwen3 235B A22B"},
|
| 879 |
-
{ID: "minimax-m2", DisplayName: "MiniMax-M2", Description: "MiniMax M2"},
|
| 880 |
}
|
| 881 |
models := make([]*ModelInfo, 0, len(entries))
|
| 882 |
for _, entry := range entries {
|
| 883 |
models = append(models, &ModelInfo{
|
| 884 |
ID: entry.ID,
|
| 885 |
Object: "model",
|
| 886 |
-
Created:
|
| 887 |
OwnedBy: "iflow",
|
| 888 |
Type: "iflow",
|
| 889 |
DisplayName: entry.DisplayName,
|
|
|
|
| 3 |
// when registering their supported models.
|
| 4 |
package registry
|
| 5 |
|
|
|
|
|
|
|
| 6 |
// GetClaudeModels returns the standard Claude model definitions
|
| 7 |
func GetClaudeModels() []*ModelInfo {
|
| 8 |
return []*ModelInfo{
|
|
|
|
| 424 |
{
|
| 425 |
ID: "gpt-5",
|
| 426 |
Object: "model",
|
| 427 |
+
Created: 1754524800,
|
| 428 |
OwnedBy: "openai",
|
| 429 |
Type: "openai",
|
| 430 |
Version: "gpt-5-2025-08-07",
|
|
|
|
| 437 |
{
|
| 438 |
ID: "gpt-5-minimal",
|
| 439 |
Object: "model",
|
| 440 |
+
Created: 1754524800,
|
| 441 |
OwnedBy: "openai",
|
| 442 |
Type: "openai",
|
| 443 |
Version: "gpt-5-2025-08-07",
|
|
|
|
| 450 |
{
|
| 451 |
ID: "gpt-5-low",
|
| 452 |
Object: "model",
|
| 453 |
+
Created: 1754524800,
|
| 454 |
OwnedBy: "openai",
|
| 455 |
Type: "openai",
|
| 456 |
Version: "gpt-5-2025-08-07",
|
|
|
|
| 463 |
{
|
| 464 |
ID: "gpt-5-medium",
|
| 465 |
Object: "model",
|
| 466 |
+
Created: 1754524800,
|
| 467 |
OwnedBy: "openai",
|
| 468 |
Type: "openai",
|
| 469 |
Version: "gpt-5-2025-08-07",
|
|
|
|
| 476 |
{
|
| 477 |
ID: "gpt-5-high",
|
| 478 |
Object: "model",
|
| 479 |
+
Created: 1754524800,
|
| 480 |
OwnedBy: "openai",
|
| 481 |
Type: "openai",
|
| 482 |
Version: "gpt-5-2025-08-07",
|
|
|
|
| 489 |
{
|
| 490 |
ID: "gpt-5-codex",
|
| 491 |
Object: "model",
|
| 492 |
+
Created: 1757894400,
|
| 493 |
OwnedBy: "openai",
|
| 494 |
Type: "openai",
|
| 495 |
Version: "gpt-5-2025-09-15",
|
|
|
|
| 502 |
{
|
| 503 |
ID: "gpt-5-codex-low",
|
| 504 |
Object: "model",
|
| 505 |
+
Created: 1757894400,
|
| 506 |
OwnedBy: "openai",
|
| 507 |
Type: "openai",
|
| 508 |
Version: "gpt-5-2025-09-15",
|
|
|
|
| 515 |
{
|
| 516 |
ID: "gpt-5-codex-medium",
|
| 517 |
Object: "model",
|
| 518 |
+
Created: 1757894400,
|
| 519 |
OwnedBy: "openai",
|
| 520 |
Type: "openai",
|
| 521 |
Version: "gpt-5-2025-09-15",
|
|
|
|
| 528 |
{
|
| 529 |
ID: "gpt-5-codex-high",
|
| 530 |
Object: "model",
|
| 531 |
+
Created: 1757894400,
|
| 532 |
OwnedBy: "openai",
|
| 533 |
Type: "openai",
|
| 534 |
Version: "gpt-5-2025-09-15",
|
|
|
|
| 541 |
{
|
| 542 |
ID: "gpt-5-codex-mini",
|
| 543 |
Object: "model",
|
| 544 |
+
Created: 1762473600,
|
| 545 |
OwnedBy: "openai",
|
| 546 |
Type: "openai",
|
| 547 |
Version: "gpt-5-2025-11-07",
|
|
|
|
| 554 |
{
|
| 555 |
ID: "gpt-5-codex-mini-medium",
|
| 556 |
Object: "model",
|
| 557 |
+
Created: 1762473600,
|
| 558 |
OwnedBy: "openai",
|
| 559 |
Type: "openai",
|
| 560 |
Version: "gpt-5-2025-11-07",
|
|
|
|
| 567 |
{
|
| 568 |
ID: "gpt-5-codex-mini-high",
|
| 569 |
Object: "model",
|
| 570 |
+
Created: 1762473600,
|
| 571 |
OwnedBy: "openai",
|
| 572 |
Type: "openai",
|
| 573 |
Version: "gpt-5-2025-11-07",
|
|
|
|
| 580 |
{
|
| 581 |
ID: "gpt-5.1",
|
| 582 |
Object: "model",
|
| 583 |
+
Created: 1762905600,
|
| 584 |
OwnedBy: "openai",
|
| 585 |
Type: "openai",
|
| 586 |
Version: "gpt-5.1-2025-11-12",
|
|
|
|
| 593 |
{
|
| 594 |
ID: "gpt-5.1-none",
|
| 595 |
Object: "model",
|
| 596 |
+
Created: 1762905600,
|
| 597 |
OwnedBy: "openai",
|
| 598 |
Type: "openai",
|
| 599 |
Version: "gpt-5.1-2025-11-12",
|
|
|
|
| 606 |
{
|
| 607 |
ID: "gpt-5.1-low",
|
| 608 |
Object: "model",
|
| 609 |
+
Created: 1762905600,
|
| 610 |
OwnedBy: "openai",
|
| 611 |
Type: "openai",
|
| 612 |
Version: "gpt-5.1-2025-11-12",
|
|
|
|
| 619 |
{
|
| 620 |
ID: "gpt-5.1-medium",
|
| 621 |
Object: "model",
|
| 622 |
+
Created: 1762905600,
|
| 623 |
OwnedBy: "openai",
|
| 624 |
Type: "openai",
|
| 625 |
Version: "gpt-5.1-2025-11-12",
|
|
|
|
| 632 |
{
|
| 633 |
ID: "gpt-5.1-high",
|
| 634 |
Object: "model",
|
| 635 |
+
Created: 1762905600,
|
| 636 |
OwnedBy: "openai",
|
| 637 |
Type: "openai",
|
| 638 |
Version: "gpt-5.1-2025-11-12",
|
|
|
|
| 645 |
{
|
| 646 |
ID: "gpt-5.1-codex",
|
| 647 |
Object: "model",
|
| 648 |
+
Created: 1762905600,
|
| 649 |
OwnedBy: "openai",
|
| 650 |
Type: "openai",
|
| 651 |
Version: "gpt-5.1-2025-11-12",
|
|
|
|
| 658 |
{
|
| 659 |
ID: "gpt-5.1-codex-low",
|
| 660 |
Object: "model",
|
| 661 |
+
Created: 1762905600,
|
| 662 |
OwnedBy: "openai",
|
| 663 |
Type: "openai",
|
| 664 |
Version: "gpt-5.1-2025-11-12",
|
|
|
|
| 671 |
{
|
| 672 |
ID: "gpt-5.1-codex-medium",
|
| 673 |
Object: "model",
|
| 674 |
+
Created: 1762905600,
|
| 675 |
OwnedBy: "openai",
|
| 676 |
Type: "openai",
|
| 677 |
Version: "gpt-5.1-2025-11-12",
|
|
|
|
| 684 |
{
|
| 685 |
ID: "gpt-5.1-codex-high",
|
| 686 |
Object: "model",
|
| 687 |
+
Created: 1762905600,
|
| 688 |
OwnedBy: "openai",
|
| 689 |
Type: "openai",
|
| 690 |
Version: "gpt-5.1-2025-11-12",
|
|
|
|
| 697 |
{
|
| 698 |
ID: "gpt-5.1-codex-mini",
|
| 699 |
Object: "model",
|
| 700 |
+
Created: 1762905600,
|
| 701 |
OwnedBy: "openai",
|
| 702 |
Type: "openai",
|
| 703 |
Version: "gpt-5.1-2025-11-12",
|
|
|
|
| 710 |
{
|
| 711 |
ID: "gpt-5.1-codex-mini-medium",
|
| 712 |
Object: "model",
|
| 713 |
+
Created: 1762905600,
|
| 714 |
OwnedBy: "openai",
|
| 715 |
Type: "openai",
|
| 716 |
Version: "gpt-5.1-2025-11-12",
|
|
|
|
| 723 |
{
|
| 724 |
ID: "gpt-5.1-codex-mini-high",
|
| 725 |
Object: "model",
|
| 726 |
+
Created: 1762905600,
|
| 727 |
OwnedBy: "openai",
|
| 728 |
Type: "openai",
|
| 729 |
Version: "gpt-5.1-2025-11-12",
|
|
|
|
| 737 |
{
|
| 738 |
ID: "gpt-5.1-codex-max",
|
| 739 |
Object: "model",
|
| 740 |
+
Created: 1763424000,
|
| 741 |
OwnedBy: "openai",
|
| 742 |
Type: "openai",
|
| 743 |
Version: "gpt-5.1-max",
|
|
|
|
| 750 |
{
|
| 751 |
ID: "gpt-5.1-codex-max-low",
|
| 752 |
Object: "model",
|
| 753 |
+
Created: 1763424000,
|
| 754 |
OwnedBy: "openai",
|
| 755 |
Type: "openai",
|
| 756 |
Version: "gpt-5.1-max",
|
|
|
|
| 763 |
{
|
| 764 |
ID: "gpt-5.1-codex-max-medium",
|
| 765 |
Object: "model",
|
| 766 |
+
Created: 1763424000,
|
| 767 |
OwnedBy: "openai",
|
| 768 |
Type: "openai",
|
| 769 |
Version: "gpt-5.1-max",
|
|
|
|
| 776 |
{
|
| 777 |
ID: "gpt-5.1-codex-max-high",
|
| 778 |
Object: "model",
|
| 779 |
+
Created: 1763424000,
|
| 780 |
OwnedBy: "openai",
|
| 781 |
Type: "openai",
|
| 782 |
Version: "gpt-5.1-max",
|
|
|
|
| 789 |
{
|
| 790 |
ID: "gpt-5.1-codex-max-xhigh",
|
| 791 |
Object: "model",
|
| 792 |
+
Created: 1763424000,
|
| 793 |
OwnedBy: "openai",
|
| 794 |
Type: "openai",
|
| 795 |
Version: "gpt-5.1-max",
|
|
|
|
| 808 |
{
|
| 809 |
ID: "qwen3-coder-plus",
|
| 810 |
Object: "model",
|
| 811 |
+
Created: 1753228800,
|
| 812 |
OwnedBy: "qwen",
|
| 813 |
Type: "qwen",
|
| 814 |
Version: "3.0",
|
|
|
|
| 821 |
{
|
| 822 |
ID: "qwen3-coder-flash",
|
| 823 |
Object: "model",
|
| 824 |
+
Created: 1753228800,
|
| 825 |
OwnedBy: "qwen",
|
| 826 |
Type: "qwen",
|
| 827 |
Version: "3.0",
|
|
|
|
| 834 |
{
|
| 835 |
ID: "vision-model",
|
| 836 |
Object: "model",
|
| 837 |
+
Created: 1758672000,
|
| 838 |
OwnedBy: "qwen",
|
| 839 |
Type: "qwen",
|
| 840 |
Version: "3.0",
|
|
|
|
| 850 |
// GetIFlowModels returns supported models for iFlow OAuth accounts.
|
| 851 |
|
| 852 |
func GetIFlowModels() []*ModelInfo {
|
|
|
|
| 853 |
entries := []struct {
|
| 854 |
ID string
|
| 855 |
DisplayName string
|
| 856 |
Description string
|
| 857 |
+
Created int64
|
| 858 |
}{
|
| 859 |
+
{ID: "tstars2.0", DisplayName: "TStars-2.0", Description: "iFlow TStars-2.0 multimodal assistant", Created: 1746489600},
|
| 860 |
+
{ID: "qwen3-coder-plus", DisplayName: "Qwen3-Coder-Plus", Description: "Qwen3 Coder Plus code generation", Created: 1753228800},
|
| 861 |
+
{ID: "qwen3-coder", DisplayName: "Qwen3-Coder-480B-A35B", Description: "Qwen3 Coder 480B A35B", Created: 1753228800},
|
| 862 |
+
{ID: "qwen3-max", DisplayName: "Qwen3-Max", Description: "Qwen3 flagship model", Created: 1758672000},
|
| 863 |
+
{ID: "qwen3-vl-plus", DisplayName: "Qwen3-VL-Plus", Description: "Qwen3 multimodal vision-language", Created: 1758672000},
|
| 864 |
+
{ID: "qwen3-max-preview", DisplayName: "Qwen3-Max-Preview", Description: "Qwen3 Max preview build", Created: 1757030400},
|
| 865 |
+
{ID: "kimi-k2-0905", DisplayName: "Kimi-K2-Instruct-0905", Description: "Moonshot Kimi K2 instruct 0905", Created: 1757030400},
|
| 866 |
+
{ID: "glm-4.6", DisplayName: "GLM-4.6", Description: "Zhipu GLM 4.6 general model", Created: 1759190400},
|
| 867 |
+
{ID: "kimi-k2", DisplayName: "Kimi-K2", Description: "Moonshot Kimi K2 general model", Created: 1752192000},
|
| 868 |
+
{ID: "kimi-k2-thinking", DisplayName: "Kimi-K2-Thinking", Description: "Moonshot Kimi K2 general model", Created: 1762387200},
|
| 869 |
+
{ID: "deepseek-v3.2", DisplayName: "DeepSeek-V3.2-Exp", Description: "DeepSeek V3.2 experimental", Created: 1759104000},
|
| 870 |
+
{ID: "deepseek-v3.1", DisplayName: "DeepSeek-V3.1-Terminus", Description: "DeepSeek V3.1 Terminus", Created: 1756339200},
|
| 871 |
+
{ID: "deepseek-r1", DisplayName: "DeepSeek-R1", Description: "DeepSeek reasoning model R1", Created: 1737331200},
|
| 872 |
+
{ID: "deepseek-v3", DisplayName: "DeepSeek-V3-671B", Description: "DeepSeek V3 671B", Created: 1734307200},
|
| 873 |
+
{ID: "qwen3-32b", DisplayName: "Qwen3-32B", Description: "Qwen3 32B", Created: 1747094400},
|
| 874 |
+
{ID: "qwen3-235b-a22b-thinking-2507", DisplayName: "Qwen3-235B-A22B-Thinking", Description: "Qwen3 235B A22B Thinking (2507)", Created: 1753401600},
|
| 875 |
+
{ID: "qwen3-235b-a22b-instruct", DisplayName: "Qwen3-235B-A22B-Instruct", Description: "Qwen3 235B A22B Instruct", Created: 1753401600},
|
| 876 |
+
{ID: "qwen3-235b", DisplayName: "Qwen3-235B-A22B", Description: "Qwen3 235B A22B", Created: 1753401600},
|
| 877 |
+
{ID: "minimax-m2", DisplayName: "MiniMax-M2", Description: "MiniMax M2", Created: 1758672000},
|
| 878 |
}
|
| 879 |
models := make([]*ModelInfo, 0, len(entries))
|
| 880 |
for _, entry := range entries {
|
| 881 |
models = append(models, &ModelInfo{
|
| 882 |
ID: entry.ID,
|
| 883 |
Object: "model",
|
| 884 |
+
Created: entry.Created,
|
| 885 |
OwnedBy: "iflow",
|
| 886 |
Type: "iflow",
|
| 887 |
DisplayName: entry.DisplayName,
|
internal/translator/gemini/openai/responses/gemini_openai-responses_request.go
CHANGED
|
@@ -6,7 +6,6 @@ import (
|
|
| 6 |
|
| 7 |
"github.com/router-for-me/CLIProxyAPI/v6/internal/translator/gemini/common"
|
| 8 |
"github.com/router-for-me/CLIProxyAPI/v6/internal/util"
|
| 9 |
-
log "github.com/sirupsen/logrus"
|
| 10 |
"github.com/tidwall/gjson"
|
| 11 |
"github.com/tidwall/sjson"
|
| 12 |
)
|
|
@@ -303,7 +302,7 @@ func ConvertOpenAIResponsesRequestToGemini(modelName string, inputRawJSON []byte
|
|
| 303 |
if !gjson.Get(out, "generationConfig.thinkingConfig").Exists() && modelName == "gemini-3-pro-preview" {
|
| 304 |
out, _ = sjson.Set(out, "generationConfig.thinkingConfig.thinkingBudget", -1)
|
| 305 |
out, _ = sjson.Set(out, "generationConfig.thinkingConfig.include_thoughts", true)
|
| 306 |
-
log.Debugf("Applied default thinkingConfig for gemini-3-pro-preview (matches Gemini CLI): thinkingBudget=-1, include_thoughts=true")
|
| 307 |
}
|
| 308 |
|
| 309 |
result := []byte(out)
|
|
|
|
| 6 |
|
| 7 |
"github.com/router-for-me/CLIProxyAPI/v6/internal/translator/gemini/common"
|
| 8 |
"github.com/router-for-me/CLIProxyAPI/v6/internal/util"
|
|
|
|
| 9 |
"github.com/tidwall/gjson"
|
| 10 |
"github.com/tidwall/sjson"
|
| 11 |
)
|
|
|
|
| 302 |
if !gjson.Get(out, "generationConfig.thinkingConfig").Exists() && modelName == "gemini-3-pro-preview" {
|
| 303 |
out, _ = sjson.Set(out, "generationConfig.thinkingConfig.thinkingBudget", -1)
|
| 304 |
out, _ = sjson.Set(out, "generationConfig.thinkingConfig.include_thoughts", true)
|
| 305 |
+
// log.Debugf("Applied default thinkingConfig for gemini-3-pro-preview (matches Gemini CLI): thinkingBudget=-1, include_thoughts=true")
|
| 306 |
}
|
| 307 |
|
| 308 |
result := []byte(out)
|
sdk/cliproxy/auth/manager.go
CHANGED
|
@@ -564,6 +564,11 @@ func (m *Manager) MarkResult(ctx context.Context, result Result) {
|
|
| 564 |
state.NextRetryAfter = next
|
| 565 |
suspendReason = "payment_required"
|
| 566 |
shouldSuspendModel = true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 567 |
case 429:
|
| 568 |
var next time.Time
|
| 569 |
backoffLevel := state.Quota.BackoffLevel
|
|
@@ -804,6 +809,9 @@ func applyAuthFailureState(auth *Auth, resultErr *Error, retryAfter *time.Durati
|
|
| 804 |
case 402, 403:
|
| 805 |
auth.StatusMessage = "payment_required"
|
| 806 |
auth.NextRetryAfter = now.Add(30 * time.Minute)
|
|
|
|
|
|
|
|
|
|
| 807 |
case 429:
|
| 808 |
auth.StatusMessage = "quota exhausted"
|
| 809 |
auth.Quota.Exceeded = true
|
|
|
|
| 564 |
state.NextRetryAfter = next
|
| 565 |
suspendReason = "payment_required"
|
| 566 |
shouldSuspendModel = true
|
| 567 |
+
case 404:
|
| 568 |
+
next := now.Add(12 * time.Hour)
|
| 569 |
+
state.NextRetryAfter = next
|
| 570 |
+
suspendReason = "not_found"
|
| 571 |
+
shouldSuspendModel = true
|
| 572 |
case 429:
|
| 573 |
var next time.Time
|
| 574 |
backoffLevel := state.Quota.BackoffLevel
|
|
|
|
| 809 |
case 402, 403:
|
| 810 |
auth.StatusMessage = "payment_required"
|
| 811 |
auth.NextRetryAfter = now.Add(30 * time.Minute)
|
| 812 |
+
case 404:
|
| 813 |
+
auth.StatusMessage = "not_found"
|
| 814 |
+
auth.NextRetryAfter = now.Add(12 * time.Hour)
|
| 815 |
case 429:
|
| 816 |
auth.StatusMessage = "quota exhausted"
|
| 817 |
auth.Quota.Exceeded = true
|