289 Commits

Author SHA1 Message Date
Anurag Saxena
5abf7102c0 fix: inject placeholder message when Responses API input[] is empty (closes #389) (#419) 2026-03-27 10:51:02 +07:00
Anurag Saxena
4e631c4f37 fix: map OpenAI image_url data URLs to Ollama images[] (closes #427) (#432) 2026-03-27 10:48:18 +07:00
Anurag Saxena
e3a7733a08 fix: strip functionCall/functionResponse id and synthetic thoughtSignature for Vertex AI (closes #388) (#414) 2026-03-27 10:46:47 +07:00
Anurag Saxena
5e308e8ff2 fix: add ?alt=sse to Vertex streaming URL (closes #388) (#409) 2026-03-27 10:44:11 +07:00
Anurag Saxena
ade3f57d4c fix: sanitize Gemini function names to meet API requirements (closes #369) (#403) 2026-03-27 10:40:29 +07:00
Ryan
56be393a59 feat: expand OpenAI and Gemini static model lists (#398)
OpenAI: add GPT-5.x series, GPT-4.1 variants, o3/o4 reasoning
models, embedding models, and TTS models (5 → 26 models).

Gemini: add 3.1 Flash Image, 3 Flash Lite, 2.0 Flash/Lite,
Embedding 2; remove deprecated 3 Pro Preview (10 → 14 models).

Closes #179, partially addresses #178.
2026-03-27 10:39:07 +07:00
Ryan
3b4184b09e fix: detect Claude format for /v1/messages + sanitize tool descriptions (#397) 2026-03-27 10:38:37 +07:00
Anurag Saxena
868eabffc0 fix: clamp Responses API call_id to 64 chars (closes #393) (#396) 2026-03-27 10:37:31 +07:00
decolua
8759545260 chore: add proper-lockfile for safe database read/write operations and implement retry logic for file access 2026-03-27 10:31:35 +07:00
Ryan
99cb9ed11f fix: support HTTP/HTTPS image URLs in Claude and Gemini translators (#344)
Previously only base64 data: URLs were handled in the OpenAI-to-Claude
and OpenAI-to-Gemini request translators. HTTP/HTTPS image URLs were
silently dropped, causing vision-capable models to respond with
"I don't see any image."
2026-03-23 14:56:40 +07:00
decolua
8df8b94180 Enhance image support in Kiro for Claude models. Update the message conversion logic to conditionally handle image types based on model capabilities. Additionally, hide the Basic Chat option in the sidebar for a cleaner UI. 2026-03-23 12:29:48 +07:00
decolua
4496bf96c8 Feat : Kiro Provider can now read images. 2026-03-23 12:17:51 +07:00
decolua
0c9ad12055 Fix : Fix error 400 2026-03-23 12:05:22 +07:00
Ibrahim Ryan
e9ccae4ca1 fix(iflow): inject stream_options for usage data in streaming
Add stream_options: { include_usage: true } to iFlow streaming requests
to get token usage data in the final streaming chunk. This fixes token
counts showing as 0 for iFlow streaming requests.

Only injected when streaming is enabled and body.messages exists (OpenAI
format), and the client hasn't already set stream_options.

Note: Applied only to iFlow executor instead of BaseExecutor to avoid
affecting all providers globally. This gives us more control and allows
testing with iFlow first.

Fixes #74

Co-authored-by: Ibrahim Ryan <ryan@nuevanext.com>
Made-with: Cursor
2026-03-23 12:03:11 +07:00
bitgineer
96f5e5c92a Add combo round-robin strategy to distribute load across providers (#390)
- Add comboRotationState Map to track rotation per combo
- Add getRotatedModels() to rotate model order based on strategy
- Pass comboName and comboStrategy to handleComboChat()
- Add comboStrategy setting (default: fallback)
- Add UI toggle for Combo Round Robin in profile settings

When enabled, each request to a combo starts with a different provider
instead of always starting with the first one, distributing load evenly.

Co-authored-by: Antigravity Agent <antigravity@example.com>
2026-03-23 09:52:31 +07:00
Liam
01e4a28f0a fix: normalize finish_reason to 'tool_calls' when tool calls are present (#379)
Some upstream providers (e.g. Antigravity) return non-standard finish_reason
values like 'other' instead of the OpenAI-standard 'tool_calls' when the
model invokes tools. This causes downstream consumers (e.g. OpenClaw) to
fail to execute tool calls, breaking agentic sub-agent workflows.

Changes:
- nonStreamingHandler: post-translation guard that normalizes finish_reason
  to 'tool_calls' when message.tool_calls is present
- sseToJsonHandler: accumulate tool_calls from streaming deltas in
  parseSSEToOpenAIResponse; extract function_call items from Responses API
  output in handleForcedSSEToJson
- openai-responses translator: use toolCallIndex to choose between
  'tool_calls' and 'stop' in flush and response.completed events

Tested: 7 scenarios (non-stream text, single/multiple tool calls, stream
text/tool calls, multi-turn tool conversation, tools present but unused)
2026-03-23 09:35:25 +07:00
Anurag Saxena
b8918c0c1c fix: treat Kiro 400 'improperly formed request' as model-unavailable (#386)
Kiro returns HTTP 400 with 'Improperly formed request (reset after Xs)'
when a model is not available on that account's subscription tier.
Previously this fell through to COOLDOWN_MS.transient (30s), causing
rapid retries on all accounts before failing — all accounts get locked
simultaneously with no actual fallback.

Treating this as paymentRequired (2min cooldown) ensures:
1. The model is locked on that account for 2min (proper cooldown)
2. The next available account is tried immediately
3. If all accounts hit the same 400, 9Router falls through to the
   next provider in the combo

Fixes #384
2026-03-23 09:31:31 +07:00
decolua
3d4dbdc0e7 fix(chat): pick last non-empty message for Codex Responses SSE
Root cause: Codex/OpenAI Responses streams multiple alternating reasoning and
message output items. The first message block often has empty output_text; the
visible answer lives in a later message. Previous code used output.find() which
always picked the first (empty) message block.

Fix: walk message items from end and use the last message whose extracted text
is non-empty; fall back to final message if all are empty.

Note: Removed debug logging code from original PR #383 to keep implementation clean.

Co-authored-by: lokinh <locnh@uniultra.xyz>
Made-with: Cursor
2026-03-23 09:29:31 +07:00
Anurag Saxena
4774150ca7 fix: combo 503 cooldown wait before fallthrough + 406 on disabled creds (#382)
- fixes #335: on transient 503/502/504, wait for short cooldown (up to
  5s) before falling to next combo model, giving the provider a chance
  to recover rather than immediately skipping it
- fixes #334: when all combo models have no active credentials, return
  503 (Service Unavailable) instead of 406 (Not Acceptable), which is
  more accurate and retriable by clients
2026-03-23 09:24:58 +07:00
Anurag Saxena
4d7ddbfffe fix: add missing type:string to enum properties in Gemini tool schema translation (#380)
Gemini API requires enum properties to have an explicit type:"string"
declaration. Without it, tool calls with enum parameters return 400
Bad Request. Fixes #359.
2026-03-23 09:20:55 +07:00
Kwan96
1154244f1d refactor: clean JSON schemas for Gemini function declarations (#371)
Apply cleanJSONSchemaForAntigravity to both Anthropic and OpenAI format tool schemas before converting to Gemini function declarations
2026-03-23 09:18:22 +07:00
decolua
f1c53a319e refactor: update MITM bypass logic and enhance combo name validation 2026-03-19 22:47:32 +07:00
Anurag Saxena
a0500dfc85 feat: add MiniMax M2.7 model support (#357)
Add MiniMax-M2.7 to provider models and pricing config alongside
existing M2.5. M2.7 is the latest reasoning model with 204K context.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 15:34:36 +07:00
xmllist
2bec2e1801 Update Antigravity provider config and headers
- Simplify ANTIGRAVITY_HEADERS to dynamic User-Agent only
- Use IDE_TYPE, PLUGIN_TYPE enums and getPlatformEnum() in metadata
- Update antigravity baseUrl to sandbox endpoint
- Bump User-Agent version from 1.104.0 to 1.107.0
- Remove redundant header spread in AntigravityExecutor

Made-with: Cursor
2026-03-17 10:12:17 +07:00
decolua
f264bb9a23 Refactor error logging to provide clearer context on provider failures 2026-03-14 17:08:11 +07:00
decolua
877eea8ebe chore: Update package version to 0.3.51 and improve connection handling in API route 2026-03-14 11:56:29 +07:00
decolua
6b624af4d0 fix: Update abort method in pipeWithDisconnect to return a promise for better error handling 2026-03-14 11:38:33 +07:00
Quan
39f651f5be feat: Add Google Cloud Vertex AI provider support (vertex, vertex-partner)
Co-authored-by: Quan <quanle96@outlook.com>
PR: https://github.com/decolua/9router/pull/298

Thanks to @kwanLeeFrmVi for the original implementation. Here is a summary
of changes made during review integration:

- Replaced google-auth-library with jose (already a project dependency)
  for SA JSON -> OAuth2 Bearer token minting (RS256 JWT assertion flow)
- Moved auth logic (parseSaJson, refreshVertexToken, token cache) from
  executor into open-sse/services/tokenRefresh.js to match project pattern
- Fixed executor to use proxyAwareFetch instead of raw fetch (proxy support)
- Simplified buildUrl: use global aiplatform.googleapis.com endpoint for
  both vertex (Gemini) and vertex-partner; removed region/modelFamily fields
- Added auto-detection of GCP project_id from raw API key via probe request
  (vertex-partner only, cached per key)
- Added vertex/vertex-partner cases to /api/providers/validate/route.js
- Updated model lists based on live testing:
  - vertex: gemini-3.1-pro-preview, gemini-3.1-flash-lite-preview,
    gemini-3-flash-preview, gemini-2.5-flash (removed gemini-2.5-pro: 404)
  - vertex-partner: deepseek-v3.2, qwen3-next-80b (instruct+thinking),
    glm-5 (removed Mistral/Llama: not enabled in test project)
  - gemini provider: added gemini-3.1-pro-preview, gemini-3.1-flash-lite-preview
- Removed bun.lock (project uses npm/package-lock.json)
- Removed region and modelFamily UI fields (global endpoint, auto-detect)
- Kiro token auto-refresh on AccessDeniedException (from commit 2)

Made-with: Cursor
2026-03-14 11:37:23 +07:00
decolua
adae2605bf Feat : Auto restart after crash 2026-03-14 09:37:29 +07:00
decolua
549223c8cf Fix codex image 2026-03-13 14:47:40 +07:00
decolua
399adca63d feat: Add support for local Ollama Local provider 2026-03-13 10:22:59 +07:00
Nick Roth
754a24d52a fix: SSE data: [DONE] sentinel + response_format for Claude via GitHub
- Guard data: [DONE] in github.js TransformStream with stream === true
- Inject response_format as system prompt for Claude models via GitHub executor

Note: stream.js guards skipped, createSSEStream is only called for true streaming paths.

Cherry-picked and adapted from PR #286 by @rothnic
https://github.com/decolua/9router/pull/286

Made-with: Cursor
2026-03-13 10:13:02 +07:00
Nick Roth
d12b14f411 feat: AI SDK compatibility - Accept header & JSON markdown stripping
- Respect Accept: application/json header to return non-streaming JSON
  instead of SSE, fixing AI SDK generateObject/generateText compatibility
- Strip markdown code block markers (```json...```) from Claude
  non-streaming responses to prevent JSON parse errors

Cherry-picked and adapted from PR #290 by @rothnic
https://github.com/decolua/9router/pull/290

Made-with: Cursor
2026-03-13 10:00:47 +07:00
decolua
373b10ebb5 feat(chat): Enhance bypass handling and introduce CC filter naming feature
Fix : Ollam Provider response
2026-03-13 09:41:40 +07:00
Nick Roth
75270ea755 feat: Add OpenAI API response_format support for structured JSON output
Translates OpenAI response_format parameter into Claude-compatible system
prompt instructions, enabling structured JSON output for json_schema and
json_object types.

Co-authored-by: Nick Roth <nlr06886@gmail.com>
Made-with: Cursor
2026-03-12 16:30:47 +07:00
decolua
b0c6b61398 Refactor config 2026-03-12 16:20:46 +07:00
decolua
8223c87988 feat(memory-management): Introduce MEMORY_CONFIG for session and DNS management, including session TTL, cleanup intervals, and proxy dispatcher limits. 2026-03-12 15:57:21 +07:00
decolua
83d94daa82 feat(ollama): Enhance Ollama support by adding new models, updating API format handling, and integrating translation functionality. 2026-03-12 15:24:10 +07:00
decolua
32e3980a13 feat(ollama): Add Ollama provider support with models and configuration, including API endpoints and UI updates. 2026-03-12 15:24:02 +07:00
decolua
a224f68e5c feat(kimi-coding): Added Kimi Coding to the list of supported OAuth providers with specific configuration. 2026-03-12 10:48:11 +07:00
decolua
f1bf027c68 feat(usage): claude quota tracker 2026-03-12 09:42:17 +07:00
decolua
fe49b61dfb feat: - Introduced per-provider strategy overrides in settings, allowing for more flexible connection management.
- Added new provider models: DeepSeek 3.1, DeepSeek 3.2, and Qwen3 Coder Next.
- Implemented UI changes to support round-robin strategy with sticky limits in the provider detail page.
- Improved logging to display connection names instead of IDs for better clarity.
2026-03-11 18:04:38 +07:00
decolua
d9dad5bcf3 Fix : Add custom to model selector 2026-03-11 11:59:07 +07:00
Peter Steinberger
31775393e6 feat(iflow): sync model list with CLIProxyAPI
Made-with: Cursor
2026-03-10 16:38:32 +07:00
Peter Steinberger
06a5307160 feat(gemini-cli): add proper User-Agent and X-Goog-Api-Client headers
Match native GeminiCLI client fingerprint to avoid upstream rejection.
Also fix base executor to call transformRequest before buildHeaders so
subclasses can store model context for header generation.

Made-with: Cursor
2026-03-10 16:38:32 +07:00
luongquocloc8668@gmail.com
36f8a8ce16 feat(base): add 429 retry with fixed delay for all providers
Retry up to 2 times with 2s delay before falling back to next URL.

Made-with: Cursor
2026-03-09 17:36:16 +07:00
Xmllist
6437a1c55f refactor(claude-to-openai): simplify usage token calculation and final chunk assembly
Made-with: Cursor
2026-03-09 17:18:49 +07:00
apeltekci
30e4689fb9 fix(cline): refresh static model catalog
Made-with: Cursor
2026-03-09 16:21:53 +07:00
apeltekci
29f3e1894e fix(cline): use workos auth token shape
Made-with: Cursor
2026-03-09 16:21:29 +07:00
decolua
880f4eca91 feat(proxy): add proxy pool and per-connection binding + strictProxy support
- Centralize proxy management with reusable proxy pools
- Per-connection proxy binding with legacy fallback
- Add strictProxy option: fail hard instead of silently falling back to direct
- Resolve alicode-intl conflict: keep alicode-intl support + proxy support

Made-with: Cursor
2026-03-09 15:46:06 +07:00