DeepSeek Reasoner models require max_completion_tokens instead of max_tokens,
similar to OpenAI's o-series models. This maps the parameter automatically
when the API base is api.deepseek.com or the model name includes
"deepseek-reasoner".
Co-authored-by: Burak Bebek <BurakBebek1@users.noreply.github.com>
* fix: resolve critical and high security vulnerabilities across packages
Bump vulnerable dependencies and remove unused `request` package to
address ~351 of ~394 npm audit vulnerabilities reported by GitHub.
* fix: handle nullable textContent from @mozilla/readability v0.6.0
readability.textContent can be undefined in v0.6.0, add nullish
coalescing to satisfy ArticleComponent.body type constraint.
* 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
* feat(openrouter): send HTTP-Referer and X-Title headers to identify app
Adds `HTTP-Referer: https://www.continue.dev/` and `X-Title: Continue`
headers to all OpenRouter API requests, as recommended by the OpenRouter
docs. This lets OpenRouter attribute requests to Continue in their
dashboard and App Showcase.
Headers are injected via both `requestOptions.headers` (for SDK-based
requests) and `getHeaders()` (for direct fetch calls). User-configured
headers take precedence.
Closes#4049
* refactor: remove redundant getHeaders() override
The OPENROUTER_HEADERS are already injected via requestOptions.headers
in the constructor. Since fetchwithRequestOptions merges
requestOptions.headers into all requests (including direct fetch calls
like fimStream and rerank), the getHeaders() override was redundant.
The BlockDuplicationDetector used only the `provider` field as the
deduplication key for context entries, so multiple HTTP context providers
with different URLs/titles were collapsed to just the first one.
Use `name ?? params.title ?? provider` as the key instead, matching
how HTTP context providers identify themselves via params.title.
Fixes#9416
The Vercel stream converter was incorrectly mapping reasoning-delta
events to delta.content, causing reasoning/thinking content to be
treated as regular assistant content. This fix maps it to
delta.reasoning_content so downstream consumers can properly
distinguish reasoning from regular output.
Fixes#11069
Co-authored-by: MumuTW <clothl47364@gmail.com>
* feat: add `useResponsesApi` option to allow opting out of OpenAI Responses API
Add a `useResponsesApi` config option that, when set to false, forces
o-series and gpt-5 models to use /chat/completions instead of /responses.
This helps users whose organizations are not verified avoid "organization
must be verified" errors related to reasoning summaries and streaming.
The option gates both code paths where the Responses API is selected:
- `canUseOpenAIResponses()` in BaseLLM (native path)
- `shouldUseResponsesEndpoint()` in the OpenAI adapter
Closes#11772
Related: #8209, #7129
* feat: suggest `useResponsesApi: false` in org verification error messages
Update error detection to also catch "organization must be verified to
stream" errors (in addition to reasoning summaries), and update the
error message to suggest adding `useResponsesApi: false` to model config
as a workaround.
* fix: improve org verification error message copy
* fix: add useResponsesApi to LLMOptions in index.d.ts
The actual type definitions used by tsc are in core/index.d.ts, not in
the string template in config/types.ts.
* fix: also check provider name when detecting org verification errors
The error message from OpenAI's API doesn't always contain the word
"openai" — check the provider name from the model config as well.
* feat: detect missing authentication header error and suggest adding apiKey
* fix: handle missing auth error directly in 401 dialog block
The 401 status code handler in StreamError.tsx renders before the
customErrorMessage check, so detect the missing authentication error
inline within the 401 block.
* Revert "fix: handle missing auth error directly in 401 dialog block"
This reverts commit 0053957d2df7c64ddea2279982f5e07e2cee1020.
* style: fix prettier formatting in index.d.ts
* style: revert unrelated prettier reformatting in index.d.ts
* fix: handle undefined providerName in error analysis
* fix: use YAML-style formatting in useResponsesApi suggestion
* fix(gemini): merge consecutive same-role messages to fix ordering errors
Gemini API requires strict role alternation between "user" and "model".
When multiple tool responses (mapped to "user" role) appear consecutively,
or when consecutive assistant messages exist, the alternation breaks causing:
- "function call turn comes immediately after a user turn or after a function response turn"
- "number of function response parts is equal to the number of function call parts"
Fix: merge consecutive messages with the same role by combining their parts
arrays, applied as a post-processing step after message conversion in both
the core Gemini LLM and the openai-adapters Gemini API.
Fixes#11047, fixes#9562
* chore: remove verbose comments
* refactor: deduplicate mergeConsecutiveGeminiMessages into openai-adapters
Export from openai-adapters gemini-types and import in core, removing
the duplicate private method from both Gemini classes.
* fix: resolve TS2345 by removing explicit nullable type annotation on contents
* fix: keep mergeConsecutiveGeminiMessages in each package's own gemini-types
The core test suite mocks @continuedev/openai-adapters entirely, which
replaces the imported function with a no-op returning undefined. Define
the function in both packages' gemini-types to avoid this coupling.
* fix: respect contextLength from YAML model config
Three fixes for contextLength not being respected:
1. Add contextLength to YAML model schema at the model level (not just
inside defaultCompletionOptions), matching JSON config behavior
2. Read contextLength from both model-level and defaultCompletionOptions,
with model-level taking precedence
3. Fix GUI selector fallback using DEFAULT_MAX_TOKENS (4096) instead of
DEFAULT_CONTEXT_LENGTH (32768)
Closes#4638Closes#4304
* fix: reduce complexity in modelConfigToBaseLLM
Replace find callbacks with includes() to offset complexity from
contextLength nullish coalescing.
* docs: document contextLength at model level in config.yaml reference
* docs: consistently show contextLength in defaultCompletionOptions for YAML
YAML examples use defaultCompletionOptions.contextLength, JSON examples
use model-level contextLength. Also fixes ollama guide using the wrong
key name (completionOptions -> defaultCompletionOptions).
* refactor: extract env options into helper to reduce complexity
Extract the repetitive env-to-options mapping from modelConfigToBaseLLM
into a separate applyEnvOptions function, bringing complexity well under
the limit of 36.
* fix: add keepAlive to YAML completion options schema
The keepAlive property was present in the JSON config schema but missing
from the YAML config schema, causing it to be silently stripped during
zod validation when users configured it under defaultCompletionOptions.
Closes#4671
* Document keepAlive option in YAML config reference
---------
Co-authored-by: continue[bot] <230936708+continue[bot]@users.noreply.github.com>
* fix: handle thinking/assistant messages at end of chat history
extractToolSequence threw "no user/tool message found" when the last
message was thinking or assistant (common with reasoning models when
assistant content is empty after thinking and gets filtered out).
* fix: guard against non-string NO_PROXY env value in getEnvNoProxyPatterns
Add typeof check before calling .split() on the NO_PROXY environment
variable to prevent "envValue.split is not a function" errors when the
value is not a string.
* 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"
* fix(openai): fix Responses API 400 errors for reasoning, tool calls, and ID handling
Three categories of OpenAI Responses API 400 errors are addressed:
1. "No tool call found for function call output with call_id" — function_call
items are now always emitted when tool calls exist (even without fc_ IDs),
and orphaned function_call_output items are removed in post-processing.
2. "Item provided without its required 'reasoning' item" — reasoning items
without encrypted_content (e.g. from saved sessions) are removed, and the
id is stripped from subsequent function_call items so the API doesn't
reject them for referencing a missing reasoning item. Trailing reasoning
items not followed by a valid successor are also removed.
3. "Expected an ID that begins with 'fc'" — responsesOutputItemIds (which
accumulates both msg_ and fc_ IDs during streaming) is now filtered to
only fc_-prefixed IDs for function_call items, preventing msg_ IDs from
being used where fc_ IDs are required.
Co-authored-by: Luna <20552038+xxsLuna@users.noreply.github.com>
Co-authored-by: Robert Benko <10097827+Quazistax@users.noreply.github.com>
Co-authored-by: pallaprolus <162944051+pallaprolus@users.noreply.github.com>
* fix(openai-adapters): don't duplicate tool call args in Vercel stream converter
The tool-call event was re-emitting the full arguments that were already
streamed via tool-input-start/delta, causing JSON.parse failures in
consumers. Now tool-call only emits extra_content when a Gemini
thoughtSignature is present, and returns null otherwise.
---------
Co-authored-by: Luna <20552038+xxsLuna@users.noreply.github.com>
Co-authored-by: Robert Benko <10097827+Quazistax@users.noreply.github.com>
Co-authored-by: pallaprolus <162944051+pallaprolus@users.noreply.github.com>
* Fix for sending x-api-key instead of api-key as header for newer azure hosted anthropic service
* Update packages/openai-adapters/src/apis/AnthropicUtils.ts
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* fix: update test to expect x-api-key for Azure AI Foundry endpoints
Azure AI Foundry (services.ai.azure.com) uses x-api-key, while only
cognitiveservices.azure.com uses api-key. Update the test to match.
---------
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: Dallin Romney <dallinromney@gmail.com>
* add support for gemini in ai sdk
* support thought signature conversion
* capture extra_content in assistasnt tool calls
* fix: update vercelStreamConverter tests for tool-call chunk emission
The tool-call case now returns a chunk (for Gemini thoughtSignature
support) instead of null, so tests need to expect the new behavior.
---------
Co-authored-by: Nate Sesti <33237525+sestinj@users.noreply.github.com>
Co-authored-by: Dallin Romney <dallinromney@gmail.com>
chore: remove Gemini 2.0 Flash from defaults/UI/docs and update Claude defaults to 4.6
Gemini 2.0 Flash is no longer supported for new Gemini users. Remove it
from the add model form, onboarding defaults, config schema, docs, and
CometAPI supported models list. Replace with Gemini 2.5 Flash where
appropriate. Gemini 2.0 Flash remains in llm-info for existing users.
Update Claude model defaults to 4.6 series (Sonnet 4.6 and Opus 4.6) in
onboarding config, workspace block templates, and documentation examples.
* fix(core): pass config name through ConfigResult instead of re-reading file
Rework per reviewer feedback: instead of reading config.yaml separately
in LocalProfileLoader's constructor, propagate the name field through
ConfigResult from the existing config loading pipeline.
Changes:
- Add optional configName to ConfigResult interface
- Populate configName in unroll.ts where AssistantUnrolled is built
- Propagate through loadContinueConfigFromYaml → doLoadConfig
- LocalProfileLoader now reads configName from doLoadConfig result
- Remove duplicate fs.readFileSync + parseConfigYaml from constructor
- Works in WSL and other environments where file paths may differ
Addresses: https://github.com/continuedev/continue/issues/11061
* style: fix prettier formatting in doLoadConfig.ts
---------
Co-authored-by: Dallin Romney <dallinromney@gmail.com>
* feat: add MiniMax as a new LLM provider
Add MiniMax (https://platform.minimax.io) as a new LLM provider with
OpenAI-compatible API support.
Changes:
- Add MiniMax LLM provider class extending OpenAI with temperature
clamping (must be in (0, 1]) and response_format removal
- Register provider in LLMClasses, openai-adapters, and config-types
- Add model info for MiniMax-M2.5 and MiniMax-M2.5-highspeed
(204K context, 192K max output)
- Add GUI model selection entries and provider configuration
- Add provider documentation page
* fix: use dedicated MiniMaxApi adapter instead of generic OpenAIApi
The minimax provider was wired to the generic OpenAIApi via
openAICompatible(), which skips MiniMax-specific request fixes.
This creates a dedicated MiniMaxApi adapter class that overrides
modifyChatBody to apply temperature clamping (MiniMax requires
temperature in (0.0, 1.0]) and response_format removal, matching
the adaptations already present in core/llm/llms/MiniMax.ts.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: upgrade MiniMax default model to M2.7
- Add MiniMax-M2.7 and MiniMax-M2.7-highspeed to model list
- Set MiniMax-M2.7 as default model
- Keep all previous models (M2.5, M2.5-highspeed) as alternatives
- Update docs and GUI model selection
* fix: add minimax to PROVIDER_HANDLES_TEMPLATING and PARALLEL_PROVIDERS
MiniMax uses an OpenAI-compatible chat completions API, so it handles
templating natively. MiniMax also supports parallel tool calls.
Not added to PROVIDER_SUPPORTS_IMAGES since MiniMax M2.7 is text-only.
* style: fix prettier formatting in MiniMax provider files
---------
Co-authored-by: PR Bot <pr-bot@minimaxi.com>
Co-authored-by: octo-patch <octo-patch@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Dallin Romney <dallinromney@gmail.com>
fix(registryClient): handle relative file paths more robustly
First attempt to resolve relative paths against current working directory before falling back to rootPath. This provides better flexibility when files are not located relative to rootPath.
* feat: add Tensorix as an LLM provider
Adds Tensorix (https://tensorix.ai) as a new OpenAI-compatible
provider, giving users access to DeepSeek, Llama 4, Qwen, GLM,
and other models through a single API key.
Changes:
- New LLM class (core/llm/llms/Tensorix.ts)
- Registered in LLM index and config schema
- Added to VS Code extension config schema
- Added to GUI provider selection with AUTODETECT
* Fix missing commas in config_schema.json for tensorix entries
Co-authored-by: openhands <openhands@all-hands.dev>
* feat: address reviewer feedback for Tensorix provider
- Add tensorix to openai-adapters (types.ts + index.ts)
- Add tensorix to PROVIDER_HANDLES_TEMPLATING, PROVIDER_SUPPORTS_IMAGES,
and PARALLEL_PROVIDERS in autodetect.ts
- Add docs page for Tensorix under more providers
- Add tensorix to docs.json navigation
Co-authored-by: openhands <openhands@all-hands.dev>
---------
Co-authored-by: openhands <openhands@all-hands.dev>
fix: packages/continue-sdk/package.json & packages/continue-sdk/package-lock.json to reduce vulnerabilities
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-NESTJSCORE-15365922
Co-authored-by: snyk-bot <snyk-bot@snyk.io>
Co-authored-by: Dallin Romney <dallinromney@gmail.com>
* fix: correct cache_hit_rate calculation and remove duplicate emission
Two bugs in prompt_cache_metrics telemetry:
1. Duplicate emission: prompt_cache_metrics was emitted twice per API
request — once using `actualInputTokens` and again using
`fullUsage.prompt_tokens`. This doubled all event counts in PostHog
and produced conflicting values.
2. Wrong denominator: cache_hit_rate was calculated as
`cacheReadTokens / prompt_tokens`, but the Anthropic adapter maps
`prompt_tokens` to only non-cached input tokens (`input_tokens`),
excluding cache reads and writes. When caching works well, this
produces ratios >> 1 (observed max: 89,892). The correct total is
`prompt_tokens + cache_read_tokens + cache_write_tokens`.
Fix: remove the first duplicate emission and compute total_prompt_tokens
as the sum of all three token types. cache_hit_rate is now a proper 0-1
ratio.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: emit tool call id/name from tool-input-start in Vercel stream converter
The Vercel AI SDK streams tool calls as tool-input-start → tool-input-delta
→ tool-input-end → tool-call. Previously, tool-input-start was ignored (returned
null) and tool-call emitted the full tool call at the end, which meant streaming
consumers never saw the tool call id on intermediate chunks.
Now tool-input-start emits the initial chunk with id and function name (matching
OpenAI's streaming format), and tool-call returns null to avoid duplicating args
already streamed via tool-input-delta.
Generated with [Continue](https://continue.dev)
Co-Authored-By: Continue <noreply@continue.dev>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Continue <noreply@continue.dev>
Skip addCacheControlToLastTwoUserMessages when cachingStrategy is "none"
so requests truly have no caching markers. Updates test to verify.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add required `provider: "anthropic"` to AnthropicApi constructor calls
and use `(textPart as any)` type assertion for `cache_control` property
access, which is dynamically added and not in the ContentBlockParam type.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cache the last two user messages in _convertBody() by calling
addCacheControlToLastTwoUserMessages() after applying the caching
strategy. This brings the direct Anthropic path to parity with
OpenRouter, which already caches user messages.
Caching the last two user messages allows Anthropic to serve ~90%
of those tokens from cache reads at 1/10th the cost, significantly
reducing per-request input token costs for multi-turn conversations.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Preserve Vitest's default excludes (dist, node_modules, etc.) when
adding the live test exclusion pattern.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Live test files (*.live.test.ts) make real Anthropic API calls and are
intended for manual validation only. Exclude them from the default
vitest configuration to prevent flaky CI failures.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>