Commit Graph
148 Commits
Author SHA1 Message Date
RCD a2a4fba626 chore: merge upstream CLIProxyAPI v6.9.1 2026-03-24 09:41:49 +07:00
sususu98 e8bb350467 fix: extend tool name sanitization to all remaining Gemini-bound translators
Apply SanitizeFunctionName on request and RestoreSanitizedToolName on
response for: gemini/claude, gemini/openai/chat-completions,
gemini/openai/responses, antigravity/openai/chat-completions,
gemini-cli/openai/chat-completions.

Also update SanitizedToolNameMap to handle OpenAI format
(tools[].function.name) in addition to Claude format (tools[].name).
2026-03-22 14:06:46 +08:00
sususu98 755ca75879 fix: address review feedback - init ToolNameMap eagerly, log collisions, add collision test 2026-03-22 13:24:03 +08:00
sususu98 2398ebad55 fix(translator): sanitize tool names for Gemini function_declarations compatibility
Claude Code and MCP clients may send tool names containing characters
invalid for Gemini's function_declarations (e.g. '/', '@', spaces).
Sanitize on request via SanitizeFunctionName and restore original names
on response for both antigravity/claude and gemini-cli/claude translators.
2026-03-22 13:10:53 +08:00
Luis Pater 2bd646ad70 refactor: replace sjson.Set usage with sjson.SetBytes to optimize mutable JSON transformations 2026-03-19 17:58:54 +08:00
RCD 82a00093b6 chore: merge upstream CLIProxyAPI v6.8.55 2026-03-17 02:25:21 +07:00
Muran-prog 152c310bb7 test: add uniqueItems stripping test
Covers the fix from the previous commit — verifies uniqueItems is
removed from the schema and moved to the description hint.
2026-03-14 21:22:14 +02:00
Muran-prog f6bbca35ab fix: strip uniqueItems from Gemini function_declarations (#2123)
Gemini API rejects uniqueItems in tool schemas with 400. Add it to
unsupportedConstraints alongside minItems/maxItems where it belongs.

Same class of fix as #1424 and #1531.
2026-03-14 21:18:06 +02:00
Luis Pater ddaa9d2436 Fixed: #2034
feat(proxy): centralize proxy handling with `proxyutil` package and enhance test coverage

- Added `proxyutil` package to simplify proxy handling across the codebase.
- Refactored various components (`executor`, `cliproxy`, `auth`, etc.) to use `proxyutil` for consistent and reusable proxy logic.
- Introduced support for "direct" proxy mode to explicitly bypass all proxies.
- Updated tests to validate proxy behavior (e.g., `direct`, HTTP/HTTPS, and SOCKS5).
- Enhanced YAML configuration documentation for proxy options.
2026-03-11 11:08:02 +08:00
RCD 98247b0b8d chore: merge upstream CLIProxyAPI v6.8.48 2026-03-09 09:01:45 +07:00
RCD 8ad863a4a2 chore: merge upstream CLIProxyAPI v6.8.43 2026-03-07 19:05:56 +07:00
RCD 08fb275fb6 chore: merge upstream CLIProxyAPI v6.8.42 2026-03-07 19:05:11 +07:00
Xu Hong 553d6f50ea fix: sanitize tool_use.id to comply with Claude API regex ^[a-zA-Z0-9_-]+$
Add util.SanitizeClaudeToolID() to replace non-conforming characters in
tool_use.id fields across all five response translators (gemini, codex,
openai, antigravity, gemini-cli).

Upstream tool names may contain dots or other special characters
(e.g. "fs.readFile") that violate Claude's ID validation regex.
The sanitizer replaces such characters with underscores and provides
a generated fallback for empty IDs.

Fixes #1872, Fixes #1849

Made-with: Cursor
2026-03-06 00:10:09 +08:00
Luis Pater 4e1d09809d Fixed: #1741
fix(translator): handle tool name mappings and improve tool call handling in OpenAI and Claude integrations
2026-03-05 22:24:50 +08:00
Luis Pater fdbd4041ca Fixed: #1531
fix(gemini): add `deprecated` to unsupported schema keywords

Add `deprecated` to the list of unsupported schema metadata fields in Gemini and update tests to verify its removal.
2026-03-05 11:48:15 +08:00
RCD 0af0ad14e5 Merge upstream CLIProxyAPI v6.8.28–v6.8.32
Upstream changes:
- Codex responses compaction payload compatibility
- Codex usage_limit_reached retry-after, deterministic parsing
- Codex refresh_token_reused non-retryable fix
- Qwen rate limiting and quota error handling
- Context management compatibility simplification
- Antigravity tool_result image fix, model list backfill, deep copy cache
- Auth auto-refresh interval/concurrency limiting
- Auth hook OnResult refactor (replaces MarkResult)
- Gemini-3.1-flash-image support
- Registry cleanup of outdated model definitions

Fork resolution:
- Accept upstream's consolidated conductor.go (auto-refresh, round-tripper)
- Delete stale conductor_oauth.go, conductor_token.go (upstream reversed split)
- Delete stale provider_rotation_test.go (references removed method)
2026-02-27 20:58:16 +07:00
RCD 064f2e6b8d Merge remote-tracking branch 'upstream/main' 2026-02-12 22:26:45 +07:00
NathanandClaude Opus 4.6 166d2d24d9 fix(schema): remove Gemini-incompatible tool metadata fields
Sanitize tool schemas by stripping prefill, enumTitles, $id, and patternProperties to prevent Gemini INVALID_ARGUMENT 400 errors, and add unit and executor-level tests to lock in the behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 18:29:17 +11:00
RCD 38e7f28233 Merge upstream CLIProxyAPI v6.7.53 into ProxyPilot
Changes (v6.7.49 - v6.7.53):
- feat(registry): add Claude 4.6 (Opus) model
- feat(registry): add GPT 5.3 Codex model
- fix(registry): correct Claude Opus 4.6 model metadata
- fix: enable extended thinking support for Claude Haiku 4.5
- refactor(executor): centralize Codex client version and user agent
- refactor(translator, executor): remove redundant bytes.Clone calls
- refactor(util): optimize JSON schema processing

Upstream: https://github.com/router-for-me/CLIProxyAPI/releases/tag/v6.7.53
2026-02-06 10:24:59 +07:00
kvokka bc78d668ac feat(registry): register Claude 4.6 static data
Add model definition for Claude 4.6 Opus with 200k context length and thinking support capabilities.
2026-02-05 23:13:36 +04:00
Luis Pater f0bd14b64f refactor(util): optimize JSON schema processing and keyword removal logic
- Consolidated path-finding logic into a new `findPathsByFields` helper function.
- Refactored repetitive loop structures to improve readability and performance.
- Added depth-based sorting for deletion paths to ensure proper removal order.
2026-02-06 00:19:56 +08:00
RCD 6c0c0b3a44 Merge upstream CLIProxyAPI v6.7.48 into ProxyPilot
Changes:
- feat(registry): add Kimi-K2.5 model to static data
- refactor(util, executor): optimize payload handling and schema processing
- fix(thinking): support user-defined includeThoughts setting (camelCase/snake_case)
- fix(thinking): ensure includeThoughts is false for ModeNone
- fix(gemini): support snake_case thinking config fields from Python SDK
- feat(gemini-cli): support image content in Claude request conversion
- fix(test): upstream fixed the builtin tools test we also fixed

Upstream: https://github.com/router-for-me/CLIProxyAPI/releases/tag/v6.7.48
2026-02-05 21:39:14 +07:00
Luis Pater 25c6b479c7 refactor(util, executor): optimize payload handling and schema processing
- Replaced repetitive string operations with a centralized `escapeGJSONPathKey` function.
- Streamlined handling of JSON schema cleaning for Gemini and Antigravity requests.
- Improved payload management by transitioning from byte slices to strings for processing.
- Removed unnecessary cloning of byte slices in several places.
2026-02-05 19:00:30 +08:00
RCDandClaude 459997789e refactor(gemini): optimize removeExtensionFields with post-order traversal
Cherry-picked from upstream ca796510

Uses post-order traversal and DeleteBytes for better performance.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:30:57 +07:00
RCDandClaude 29f0da4942 fix(gemini): remove unsupported extension fields
Cherry-picked from upstream d0d66cdc

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:30:35 +07:00
이대희andAmp ca796510e9 refactor(gemini): optimize removeExtensionFields with post-order traversal and DeleteBytes
Amp-Thread-ID: https://ampcode.com/threads/T-019c0d09-330d-7399-b794-652b94847df1
Co-authored-by: Amp <amp@ampcode.com>
2026-01-30 13:02:58 +09:00
이대희andAmp d0d66cdcb7 fix(gemini): Removes unsupported extension fields
Removes x-* extension fields from JSON schemas to ensure compatibility with the Gemini API.

These fields, while valid in OpenAPI/JSON Schema, are not recognized by the Gemini API and can cause issues.
The change recursively walks the schema, identifies these extension fields, and removes them, except when they define properties.

Amp-Thread-ID: https://ampcode.com/threads/T-019c0cd1-9e59-722b-83f0-e0582aba6914
Co-authored-by: Amp <amp@ampcode.com>
2026-01-30 12:31:26 +09:00
RCDandClaude 41b1ad654e feat(config): add oauth-model-alias migration support
Add migration logic for converting oauth-model-mappings to oauth-model-alias
with comprehensive test coverage.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:30:09 +07:00
RCD 1663148a32 feat: sync with upstream v6.7.25-26
Cherry-picked changes from CLIProxyAPI:
- fix(gemini): force type to string for enum fields (fixes Antigravity Gemini API error)
- feat(auth): add request_retry and disable_cooling per-auth overrides
- feat(auth): add skip persistence context key for file watcher events

Manually added RequestRetryOverride/DisableCoolingOverride methods to
types.go to preserve ProxyPilot's conductor.go compatibility while
gaining new functionality.
2026-01-27 22:08:43 +07:00
Darley decddb521e fix(gemini): force type to string for enum fields to fix Antigravity Gemini API error (Relates to #1260) 2026-01-27 11:14:08 +03:30
RCD 377697331b feat: sync with upstream v6.7.17-18
- Updated gemini_schema.go with improved schema cleaning
- Refined signature caching logic (kept 1h TTL for memory efficiency)
- Enhanced Claude/Gemini translator tests
- Fixed Gemini function-calling INVALID_ARGUMENT via relaxed tool validation
2026-01-23 19:26:02 +07:00
hkfires abfca6aab2 refactor(util): reorder gemini schema cleaner helpers 2026-01-22 18:38:48 +08:00
sowar1987andWarp 269a1c5452 refactor: reuse placeholder reason description
Co-Authored-By: Warp <agent@warp.dev>
2026-01-22 17:12:47 +08:00
sowar1987 a2f8f59192 Fix Gemini function-calling INVALID_ARGUMENT by relaxing Gemini tool validation and cleaning schema 2026-01-22 17:11:07 +08:00
RCD e6e7e6db30 feat(registry): support provider-specific model info lookup
Add InfoByProvider map to ModelRegistration to store provider-specific
ModelInfo, enabling different capabilities for the same model across
providers (e.g., direct API vs OpenRouter).

Changes:
- Add InfoByProvider field to ModelRegistration struct
- Update GetModelInfo to accept provider parameter for provider-specific lookup
- Update LookupModelInfo to accept variadic provider parameter
- Add LookupStaticModelInfo for fallback to static model definitions
- Update ApplyThinking to pass providerKey for registry lookups
- Update all GetModelInfo callers to use new signature
- Remove ensureMaxTokensForThinking test (function moved to thinking package)

Ported from CLIProxyAPI e641fde2
2026-01-20 11:15:39 +07:00
RCD 630102632f fix(antigravity): convert non-string enum values to strings for Gemini API
Gemini API requires enum values to be strings. This adds NormalizeEnumValues
to convert numeric or boolean enum values to their string representations.
Cherry-picked from CLIProxyAPI.
2026-01-19 06:01:28 +07:00
sususu98 dd6d78cb31 fix(antigravity): convert non-string enum values to strings for Gemini API
Gemini API requires all enum values in function declarations to be
strings. Some MCP tools (e.g., roxybrowser) define schemas with numeric
enums like `"enum": [0, 1, 2]`, causing INVALID_ARGUMENT errors.

Add convertEnumValuesToStrings() to automatically convert numeric and
boolean enum values to their string representations during schema
transformation.
2026-01-18 02:00:02 +00:00
hkfires 6e4a602c60 fix(thinking): map reasoning_effort to thinkingConfig 2026-01-15 13:06:40 +08:00
hkfires 2262479365 refactor(thinking): remove legacy utilities and simplify model mapping 2026-01-15 13:06:40 +08:00
hkfires 0b06d637e7 refactor: improve thinking logic 2026-01-15 13:06:39 +08:00
Finessse b654a19a09 feat(gemini): enable thinking by default for Gemini 3 Flash 2026-01-11 14:28:59 +07:00
Finessse 741333697e sync(upstream): gemini thinking guards + thoughtSignature
Cherry-picked:
- 05444cf3: abort default injection on existing thinking keys
- 8edbda57: add thoughtSignature to node parts for Gemini/Antigravity

Skipped ef6bafbf (context cancellation) - structural conflict with our
multi-project fallback loops.
2026-01-11 06:45:24 +07:00
Finessse db647820c9 fix(util): add kiro prefix fallback and reduce debug log noise 2026-01-09 23:41:57 +07:00
hkfires 05444cf32d fix(gemini): abort default injection on existing thinking keys 2026-01-05 10:24:30 +08:00
Luis Pater ebec293497 feat(api): integrate TokenStore for improved auth entry management
Replaced file-based auth entry counting with `TokenStore`-backed implementation, enhancing flexibility and context-aware token management. Updated related logic to reflect this change.
2026-01-03 04:53:47 +08:00
hkfires fdf5720217 fix(gemini): remove default thinking for gemini 3 models 2026-01-02 10:55:59 +08:00
hkfires 4fc3d5e935 refactor(iflow): simplify thinking config handling for GLM and MiniMax models 2026-01-01 19:31:08 +08:00
Luis Pater 6a66d32d37 Merge pull request #803 from HsnSaboor/fix-invalid-function-names-sanitization-v2
feat(translator): resolve invalid function name errors by sanitizing Claude tool names
2026-01-01 01:15:50 +08:00
hkfires 8bf3305b2b fix(thinking): fallback to upstream model for thinking support when alias not in registry 2025-12-31 18:07:13 +08:00
hkfires d00e3ea973 feat(thinking): add numeric budget to thinkingLevel conversion fallback 2025-12-31 17:14:47 +08:00