Skip to content

feat: Add benchmarks module with tokenledger integration#290

Closed
KooshaPari wants to merge 654 commits intorouter-for-me:mainfrom
KooshaPari:cliproxy++-feature-routing-orchestration
Closed

feat: Add benchmarks module with tokenledger integration#290
KooshaPari wants to merge 654 commits intorouter-for-me:mainfrom
KooshaPari:cliproxy++-feature-routing-orchestration

Conversation

@KooshaPari
Copy link
Copy Markdown

Summary

Adds benchmarks module to cliproxy++ for tokenledger integration:

    • Tokenledger HTTP client
    • Unified benchmark store with fallback to hardcoded values

Features

  • Dynamic benchmark data from tokenledger
  • Fallback to hardcoded quality/cost/latency maps
  • Maintains backward compatibility

Testing

  • Build passes

KooshaPari and others added 30 commits February 22, 2026 21:51
…-20260223

merge: absorb heliosharness parity branch functional delta
fix: resolve executor compile regressions
…-20260223

chore: merge remaining branch deltas (dependabot + CP2K queue docs)
KooshaPari and others added 23 commits February 24, 2026 16:14
Antigravity quota display shows 100% because no Google Cloud quota API
is integrated. Unlike GitHub Copilot which has quota endpoints,
Antigravity would require Google Cloud API integration.

This is a complex feature requiring external API integration.
Add util package with safe logging helpers to mask passwords, tokens, and secrets in logs.
- Removed duplicate pkg/llmproxy/config package
- Updated all imports to use internal/config
- Fixed type mismatch errors between config packages
- Build now succeeds
…ravity quota

- Remove build-errors.log artifact
- Update README and docs config
- Clean up translator files
- Remove pkg/llmproxy/config/config.go (consolidated to internal/config)
- Add benchmarks client with caching
- Add unified store with fallback to hardcoded values
- Maintain backward compatibility with existing pareto router
- Add benchmarks.UnifiedBenchmarkStore to ParetoRouter
- Use dynamic benchmarks with hardcoded fallback
- Maintain backward compatibility
security: Add safe logging utility
…chestration

feat: Integrate benchmarks into ParetoRouter
# Conflicts:
#	.gitignore
#	.worktrees/config/m/config-build/active/pkg/llmproxy/config/config.go
#	.worktrees/config/m/config-build/active/pkg/llmproxy/config/oauth_model_alias_migration.go
#	README.md
chore: merge full-sdk type unification (layer 3)
chore: merge full-sdk/test-cleanup stack into main
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @KooshaPari, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly expands the project's capabilities by integrating a new benchmarks module with Tokenledger for dynamic data. It also introduces a robust set of CI/CD workflows and scripts to enhance code quality, security, and release processes. A new CLI tool, cliproxyctl, is added to simplify common administrative tasks. Furthermore, the management API has been upgraded to support CBOR and provide more detailed information for GitHub Copilot users, alongside general improvements to configuration handling and deployment options.

