428 Commits

Author SHA1 Message Date
Luis Pater c0fbc1979e refactor: remove redundant Codex instruction validation logic
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
- Eliminated unnecessary calls to `misc.CodexInstructions` and corresponding checks in response processing.
- Streamlined instruction handling by directly updating "instructions" field from the original request payload.
v5.2.0
2025-09-19 09:19:18 +08:00
Luis Pater d00604dd28 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.
2025-09-19 09:09:22 +08:00
Luis Pater 869a3dfbb4 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.
2025-09-19 08:47:54 +08:00
Luis Pater df66046b14 feat: add client availability tracking and error handling improvements
- Introduced `IsAvailable` and `SetUnavailable` methods to clients for availability tracking.
- Integrated availability checks in client selection logic to skip unavailable clients.
- Enhanced error handling by marking clients unavailable on specific error codes (e.g., 401, 402).
- Removed redundant quota verification logs in client reordering logic.
2025-09-19 01:53:38 +08:00
Luis Pater 9ec8478b41 Merge pull request #44 from luispater/gemini-web
Merge gemini-web into dev
2025-09-18 16:00:18 +08:00
hkfires bb6ec7ca81 fix(gemini-web): Correct inaccurate cookie refresh log message 2025-09-18 12:35:39 +08:00
hkfires 1b2e3dc7af feat(gemini): Implement pseudo-streaming and improve context reuse
This commit introduces two major enhancements to the Gemini Web client to improve user experience and conversation continuity.

First, it implements a pseudo-streaming mechanism for non-code mode. The Gemini Web API returns the full response at once in this mode, leading to a poor user experience with a long wait for output. This change splits the full response into smaller chunks and sends them with an 80ms delay, simulating a real-time streaming effect.

