17 Commits

  • refactor(translator, executor): remove redundant bytes.Clone calls for improved performance
    - Replaced all instances of `bytes.Clone` with direct references to enhance efficiency.
    - Simplified payload handling across executors and translators by eliminating unnecessary data duplication.
  • refactor: replace json.Marshal and json.Unmarshal with sjson and gjson
    Optimized the handling of JSON serialization and deserialization by replacing redundant `json.Marshal` and `json.Unmarshal` calls with `sjson` and `gjson`. Introduced a `marshalJSONValue` utility for compact JSON encoding, improving performance and code simplicity. Removed unused `encoding/json` imports.
  • **fix(translator): reintroduce thoughtSignature bypass logic for model parts**
    - Restored `thoughtSignature` validator bypass for model-specific parts in Gemini content processing.
    - Removed redundant logic from the `executor` for cleaner handling.
  • **feat(auth, executor, cmd): add Antigravity provider integration**
    - Implemented OAuth login flow for the Antigravity provider in `auth/antigravity.go`.
    - Added `AntigravityExecutor` for handling requests and streaming via Antigravity APIs.
    - Created `antigravity_login.go` command for triggering Antigravity authentication.
    - Introduced OpenAI-to-Antigravity translation logic in `translator/antigravity/openai/chat-completions`.
    
    **refactor(translator, executor): update Gemini CLI response translation and add Antigravity payload customization**
    
    - Renamed Gemini CLI translation methods to align with response handling (`ConvertGeminiCliResponseToGemini` and `ConvertGeminiCliResponseToGeminiNonStream`).
    - Updated `init.go` to reflect these method changes.
    - Introduced `geminiToAntigravity` function to embed metadata (`model`, `userAgent`, `project`, etc.) into Antigravity payloads.
    - Added random project, request, and session ID generators for enhanced tracking.
    - Streamlined `buildRequest` to use `geminiToAntigravity` transformation before request execution.
  • Fixed: #129 #123 #102 #97
    feat: add all protocols request and response translation for Gemini and Gemini CLI compatibility
  • feat(translators): add token counting support for Claude and Gemini responses
    - Implemented `TokenCount` transform method across translators to calculate token usage.
    - Integrated token counting logic into executor pipelines for Claude, Gemini, and CLI translators.
    - Added corresponding API endpoints and handlers (`/messages/count_tokens`) for token usage retrieval.
    - Enhanced translation registry to support `TokenCount` functionality alongside existing response types.
  • feat: introduce custom provider example and remove redundant debug logs
    - Added `examples/custom-provider/main.go` showcasing custom executor and translator integration using the SDK.
    - Removed redundant debug logs from translator modules to enhance code cleanliness.
    - Updated SDK documentation with new usage and advanced examples.
    - Expanded the management API with new endpoints, including request logging and GPT-5 Codex features.
  • refactor: standardize constant naming and improve file-based auth handling
    - Renamed constants from uppercase to CamelCase for consistency.
    - Replaced redundant file-based auth handling logic with the new `util.CountAuthFiles` helper.
    - Fixed various error-handling inconsistencies and enhanced robustness in file operations.
    - Streamlined auth client reload logic in server and watcher components.
    - Applied minor code readability improvements across multiple packages.
  • 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 Gemini-to-Gemini request normalization and passthrough support
    - Introduced a `ConvertGeminiRequestToGemini` function to normalize Gemini v1beta requests by ensuring valid or default roles.
    - Added passthrough response handlers for both streamed and non-streamed Gemini responses.
    - Registered translators for Gemini-to-Gemini traffic in the initialization process.
    - Updated `gemini-cli` request normalization to align with the new Gemini translator logic.