16 Commits

  • feat: add client availability tracking and error handling improvements
    - Introduced `IsAvailable` and `SetUnavailable` methods to clients for availability tracking.
    - Integrated availability checks in client selection logic to skip unavailable clients.
    - Enhanced error handling by marking clients unavailable on specific error codes (e.g., 401, 402).
    - Removed redundant quota verification logs in client reordering logic.
  • Add support for forcing GPT-5 Codex model configuration
    - Introduced a new `ForceGPT5Codex` configuration option in settings.
    - Added relevant API endpoints for managing `ForceGPT5Codex`.
    - Enhanced Codex client to handle GPT-5 Codex-specific logic and mapping.
    - Updated example configuration file to include the new option.
    
    Add GPT-5 Codex model support and configuration options in documentation
  • Update internal module imports to use v5 package path
    - Updated all `github.com/luispater/CLIProxyAPI/internal/...` imports to point to `github.com/luispater/CLIProxyAPI/v5/internal/...`.
    - Adjusted `go.mod` to specify `module github.com/luispater/CLIProxyAPI/v5`.
  • Add support for Codex API key authentication
    - Introduced functionality to handle Codex API keys, including initialization and management via new endpoints in the management API.
    - Updated Codex client to support both OAuth and API key authentication.
    - Documented Codex API key configuration in both English and Chinese README files.
    - Enhanced logging to distinguish between API key and OAuth usage scenarios.
  • Refactor translator packages for OpenAI Chat Completions
    - Renamed `openai` packages to `chat_completions` across translator modules.
    - Introduced `openai_responses_handlers` with handlers for `/v1/models` and OpenAI-compatible chat completions endpoints.
    - Updated constants and registry identifiers for OpenAI response type.
    - Simplified request/response conversions and added detailed retry/error handling.
    - Added `golang.org/x/crypto` for additional cryptographic functions.
  • Add support for new GPT-5 model variants
    - Renamed existing GPT-5 variants for consistency (`nano` → `minimal`, `mini` → `low`, etc.).
    - Added metadata definitions for new variants: `gpt-5-minimal`, `gpt-5-low`, `gpt-5-medium`, and updated logic to reflect variant-specific reasoning efforts.
  • Add nil-check for GetRequestMutex across handlers to prevent potential panics
    - Updated all handlers to safely unlock the request mutex only if it's non-nil.
    - Enhanced mutex locking and unlocking logic to avoid runtime errors.
    - Improved robustness of resource cleanup across clients.
    
    Add `GetRequestMutex` method for synchronization across clients
    
    - Introduced a new `GetRequestMutex` method in OpenAICompatibilityClient, CodexClient, GeminiCLIClient, GeminiClient, and QwenClient for request synchronization.
    - Ensures only one request is processed at a time to manage quotas effectively.
  • Add OpenAI compatibility support and improve resource cleanup
    - Introduced OpenAI compatibility configurations for external providers, enabling model alias routing via the OpenAI API format.
    - Enhanced provider logic in `GetProviderName` to handle OpenAI aliases and added new helper functions for compatibility checks.
    - Updated API handlers and client initialization to support OpenAI compatibility models.
    - Improved resource cleanup across clients by closing response bodies and streams using deferred functions.
  • Add request logging capabilities to API handlers and update .gitignore
    Enhance API response handling by storing responses in context and updating request logger to include API responses