Commit Graph

631 Commits

Author SHA1 Message Date
hkfires
7f266aa19e fix(aistudio): ensure colon-spaced JSON in responses 2025-10-26 20:21:45 +08:00
hkfires
f3f31274e8 refactor(wsrelay): rename RoundTrip to NonStream 2025-10-26 20:01:46 +08:00
hkfires
7061cd6058 fix(gemini): map responseModalities to uppercase IMAGE/TEXT 2025-10-26 19:35:22 +08:00
Luis Pater
5da5674ae2 Merge pull request #161 from router-for-me/aistudio
Add websocket provider
2025-10-26 16:39:09 +08:00
hkfires
7459c2c81a fix(aistudio): remove generationConfig and tools when action is countTokens 2025-10-26 16:28:20 +08:00
Luis Pater
cd4706f60e fix(server): resolve incorrect variable usage in management asset paths
- Replaced `s.currentPath` with `s.configFilePath` for consistent handling of management asset paths.
- Adjusted calls to `managementasset.FilePath` and `StaticDir` to use the updated configuration path.
v6.2.32
2025-10-26 12:44:57 +08:00
hkfires
359b8de44e feat(ws): add WebSocket auth 2025-10-26 07:46:04 +08:00
hkfires
ea6065f1b1 fix(aistudio): strip usage metadata from non-final stream chunks 2025-10-26 07:46:04 +08:00
hkfires
8aaed4cf09 feat(aistudio): support non-streaming responses 2025-10-26 07:46:04 +08:00
hkfires
c32e013605 feat(aistudio): track Gemini usage and improve stream errors 2025-10-26 07:46:04 +08:00
hkfires
3839d93ba0 feat: add websocket routing and executor unregister API
- Introduce Server.AttachWebsocketRoute(path, handler) to mount websocket
  upgrade handlers on the Gin engine.
- Track registered WS paths via wsRoutes with wsRouteMu to prevent
  duplicate registrations; initialize in NewServer and import sync.
- Add Manager.UnregisterExecutor(provider) for clean executor lifecycle
  management.
- Add github.com/gorilla/websocket v1.5.3 dependency and update go.sum.

Motivation: enable services to expose WS endpoints through the core server
and allow removing auth executors dynamically while avoiding duplicate
route setup. No breaking changes.
2025-10-26 07:46:03 +08:00
Luis Pater
a552a45b81 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.
v6.2.31
2025-10-26 05:39:15 +08:00
Luis Pater
f6cf784cd1 refactor(translator): remove unused log dependency and comment out debug logging
docs: add GPT-5 Codex guidelines for CLI usage

- Added detailed guidelines for GPT-5 Codex in Codex CLI.
- Expanded instructions on sandboxing, approvals, editing constraints, and style requirements.
- Included presentation and response formatting best practices.

fix(codex_instructions): update comparison logic to use prefix matching

