Commit Graph

7 Commits

  • Fixed: #140 #133 #80
    feat(translator): add token counting functionality for Gemini, Claude, and CLI
    
    - Introduced `TokenCount` handling across various Codex translators (Gemini, Claude, CLI) with respective implementations.
    - Added utility methods for token counting and formatting responses.
    - Integrated `tiktoken-go/tokenizer` library for tokenization.
    - Updated CodexExecutor with token counting logic to support multiple models including GPT-5 variants.
    - Refined go.mod and go.sum to include new dependencies.
    
    feat(runtime): add token counting functionality across executors
    
    - Implemented token counting in OpenAICompatExecutor, QwenExecutor, and IFlowExecutor.
    - Added utilities for token counting and response formatting using `tiktoken-go/tokenizer`.
    - Integrated token counting into translators for Gemini, Claude, and Gemini CLI.
    - Enhanced multiple model support, including GPT-5 variants, for token counting.
    
    docs: update environment variable instructions for multi-model support
    
    - Added details for setting `ANTHROPIC_DEFAULT_OPUS_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL`, and `ANTHROPIC_DEFAULT_HAIKU_MODEL` for version 2.x.x.
    - Clarified usage of `ANTHROPIC_MODEL` and `ANTHROPIC_SMALL_FAST_MODEL` for version 1.x.x.
    - Expanded examples for setting environment variables across different models including Gemini, GPT-5, Claude, and Qwen3.
  • Refactor executor error handling and usage reporting
    - Updated the Execute methods in various executors (GeminiCLIExecutor, GeminiExecutor, IFlowExecutor, OpenAICompatExecutor, QwenExecutor) to return a response and error as named return values for improved clarity.
    - Enhanced error handling by deferring failure tracking in usage reporters, ensuring that failures are reported correctly.
    - Improved response body handling by ensuring proper closure and error logging for HTTP responses across all executors.
    - Added failure tracking and reporting in the usage reporter to capture unsuccessful requests.
    - Updated the usage logging structure to include a 'Failed' field for better tracking of request outcomes.
    - Adjusted the logic in the RequestStatistics and Record methods to accommodate the new failure tracking mechanism.
  • Enhance logging for API requests and responses across executors
    - Added detailed logging of upstream request metadata including URL, method, headers, and body for Codex, Gemini, IFlow, OpenAI Compat, and Qwen executors.
    - Implemented error logging for API response failures to capture errors during HTTP requests.
    - Introduced structured logging for authentication details (AuthID, AuthLabel, AuthType, AuthValue) to improve traceability.
    - Updated response logging to include status codes and headers for better debugging.
    - Ensured that all executors consistently log API interactions to facilitate monitoring and troubleshooting.
  • feat(registry/runtime): add Gemini 2.5 model and increase buffer sizes
    - Added new "Gemini 2.5 Flash Image Preview" model definition, with enhanced image generation capabilities.
    - Increased scanner buffer size to 20,971,520 bytes across executors and translators to handle larger payloads.