Commit Graph

22 Commits

  • Add FunctionCallIndex to ConvertCliToOpenAIParams and enhance tool call handling
    - Introduced `FunctionCallIndex` to track and manage function call indices within `ConvertCliToOpenAIParams`.
    - Enhanced handling for `response.completed` and `response.output_item.done` data types to support tool call scenarios.
    - Improved logic for restoring original tool names and setting function arguments during response parsing.
  • Add reasoning/thinking configuration handling for Claude and OpenAI translators
    - Implemented `thinkingConfig` handling to allow reasoning effort configuration in request generation.
    - Added support for reasoning content deltas (`thinking_delta`) in response processing.
    - Enhanced reasoning-related token budget mappings for various reasoning levels.
    - Improved response handling logic to ensure proper reasoning content inclusion.
  • Add reverse mappings for original tool names and improve error logging
    - Introduced reverse mapping logic for tool names in translators to restore original names when shortened.
    - Enhanced error handling by logging API response errors consistently across handlers.
    - Refactored request and response loggers to include API error details, improving debugging capabilities.
    - Integrated robust tool name shortening and uniqueness mechanisms for OpenAI, Gemini, and Claude requests.
    - Improved handler retry logic to properly capture and respond to errors.
  • Enhance parseArgsToMap with tolerant JSON parsing
    - Introduced `tolerantParseJSONMap` to handle bareword values in streamed tool calls.
    - Added robust handling for JSON strings, objects, arrays, and numerical values.
    - Improved fallback mechanisms to ensure reliable parsing.
  • Add Codex load balancing documentation and refine JSON handling logic
    - Updated README and README_CN to include a guide for configuring multiple account load balancing with CLI Proxy API.
    - Enhanced JSON handling in gemini translators by differentiating object and string outputs.
    - Added commented debug logging for Gemini CLI response conversion.
  • Extract argument parsing logic into parseArgsToMap helper function
    Simplifies parsing and error handling for function arguments across OpenAI response processing methods. Replaces repeated logic with a reusable utility function.
  • 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.
  • 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.
  • 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.
  • Update PassthroughGeminiResponseStream to handle [DONE] marker
    - Added logic to return an empty slice when the raw JSON equals the `[DONE]` marker.
    - Ensures proper termination of streamed Gemini responses.
  • 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.
  • Add management API handlers for config and auth file management
    - Implemented CRUD operations for authentication files.
    - Added endpoints for managing API keys, quotas, proxy settings, and other configurations.
    - Enhanced management access with robust validation, remote access control, and persistence support.
    - Updated README with new configuration details.
    
    Fixed OpenAI Chat Completions for codex
  • Suppress debug logs for model routing and ignore empty tools arrays
    - Comment out verbose routing logs in the API server to reduce noise.
    - Remove the `tools` field from Qwen client requests when it is an empty array.
    - Add guards in Claude, Codex, Gemini‑CLI, and Gemini translators to skip tool conversion when the `tools` array is empty, preventing unnecessary payload modifications.