- Changed system instructions comparison to use `strings.HasPrefix` for improved flexibility.
v6.2.30
2025-10-24 12:15:15 +08:00
Luis Pater
e783923464 feat(executor): add debug logs for rate-limiting retries in Gemini CLI executor 2025-10-23 10:39:21 +08:00
Luis Pater
e6d7677373 docs: add GPT-5 Codex guidelines for internal usage
- Added comprehensive instructions for Codex CLI harness, sandboxing, approvals, and editing constraints to `internal/misc/codex_instructions/`.
- Clarified `approval_policy` configurations and scenarios requiring escalated permissions.
- Provided detailed style and structure guidelines for presenting results in the Codex CLI.
v6.2.29
2025-10-23 09:14:56 +08:00
Luis Pater
d225558dae feat: improve error handling with added status codes and headers
- Updated Execute methods to include enhanced error handling via `StatusCode` and `Headers` extraction.
- Introduced structured error responses for cooling down scenarios, providing additional metadata and retry suggestions.
- Refined quota management, allowing for differentiation between cool-down, disabled, and other block reasons.
- Improved model filtering logic based on client availability and suspension criteria.
2025-10-22 09:01:11 +08:00
Luis Pater
9678be7aa4 feat: add DisableCooling configuration to manage quota cooldown behavior v6.2.28 2025-10-21 21:51:30 +08:00
Luis Pater
243bf5c108 feat: enhance tool call handling in OpenAI response conversion v6.2.27 2025-10-21 20:04:24 +08:00
Luis Pater
3569e5779a feat: enhance quota management with backoff levels and cooldown logic v6.2.26 2025-10-21 18:44:28 +08:00
Luis Pater
20985d1a10 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.
2025-10-21 11:22:24 +08:00
Luis Pater
67f553806b feat: implement management asset configuration and auto-updater 2025-10-21 09:01:58 +08:00
Luis Pater
29044312a4 docs: add Subtitle Translator tool to README files 2025-10-21 02:48:08 +08:00
Luis Pater
5b3fc092ee Merge pull request #151 from VjayC/add-subtitle-translator
docs: add Subtitle Translator to projects list
2025-10-21 02:44:50 +08:00
Vijay Chimmi
792e8d09d7 docs: add Subtitle Translator to projects list 2025-10-20 11:29:18 -07:00
Luis Pater
eadccb229f Fixed: #148
feat(executor): add initial cache_helpers.go file
v6.2.25
2025-10-20 10:17:29 +08:00
Luis Pater
fed6f3ecd7 Merge pull request #147 from router-for-me/config
feat(mgmt): support YAML config retrieval and updates via /config.yaml
v6.2.24
2025-10-19 22:26:38 +08:00
hkfires
f8dcd707a6 feat(mgmt): support YAML config retrieval and updates via /config.yaml 2025-10-19 21:56:29 +08:00
Luis Pater
0e91e95287 Merge pull request #145 from router-for-me/path
feat: prefer util.WritablePath() for logs and local storage
v6.2.23
2025-10-19 20:50:44 +08:00
Luis Pater
c5dcbc1c1a Merge pull request #146 from router-for-me/iflow
feat(iflow): add masked token logs; increase refresh lead to 24h
2025-10-19 20:49:40 +08:00
hkfires
4504ba5329 feat(iflow): add masked token logs; increase refresh lead to 24h 2025-10-19 10:56:29 +08:00
hkfires
d16599fa1d feat: prefer util.WritablePath() for logs and local storage 2025-10-19 10:19:55 +08:00
Luis Pater
674393ec12 Merge pull request #139 from router-for-me/log
feat(logging): centralize sensitive header masking
v6.2.22
2025-10-18 22:25:28 +08:00
hkfires
9f45806106 feat(logging): centralize sensitive header masking 2025-10-18 17:16:00 +08:00
Luis Pater
307ae76ed4 refactor: streamline ConvertCodexResponseToGeminiNonStream by removing unnecessary buffer and improving response handling v6.2.21 2025-10-18 16:08:30 +08:00
Luis Pater
735b21394c Fixed: #137
refactor: simplify ConvertCodexResponseToClaudeNonStream by removing bufio.Scanner usage and restructuring response parsing logic
v6.2.20
2025-10-18 06:22:42 +08:00
Luis Pater
9cdef937af fix: initialize contentBlocks with an empty slice and improve content handling in ConvertOpenAIResponseToClaudeNonStream v6.2.19 2025-10-17 08:47:09 +08:00
Luis Pater
3dd0844b98 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.
v6.2.18
2025-10-17 04:12:38 +08:00
Luis Pater
4477c729a4 Fixed: #129 #123 #102 #97
feat: add all protocols request and response translation for Gemini and Gemini CLI compatibility
v6.2.17
2025-10-17 02:11:29 +08:00
Luis Pater
0d89a22aa0 feat: add handling for function call finish reasons in OpenAI response conversion v6.2.16 2025-10-17 00:19:32 +08:00
hkfires
9319602812 UPDATE README 2025-10-16 22:57:44 +08:00
Chén Mù
8e95c5e0a8 Merge pull request #134 from router-for-me/hg
feat(managementasset): add MANAGEMENT_STATIC_PATH override
v6.2.15
2025-10-16 22:25:05 +08:00
hkfires
93f0e65cef docs: document MANAGEMENT_STATIC_PATH for management.html location 2025-10-16 22:15:17 +08:00
hkfires
c75e524fe5 feat(managementasset): add MANAGEMENT_STATIC_PATH override 2025-10-16 21:52:59 +08:00
Chén Mù
f58d0faf8c Merge pull request #130 from router-for-me/log
feat(management): add log retrieval and cleanup endpoints
v6.2.14
2025-10-16 12:39:06 +08:00
hkfires
df3b00621a fix(logs): ignore ENOENT when truncating default log file 2025-10-16 12:35:29 +08:00
hkfires
72cb2689e8 feat(management): add log retrieval and cleanup endpoints 2025-10-16 11:55:58 +08:00
Luis Pater
ade279d1f2 Feature: #103
feat(gemini): add Gemini thinking configuration support and metadata normalization

- Introduced logic to parse and apply `thinkingBudget` and `include_thoughts` configurations from metadata.
- Enhanced request handling to include normalized Gemini model metadata, preserving the original model identifier.
- Updated Gemini and Gemini-CLI executors to apply thinking configuration based on metadata overrides.
- Refactored handlers to support metadata extraction and cloning during request preparation.
2025-10-16 11:31:18 +08:00
Luis Pater
9c5ac2927a fix(request_logging): update logging conditions to include only /v1 paths 2025-10-16 09:57:27 +08:00
Luis Pater
7980f055fa fix(iflow): streamline authentication callback handling and improve error reporting 2025-10-16 09:44:36 +08:00
Luis Pater
eb2549a782 fix(gemini): update response template to omit finishReason until known v6.2.13 2025-10-16 06:41:04 +08:00