8 Commits

  • refactor(auth): Centralize logging for saving credentials
    The logic for logging the path where credentials are saved was duplicated across several client implementations.
    
    This commit refactors this behavior by creating a new centralized function, `misc.LogSavingCredentials`, to handle this logging. The `SaveTokenToFile` method in each authentication token storage struct now calls this new function, ensuring consistent logging and reducing code duplication.
    
    The redundant logging statements in the client-level `SaveTokenToFile` methods have been removed.
  • Refine Codex instructions for GPT-5 use case
    - Simplified `gpt_5_instructions.txt` by removing redundancy and aligning scope with AGENTS.md standard instructions.
    - Enhanced clarity and relevance of directives per Codex context.
  • feat: implement model-specific Codex instructions for GPT-5
    - Added `CodexInstructions(modelName string)` function to dynamically select instructions based on the model (e.g., GPT-5 Codex).
    - Introduced `gpt_5_instructions.txt` and `gpt_5_codex_instructions.txt` for respective model configurations.
    - Updated translators to pass `modelName` and use the new instruction logic.
  • Add OAuth support for Gemini CLI, Claude, Codex, and Qwen authentication
    - Implemented new handlers (`RequestGeminiCLIToken`, `RequestAnthropicToken`, `RequestCodexToken`, `RequestQwenToken`) for initiating OAuth flows.
    - Added endpoints for authorization URLs in management API.
    - Extracted `GenerateRandomState` to a reusable utility in `misc` package.
    - Refactored related logic in `openai_login.go` and `anthropic_login.go` for consistency.
    
    Add endpoints for initiating OAuth flows in management API documentation
    
    - Documented new endpoints for Anthropic, Codex, Gemini CLI, and Qwen login URLs.
    - Provided request and response examples for each endpoint in both English and Chinese versions.