3130 Commits
Author SHA1 Message Date
Supra4E8C a14dfc779f fix(docs): update Claude API registration links in README files 2026-07-25 12:13:03 +08:00
Chén Mù 5ac5debdc2 Merge pull request #4553 from router-for-me/log
feat(logging): add debug logging for OAuth selection in home execution
2026-07-25 09:44:17 +08:00
hkfires 3727d87cef feat(logging): add debug logging for OAuth selection in home execution 2026-07-25 09:17:20 +08:00
Luis Pater f8dffa0522 feat(logging): log Codex media forwarding start with detailed fields
- Implemented logging for Codex remote media forwarding start events, including detailed connection and credential metadata.
- Added `formatLogFieldValue` for quoting specific log fields and ensured newline safety in log output.
- Enhanced unit tests to validate log content, escaping, and field inclusion.
2026-07-25 07:51:43 +08:00
Luis Pater 49be36aef6 feat(live): add TCP proxy for Codex Live WebRTC relay
- Implemented a TCP proxy for WebRTC candidate tunneling in Codex Live, supporting passive TCP candidates on port 443.
- Restricted tunneling to globally routable public IPs and added safeguards for rejecting unsafe/private targets.
- Added robust validation of STUN BindingRequest frames before forwarding to upstream candidates.
- Includes extensive unit tests for proxying behavior, candidate validation, and tunnel edge cases.
2026-07-25 07:12:28 +08:00
Luis Pater ebc7446929 feat(diff): enhance config diff and relay updates for Codex Live Media
- Added comprehensive diffing for Codex live media relay settings, including support for public IP, UDP port ranges, and ICE server changes.
- Introduced `displayOptionalValue` utility to handle optional values in diff outputs.
- Improved test coverage for config change detection, ensuring no sensitive information leakage.
- Replaced `allow-private-remote-ips` with the new `disable-private-remote-ips` property, adding YAML backward compatibility.
- Updated Codex live handler to differentiate media relay configuration changes and runtime updates.
2026-07-25 06:09:50 +08:00
Luis Pater bda79b21bb feat(live): relay realtime WebRTC media 2026-07-25 05:11:28 +08:00
Luis Pater 46172dd452 feat(live): add Codex Live session handler and sideband support
- Implemented `live` package to handle Codex WebRTC session bootstrap requests.
- Introduced session forwarding, OAuth-based selection, and multipart payload handling.
- Added sideband WebSocket relay functionality with authorization pinning.
- Comprehensive tests for session handling, response validation, and header management included.