Highlights

  • Benchmarks Module: Introduced a new benchmarks module with Tokenledger integration, enabling dynamic benchmark data retrieval and fallback to hardcoded values.
  • CI/CD Enhancements: Added numerous GitHub Actions workflows and scripts for automated quality checks, external endpoint validation, token permission checks, release linting, and comprehensive testing of critical paths.
  • New CLI Tool (cliproxyctl): Implemented a new command-line interface tool, cliproxyctl, to streamline setup, provider login, and diagnostic operations, including JSON output capabilities.
  • Management API Improvements: Enhanced the management API with support for CBOR payloads in API calls, enriched GitHub Copilot token responses with quota information, and added endpoints for managing various configuration lists and OAuth sessions.
  • Configuration and Deployment: Improved Docker and systemd configurations, added example environment files, and refined config path resolution and strict validation for the server.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .github/dependabot.yml
    • Added Dependabot configuration for automated dependency updates.
  • .github/policies/approved-external-endpoints.txt
    • Added a policy file listing approved external endpoint hosts.
  • .github/release-required-checks.txt
    • Added a file specifying required checks for release workflows.
  • .github/required-checks.txt
    • Added a file specifying required checks for pull request workflows.
  • .github/scripts/check-approved-external-endpoints.sh
    • Added a script to enforce the approved external endpoints policy.
  • .github/scripts/check-distributed-critical-paths.sh
    • Added a script to validate critical paths in distributed systems.
  • .github/scripts/check-docs-secret-samples.sh
    • Added a script to detect potential secrets in documentation samples.
  • .github/scripts/check-open-items-fragmented-parity.sh
    • Added a script to ensure parity for fragmented open items reports.
  • .github/scripts/check-phase-doc-placeholder-tokens.sh
    • Added a script to reject unresolved placeholder tokens in planning reports.
  • .github/scripts/check-workflow-token-permissions.sh
    • Added a script to verify GitHub Actions workflow token permissions.
  • .github/scripts/release-lint.sh
    • Added a release linting script for config examples and markdown snippets.
  • .github/scripts/tests/check-lane-f2-cpb-0691-0700.sh
    • Added a test script for specific lane F2 CPB items.
  • .github/scripts/tests/check-open-items-fragmented-parity-test.sh
    • Added tests for the open items fragmented parity script.
  • .github/scripts/tests/check-wave80-lane-d-cpb-0556-0610.sh
    • Added a test script for specific wave 80 lane D CPB items.
  • .github/scripts/tests/check-wave80-lane-e-cpb-0581-0590.sh
    • Added a test script for specific wave 80 lane E CPB items.
  • .github/scripts/tests/check-wave80-lane-f-cpb-0546-0555.sh
    • Added a test script for specific wave 80 lane F CPB items.
  • .github/scripts/tests/fixtures/open-items-parity/fail-missing-status.md
    • Added a fixture for testing missing status in open items parity.
  • .github/scripts/tests/fixtures/open-items-parity/fail-status-partial.md
    • Added a fixture for testing partial status in open items parity.
  • .github/scripts/tests/fixtures/open-items-parity/pass-hash-status-done.md
    • Added a fixture for testing done status in open items parity.
  • .github/scripts/tests/fixtures/open-items-parity/pass-status-implemented.md
    • Added a fixture for testing implemented status in open items parity.
  • .golangci.yml
    • Added configuration for golangci-lint.
  • .pre-commit-config.yaml
    • Added pre-commit hooks for quality checks.
  • .worktrees/config/m/config-build/active/.dockerignore
    • Added Docker ignore rules for build artifacts and development files.
  • .worktrees/config/m/config-build/active/.env.example
    • Added an example environment configuration file.
  • .worktrees/config/m/config-build/active/.github/FUNDING.yml
    • Added GitHub funding configuration.
  • .worktrees/config/m/config-build/active/.github/ISSUE_TEMPLATE/bug_report.md
    • Added a bug report issue template.
  • .worktrees/config/m/config-build/active/.github/dependabot.yml
    • Added Dependabot configuration for automated dependency updates.
  • .worktrees/config/m/config-build/active/.github/policies/approved-external-endpoints.txt
    • Added a policy file listing approved external endpoint hosts.
  • .worktrees/config/m/config-build/active/.github/release-required-checks.txt
    • Added a file specifying required checks for release workflows.
  • .worktrees/config/m/config-build/active/.github/required-checks.txt
    • Added a file specifying required checks for pull request workflows.
  • .worktrees/config/m/config-build/active/.github/scripts/check-approved-external-endpoints.sh
    • Added a script to enforce the approved external endpoints policy.
  • .worktrees/config/m/config-build/active/.github/scripts/check-distributed-critical-paths.sh
    • Added a script to validate critical paths in distributed systems.
  • .worktrees/config/m/config-build/active/.github/scripts/check-docs-secret-samples.sh
    • Added a script to detect potential secrets in documentation samples.
  • .worktrees/config/m/config-build/active/.github/scripts/check-open-items-fragmented-parity.sh
    • Added a script to ensure parity for fragmented open items reports.
  • .worktrees/config/m/config-build/active/.github/scripts/check-phase-doc-placeholder-tokens.sh
    • Added a script to reject unresolved placeholder tokens in planning reports.
  • .worktrees/config/m/config-build/active/.github/scripts/check-workflow-token-permissions.sh
    • Added a script to verify GitHub Actions workflow token permissions.
  • .worktrees/config/m/config-build/active/.github/scripts/release-lint.sh
    • Added a release linting script for config examples and markdown snippets.
  • .worktrees/config/m/config-build/active/.github/scripts/tests/check-lane-f2-cpb-0691-0700.sh
    • Added a test script for specific lane F2 CPB items.
  • .worktrees/config/m/config-build/active/.github/scripts/tests/check-open-items-fragmented-parity-test.sh
    • Added tests for the open items fragmented parity script.
  • .worktrees/config/m/config-build/active/.github/scripts/tests/check-wave80-lane-d-cpb-0556-0610.sh
    • Added a test script for specific wave 80 lane D CPB items.
  • .worktrees/config/m/config-build/active/.github/scripts/tests/check-wave80-lane-e-cpb-0581-0590.sh
    • Added a test script for specific wave 80 lane E CPB items.
  • .worktrees/config/m/config-build/active/.github/scripts/tests/check-wave80-lane-f-cpb-0546-0555.sh
    • Added a test script for specific wave 80 lane F CPB items.
  • .worktrees/config/m/config-build/active/.github/scripts/tests/fixtures/open-items-parity/fail-missing-status.md
    • Added a fixture for testing missing status in open items parity.
  • .worktrees/config/m/config-build/active/.github/scripts/tests/fixtures/open-items-parity/fail-status-partial.md
    • Added a fixture for testing partial status in open items parity.
  • .worktrees/config/m/config-build/active/.github/scripts/tests/fixtures/open-items-parity/pass-hash-status-done.md
    • Added a fixture for testing done status in open items parity.
  • .worktrees/config/m/config-build/active/.github/scripts/tests/fixtures/open-items-parity/pass-status-implemented.md
    • Added a fixture for testing implemented status in open items parity.
  • .worktrees/config/m/config-build/active/.golangci.yml
    • Added configuration for golangci-lint.
  • .worktrees/config/m/config-build/active/.goreleaser.yml
    • Added GoReleaser configuration for automated releases.
  • .worktrees/config/m/config-build/active/.pre-commit-config.yaml
    • Added pre-commit hooks for quality checks.
  • .worktrees/config/m/config-build/active/CHANGELOG.md
    • Updated changelog with support for multiple aliases for a single upstream model in OAuth model alias configuration.
  • .worktrees/config/m/config-build/active/CONTRIBUTING.md
    • Added contributing guidelines, including repository usage and governance.
  • .worktrees/config/m/config-build/active/Dockerfile
    • Added Dockerfile for building the application.
  • .worktrees/config/m/config-build/active/LICENSE
    • Added MIT License file.
  • .worktrees/config/m/config-build/active/README.md
    • Added English README with project overview, features, Kiro authentication, Docker deployment, and contribution guidelines.
  • .worktrees/config/m/config-build/active/README_CN.md
    • Added Chinese README with project overview, features, Kiro authentication, Docker deployment, and contribution guidelines.
  • .worktrees/config/m/config-build/active/README_FA.md
    • Added Farsi README with project overview, features, Kiro authentication, Docker deployment, and contribution guidelines.
  • .worktrees/config/m/config-build/active/SECURITY.md
    • Added security policy outlining supported versions and vulnerability reporting.
  • .worktrees/config/m/config-build/active/Taskfile.yml
    • Added Taskfile for unified development experience, including build, test, quality, and Docker operations.
  • .worktrees/config/m/config-build/active/api/openapi.yaml
    • Added OpenAPI specification for the API, detailing endpoints for chat, models, and management.
  • .worktrees/config/m/config-build/active/cliproxyctl/main.go
    • Added main Go file for the cliproxyctl CLI tool, including setup, login, and doctor commands.
  • .worktrees/config/m/config-build/active/cliproxyctl/main_test.go
    • Added tests for the cliproxyctl CLI tool's JSON response shapes and error handling.
  • .worktrees/config/m/config-build/active/cmd/boardsync/main.go
    • Added main Go file for the board synchronization tool, generating planning board artifacts.
  • .worktrees/config/m/config-build/active/cmd/cliproxyctl/main.go
    • Added main Go file for the cliproxyctl CLI tool, including setup, login, and doctor commands.
  • .worktrees/config/m/config-build/active/cmd/cliproxyctl/main_test.go
    • Added tests for the cliproxyctl CLI tool's JSON response shapes and error handling.
  • .worktrees/config/m/config-build/active/cmd/codegen/main.go
    • Added main Go file for the code generation tool, creating config and synthesizer files.
  • .worktrees/config/m/config-build/active/cmd/releasebatch/main.go
    • Added main Go file for the release batching tool, managing version tags and release notes.
  • .worktrees/config/m/config-build/active/cmd/releasebatch/main_test.go
    • Added tests for the release batching tool's version tag parsing and notes generation.
  • .worktrees/config/m/config-build/active/cmd/server/config_path.go
    • Added config path resolution logic for the server, including environment variable and cloud deployment considerations.
  • .worktrees/config/m/config-build/active/cmd/server/config_path_test.go
    • Added tests for config path resolution logic.
  • .worktrees/config/m/config-build/active/cmd/server/config_validate.go
    • Added config validation logic for the server, ensuring strict schema adherence.
  • .worktrees/config/m/config-build/active/cmd/server/config_validate_test.go
    • Added tests for config validation logic.
  • .worktrees/config/m/config-build/active/cmd/server/main.go
    • Updated main server file to incorporate new features, environment variable loading, and token store initialization.
  • .worktrees/config/m/config-build/active/config.example.yaml
    • Updated example configuration file with new settings for remote management, logging, quota, and various provider keys.
  • .worktrees/config/m/config-build/active/contracts/cliproxyctl-response.schema.json
    • Added JSON schema for cliproxyctl command responses.
  • .worktrees/config/m/config-build/active/docker-build.ps1
    • Added PowerShell script for Docker build and run operations.
  • .worktrees/config/m/config-build/active/docker-build.sh
    • Added shell script for Docker build and run operations, including usage statistics preservation.
  • .worktrees/config/m/config-build/active/docker-compose.yml
    • Added Docker Compose configuration for cli-proxy-api service.
  • .worktrees/config/m/config-build/active/docker-init.sh
    • Updated Docker initialization script to handle config file creation and environment variable overrides.
  • .worktrees/config/m/config-build/active/examples/custom-provider/main.go
    • Added an example demonstrating how to create and integrate a custom AI provider executor.
  • .worktrees/config/m/config-build/active/examples/http-request/main.go
    • Added an example demonstrating how to use coreauth.Manager.HttpRequest for authenticated HTTP requests.
  • .worktrees/config/m/config-build/active/examples/launchd/com.router-for-me.cliproxyapi-plusplus.plist
    • Added a launchd plist example for macOS service management.
  • .worktrees/config/m/config-build/active/examples/process-compose.dev.yaml
    • Updated process-compose development configuration with a health probe.
  • .worktrees/config/m/config-build/active/examples/process-compose.yaml
    • Added process-compose configuration for managing the proxy service.
  • .worktrees/config/m/config-build/active/examples/systemd/cliproxyapi-plusplus.env
    • Added a systemd environment file example.
  • .worktrees/config/m/config-build/active/examples/systemd/cliproxyapi-plusplus.service
    • Added a systemd service file example for Linux service management.
  • .worktrees/config/m/config-build/active/examples/translator/main.go
    • Added an example demonstrating translator usage for request and response conversion.
  • .worktrees/config/m/config-build/active/examples/windows/cliproxyapi-plusplus-service.ps1
    • Added a PowerShell script for Windows service management.
  • .worktrees/config/m/config-build/active/go.mod
    • Updated Go module dependencies, including new modules for CBOR, Git, Postgres, and Minio.
  • .worktrees/config/m/config-build/active/go.sum
    • Updated Go module checksums to reflect new and updated dependencies.
  • .worktrees/config/m/config-build/active/internal/access/config_access/provider.go
    • Added a configuration-based access provider for API key authentication.
  • .worktrees/config/m/config-build/active/internal/access/reconcile.go
    • Added logic to reconcile access providers based on configuration changes.
  • .worktrees/config/m/config-build/active/internal/api/handlers/management/api_tools.go
    • Added management API tools, including generic HTTP API calls with credential injection, CBOR support, and GitHub Copilot quota enrichment.
  • .worktrees/config/m/config-build/active/internal/api/handlers/management/api_tools_cbor_test.go
    • Added tests for CBOR support in management API tools.
  • .worktrees/config/m/config-build/active/internal/api/handlers/management/api_tools_test.go
    • Added tests for API tools, including token refresh for Antigravity.
  • .worktrees/config/m/config-build/active/internal/api/handlers/management/auth_files.go
    • Added handlers for listing, downloading, uploading, and deleting authentication files, including OAuth flows for various providers.
  • .worktrees/config/m/config-build/active/internal/api/handlers/management/config_basic.go
    • Added basic config management handlers for retrieving, updating, and validating the main configuration file.
  • .worktrees/config/m/config-build/active/internal/api/handlers/management/config_lists.go
    • Added handlers for managing configuration lists such as API keys, Gemini keys, Claude keys, OpenAI compatibility, Vertex keys, OAuth excluded models, and OAuth model aliases.
  • .worktrees/config/m/config-build/active/internal/api/handlers/management/handler.go
    • Added the main management API handler, including middleware for access control and rate limiting.
  • .worktrees/config/m/config-build/active/internal/api/handlers/management/logs.go
    • Added handlers for retrieving and deleting application logs, including request error logs.
  • .worktrees/config/m/config-build/active/internal/api/handlers/management/model_definitions.go
    • Added handlers for retrieving static model definitions by channel.
  • .worktrees/config/m/config-build/active/internal/api/handlers/management/oauth_callback.go
    • Added OAuth callback handler for processing authorization responses.
  • .worktrees/config/m/config-build/active/internal/api/handlers/management/oauth_sessions.go
    • Added OAuth session management logic for tracking and validating authentication flows.
  • .worktrees/config/m/config-build/active/internal/api/handlers/management/quota.go
    • Added handlers for managing quota exceeded toggles.
  • .worktrees/config/m/config-build/active/internal/api/handlers/management/usage.go
    • Added handlers for retrieving, exporting, and importing usage statistics.
  • .worktrees/config/m/config-build/active/internal/api/handlers/management/vertex_import.go
    • Added handlers for importing Vertex service account credentials.
  • .worktrees/config/m/config-build/active/internal/api/middleware/request_logging.go
    • Added request logging middleware to capture HTTP request and response data.
  • .worktrees/config/m/config-build/active/internal/api/middleware/request_logging_test.go
    • Added tests for request logging middleware, including method skipping and body capture logic.
  • .worktrees/config/m/config-build/active/internal/api/middleware/response_writer.go
    • Added a response writer wrapper to intercept and log response data, supporting streaming responses.
  • .worktrees/config/m/config-build/active/internal/api/middleware/response_writer_test.go
    • Added tests for the response writer wrapper's request body extraction logic.
  • .worktrees/config/m/config-build/active/internal/api/modules/amp/amp.go
    • Added the Amp module implementation, providing reverse proxy, provider aliases, and model mapping capabilities.
  • .worktrees/config/m/config-build/active/internal/api/modules/amp/amp_test.go
    • Added tests for the Amp module's registration, configuration updates, and secret source handling.
  • .worktrees/config/m/config-build/active/internal/api/modules/amp/fallback_handlers.go
    • Added Amp fallback handlers for routing requests to local providers or Ampcode.com based on model availability and mappings.
  • .worktrees/config/m/config-build/active/internal/api/modules/amp/fallback_handlers_test.go
    • Added tests for Amp fallback handlers, including model mapping and response rewriting.
  • .worktrees/config/m/config-build/active/internal/config/oauth_model_alias_migration_test.go
    • Renamed internal/config/oauth_model_alias_migration_test.go to .worktrees/config/m/config-build/active/internal/config/oauth_model_alias_migration_test.go.
  • .worktrees/config/m/config-build/active/internal/config/oauth_model_alias_test.go
    • Renamed internal/config/oauth_model_alias_test.go to .worktrees/config/m/config-build/active/internal/config/oauth_model_alias_test.go.
