Commit Graph

694 Commits

Author SHA1 Message Date
Delcado19
2be00e2a78 fix(proxy): raise Next client body limit to 128MB (configurable)
Avoid 10MB truncation of large /v1 payloads via NINEROUTER_PROXY_CLIENT_MAX_BODY_SIZE (#1529, #1572)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 12:34:43 +07:00
Farhan Usman
4fc02e67e5 fix(minimax): echo reasoning_content on follow-up turns to avoid 400
MiniMax requires reasoning_content echoed back on assistant messages in
multi-turn/tool-call conversations. Add minimax and minimax-cn to
PROVIDER_RULES (scope all), same fix as DeepSeek (#1543).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 12:25:12 +07:00
Simon Shi
8ad95542da fix(kiro): handle 400 on tool-bearing history without client tools
Kiro requires a non-empty currentMessage tools array whenever history
references any tool use, else returns "Improperly formed request" (400).
Clients trip this by omitting tools on follow-ups after client-side
compaction.

- flattenToolInteractions(): no client tools -> collapse tool_use/result
  to text so the "tools required" rule never fires
- reconcileOrphanedToolResults(): client tools -> salvage orphaned
  results as text, keep matched ones, guard co-located tools array
- safeJSONParse(): guard tool-call argument parsing against bad JSON
- merge consecutive user userInputMessageContext; null-guard
  currentMessage for assistant-only input

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 12:23:47 +07:00
decolua
281f292f63 test(translator): add data-driven coverage, bug-exposing cases, and real provider smoke
- matrix.js generates N providers x M models from PROVIDER_MODELS
- coverage-all-models + format-roundtrip for structural/semantic checks
- bugs-* files expose known translation issues via it.fails
- real/smoke-providers runs full handleChatCore path against live providers (RUN_REAL=1), concurrent
- registerAll.js eagerly imports translators (Vitest ESM require fix)
- vitest.config: array aliases for subpaths + maxConcurrency 60

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 12:19:59 +07:00
decolua
4758a00b44 docs: add Russian README, remove unused testFromFile script
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 12:18:37 +07:00
Giao Ho
0850f0a470 fix(mitm): Kiro binary EventStream crash + add models & TTS tool filtering
- server.js: isBinaryData() skips binary AWS EventStream bodies (fix JSON parse crash)
- kiro.js: isBinaryEventStream detection + migrate to pipeTransformedEventStream pipeline
- base.js: add pipeTransformedSSE / pipeTransformedEventStream helpers
- chatCore.js: filter tool messages + tools for TTS models via getModelType()
- providerModels.js: add getModelType()
- cliTools.js: add gpt-5-mini (Copilot), glm-5 & minimax-m2.5 (Kiro)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 11:31:52 +07:00
Kevin Le
c233c7c8fc fix(codex): durable OAuth refresh lifecycle
Add shared OAuth credential lifecycle manager with provider-aware refresh
decisions. Implement CodexExecutor.refreshCredentials so 401/403 retry
refresh works for Codex, track lastRefreshAt and refresh before the
upstream stale-token window, preserve omitted idToken, and add
per-connection single-flight refresh to avoid refresh-token rotation races.

Merged from PR #1664.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 11:04:36 +07:00
Delcado19
38b73bfc6b fix(antigravity): passthrough tab-autocomplete + mark default agent slot mandatory
MODEL_NO_MAP guard never re-routes Antigravity tab-autocomplete (tab_* models)
so latency-critical inline completion stays native. Flags gemini-3.5-flash-low
(agent/Default) as mandatory in the dashboard.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 10:48:14 +07:00
therunnas
61d546627e fix(qoder): allow qmodel_latest model key
- Add qmodel_latest to QODER_MODEL_MAP
- Expose qmodel_latest in static Qoder provider catalog (qd)
- Generalize executor comment so model set does not go stale
- Add unit coverage for the new model key + catalog

Closes #1638

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 10:44:37 +07:00
AbdoKnbGit
e6c09aad15 feat(antigravity): add gemini-3.5-flash-extra-low (Low) model
- Add gemini-3.5-flash-extra-low across CLI menu, provider models, usage, pricing
- Add MITM synonyms (high/medium/extra-low) and split pattern so Low no longer falls through to Medium
- Strip models/ prefix in getMappedModel for AG public name normalization

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 10:42:47 +07:00
Mr_NoboDy
40cfa63eb8 feat(xiaomi-tokenplan): add Claude-native MiMo V2.5 Pro alias via dedicated executor
Add mimo-v2.5-pro-claude alias routing to the Xiaomi TokenPlan Anthropic-compatible
/anthropic/v1/messages endpoint. Logic lives in a dedicated XiaomiTokenplanExecutor
(config-driven via targetFormat) instead of the shared DefaultExecutor.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 10:36:03 +07:00
Delcado19
3dda651bad fix(kiro): add mappable "auto" model slot for Kiro agent mode
Kiro sends modelId "auto" for the main agent turn; without a defaultModels
slot getMappedModel returned null and the call leaked to AWS instead of the
configured provider. Adds the slot + guard test.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 10:31:39 +07:00
zhangweihong
12c97ad46f feat(qoder): fetch latest model + nút import model trên dashboard
Merge PR #1642 (decolua/9router) — chỉ lấy code + i18n, bỏ test/docs/package.json.

- qoder.js: bỏ guard QODER_MODEL_MAP cứng, resolve model_config qua dynamic API (hỗ trợ qmodel_latest không cần sửa code)
- dashboard page: thêm nút "Fetch Qoder Models" tự import model list vào aliases
- i18n zh-CN: thêm key cho nút fetch

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 10:22:03 +07:00
Delcado19
44d8de288d fix(providers): restore one-connection guard for compatible/embedding nodes
OpenAI/Anthropic Compatible and Custom Embedding nodes allow exactly one
connection each. The guards were dropped during the bun:sqlite refactor
(v0.4.28), so duplicate POSTs were accepted (201) instead of rejected (400).

Restore the per-node existing-connection check in the POST handler.
Test: tests/unit/compatible-provider-connections.test.js now passes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 10:07:44 +07:00
decolua
8671468360 Merge PR #1628: fix(model-test) route image and STT probes to their real endpoints
Route image model tests to /api/v1/images/generations and STT to
/api/v1/audio/transcriptions instead of forcing all non-embedding
models through chat completions. Adds kind-aware pingModelByKind,
hf->huggingface alias, and silent WAV sample for STT reachability.

Scoped to dashboard/internal model testing only; runtime inference
routing is unchanged.

Author: yicone <yicone@gmail.com>
Closes #1628
2026-06-06 10:03:32 +07:00
hodtien
41f94ce8c8 fix(minimax): Bổ sung MiniMax-M3 + cập nhật Quota Tracker coding/CN
Squash-merge PR #1631 (decolua/9router) — chỉ lấy file code + test, bỏ docs.

- feat(minimax): add MiniMax-M3 to intl + cn provider models (targetFormat claude)
- feat(minimax): add MiniMax-M3 pricing entry
- fix(minimax): translate Claude body khi content=null (M3 thinking-only)
- fix(minimax): hiển thị quota M-series bucket "general"/"MiniMax-M*" + percent-only
- test: minimax usage / model registration / pricing

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 10:01:05 +07:00
yicone
c980e1f7ad Harden STT ping input and expand model-test coverage 2026-06-03 01:53:34 +08:00
yicone
dcf9beee4b Use a valid WAV sample for STT model tests 2026-06-02 21:15:08 +08:00
yicone
d4c3e6383a Fix STT model test routing 2026-06-02 21:14:42 +08:00
yicone
e414975d0c Fix model test routing for image providers 2026-06-02 21:14:36 +08:00
Antonius Joshua
cce8a50cac fix: add opencode-go and xiaomi-tokenplan cases to connection test route (#1576)
Co-authored-by: ant-joshua <ant-joshua@users.noreply.github.com>
2026-05-31 15:03:20 +07:00
decolua
7aa7a11599 Update ver 2026-05-29 17:49:12 +07:00
decolua
e9ae21a723 # v0.4.66 (2026-05-29)
## Features
- Add Qoder provider: device-flow OAuth, COSY signing, WAF-bypass body encoding, live model catalog, dashboard quota tracker, 11 models (#1372)
- Add new models: Claude Opus 4.8 (Claude Code), GPT 5.4 Mini (Codex)

## Fixes
- DeepSeek thinking mode: echo `reasoning_content` back on follow-up/tool-call turns so OpenCode-free and custom providers no longer 400 with "reasoning_content must be passed back" (#1543)
- Reasoning injector: match deepseek/kimi model ids case-insensitively (covers custom providers using capitalized model names)
- OpenCode suggested-models: include free models without the `-free` suffix, e.g. `big-pickle` (#1535)

## Improvements
- Codex: trim sunset models, keep gpt-5.5 / gpt-5.4 / gpt-5.3-codex family, add gpt-5.4-mini
- volcengine-ark: refresh model list (add DeepSeek-V4-Flash/Pro, drop EOL entries)
- Lower stream stall timeout 35s → 30s for faster hang detection
2026-05-29 17:48:01 +07:00
Delcado19
9ee8b32887 fix: include free OpenCode models without -free suffix in suggested models (#1535)
The "opencode-free" suggested-models filter only kept models whose id ends
in "-free", so free-but-unsuffixed models like `big-pickle` (routed via
open-sse/executors/opencode.js MESSAGES_MODELS) never appeared in the
import UI.

Extract the filters into a testable module and include a
KNOWN_FREE_OPENCODE_MODELS allowlist (big-pickle) alongside the "-free"
suffix check.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-29 17:36:27 +07:00
Simon Shi
4baaa5c7aa Feat : qoder provider 2026-05-29 17:36:27 +07:00
Simon Shi
53c0eefa00 chore(qoder): rename display label from "Qoder AI" to "Qoder" 2026-05-29 17:36:27 +07:00
Simon Shi
3d523b1387 fix(qoder): drop remaining from normalized quota — was rendering as %
Qoder's API returns `remaining` as an absolute credit count (e.g. 348
out of 3000), but ProviderLimits' getRemainingPercentage and QuotaTable
treat the `remaining` field as a 0-100 percentage. Result: "348%" with
red status.

Stop forwarding `remaining` from the qoder parser. The percentage is
computed from used/total via calculatePercentage, which gives the
correct ~12% remaining for the example case.
2026-05-29 17:36:27 +07:00
Simon Shi
af7f6b1de2 feat(qoder): show in Quota Tracker dashboard
Wire Qoder credits into the Quota Tracker card grid:

- Add `qoder` to USAGE_SUPPORTED_PROVIDERS so the connection passes the
  isUsageEligible filter at /api/providers/client and shows up in
  providerOptions on the dashboard.
- Reshape getQoderUsage so quota records (user, organization) live under
  `quotas` and scalar metadata (totalUsagePercentage, isQuotaExceeded,
  expiresAt) are siblings — the parser used to walk Object.entries(quotas)
  and would have rendered `totalUsagePercentage: 0.42` as a "0/0" row.
- Surface Qoder's expiresAt as resetAt on each quota record so the card
  shows when credits reset.
- Add a parser branch in ProviderLimits/utils.js: rename internal keys
  (user → "Personal", organization → "Organization"), drop empty org
  buckets so personal accounts don't render a misleading "0/0 Organization"
  row, and forward remaining/unit so the QuotaProgressBar can use them.
- Add Qoder's brand color (#EC4899) to ProviderLimitCard's color map.

42 tests still pass; build clean.
2026-05-29 17:36:27 +07:00
Simon Shi
69bc71cf11 refactor(qoder): mirror Kiro's OAuth service layout
Move device-flow / poll / userinfo / parseExpiry from src/lib/qoder/auth.js
into a QoderService class at src/lib/oauth/services/qoder.js, matching how
KiroService is organized. Also re-add the QoderService re-export from
services/index.js.

The split now mirrors Kiro:
  src/lib/oauth/services/qoder.js    OAuth flow            (was auth.js)
  src/lib/qoder/cosy.js              Per-request signing   (unchanged)
  src/lib/qoder/encoding.js          WAF-bypass body       (unchanged)
  src/lib/qoder/constants.js         Endpoints + model map (unchanged)

Behavior is unchanged — same functions, same signatures, just relocated
into a class so the import path lines up with `import { QoderService } from
"@/lib/oauth/services"` like every other OAuth provider. parseExpiry is now
a static method so callers and tests can use it without instantiating.

42 tests still pass; build still clean.
2026-05-29 17:36:27 +07:00
Simon Shi
935462ce8f test(qoder): add regression coverage for review-fix changes
Adds 18 new tests covering the bugs fixed in the previous commit so they
can't silently regress:

- parseExpiry (7 tests): numeric ms-epoch input, numeric strings handled
  before Date.parse so "1700000000" doesn't get year-interpreted, RFC3339
  strings, expires_in:0 honored as already-expired, 30-day fallback only
  when both inputs are missing/invalid

- normalizeMessages (4 tests): system hoisting, multipart text flatten,
  multiple system joining, empty input

- wrapQoderSSE (6 tests): the fixed cases — trailing partial line drained
  in flush(), no chunks forwarded after [DONE], embedded newlines stripped
  from inner body, error envelope produces error chunk + [DONE], non-ok
  responses returned unchanged

- expose parseExpiry from auth.js, expose normalizeMessages/wrapQoderSSE
  via __test__ from the executor (internals only — not part of the public
  API). Marked with comment so the surface is intentional.

42 tests total (24 original + 18 new). Build still clean.
2026-05-29 17:36:27 +07:00
Simon Shi
620b59ca0b fix(qoder): address review findings
Correctness:
- testUtils: drop checkExpiry so the userinfo URL probe actually runs (revoked
  tokens used to look "active" until local 30-day expiry passed)
- auth.parseExpiry: handle numeric expiresAt, swap parseInt before Date.parse
  so "2026" doesn't get interpreted as year-2026, treat expires_in:0 as
  already-expired instead of fabricating a 30-day default
- providers.mapTokens: synthesize email from userId when fetchUserInfo fails
  so OAuth dedup works (re-logins no longer accumulate "Account N" rows)

SSE wrapper:
- wrapQoderSSE: add !doneEmitted guard on success branch (chunks could leak
  past [DONE] when an error envelope shared a TCP packet with a valid one)
- flush(): finalize TextDecoder + drain trailing buffer so the chunk carrying
  finish_reason is delivered when upstream closes without a final \n
- sanitize literal \n inside inner OpenAI body so SSE framing stays intact

Robustness:
- executor: wrap buildCosyHeaders in try/catch so a missing accessToken
  returns 401 (re-auth) instead of bubbling as 500
- executor: short-circuit on missing accessToken before signing
- executor: plumb proxyOptions/signal through buildQoderRequestBody so
  proxy-only networks can fetch the model_config catalog
- qoderModels: dedupe concurrent first-time misses with an in-flight Promise
  map (parallel chat windows now do 1 upstream fetch instead of N)
- qoderModels: check signal.aborted before addEventListener so a pre-aborted
  parent signal cancels the inner fetch immediately
- auth: AbortController + 15s timeout on pollDeviceToken / fetchUserInfo to
  prevent hung sockets when openapi.qoder.sh stalls mid-response

UX:
- OAuthModal: derive polling deadline from device-code expires_in (qoder
  publishes 300s; the previous fixed 120s caused timeouts when users took
  more than 2 minutes on the consent page)

Cleanup:
- delete src/lib/oauth/services/qoder.js — referenced removed config fields
  (clientId/clientSecret/tokenUrl/authorizeUrl) and was re-exported from
  services/index.js, so any future caller would TypeError on first use
2026-05-29 17:36:27 +07:00
Simon Shi
a6fd84691b feat(qoder): port Kiro-style provider integration with COSY signing
Replaces the Qoder placeholder with a real free-tier provider:

- Device-flow OAuth: PKCE + nonce generated locally, user authorizes at
  qoder.com/device/selectAccounts, poll openapi.qoder.sh until token
- COSY signing (RSA-1024 + AES-128-CBC + MD5) for chat / model-list
- WAF-bypass body encoding (custom-alphabet base64 + thirds rearrange)
- Live model_config catalog from /algo/api/v2/model/list, cached 1h
- 11 models registered (auto/ultimate/performance/efficient/lite +
  6 frontier *model ids)
- Usage fetcher for openapi.qoder.sh/api/v2/quota/usage
- Dashboard live-models resolver, provider test, OAuth modal hookup
- 24 unit tests covering encoder, PKCE, COSY headers, sigPath stripping
2026-05-29 17:36:27 +07:00
decolua
468c61b2ac Added new models for Claude Opus 4.8 and GPT 5.4 Mini.
Disabled Cowork
2026-05-29 17:36:27 +07:00
Delcado
88224b80ca fix: never route GitHub Copilot Gemini/Claude models to /responses (#1062) (#1536)
GitHub Copilot's /responses endpoint only serves OpenAI (gpt/codex)
models. gemini-3.1-pro-preview was failing on /chat/completions with a
"not supported" error, getting cached as a codex model, then escalated
to /responses where it 400s with "does not support Responses API".

Add GithubExecutor.supportsResponsesEndpoint() and gate both the cached
/responses route and the 400-fallback on it, so Gemini/Claude always
stay on /chat/completions and the real upstream error surfaces.

Adds tests/unit/github-responses-routing.test.js (5 tests).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-29 15:40:42 +07:00
decolua
9742074b38 # v0.4.63 (2026-05-26)
## Fixes
- proxyFetch: restore missing `Readable` import causing runtime `ReferenceError` in DNS-bypass fetch path

## Improvements
- Lower stream stall timeout from 60s → 35s for faster hang detection
2026-05-26 23:16:21 +07:00
decolua
146310a3a3 Fix Bug 2026-05-26 23:09:19 +07:00
decolua
ac2fee7305 # v0.4.62 (2026-05-26)
## Fixes
- Codex: auto-retry when upstream drops mid-stream (no more hangs)
- Codex: fix random 400/404 errors, tool-calling failures, and unstable prompt cache
- MITM: support Antigravity 2.x
- Sanitize Read tool args to prevent retry loops from non-Anthropic models (#1144)
- Implement json_schema fallback for OpenAI-compatible providers without native Structured Output (#1343)
- Strip empty Read pages argument in OpenAI-to-Claude translator (#1354)
- Forward Gemini output dimensions for embeddings (#1366)
- Resolve setState-in-effect errors in dashboard components (#1362)
- Gemini CLI: reuse stored OAuth project IDs for quota checks and show clearer setup guidance when the project is missing (#1271, #1428)
2026-05-26 13:15:59 +07:00
decolua
0065bbbdfd # v0.4.62 (2026-05-26)
## Fixes
- Codex: auto-retry when upstream drops mid-stream (no more hangs)
- Codex: fix random 400/404 errors, tool-calling failures, and unstable prompt cache
- MITM: support Antigravity 2.x (updated IDE version detection and DNS/cert flow)
- Sanitize Read tool args to prevent retry loops from non-Anthropic models (#1144)
- Implement json_schema fallback for OpenAI-compatible providers without native Structured Output (#1343)
- Strip empty Read pages argument in OpenAI-to-Claude translator (#1354)
- Forward Gemini output dimensions for embeddings (#1366)
- Resolve setState-in-effect errors in dashboard components (#1362)
- Gemini CLI: reuse stored OAuth project IDs for quota checks and show clearer setup guidance when the project is missing (#1271, #1428)
2026-05-26 12:46:30 +07:00
mustafabozkaya
f3176b4b23 fix: implement json_schema fallback for OpenAI-compatible providers (#1343)
When json_schema response_format is sent to models that do not natively
support Structured Output (e.g. DeepSeek/Ollama/local LLMs via
openai-compatible-* providers), they often return empty or malformed
content.

Detect response_format.type === "json_schema", inject the schema into the
system prompt, and downgrade response_format to json_object so Structured
Output works transparently across openai-compatible providers.

Gated to provider.startsWith("openai-compatible-") so providers with
native Structured Output support are not downgraded.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-26 11:35:39 +07:00
decolua
a648a42bdb Fix codex 2026-05-26 11:35:39 +07:00
decolua
b876e0225a Refactor Tunnel 2026-05-26 11:35:39 +07:00
GodrezJr2
96a9a2b36d fix: sanitize Read tool args to prevent retry loops from non-Anthropic models (#1144)
* fix: sanitize Read tool args to prevent retry loops from non-Anthropic models

* fix: sanitize invalid Read pages from tool args

Non-Anthropic models sometimes emit optional Read args like pages: "" for
non-PDF files, which Claude Code rejects before the tool runs. Drop invalid
pages values, keep valid PDF page ranges, and coerce numeric string bounds
before clamping limit/offset.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 11:33:38 +07:00
Delcado
dcc46f2eee Reuse Gemini CLI project ID for usage (#1428) 2026-05-26 11:23:47 +07:00
@TD
57b3e94e40 feat(proxy-pools): add support for deno deploy relays and fix layout overflow issues in proxy pools dashboard (#1437)
Co-authored-by: TD <tho.din@inno.ai.vn>
2026-05-26 11:21:49 +07:00
YourAnsh
13a28452fb feat: Add Cloudflare Workers proxy deployer and pool integration (#1360)
Co-authored-by: ansh <ansh@example.com>
2026-05-23 09:35:20 +07:00
Hamsa_M
315dcaa37a fix: strip empty Read pages argument in OpenAI-to-Claude translator (#1354)
Some OpenAI-compatible providers emit optional string tool parameters
as empty strings (e.g. pages: "") instead of omitting them. Claude
Code rejects pages: "" as invalid, breaking the Read tool for
non-PDF files routed through 9router.

Add sanitizeToolArguments() that parses tool-call arguments and
removes known optional empty-string fields before emitting
input_json_delta back to Claude format. Currently handles the
Read tool pages field specifically.

Includes regression test.

Fixes #1278

Co-authored-by: JoJo <noreply@github.com>
2026-05-23 09:27:13 +07:00
YourAnsh
2604b46847 fix (#1361)
Co-authored-by: Ansh7473 <Ansh7473@users.noreply.github.com>
2026-05-23 09:26:10 +07:00
OKWN
d29b19bc27 fix(eslint): resolve setState-in-effect errors in dashboard components (#1362)
- LanguageSwitcher: remove mounted state + useLayoutEffect pattern
  Portal renders directly based on open state (SSR-safe without client check)
- UsageStats: replace stats-null check with isInitialLoad ref to avoid
  setState in effect body (cascading render issue)
2026-05-23 09:24:35 +07:00
nguyenha935
7bc97eae7b fix(embeddings): forward Gemini output dimensions (#1366)
Co-authored-by: GoClaw Operator <operator@goclaw>
2026-05-23 09:23:26 +07:00
decolua
e1b821dd53 # v0.4.59 (2026-05-21)
## Fixes
- OAuth: fix login flow on Windows
2026-05-21 14:33:56 +07:00