Second, the conversation context reuse logic is now more robust. A fallback mechanism has been added to reuse conversation metadata when a clear continuation context is detected (e.g., a user replies to an assistant's turn). This improves conversational flow. Metadata lookups have also been improved to check both the canonical model key and its alias for better compatibility.
2025-09-18 11:22:56 +08:00
hkfires 580ec737d3 feat: Add support for Gemini Web via cookie authentication 2025-09-17 20:36:07 +08:00
hkfires e4dd22b260 feat(gemini-web): squash all features and fixes for gemini-web 2025-09-17 20:24:23 +08:00
Luis Pater 172f282e9e feat: add graceful shutdown for streaming response handling
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
- Introduced `streamDone` channel to signal the completion of streaming goroutines.
- Updated `processStreamingChunks` to incorporate proper cleanup and defer close operations.
- Ensured `streamWriter` and associated resources are released when streaming completes.
v5.1.29
2025-09-17 19:46:57 +08:00
Luis Pater 7f0c9b1942 Merge pull request #43 from kyle-the-dev/fix/gemini-schema-sanitization
fix: comprehensive JSON Schema sanitization for Claude to Gemini
2025-09-16 20:26:32 +08:00
Luis Pater 8c2063aeea Fix log key name from gpt-5-codex to force-gpt-5-codex for consistency 2025-09-16 20:03:48 +08:00
Luis Pater ed6e7750e2 Update config key gpt-5-codex to force-gpt-5-codex for clarity in example configuration file
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
v5.1.28
2025-09-16 20:00:21 +08:00
Kyle Ryan a0c389a854 fix: comprehensive JSON Schema sanitization for Claude to Gemini
- Add SanitizeSchemaForGemini utility handling union types, allOf, exclusiveMinimum
- Fix both gemini-cli and gemini API translators
- Resolve "Proto field is not repeating, cannot start list" errors
- Maintain backward compatibility with fallback logic

This fixes Claude Code CLI compatibility issues when using tools with either
Gemini CLI credentials or direct Gemini API keys by properly sanitizing
JSON Schema fields that are incompatible with Gemini's Protocol Buffer validation.
2025-09-16 18:24:49 +08:00
hkfires e9037fceb0 fix(windows): Improve path handling and file read reliability 2025-09-16 10:01:58 +08:00
Luis Pater 2406cc775e Add GPT-5 Codex model support and configuration options in documentation 2025-09-16 04:53:25 +08:00
Luis Pater b84cbee77a Add support for forcing GPT-5 Codex model configuration
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
- Introduced a new `ForceGPT5Codex` configuration option in settings.
- Added relevant API endpoints for managing `ForceGPT5Codex`.
- Enhanced Codex client to handle GPT-5 Codex-specific logic and mapping.
- Updated example configuration file to include the new option.

Add GPT-5 Codex model support and configuration options in documentation
v5.1.27
2025-09-16 04:40:19 +08:00
Luis Pater fa762e69a4 Merge branch 'dev' of github.com:luispater/CLIProxyAPI into dev
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
v5.1.26
2025-09-14 22:55:18 +08:00
Luis Pater 7e0fd1e260 Add Keep-Alive header 2025-09-14 22:54:36 +08:00
hkfires d6037e5549 Refine .gitignore and .dockerignore files 2025-09-14 16:29:06 +08:00
Luis Pater 9fce13fe03 Update internal module imports to use v5 package path
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
- 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`.
v5.1.25
2025-09-13 23:34:32 +08:00
Luis Pater 4375822cbb Resolve logsDir path relative to configuration directory in FileRequestLogger
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
v5.1.24
2025-09-12 15:28:07 +08:00
Luis Pater e0d13148ef Merge branch 'main' into dev
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
v5.1.23
2025-09-12 13:12:02 +08:00
Luis Pater bd68472d3c Merge pull request #41 from kaixxx/main
Codex CLI - setting 'store = false' to prevent the request being rejected by OpenAI
2025-09-12 13:10:22 +08:00
kaixxx b3c534bae5 Build instructions reformatting 2025-09-12 01:16:54 +02:00
kaixxx b7d6ae1b48 Windows build instructions 2025-09-12 01:12:51 +02:00
kaixxx aacfcae382 Codex CLI - setting 'store = false'
store = true leads to:
BadRequestError("Error code: 400 - {'detail': 'Store must be set to false'}")
2025-09-12 00:59:49 +02:00
Luis Pater 1c92034191 Implement IP-based rate limiting and ban mechanism for management API
- Introduced a new `attemptInfo` structure to track failed login attempts per IP.
- Added logic to temporarily ban IPs exceeding the allowed number of failures.
- Enhanced middleware to reset failed attempt counters on successful authentication.
- Updated `Handler` to include a `failedAttempts` map with thread-safe access.
2025-09-12 03:00:37 +08:00
Luis Pater ef8820e4e4 Default tokenType to an empty string instead of "gemini" in watcher.go and run.go.
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
v5.1.22
2025-09-11 21:09:27 +08:00
Luis Pater 35daffdb2f Ensure auth directory existence before processing tokens in run.go
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
v5.1.21
2025-09-11 18:03:42 +08:00
Luis Pater 0983119ae2 Remove API key truncation in Gemini client ID generation
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
v5.1.20
2025-09-11 10:22:42 +08:00
Luis Pater 0371062e86 Normalize select to STRING type in Gemini OpenAI request outputs
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
v5.1.19
2025-09-10 23:54:16 +08:00
Luis Pater 74bae32c83 Filter OpenAI models response to include only essential fields (id, object, created, owned_by).
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
v5.1.18
2025-09-10 17:50:33 +08:00
Luis Pater 4e67cd4baf Resolve relative logsDir to executable directory in FileRequestLogger
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
v5.1.17
2025-09-10 03:15:58 +08:00
Luis Pater 0449fefa60 Enhance OAuth handling for Anthropic, Codex, Gemini, and Qwen tokens
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
- Transitioned OAuth callback handling from temporary servers to predefined persistent endpoints.
- Simplified token retrieval by replacing in-memory handling with state-file-based persistence.
- Introduced unified `oauthStatus` map for tracking flow progress and errors.
- Added new `/auth/*/callback` routes, streamlining code and state management for OAuth flows.
- Improved error handling and logging in token exchange and callback flows.
v5.1.16
2025-09-10 02:34:22 +08:00
Luis Pater 156e3b017d Restrict management key validation to non-localhost requests only 2025-09-09 23:28:16 +08:00
Luis Pater d4dc7b0a34 Merge pull request #39 from luispater/config_hash
Avoid unnecessary config.yaml reloads via hash check
2025-09-09 09:26:34 +08:00
hkfires ebf2a26e72 Avoid unnecessary config.yaml reloads via hash check 2025-09-09 09:11:57 +08:00
Luis Pater 545dff8b64 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.
2025-09-09 02:54:06 +08:00
Luis Pater 7353bc0b2b Fix bug: #38 about lobechat cors policy
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
Relax CORS policy by allowing all headers in API responses
v5.1.15
2025-09-08 23:36:43 +08:00
Luis Pater 99c9f3069c Fixed bug #38
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
Add support for API key indexing in OpenAI compatibility clients

- Updated `NewOpenAICompatibilityClient` to accept `apiKeyIndex` for managing multiple API keys.
- Modified client instantiation loops to initialize one client per API key.
- Adjusted client ID format to include `apiKeyIndex` for unique identification.
- Removed API key rotation logic within `GetCurrentAPIKey`.
- Updated `.gitignore` to include `AGENTS.md`.
v5.1.14
2025-09-08 22:36:44 +08:00
Luis Pater f9f2333997 Fix model name update during quota check to avoid incorrect logging
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
v5.1.13
2025-09-08 22:17:21 +08:00
Luis Pater 179b8aa88f Merge pull request #36 from luispater/ssh-tunnel
Add SSH tunnel guidance for login fallback
2025-09-08 09:16:52 +08:00
hkfires 040d66f0bb Add SSH tunnel guidance for login fallback 2025-09-08 09:01:15 +08:00
Luis Pater c875088be2 Add dynamic log level adjustment and "type" field to auth files response
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
- Introduced `SetLogLevel` utility function for unified log level management.
- Updated dynamic log level handling across server and watcher components.
- Extended auth files response by extracting and including the `type` field from file content.
- Updated management API documentation with the new `type` field in auth files response.
v5.1.12
2025-09-08 01:09:39 +08:00
Luis Pater 46fa32f087 Update log level in OpenURL function from Debug to Info 2025-09-07 21:28:10 +08:00
Luis Pater 551bc1a4a8 Enhance README formatting and update .dockerignore
docker-image / docker (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
v5.1.11
2025-09-07 12:26:08 +08:00
Luis Pater 1305f2f6dc Merge pull request #33 from luispater/docker
Modify docker compose for remote image and local build
2025-09-07 12:11:15 +08:00
hkfires 2a2a276e3b Update README 2025-09-07 11:58:43 +08:00
hkfires 5aba4ca1b1 Refactor docker-compose config for simplicity and consistency 2025-09-07 11:35:54 +08:00