Ignored Files
  • Ignored by pattern: .github/workflows/** (7)
    • .github/workflows/ci-rerun-flaky.yml
    • .github/workflows/codeql.yml
    • .github/workflows/docs.yml
    • .github/workflows/generate-sdks.yaml
    • .github/workflows/release-batch.yaml
    • .github/workflows/required-check-names-guard.yml
    • .github/workflows/vitepress-pages.yml
Activity
  • The pull request introduces a new benchmarks module with Tokenledger integration, enhancing the application's ability to gather and utilize performance data.
  • Significant effort has been made to bolster the CI/CD pipeline, with new GitHub Actions workflows and scripts covering dependency updates, security policies, release checks, and various code quality gates.
  • A new cliproxyctl CLI tool has been added, providing users with simplified commands for initial setup, logging into different providers, and diagnosing configuration issues.
  • The management API has been extended to support CBOR for API calls and now offers detailed GitHub Copilot quota information, improving administrative capabilities.
  • Deployment and configuration management have been refined through updated Dockerfiles, Docker Compose configurations, and systemd service examples, ensuring smoother setup across different environments.
  • Numerous new test files and fixtures have been added, particularly for the new CLI scripts and API handlers, indicating a strong focus on reliability and correctness.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new benchmarks module with tokenledger integration, along with numerous CI/CD scripts, GitHub workflows, and configuration files. The changes enhance the project's automation, security, and extensibility. However, there are several areas that require attention, including resolving Git merge conflicts, addressing typos, improving clarity in documentation, and updating CLI usage messages. A significant concern is the use of future Go versions and highly unstable golang.org/x dependency versions, which could lead to compatibility issues and build failures. Additionally, some API responses and configuration fields could be streamlined for better consistency and user experience.

github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect
golang.org/x/sys v0.38.0 // indirect
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The indirect dependency golang.org/x/tools is pinned to a very high version (v0.38.0). This version is significantly higher than current stable releases (e.g., v0.21.0). This strongly suggests that this is a future or unstable version, which can lead to compatibility issues, unexpected behavior, or build failures. It's critical to use stable, officially released versions of these core libraries.

gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The indirect dependency golang.org/x/tools is pinned to a very high version (v0.38.0). This version is significantly higher than current stable releases (e.g., v0.21.0). This strongly suggests that this is a future or unstable version, which can lead to compatibility issues, unexpected behavior, or build failures. It's critical to use stable, officially released versions of these core libraries.

@@ -0,0 +1,112 @@
module github.com/router-for-me/CLIProxyAPI/v6

go 1.26.0
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The go.mod file specifies go 1.26.0. As of the current date, Go 1.26.0 is a future version and not yet released. Using a future Go version can lead to build failures or unexpected behavior in current environments. It's recommended to use a stable, currently released version of Go.

Comment on lines +223 to +243
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 h1:mgKeJMpvi0yx/sU5GsxQ7p6s2wtOnGAHZWCHUM4KGzY=
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70=
golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Several golang.org/x dependencies (crypto, net, oauth2, sync, term, text) are pinned to unusually high version numbers (e.g., v0.45.0, v0.47.0). These versions are significantly higher than current stable releases (e.g., crypto is around v0.25.0). This strongly suggests that these are future or unstable versions, which can lead to compatibility issues, unexpected behavior, or build failures. It's critical to use stable, officially released versions of these core libraries.

Comment on lines +25 to +30
github.com/stretchr/testify v1.11.1
github.com/tidwall/gjson v1.18.0
github.com/tidwall/sjson v1.2.5
github.com/tiktoken-go/tokenizer v0.7.0
golang.org/x/crypto v0.45.0
golang.org/x/net v0.47.0
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Several golang.org/x dependencies (crypto, net, oauth2, sync, term, text) are pinned to unusually high version numbers (e.g., v0.45.0, v0.47.0). These versions are significantly higher than current stable releases (e.g., crypto is around v0.25.0). This strongly suggests that these are future or unstable versions, which can lead to compatibility issues, unexpected behavior, or build failures. It's critical to use stable, officially released versions of these core libraries.

return
}

authIndex := firstNonEmptyString(body.AuthIndexSnake, body.AuthIndexCamel, body.AuthIndexPascal)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The firstNonEmptyString helper is used here to extract auth_index from potentially three different fields. While functional, this pattern confirms the redundancy of having AuthIndexSnake, AuthIndexCamel, and AuthIndexPascal in the apiCallRequest struct. Consolidating to a single field with a custom unmarshaler would be cleaner.

Comment on lines +146 to +151
func (h *Handler) PatchGeminiKey(c *gin.Context) {
type geminiKeyPatch struct {
APIKey *string `json:"api-key"`
Prefix *string `json:"prefix"`
BaseURL *string `json:"base-url"`
ProxyURL *string `json:"proxy-url"`
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The geminiKeyPatch struct is missing the Models field from config.GeminiKey. This means the models field cannot be patched via this endpoint, leading to incomplete functionality. Please add the Models field to geminiKeyPatch.

type geminiKeyPatch struct {
	APIKey         *string            `json:"api-key"`
	Prefix         *string            `json:"prefix"`
	BaseURL        *string            `json:"base-url"`
	ProxyURL       *string            `json:"proxy-url"`
	Headers        *map[string]string `json:"headers"`
	Models         *[]config.GeminiModel `json:"models"`
	ExcludedModels *[]string          `json:"excluded-models"`
}

Comment on lines +731 to +734
func (h *Handler) PatchOAuthModelAlias(c *gin.Context) {
var body struct {
Provider *string `json:"provider"`
Channel *string `json:"channel"`
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The PatchOAuthModelAlias request body includes redundant fields for the channel (Provider, Channel). It's better to pick one naming convention (e.g., channel) and stick to it, or use a custom unmarshaler to handle multiple formats gracefully without exposing them as separate fields. This adds unnecessary complexity and can lead to confusion.

Comment on lines +741 to +746
channelRaw := ""
if body.Channel != nil {
channelRaw = *body.Channel
} else if body.Provider != nil {
channelRaw = *body.Provider
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This logic handles both Channel and Provider fields to determine the target channel. While functional, it confirms the redundancy of having both fields in the request body. Consolidating to a single field (e.g., channel) would simplify the API and reduce potential confusion.

Comment on lines +782 to +785
func (h *Handler) DeleteOAuthModelAlias(c *gin.Context) {
channel := strings.ToLower(strings.TrimSpace(c.Query("channel")))
if channel == "" {
channel = strings.ToLower(strings.TrimSpace(c.Query("provider")))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This logic handles both channel and provider query parameters. While functional, it confirms the redundancy of supporting both. Consolidating to a single query parameter (e.g., channel) would simplify the API and reduce potential confusion.

@gemini-code-assist
Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@KooshaPari

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants