Commit Graph

315 Commits

Author SHA1 Message Date
Thiên Toán
4e92a66379 fix(auth): wire up dashboard auth guard as Next.js proxy (#227)
Dashboard routes were accessible without authentication because
dashboardGuard.js was not connected to Next.js middleware pipeline.

Created src/proxy.js to export the auth guard using Next.js 16
proxy convention. Now /dashboard routes properly redirect to
/login when auth_token cookie is missing or invalid.
2026-03-02 15:21:50 +07:00
Владимир Акимов
0c832c9c59 feat(gemini): convert OpenAI SSE to Gemini SSE format in /v1beta/models route (#225)
* fix(translator): filter nameless hosted tools when converting Responses API to Chat format

Codex CLI sends "hosted" tools (e.g. `request_user_input`) via the OpenAI
Responses API. These tools have no explicit `name` field. The previous
`body.tools.map()` pass propagated `name: undefined` into the resulting
Chat Completions function declarations, which then became anonymous
`functionDeclarations` after the OpenAI→Gemini translation step.

Gemini strictly requires every function declaration to have a valid name
and rejects the entire request with:

  GenerateContentRequest.tools[0].function_declarations[4].name:
  Invalid function name. Must start with a letter or an underscore.

Fix: filter out any Responses API tool that lacks a non-empty `name`
string before converting to `{ type: "function", function: { name, ... } }`.
Named function tools are unaffected; only unnamed hosted tools are skipped.

Fixes: Gemini 400 error when Codex CLI is routed through 9router.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* feat(gemini): convert OpenAI SSE to Gemini SSE format in /v1beta/models route

The @google/genai SDK always uses :streamGenerateContent?alt=sse for chat
and expects Gemini SSE chunk format. The upstream handleChat returns OpenAI
SSE format, causing the SDK to crash on the [DONE] sentinel.

Changes:
- Add transformOpenAISSEToGeminiSSE() using TransformStream that converts
  each OpenAI SSE chunk (choices[0].delta) to Gemini SSE format
  (candidates[0].content.parts) on the fly
- Drop the OpenAI [DONE] sentinel (Gemini SSE ends by stream close)
- Map finish_reason -> finishReason, attach usageMetadata on final chunk
- Support reasoning_content -> thought: true parts for thinking models
- Refactor finishReasonMap to shared FINISH_REASON_MAP constant
- Fix streaming dispatch: stream=true now calls transformOpenAISSEToGeminiSSE
  instead of passing OpenAI SSE through raw

Fixes: SyntaxError: "[DONE]" is not valid JSON in Gemini CLI

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-02 09:36:08 +07:00
decolua
4903a9b2cb Feat : console log 2026-03-02 09:31:16 +07:00
decolua
50990e84b4 Fix AG MITM 2026-03-01 18:40:55 +07:00
Владимир Акимов
7076108550 fix(translator): filter nameless hosted tools when converting Responses API to Chat format (#222)
Codex CLI sends "hosted" tools (e.g. `request_user_input`) via the OpenAI
Responses API. These tools have no explicit `name` field. The previous
`body.tools.map()` pass propagated `name: undefined` into the resulting
Chat Completions function declarations, which then became anonymous
`functionDeclarations` after the OpenAI→Gemini translation step.

Gemini strictly requires every function declaration to have a valid name
and rejects the entire request with:

  GenerateContentRequest.tools[0].function_declarations[4].name:
  Invalid function name. Must start with a letter or an underscore.

Fix: filter out any Responses API tool that lacks a non-empty `name`
string before converting to `{ type: "function", function: { name, ... } }`.
Named function tools are unaffected; only unnamed hosted tools are skipped.

Fixes: Gemini 400 error when Codex CLI is routed through 9router.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-01 08:48:43 +00:00
Cengizhan
f763d4ffed fix: resolve GitHub Copilot 400 error for Claude models in Cursor IDE (#220)
- github.js: add sanitizeMessages() to convert unsupported content types
  (tool_use, tool_result, thinking) to plain text before sending to
  GitHub /chat/completions endpoint
- openai-responses.js: skip pushing message blocks with empty content
  (e.g. assistant messages that only contain tool_calls)
- providerModels.js: revert targetFormat changes (not needed with sanitize fix)

Fixes: https://github.com/decolua/9router/issues/219
2026-03-01 15:38:14 +07:00
decolua
a7365c5a4e Fix : Codex on cursor 2026-03-01 15:35:41 +07:00
decolua
a84477e815 chore: update version and enhance dashboard components
- Add a warning message for Windows users in AntigravityToolCard to run the terminal as Administrator for MITM functionality.
- Refactor model testing logic in ProviderDetailPage to improve state management and user experience.
- Introduce new version notification in Sidebar for available updates.
2026-02-28 16:33:18 +07:00
decolua
2f4b813c5b feat(usage): implement timeout and error handling for antigravity usage and subscription requests
- Add a 10-second timeout for fetch requests in getAntigravityUsage and getAntigravitySubscriptionInfo functions.
- Include error logging for fetch failures in both functions.
- Update headers to include "x-request-source" for MITM bypass.
- Enhance proxyFetch with DNS resolution and MITM bypass capabilities.
- Ensure proxyFetch is loaded in the API route for proper fetch patching.
2026-02-28 12:12:49 +07:00
decolua
04ba66bc1e chore: Refactor CursorAuthModal to handle manual instructions for Windows users. 2026-02-28 12:12:49 +07:00
Thiên Toán
d1ce98ca8a feat: add API key visibility toggle in Endpoint dashboard (#214)
- Added eye icon button to show/hide individual API keys
- Keys hidden by default on page load for security
- Copy button always copies full key regardless of visibility state
- Implemented per-key visibility state with React useState
- Added maskKey helper to display first 8 characters + "..."
- Clean up visibility state when keys are deleted

Improves security and UX when managing API keys in the dashboard.
2026-02-28 11:07:51 +07:00
gen
5a015e5b4d feat(proxy): add outbound HTTP proxy support for OAuth + provider requests
- Patch Node fetch via undici ProxyAgent when HTTP_PROXY/HTTPS_PROXY/ALL_PROXY is set
- Ensure proxy patch is loaded for both chat pipeline and OAuth token exchange
- Add Dashboard Settings → Network to edit outbound proxy and apply immediately
- Persist outbound proxy settings in local db and initialize on server startup
- Move proxy helpers to src/lib/network/ for better structure
- Rename src/proxy.js → src/dashboardGuard.js to avoid naming confusion
- Re-apply proxy env after DB import
- Fix: close old dispatcher on proxy URL change to prevent connection pool leak
- Fix: idempotency guard to avoid patching globalThis.fetch multiple times

Made-with: Cursor
v0.3.17
2026-02-28 10:11:53 +07:00
decolua
833069caac Fix MITM on window 2026-02-28 10:04:57 +07:00
Muhammad Hamid Raza
49a56612bf Update README.md (#212) 2026-02-27 12:13:12 +07:00
decolua
5954b8f4eb - Refactor chatCore.js to streamline imports and remove unused functions.
- Fix streaming /v1/responses
2026-02-27 11:15:12 +07:00
decolua
25c2ad7360 feat: implement model lock functionality for connection management 2026-02-27 10:29:11 +07:00
decolua
1f4423d444 Merge remote-tracking branch 'origin/master' 2026-02-27 09:35:39 +07:00
BiuBiuHu
6e6ea7d97f feat: add Aliyun Bailian (alicode) provider support
- Add alicode provider with OpenAI-compatible API endpoint
- Support 8 models via Aliyun Bailian Coding Plan
- Add API key validation and connection testing
- Use getDefaultModel() instead of hardcoded model names

Co-authored-by: decolua <decoluadt@example.com>
Made-with: Cursor
2026-02-27 09:34:16 +07:00
decolua
0e285a9ed3 Merge branch 'pr-203' 2026-02-27 09:33:14 +07:00
decolua
9ae5487bc7 Fix antigravity 2026-02-27 09:17:49 +07:00
司徒玟琅
4527e5e126 feat: update provider models(Cursor IDE) with new versions (#204)
- Added new provider models: Claude 4.6 Opus Max, Claude 4.6 Sonnet Medium Thinking, Kimi K2.5, Gemini 3.1 Pro Preview, Gemini 3 Flash Preview, GPT 5.2, and GPT 5.3 Codex.
2026-02-27 09:09:20 +07:00
BiuBiu_Hu
d14c18f77f refactor: rename provider to alicode (Aliyun Coding)
Rename alicloud to alicode to clearly indicate Aliyun's Coding Plan service.

- Provider ID: alicode (short for Aliyun Coding)
- Model format: alicode/qwen3.5-plus
- Simplified mapping - no more bidirectional aliases

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-26 08:05:05 +08:00
BiuBiu_Hu
b0ec81f4a5 feat: add Alibaba Cloud Coding Plan support
Add support for Alibaba Cloud Bailian Coding Plan, a coding-focused AI service
that provides fixed monthly pricing for multiple models.

Changes:
- Add alicloud provider with OpenAI-compatible API endpoint
- Support 8 models: qwen3.5-plus, kimi-k2.5, glm-5, MiniMax-M2.5,
  qwen3-max, qwen3-coder-next, qwen3-coder-plus, glm-4.7
- Use "ali" as provider alias (ali/model format)
- Add API key validation and connection testing
- Add frontend provider definition with "ALi" text icon

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-26 07:58:40 +08:00
decolua
9003675b71 - Updated CLI tool components to accept initial status as a prop, improving state management for tool statuses.
- Added functionality to fetch and set statuses for various CLI tools (Claude, Codex, Droid, OpenClaw, Antigravity) on component mount.
- Enhanced error handling and logging in the OAuth provider test utilities and DNS management functions.
- Improved the MITM server to handle multiple target hosts and provide clearer error messages regarding port usage.
2026-02-25 16:32:05 +07:00
decolua
484e7025e8 feat: add ProviderDetailPage component for managing provider connections and models
- Introduced a new ProviderDetailPage component to handle provider-specific functionalities.
- Implemented state management for connections, loading states, and model selections.
- Added API calls for fetching provider connections and model aliases.
- Included modals for OAuth and API key management.
- Enhanced user experience with model selection and saving capabilities.
2026-02-25 16:31:40 +07:00
Mai Trung Tiến
3cf900a0a1 feat: add database backup import/export (#194) 2026-02-25 15:32:38 +07:00
Quan
07717bad60 feat: cherry-pick PR #183 — multi-provider support, PWA, dynamic models, UI improvements
Cherry-picked from decolua/9router PR #183.
Note: open-sse changes included but need further review due to extensive modifications.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-25 11:40:50 +07:00
decolua
147fc168f9 fix bug 2026-02-25 10:40:15 +07:00
Blade
091ad3fc5d Fix: Add missing glm-cn provider definition for Web UI discovery (#186)
- Add glm-cn to APIKEY_PROVIDERS in src/shared/constants/providers.js
- Align with existing glm-cn model definitions in providerModels.js
- Users can now see and select GLM (China) option in Web UI
- Follows same pattern as minimax-cn (red color for China region)
2026-02-25 10:34:52 +07:00
Thiên Toán
39d04d0425 Add GitHub Actions workflow for Docker build and push (#185) 2026-02-25 10:34:23 +07:00
decolua
8221f7c027 Fix MITM 2026-02-23 21:56:40 +07:00
decolua
d21f7aaadc Fix bug Tunnel 2026-02-22 21:44:11 +07:00
decolua
a5eb5a864e chore: add Gemini 3.1 Pro models to provider configurations 2026-02-22 15:20:24 +07:00
decolua
930e917092 chore: update version and enhance provider model configurations. 2026-02-22 11:30:43 +07:00
zx07
ea67742f2a feat: implement real project ID fetching for Antigravity (#170)
* feat: implement Project ID service to fetch and cache real Project IDs from Google Cloud Code API

* fix: implement caching and cleanup for Project ID retrieval

* feat: add project ID invalidation and refresh logic after token updates

* refactor: remove unnecessary format changes

* feat: add on-demand project ID retrieval for antigravity requests
2026-02-21 23:15:18 +07:00
decolua
94c4320632 Fix 2026-02-21 23:06:55 +07:00
decolua
33830b00bb Modify image source in README.md
Updated image source URL in README.md to include a cache-busting query parameter.
2026-02-21 21:18:59 +07:00
Muhammad Hamid Raza
7837d7f1d0 Update 9router.png (#168) 2026-02-21 21:17:06 +07:00
Muhammad Hamid Raza
b7ac06cccb docs: Add billing clarification to prevent user confusion (#166)
* update

* Update 9router.png
2026-02-21 20:33:25 +07:00
decolua
0baa299722 feat :
- Added tunnel
- Removed cloud feature
v0.2.89
2026-02-21 16:42:46 +07:00
decolua
adf57aa0c9 Fixed Codex 2026-02-21 14:36:06 +07:00
decolua
f2025cc776 feat: add Gemini 3.1 Pro models to provider 2026-02-20 21:05:02 +07:00
decolua
985985e454 refactor: update Antigravity model configurations and pricing 2026-02-20 17:52:15 +07:00
decolua
3debf84b9a Add Providers 2026-02-20 17:05:46 +07:00
decolua
bd71298fb7 docs: add OmniRoute fork to README
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-20 15:23:03 +07:00
Aakash Thakkar
d7e06c3085 fix: improve cursor auto-import reliability on macOS (#161)
The macOS auto-import was failing with "Cursor database not found" even
when Cursor was installed and logged in. This was caused by a single
hardcoded path and no fallback when the DB file existed but couldn't be
opened (e.g. WAL lock, Insiders variant).

Changes (macOS only — linux/win32 paths are unchanged):
- Probe both standard and Insiders DB locations on macOS
- Return a descriptive error when the DB file exists but can't be opened
- Try multiple known key names for token and machine ID
- Add fuzzy key fallback for future Cursor schema changes
- Normalize JSON-encoded string values from the DB

Adds unit tests covering all new and existing behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-20 15:07:43 +07:00
Thiên Toán
73388a02a1 feat: add pause/resume functionality for API keys (#158)
- Add isActive field to API key schema with migration
- Implement PUT /api/keys/[id] endpoint for toggle
- Update validation to reject paused keys (403)
- Add UI toggle controls with confirmation
- Ensure cloud sync preserves pause state
2026-02-20 15:07:12 +07:00
Thiên Toán
806bd4ae14 feat: add API endpoint dimension to usage statistics dashboard (#152)
- Tracks endpoints like /v1/chat/completions, /v1/messages, /v1/responses
- New sortable/groupable table in usage dashboard with expandable groups
- Enhanced usage database aggregation by endpoint + model + provider
- Added endpoint tracking to all saveRequestUsage/saveRequestDetail calls
- Maintains backward compatibility with existing data structure
2026-02-20 15:03:18 +07:00
Hồ Xuân Dũng
a57a8ce206 feat: add Gemini embeddings support + Letta compatibility fixes
Cherry-picked from decolua/9router#148 (author: xuandung38 / Hồ Xuân Dũng <me@hxd.vn>)

- Add Google AI (Gemini) embeddings support for /v1/embeddings endpoint
- Add Gemini embedding models: gemini-embedding-001, text-embedding-005, text-embedding-004
- Inject missing object/created fields for Letta and strict OpenAI clients
- Strip Azure-specific fields (prompt_filter_results, content_filter_results) from responses
- Fix Dockerfile: copy open-sse directory into Docker runner stage

Skipped: whitelist message field stripping (commit 3/7/8) — too aggressive for all providers
Skipped: default stream=false change (commit 9) — behavior change needs further review
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-20 15:01:10 +07:00
decolua
e1e5a81613 feat: add GLM 5 and MiniMax M2.5 models to providerModels.js; add Claude Sonnet 4.6 to CLI tools 2026-02-20 14:44:53 +07:00