Closes: #4541
2026-07-25 03:44:41 +08:00
Luis Pater 0296600be6 feat(models): add Claude client model catalog and response builder
- Introduced a new `models` package for organizing Claude client model templates and building responses.
- Migrated Claude response handling to `claudemodels.BuildResponse`.
- Added comprehensive tests for model ID transformation, sorting, and metadata validation.
- Removed redundant utility functions and simplified integration with the API server.
2026-07-25 01:41:07 +08:00
Luis Pater 71d591296b feat(models): add Codex client model catalog and response builder
- Introduced a new `models` package for organizing Codex client model templates and building responses.
- Migrated Codex response handling to `codexmodels.BuildResponse`.
- Added comprehensive tests for model metadata, reasoning levels, and input modalities handling.
2026-07-25 01:24:22 +08:00
Luis Pater 9a52607f18 docs: update AICodeMirror sponsor links in README files
Updated AICodeMirror registration links in README, README_CN, and README_JA to reflect the new domain (`aicodemirror.ai`).
2026-07-25 01:02:38 +08:00
Luis Pater 35ebe3f3ed Merge branch 'optimize-multi-agent-v2' into dev 2026-07-25 00:33:33 +08:00
Luis Pater 84bf9376e5 feat(executor): replace sdktranslator.TranslateRequest with helps.TranslateRequestWithCodexMultiAgentV2
- Updated Kimi and Gemini executors to use `TranslateRequestWithCodexMultiAgentV2` for improved multi-agent v2 optimization.
- Enhanced configuration and API server to support `CodexOptimizeMultiAgentV2`.
- Added codex multi-agent V2 optimizations in `config`, `executor`, and `watcher` modules.
2026-07-25 00:32:37 +08:00
Chén Mù a556dfc83a Merge pull request #4540 from router-for-me/test
refactor(tests): simplify credential concurrency and sentinel test fixtures
2026-07-24 22:13:38 +08:00
hkfires 7692ccdca5 refactor(tests): simplify credential concurrency and sentinel test fixtures 2026-07-24 20:46:28 +08:00
Luis Pater 42f36b94e0 fix(usage): harden canonical token normalization 2026-07-24 01:18:18 +08:00
Luis Pater 885ffac42c Merge pull request #4528 from router-for-me/fix/issue-81-normalized-token-accounting
fix(usage): add canonical token accounting v2
2026-07-24 01:04:02 +08:00
Dylan fe8a616aa3 fix(usage): classify partial token accounting correctly 2026-07-24 00:31:32 +08:00
Dylan 416a080174 fix(usage): add normalized token accounting v2 2026-07-23 21:27:03 +08:00
Luis Pater e5729872fa Merge pull request #4522 from sususu98/fix/responses-ws-continuity 2026-07-23 14:31:41 +08:00
Luis Pater 285322cd97 Merge branch 'dev' of github.com:router-for-me/CLIProxyAPI into dev 2026-07-23 14:19:15 +08:00
Luis Pater b30e7d992a Merge branch 'credential-concurrency' into dev
# Conflicts:
#	internal/api/server.go
2026-07-23 13:53:11 +08:00
Luis Pater 3ecd4afe80 feat: add Home credential concurrency support 2026-07-23 13:42:08 +08:00
sususu a661172b1f fix(responses): commit websocket tool cache atomically 2026-07-23 13:07:57 +08:00
sususu 840ba5dcc1 fix(xai): preserve compacted websocket transcript state 2026-07-23 13:07:37 +08:00
sususu e05ae09425 fix(responses): preserve context across websocket transport changes 2026-07-23 13:07:23 +08:00
Luis Pater e8ef4d7338 Merge pull request #4249 from sylearn/docs/add-aiusage-showcase
docs: add AIUsage to related projects
2026-07-22 23:51:48 +08:00
Luis Pater f71ec0eb67 feat(server): add support for Codex Alpha Search model routing
- Implemented `codexAlphaSearchSelectionModel` and `codexAlphaSearchModelRouterHost` for dynamic model selection using plugin-based routing.
- Introduced new `codex-alpha-search` source format for model route requests.
- Integrated routing logic into the model selection pipeline to handle Codex Alpha Search requests with fallback mechanisms.
2026-07-22 22:46:10 +08:00
Luis Pater f3e36f19c0 feat(executor): add Claude input token state handling and token estimation logic
- Introduced `ClaudeInputTokenState` to track and estimate input token usage for Claude message_start events.
- Added `TranslateStreamWithClaudeInputTokens` for token-aware stream translation.
- Updated executors (XAI, Kimi, Gemini) to leverage the new logic.
- Included robust test cases for token counting, JSON validation, and concurrent tokenization scenarios.
2026-07-22 05:21:14 +08:00
Luis Pater cb110ad4fa perf(executor): improve token counting by introducing countXAIInputTokens
- Refactored token counting logic into a reusable `countXAIInputTokens` function for better readability and maintainability.
- Replaced direct encoder usage with structured input handling, including JSON parsing and segment collection.
- Switched tokenizer from `Cl100kBase` to `O200kBase` to support larger contexts.

Closes: #4492
2026-07-22 04:00:51 +08:00
Luis Pater 3ad6dfe30e perf(translator): optimize tool handling in OpenAI translator requests
- Moved `parallel_tool_calls` and `tool_choice` logic inside conditional handling for `chatCompletionsTools`.
- Eliminated redundant field updates to streamline payload processing.

