Commit graph

121 commits

Author SHA1 Message Date
1bcMax
becda53a17
feat: add ClawRouter as a provider for cost-optimized model routing (#11751)
* feat: add ClawRouter as a provider for cost-optimized model routing

ClawRouter is an open-source LLM router that automatically selects the
cheapest capable model for each request based on prompt complexity,
providing 78-96% cost savings on blended inference costs.

Changes:
- Add ClawRouterApi class extending OpenAI adapter
- Add 'clawrouter' provider to the type system
- Add ClawRouter models (auto, free, eco)
- Add ClawRouter provider config with UI setup
- Add ClawRouter logo
- Add documentation (clawrouter.mdx)

Closes #10843

* docs: enhance ClawRouter documentation

- Add ClawRouter to providers overview
- Expand documentation with:
  - Model capabilities configuration
  - Multiple roles setup
  - Troubleshooting section
  - Cost monitoring
  - Comparison with OpenRouter
  - Complexity dimensions explanation

* feat: add ClawRouter to core/llm/llms

- Add ClawRouter.ts extending OpenAI base class
- Register ClawRouter in llms/index.ts

* feat: add User-Agent headers for ClawRouter integration tracking

- Add 'User-Agent: Continue/IDE' header to identify Continue requests
- Add 'X-Continue-Provider: clawrouter' header for routing analytics
- Enhanced documentation with features list

This helps ClawRouter optimize routing decisions based on integration
source and enables better analytics for the Continue community.

* feat: complete ClawRouter integration with full provider support

- Add clawrouter to PROVIDER_HANDLES_TEMPLATING (autodetect.ts)
- Add clawrouter to PROVIDER_SUPPORTS_IMAGES (autodetect.ts)
- Add clawrouter tool support function (toolSupport.ts)
- Add supportsReasoningField and supportsReasoningDetailsField
- Add promptTemplates with osModelsEditPrompt
- Match OpenRouter implementation patterns

* feat: add ClawRouter to VS Code schema, docs nav, and AI SDK

- Add clawrouter to VS Code config_schema.json provider enum
- Add ClawRouter description in config_schema.json
- Add clawrouter to docs.json navigation (top-level providers)
- Add clawrouter to AI SDK PROVIDER_MAP

* docs: add wallet setup and x402 payment documentation

- Add Wallet & Payment Setup section to clawrouter.mdx
- Document payment tiers (free/eco/auto)
- Add wallet funding instructions (Solana/Base USDC)
- Add spend control configuration
- Update VS Code schema description with wallet info
- Update provider longDescription with payment options

* feat: add premium tier and enhanced ClawRouter features

- Add blockrun/premium routing profile (mission-critical tasks)
- Add dual-chain wallet support docs (Base EVM + Solana)
- Add model exclusion documentation
- Update routing profiles table with savings percentages
- Update comparison table with auth/payment differences
- Total 44+ models, 4 routing tiers

* test: add ClawRouter unit tests

- Add ClawRouter.vitest.ts (core/llm/llms)
  - Provider name verification
  - Default options validation
  - Reasoning field support
  - User-Agent header verification
  - Routing profiles acceptance

- Add ClawRouter.test.ts (openai-adapters)
  - Default apiBase
  - Custom apiBase override
  - Continue headers
  - OpenAI standard headers

- Add clawrouter tests to toolSupport.test.ts
  - blockrun/* routing profiles
  - Tool-supporting model patterns

* docs: add routing profile switching and enhanced error handling docs

- Add 'Switching Between Routing Profiles' section with full examples
- Add /model command tip for quick switching
- Add 'Error Handling' section comparing Continue vs ClawRouter
- Document automatic error recovery (429, 402, 500+, timeout)
- Add response header documentation for diagnostics
- Add AI-powered doctor command for troubleshooting

* fix: address PR review feedback - move docs to /more, resize logo, add provider constants, fix docs example

* fix: replace clawrouter logo with higher-res brand kit version (128x128)
2026-03-26 10:26:12 -07:00
Dallin Romney
a33cd37041
fix(openrouter): Gemini 3 tool support, suffix stripping, thought_signature, autocomplete endpoint (#11856)
* fix: multiple OpenRouter provider improvements

- Add google/gemini-3 to tool support prefixes so Gemini 3 models are
  detected as supporting tools via OpenRouter (#8980)
- Strip :free/:extended/:beta suffixes before matching in OpenRouter
  tool support, fixing models like meta-llama/llama-3.2-3b-instruct:free
  not being recognized (#11095)
- Add thought_signature fallback for Gemini models via OpenRouter to
  prevent 400 errors when tool calling (#8980)
- Fix autocomplete/next-edit forcing legacy /completions endpoint on
  OpenRouter, which only supports /chat/completions (#3648)
- Enrich OpenRouter error messages with provider metadata details
  instead of showing generic "Provider returned error" (#11262, #11577)

* fix: remove error enrichment, add TODO for OpenRouter error extraction

* chore: clean up verbose comments and add OpenRouter tool support tests

* style: fix prettier formatting in toolSupport.ts
2026-03-25 20:31:53 -07:00
Dallin Romney
afa6bab1ba
fix: expand tool support to reduce 'Invalid tool name' errors (#11792)
fix: expand tool support to prevent "Invalid tool name" errors

Models not recognized in PROVIDER_TOOL_SUPPORT fall back to a text-based
tool calling format injected into the system message. When models don't
follow this format exactly, the parser throws "Invalid tool name". This
was affecting many models that actually support native tool calling but
weren't listed.

Changes:
- Azure: add gpt-5, gpt-4.1, o1, o4 (was only gpt-4, o3)
- Ollama: add glm-4/5, deepseek, dolphin families
- DeepSeek provider: add deepseek-coder (was only chat/reasoner)
- OpenRouter: add deepseek/deepseek-v3, deepseek/deepseek-coder

Fixes #10678, #11594, #11431, #11218, #10900, #10272, #10156, #10143,
#10050, #9891, #9839
2026-03-24 20:23:07 -07:00
Dallin Romney
09650d4a4f
fix(gemini): update model catalog for retired/new Gemini models (#11793)
* fix(gemini): update model catalog for retired/new Gemini models

Gemini 1.x models are fully retired (returning 404), gemini-3-pro-preview
was shut down March 9 2026, and new 3.1 series models were missing.

- Add gemini-3.1-pro-preview, gemini-3.1-flash-lite-preview, gemini-3.1-flash-image-preview
- Replace gemini-3-pro-preview with gemini-3.1-pro-preview everywhere
- Remove retired Gemini 1.x models (gemini-1.0-pro, gemini-1.5-pro, gemini-1.5-flash, gemini-1.5-flash-8b)
- Remove retired experimental 2.0 image gen models
- Fix default model from retired gemini-pro to gemini-2.5-flash
- Update docs, onboarding config, VSCode schema, GUI model picker, VertexAI provider
- Update isRecommendedAgentModel regex and tests

Fixes #10996, #10998

* fix: address review comments

- Add missing gemini-3.1-flash-image-preview to VS Code schema enum
- Tighten isRecommendedAgentModel regex to match 3-flash-preview (not bare 3-flash)
- Update case-insensitivity tests for new model names

* fix: fix misleading test description and inconsistent doc heading

- Rename test to "Gemini 3.1 Pro and 3 Flash Preview models" to match assertions
- Update chat.mdx heading from "Gemini 3 Pro" to "Gemini 3.1 Pro"
2026-03-24 20:22:47 -07:00
Dallin Romney
ced1e3c86b
fix(ollama): check model template for tool support via /api/show (#11670)
fix(ollama): check model template for tool support before sending tools

Ollama models only support tool calling if their template includes
.Tools. The heuristic in toolSupport.ts was too broad, causing 400
errors for models whose templates lack tool support.

Two changes:
- Query /api/show template for .Tools (same pattern as existing .Suffix
  FIM check) and skip sending tools when the template says no
- Exclude Ollama cloud models (:cloud tag) in the heuristic, since
  cloud tool calling is unreliable

Fixes #9639 #9646 #9875 #10304 #10461 #10539 #10561 #10593 #10640
Fixes #10672 #10833 #10876 #11308 #11382 #11402
2026-03-24 12:45:42 -07:00
Dallin Romney
a2c1fe6897
feat: model updates and + z.ai (#10638)
* Add latest model definitions across providers

Add new models for OpenAI (gpt-4.1, gpt-5.2, codex-mini, o1/o3/o4-mini),
Gemini (2.5 stable, 2.5-flash-lite, 3-flash-preview), Mistral (devstral,
magistral, ministral, mistral-nemo), xAI (grok-4-fast, grok-4-1-fast,
grok-3-fast), and Bedrock (Claude 4.5/4.6, Nova, Llama 4, DeepSeek).

Update tool support and reasoning detection for the new model families.

* Add Z.ai (GLM) provider, Kimi K2/K2.5 models, and fix OpenRouter tool support bug

- Add Z.ai as a new provider with GLM-5, GLM-4.7, GLM-4-plus, GLM-4.5 models
- Add Kimi K2 and K2.5 model packages to Moonshot provider
- Fix variable shadowing bug in OpenRouter tool support where loop
  variables shadowed the outer model parameter, causing specificModels
  and supportedContains checks to always return true
- Add moonshotai/kimi and zai-org/glm to OpenRouter supported prefixes
- Add Z.ai and Moonshot to docs navigation

* Clean up unnecessary import aliases for zAI

* Add Z.ai Coding Plan endpoint note to docs

* Replace placeholder zai.png icon with proper zAI.svg

* Add zAI provider to openai-adapters

* Fix Z.ai API key URL
2026-02-20 00:35:44 -08:00
Varun Chawla
cfff26f522 fix: check exclusions against both raw and normalized model IDs for LM Studio
Extract isExcluded helper that tests a given name against each exclusion
pattern in both its original and hyphen-stripped forms.  Call it with
both the raw lowercased model name and the normalized (hyphen-stripped)
form so that e.g. "mistral-lite" is correctly caught by the
"mistrallite" exclusion regardless of which path is evaluated.
2026-02-08 12:11:01 -08:00
Varun Chawla
dc47a957d1 fix: check exclusions on both raw and normalized model names for LM Studio
The exclusion check only tested the lowercased model name, missing cases
where hyphenated names like "Mistral-Lite" normalize to "mistrallite"
which should match the exclusion pattern.
2026-02-08 10:09:33 -08:00
Varun Chawla
f83aeed254 fix: correct model ID normalization order for LM Studio
Check exclusions on both raw and normalized (hyphen-stripped) model
names before delegating to Ollama's heuristic. This ensures:

1. Hyphenated exclusions like "mistral-openorca" are caught on the raw name
2. Non-hyphenated variants like "MistralOpenOrca" are caught on the
   normalized name before the "mistral" support pattern matches
3. Hyphenated LM Studio IDs like "Meta-Llama-3.1-8B" still get detected
   via the normalized fallback to Ollama
2026-02-08 05:20:12 -08:00
Varun Chawla
61471b37f9 fix: check exclusions before early return in LM Studio tool support
The LM Studio handler was checking Ollama's full heuristic (which
doesn't match hyphenated names) before trying the normalized version.
This caused hyphenated LM Studio model IDs like
"Meta-Llama-3.1-8B-Instruct-GGUF" to be incorrectly rejected.

Now checks exclusions separately first, then falls back to the
normalized (hyphen-removed) name for Ollama's support check.
2026-02-08 05:05:33 -08:00
Varun Chawla
8b04ae1845 Fix LM Studio model ID tool support with proper hyphen normalization
Improve the LM Studio tool support check to first verify exclusions on the
original model ID before normalizing hyphens. This ensures that models like
'Mistral-Openorca-GGUF' are correctly excluded from tool support, while
allowing hyphenated variants of supported models like 'Meta-Llama-3.1-8B-Instruct-GGUF'.

The previous implementation would remove all hyphens before checking Ollama's
heuristics, which could bypass exclusion rules for models like mistral-openorca.
2026-02-08 01:24:34 -08:00
Varun Chawla
71d355ec44 fix: normalize hyphenated model IDs for LM Studio tool support
LM Studio uses hyphenated model identifiers (e.g., "Meta-Llama-3.1-8B-Instruct-GGUF"),
but the Ollama heuristic checks for non-hyphenated patterns like "llama3.1".

This fix normalizes hyphenated model names by removing hyphens before delegating to
Ollama's tool support logic, enabling agent mode for LM Studio models with hyphenated IDs.

Added comprehensive tests for hyphenated model names including:
- Meta-Llama-3.1-8B-Instruct-GGUF
- Qwen2-7B-Instruct
- Mixtral-8x7B-Instruct-v0.1
- Case insensitivity checks
- Negative tests for unsupported models like "Llama-Vision-Free"

Addresses feedback from Cubic AI bot review.
2026-02-07 20:12:08 -08:00
Varun Chawla
be5181ef31 feat: enable agent mode support for LM Studio models
Add LM Studio to PROVIDER_TOOL_SUPPORT by referencing Ollama's
tool support implementation. LM Studio uses an OpenAI-compatible
API similar to Ollama, so the same model compatibility logic applies.

Fixes #5182
2026-02-07 15:16:51 -08:00
Elias TOURNEUX
9c2ffde418
feat: Add new OVHcloud models 2026-01-19 10:39:17 -05:00
Dallin Romney
5908d184ca fix: tool support tests 2025-12-02 13:14:02 -08:00
Dallin Romney
886c0a4741 merge main 2025-12-02 12:25:02 -08:00
Dallin Romney
ff335487aa merge: main 2025-11-25 20:39:59 -08:00
Dallin Romney
b024fa8d70
Merge branch 'main' into gemini-3-support 2025-11-25 12:32:43 -08:00
Dallin Romney
0fd1594e2b
Merge pull request #8832 from uinstinct/gpt-5.1-support
chore: add support for gpt 5.1
2025-11-25 12:02:28 -08:00
uinstinct
4717748ca5 add tool support for gemini 3 2025-11-25 18:23:02 +05:30
uinstinct
bc3d06330c add gpt-5.1 to recommended tool 2025-11-24 19:19:49 +05:30
uinstinct
5777c88770 also add to tool support 2025-11-24 19:01:48 +05:30
uinstinct
862914aa38 add grok 4.1 to recommended agent model 2025-11-24 18:54:05 +05:30
Maxime Brunet
9525ea8794
feat(cohere): add support from Reasoning/Vision/Translate models 2025-11-04 20:25:44 -03:00
Dallin Romney
6aad84013c
feat: upgrade grok code fast 1 (#8475)
* fix: grok code fast tweaks

* fix: revert thinking addition for grok code
2025-11-03 12:33:05 -08:00
Dallin Romney
c029738122
fix: explicit haiku 4.5 tool support (#8491)
* fix: haiku tool support

* fix: add claude 4-5 models to recommended agent mode
2025-11-02 18:48:35 -08:00
Gabe Goodhart
d1ba7c9bba
feat: Support Granite 4 FIM and tool calling correctly (#8531)
* feat: Use the correct FIM template for Granite 4 models

Branch: GraniteFourTemplates

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>

* feat: Add granite4 name variants to the list of models that natively support tools

Branch: GraniteFourTemplates

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>

---------

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
2025-10-30 17:25:24 -07:00
Dallin Romney
7a5731eb23 feat: sonnet 4 5 updates and 3 5 deprecation 2025-10-18 01:33:39 -07:00
Dallin Romney
294308531f fix: revert vertexai change 2025-09-23 14:10:15 -07:00
Dallin Romney
1e3bf050d2 feat: grok model additions 2025-09-23 14:08:17 -07:00
Jorge Piedrahita Ortiz
ee1905290b
fix: Update sambanova models (#7901)
* update sambanova models

* fmt
2025-09-22 13:53:26 -07:00
Patrick Erichsen
3e74e97565
feat: use recommended models fn for tools (#7755)
* feat: use recommended models fn for tools

* Update toolSupport.ts

---------

Co-authored-by: Dallin Romney <dallinromney@gmail.com>
2025-09-17 16:48:49 -07:00
Dallin Romney
be0c0d585b merge: main 2025-08-22 12:36:32 -07:00
Dallin Romney
8444e83caf
Merge branch 'main' into feat/novita-tool-support 2025-08-22 12:00:40 -07:00
Dallin Romney
da3f07f1a3
Merge pull request #7257 from uinstinct/kimik2-tools
chore: enable native tool support for kimi k2
2025-08-21 17:16:11 -07:00
chezsmithy
34829b3b4f feat: ✨ Add gpt-oss to the bedrock provider 2025-08-20 23:46:28 -07:00
uinstinct
9183b3a235 add in tool support 2025-08-21 09:34:32 +05:30
Dallin Romney
efa6328643 feat: UIs and add single replace to default tools 2025-08-20 17:18:23 -07:00
u-yuta
e3155df12c style: apply prettier formatting 2025-08-17 00:10:25 +09:00
Suhas S
89c52cad9b style: apply prettier formatting to toolSupport.ts 2025-08-16 09:24:20 +08:00
Suhas S
cbdd187bbb fix: disable tool support for moonshotai/kimi-k2:free model
Fixes #6619 where moonshotai/kimi-k2:free was causing 400 errors
in agent mode because it doesn't support tool calls.

This is a minimal, targeted fix that only affects the specific
model reported in the issue.
2025-08-15 21:20:53 +08:00
u-yuta
9fb3c93b9d feat: add tool support for Novita provider models
Register major tool-capable models available through Novita provider
to enable function calling in Agent mode.
2025-08-15 20:41:20 +09:00
Juan Calderon-Perez
3a08e8a591
Update toolSupport.ts 2025-08-07 22:52:01 -04:00
Juan Calderon-Perez
b0484fc375
Merge branch 'main' into 2025-08-05-03-21-49 2025-08-07 22:37:56 -04:00
Juan Calderon-Perez
ef48171c8a
fix review 2025-08-07 22:35:36 -04:00
Dallin Romney
01812e598f
feat: gpt-5 support (#7054)
* fix: gpt-5 support

* fix: gpt 5 context length

* fix: broken test file
2025-08-07 13:36:26 -07:00
Juan Calderon-Perez
75fd68d8c9
Remove EXAONE from OpenRouter 2025-08-06 23:07:30 -04:00
Juan Calderon-Perez
24cf6c0abb
Merge branch 'main' into 2025-08-05-03-21-49 2025-08-06 20:38:43 -04:00
Juan Calderon-Perez
387e6895e2
Add exaone to ollama provider 2025-08-06 09:02:34 -04:00
Juan Calderon-Perez
b734afe9a0
Add gpt-oss to ollama provider 2025-08-06 09:01:15 -04:00