Commit Graph

11 Commits

  • **feat(translator): add Antigravity translation logic**
    - Introduced request and response translation functions to enable compatibility between OpenAI Chat Completions API and Antigravity.
    - Registered translation utilities for both streaming and non-streaming scenarios.
    - Added support for reasoning content, tool calls, and metadata handling.
    - Established request normalization and embedding for Antigravity-compatible payloads.
    - Added new fields to `Params` struct for better tracking of finish reasons, usage metadata, and tool usage.
    - Refactored handling of response transitions, final events, and state-driven logic in `ConvertAntigravityResponseToClaude`.
    - Introduced `appendFinalEvents` and `resolveStopReason` helper functions for cleaner separation of concerns.
    - Added `TotalTokenCount` field to `Params` struct for enhanced token tracking.
    - Updated token count calculations to fallback on `TotalTokenCount` when specific counts are missing.
    - Introduced `hasNonZeroUsageMetadata` function to validate presence of token data in `usage_metadata`.
  • 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`.
  • 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.
  • 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 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.