Closes: #4491
2026-07-22 03:43:50 +08:00
Luis Pater 36b45d57a3 Merge pull request #4083 from seakee/fix/auth-files-filter-by-index
fix(management): filter auth files by name and auth index
2026-07-21 22:06:35 +08:00
Luis Pater 2b4e96212a Merge pull request #4481 from KorenKrita/agent/fix-plugin-stream-bridge-close-race
fix(pluginhost): prevent stream close/send panic
2026-07-21 21:42:09 +08:00
KorenKrita 119debe1f2 fix(pluginhost): honor accepted emit results 2026-07-21 19:21:20 +08:00
KorenKrita 3e7e0815aa fix(pluginhost): prevent stream close/send panic (#4480) 2026-07-21 19:08:17 +08:00
Luis Pater db82d65d1c docs(readme): update Kimi model descriptions with K3 details
- Replaced references to K2.6 with K3 across README files (EN, CN, JA).
- Highlighted Kimi K3's capabilities as the world's first open 3T-class model, including 2.8T parameters, native vision, and enhanced context window (1M tokens).
- Updated quickstart links and clarified CLIProxyAPI support information.
2026-07-21 17:16:25 +08:00
hkfires 01f387f447 feat(docker): add plugin volume mapping to docker-compose files 2026-07-21 13:10:17 +08:00
Luis Pater a007ad69f2 test(websocket): add robust unit tests for tool call handling and reconciliation
- Implemented tests for scenarios involving incomplete, conflicting, and reconciled tool calls in response payloads.
- Enhanced coverage for `restoreResponsesWebsocketCompletionOutput` and `responseCompletedOutputFromPayload` logic.
- Refactored `isCompleteResponsesWebsocketToolCall` to validate string fields in tool calls.
- Improved caching behavior to skip incomplete tool calls and ensure reconciliation logic aligns with expected outputs.

Closes: #4447
2026-07-20 16:47:22 +08:00
sususu98 7329437297 fix(websocket): propagate upstream 1009 without credential fallback (#4444)
Preserve Codex and XAI upstream message-too-big closes across the Responses WebSocket boundary while treating them as request-scoped errors. Prevent CPA reconnect and credential cooldown/fallback, scope close state to the active connection, retain terminal errors under backpressure, and ensure downstream disconnect cleanup cannot wait behind a blocked writer.
2026-07-20 16:18:13 +08:00
Luis Pater 7d2883e745 chore(models): remove obsolete variables and approvals from Codex client models
- Deleted unused `instructions_variables` and `approvals` fields from `codex_client_models.json`.
2026-07-20 15:58:37 +08:00
Luis Pater 53c1e7e2dd perf(util): introduce GetGJSONBytesNoCopy for efficient JSON parsing without data duplication
- Added `GetGJSONBytesNoCopy` in `internal/util` for safe, no-copy JSON parse operations leveraging `unsafe`.
- Replaced `gjson.GetBytes` with the new helper in key payload processing paths (`kimi_executor`, `vertex_payload_helpers`, etc.) to improve performance.
- Added unit tests for behavior validation, including edge cases with empty input.
2026-07-20 15:37:55 +08:00
Luis Pater 8b4fd28c95 perf(executor): replace sjson.SetBytes with optimized helpers for conditional payload updates
- Introduced `SetStringIfDifferent`, `SetBoolIfDifferent`, and similar helpers in `payload_helpers` to avoid unnecessary writes during JSON modifications.
- Simplified message patching in `kimi_executor` for reasoning and tool call adjustments.
- Updated all executors (Gemini, Codex, XAI, Antigravity, etc.) to use the new helpers, enhancing readability and potentially reducing overhead.
- Removed obsolete `filterKimiEmptyAssistantMessages` function in `kimi_executor`.
2026-07-20 13:57:14 +08:00
Luis Pater 64291120e7 perf(translator): add unit tests for payload reuse and normalization across translators
- Added tests to ensure no-copy payload reuse for various translators (Codex, Gemini, OpenAI, Claude, etc.).
- Covered scenarios for field normalization, tool parameter cleaning, and thought signature sanitization.
- Included a benchmark for SanitizeGeminiRequestThoughtSignatures with large normalized payloads.
2026-07-20 03:50:35 +08:00
Luis Pater 0f52284e6c perf(translator): add normalization and reuse logic for Codex request payloads
- Introduced field normalization functions (`setCodexRequiredBool`, `setCodexRequiredInclude`) to ensure correct Codex input structure.
- Added tests for normalized payload reuse and field validation in `ConvertOpenAIResponsesRequestToCodex`.
- Implemented `deleteCodexRequestFields` utility to remove unsupported fields dynamically.
- Added benchmarks for normalized payload processing to measure performance across different payload sizes.

Closes: #4362
2026-07-20 02:23:15 +08:00
Luis Pater fde40c5a0a feat(executor): sanitize and drop overlong encrypted reasoning IDs in Codex input processing
- Updated `SanitizeCodexInputItemIDs` to remove encrypted reasoning items with IDs exceeding the Codex length limit.
- Refactored logic to deterministically shorten other overlong input item IDs, ensuring compliance with the Codex format.
- Added new tests to verify dropping behavior for encrypted reasoning and shortening of lengthy IDs without encrypted content.
2026-07-20 02:02:17 +08:00
sylearn c502eba874 docs: clarify CPA process supervision 2026-07-19 19:55:04 +08:00
sylearn 2457e01e87 docs: add AIUsage to related projects 2026-07-19 19:55:04 +08:00
Luis Pater e47ffda75b feat(translator): normalize and extract OpenAI file content with MIME type
- Added `NormalizeOpenAIFileData` utility to parse and validate file content, ensuring proper MIME type handling and base64 extraction.
- Refactored translation logic to use normalized file data for Gemini, Antigravity, and Interactions processors.
- Introduced comprehensive unit tests for both valid and invalid file data scenarios across all translators.

Fixed: #4416
2026-07-19 18:29:05 +08:00
Luis Pater 07f8354912 feat(translator): qualify function names with namespace in OpenAI response handling
- Updated `ConvertOpenAIResponsesRequestToOpenAIChatCompletions` to include namespaces when generating function names for tool calls.
- Added test case to validate namespace qualification logic for function call histories.

Fixed: #4423
2026-07-19 17:52:02 +08:00
Luis Pater cd98e9d74d feat(translator): handle empty response content for Claude and adjust JSON structure
- Added conditional logic to append `content_block_start` for empty responses, ensuring correct event flow.
- Updated default `responseJSON` structure to use an empty array (`[]`) for the `content` field instead of `null`.

Fixed: #4431
2026-07-19 17:32:54 +08:00