10 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`.
  • chore(docs): add and refine package-level comments across modules
    - Added detailed package-level comments to improve documentation coverage.
    - Clarified parameter descriptions, return types, and functionality of exported methods across packages.
    - Enhanced overall code readability and API documentation consistency.
  • 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.
  • 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 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.