Commit Graph

98 Commits

Author SHA1 Message Date
Cohee 97dba399e4 Implement S256 challenge in OpenRouter OAuth flow (#5501)
* feat: implement S256 challenge in OpenRouter OAuth flow

* fix: add error handling for missing OpenRouter authorization code

* fix: save verifier to accountStorage

Co-authored-by: Copilot <copilot@github.com>

* fix: comment on getVerifierKey

---------

Co-authored-by: Copilot <copilot@github.com>
2026-04-26 22:32:53 +03:00
Octopus aecbb9a2ee feat: add MiniMax as a chat completion provider (#5452)
* feat: add MiniMax as a chat completion provider

Add MiniMax (https://www.minimax.io) as a first-class chat completion
provider. MiniMax already has TTS integration in SillyTavern; this
extends support to LLM chat completions via their OpenAI-compatible API.

Supported models:
- MiniMax-M2.5 (default) — 204K context
- MiniMax-M2.5-highspeed — same capability, faster inference

Key implementation details:
- Reuses existing SECRET_KEYS.MINIMAX (shared with TTS)
- API endpoint: https://api.minimax.io/v1
- Temperature clamped to (0.0, 1.0] as required by MiniMax API
- Returns hardcoded model list since MiniMax doesn't expose /v1/models
- Full UI integration: model selector, sampler parameters, streaming

Co-Authored-By: octo-patch <octo-patch@users.noreply.github.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 as alternatives

* feat: independent request function, vision support, temp clamping for MiniMax

- Extract sendMinimaxRequest() following Chutes pattern (PR #4844)
  with function calling and JSON Schema structured output support
- Clamp temperature to (0.01, 1.0] on backend; limit frontend UI max to 1.0
- Enable image inlining for MiniMax M2.7 model
- Add MiniMax to slash-commands model selector and tokenizer mapping
- Add minimax_model to default preset

* feat: add VLM-based vision support for MiniMax M2.7

M2.7 does not natively accept image input. When images are detected
in messages, pre-process them via the MiniMax VLM endpoint
(/v1/coding_plan/vlm) to convert images to text descriptions before
sending to the chat completions API. Uses the same API key.

* feat: add M2-her model to MiniMax provider

M2-her is MiniMax's dialogue/roleplay-optimized model with 64K context
and 2048 max completion tokens. Text-only (no vision).

* feat: add MiniMax China endpoint (minimaxi.com) support

Add endpoint selector (Global/China) for MiniMax, mirroring the
SiliconFlow pattern. Users can now choose between api.minimax.io
(international) and api.minimaxi.com (China domestic).

* fix: merge consecutive same-role messages for MiniMax

MiniMax API rejects consecutive messages with the same role with
error 'invalid chat setting (2013)'. Merge them before sending.

* review: address PR feedback on MiniMax provider

Backend (src/endpoints/backends/chat-completions.js):
- Drop the entire MiniMax VLM image-preprocessing path; vision is no
  longer advertised for this provider, so M2.7 messages now go straight
  to /chat/completions without a separate VLM round-trip.
- Drop the json_schema -> response_format mapping (MiniMax does not
  document structured-output support; relying on it was speculative).
- Drop the backend temperature clamp; the same clamp now lives in the
  frontend so the wire payload matches what the user sees.
- Drop the MINIMAX branch in /status that returned a hard-coded model
  list; the frontend hardcodes the same list and bypasses /status via
  noValidateSources, so the round-trip was wasted.
- Add a streaming Transform + non-streaming helper that move
  <think>...</think> blocks from delta.content / message.content to
  reasoning_content. MiniMax M2.x emit chain-of-thought inline in
  content; without this transform the raw <think> tags leak into the
  rendered chat. Includes a state machine that holds back partial
  marker bytes so a marker split across SSE chunks is still detected.

Frontend:
- public/scripts/openai.js: add MINIMAX to noValidateSources so the key
  is accepted without a /models call; remove the dead saveModelList
  branch; clamp temperature to (0.0, 1.0] in createGenerationParameters.
- public/scripts/reasoning.js: add MINIMAX to the non-streaming
  reasoning_content extraction case (the backend transform now produces
  this field for MiniMax responses).
- public/scripts/slash-commands.js: add MINIMAX to the /api enum and
  add a MiniMax case to /api-url so users can switch endpoint by
  command.
- public/scripts/custom-request.js: pass minimax_endpoint through the
  override-payload merge alongside the other per-source endpoint fields.
- public/scripts/tokenizers.js: stop returning openai_model (which was
  always a MiniMax model id and thus an unknown tokenizer); fall back
  to gpt-3.5-turbo for a coarse but functional estimate.
- public/scripts/tool-calling.js: add MINIMAX to supportedSources so
  function-calling settings are exposed.
- public/index.html: drop the "-- Connect to the API --" placeholder
  option from the model select (the model list is hardcoded and always
  populated); remove minimax from the vision data-source attributes
  on the inline-media controls.
- public/img/minimax.svg: replace the multicolor brand SVG with a
  single-color currentColor version that matches the other provider
  icons in the connect panel.

* review: drop backend <think> parsing, defer to frontend

Per reviewer feedback: SillyTavern's reasoningHandler / reasoning_auto_parse
setting already extracts <think>...</think> blocks on the client side, so the
backend doesn't need to rewrite MiniMax responses. Removes the SSE Transform,
the non-streaming helper, and the corresponding case in reasoning.js.

* fix: remove isImageInliningSupported declaration for MINIMAX

* fix: remove MINIMAX from stream reasoning parsing

* fix: add to autoconnect logic

* fix: add missing MINIMAX models from docs

* fix: freq. and pres. pen aren't supported for MINIMAX

* fix: use clamp function for adjusting temperature

* fix: pass minimax_endpoint from connection profile to ChatCompletionService

* fix: update supported APIs in slash command documentation

* fix: replace bespoke merge with standard MERGE_TOOLS processing

* fix: add data-i18n attributes for headers

---------

Co-authored-by: octo-patch <octo-patch@users.noreply.github.com>
Co-authored-by: octo-patch <octo-patch@github.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-24 00:43:05 +03:00
Stagnating a028bec87b Display OpenRouter credit balance in UI (#5513)
* Display OpenRouter credit balance in UI

Adds a "View Remaining Credits" click handler that fetches the
current balance from the OpenRouter /credits endpoint via a new
server-side /api/openrouter/credits route, and renders it next
to the link. The anchor still points at openrouter.ai/account
so middle-click / right-click "open in new tab" keeps working.

* Return 500 on OpenRouter credits failure

* Reduce to two decimals

* Update view credits URL

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-23 23:21:28 +03:00
Wolfsblvt df27574247 Fix: Remove unused ComfyUI RunPod API key input mapping (#5432) 2026-04-09 22:20:34 +03:00
Tony Gies 700fc05411 feat: add Cloudflare Workers AI provider (#5385)
* feat: add Cloudflare Workers AI provider

Adds support for Cloudflare Workers AI using its OpenAI-compatible API.

Workers AI-specific stuff includes:
- Model list fetching and capabilities detection
- Tokenizer auto-detection for typical hosted model families
- Streaming not supported when using structured output

Closes #5305

* Make the entire header clickable

* Add missing samplers

* Fix non-streaming reasoning parsing

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-06 00:24:47 +03:00
Cohee c78f978ede fix: conditionally include secrets in user data backup (#5360)
* fix: conditionally include secrets in user data backup

* feat: add full data backup toggle

* 418 -> 403
I'm not a teapot

* Distinguish fails from disabled
2026-03-28 01:52:03 +02:00
Cohee ae5c65c3cf Baka-proofing OpenRouter OAuth flow 2026-03-09 20:46:46 +02:00
Crush0 eaa6a00e97 Volcengine tts (#5003)
* feat(tts): Add support for Volcengine TTS provider

* refactor: Remove the redundant comments in the Volcengine TTS-related code.

* fix(volcengine): Fix the audio data processing logic in the voice generation interface

* feat(tts): Enhance Volcengine TTS functionality and improve error handling

- Return more detailed error information when generating voice fails
- Add multiple preset voice options and support custom voice management
- Reconstruct the audio stream processing logic to enhance reliability
- Improve the UI interface, adding a voice selection dropdown menu and operation buttons

* refactor(tts): Optimize the code structure and error handling of the Volcengine TTS provider
- Remove the unused "voices" array and "model" parameter
- Improve the text processing logic, eliminating unnecessary separators
- Standardize the error handling logic, simplifying the status code checks
- Fix the DOM operation method, using "createElement" instead of string concatenation
- Ensure the existence check of the "customVoices" array

* Fix: Change the Content-Type of the audio response to audio/mpeg.

* Clean-up

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-01-26 20:45:38 +02:00
Cohee 5a7875ba28 Update Pollinations API (#5060)
* Upgrade Pollinations API
Done: text, caption
To do: TTS, image
Fixes #5020

* Update Pollinations TTS to new API

* Update Pollinations API for images
2026-01-26 20:31:13 +02:00
Cohee 1c6d5da1b5 Cut secret input UI messages 2026-01-07 00:26:36 +02:00
9nbf7c4q6b-lgtm 3098c4c5bf Comfyui serverless runpod image generation (#4891)
* Add comfyrunpod generation endpoints.

Get a bunch of settings added.

Probably get runpod api secret stored properly.

sending to runpod.

Correct workflow wrapping for runpod.

* Reuse comfyui workflow setting block for runpod.

* Update API key url to point to runpod settings

* Remove debug print.

* Combine normal and runpod comfyui generation functions

* Remove unused server endpoints for runpod.

* Remove debug prints from server.

* Remove redundant switch case.

* Check for url to see if image generation is possible for comfy and comfy runpod.

* lint

* Correct/update doc comments.

* Make runpod serverless a sub-type under comfyui source in the UI.

* Set comfy_type in stable-diffusion defaultSettings

* Allow loading comfy workflows even if url isnt set yet.

* Change default runpod url to template example

* Rename runpod api key to comfy_runpod

* Handle default switches separately from standard now that default setting is ensured.

* Update runpod api key name on server.

* Move example runpod url to placeholder.

* lint

* Remove incorrect comment.

* Hide toasts remote models toasts

* React to key updates

* Add type annotation for data and improve workflow handling in generate endpoint

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-12-24 23:37:57 +02:00
Cohee c75df956c5 Refactor ElevenLabs TTS API key handling (#4906)
* Refactor ElevenLabs TTS API key handling #4483

* Remove unused connection button and related event handler from ElevenLabs TTS provider

* Add ElevenLabs STT endpoint
2025-12-20 18:37:59 +02:00
Cohee f26a672811 Omit content type in POST request if no body 2025-12-07 23:26:47 +02:00
Ben 55a07d445d Chutes integration (#4844)
* Chutes integration

* Fix eslint

* Fix key saving

* Fix logo coloration

* Fix tool checks

* Unhide image inlining controls

* Fix order of options

* Fix type use in TTS extension script

* Add Chutes as a vector storage source

* Change log levels to debug

* Fix streamed reasoning parsing

* Skip remote models update

* TTS: Fix API key highlight

* Sort image models A-Z

* TTS: Fixes

* Remove unused SD endpoint

* Skip setting context size if models list is not yet loaded

* remove chutes quota / balance

* Fix: streamed tool calling

* Hide reasoning effort control

* Add image request debug log

* Fix: scroll down on media load in extensions

* Unhide some samplers

* Bring back reasoning effort

* This code will never execute

* Reformat else if cases

* Add stop strings to request

* Remove conditional from reasoning_effort body param

* Preserve original pricing fields

* Unhide logit bias setting

* Pass repetition penalty and logit bias to backend

* Swap llama tokenizer for llama3

* Pass min_p, remove supported_sampling_parameters checks

* Enable logprobs

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-12-01 00:17:49 +02:00
QiyuanChen 5c974bd148 feat: add siliconflow chat provider (#4764)
* feat: add siliconflow chat provider

* fix: remove siliconflow seed handling

* fix: enable SiliconFlow image inlining from shared vision list

* fix: handle SiliconFlow model context limits and sizing

* fix: drop SiliconFlow reasoning effort handling since controls are hidden

* fix: parse SiliconFlow reasoning in streaming and non-streaming

* fix: add missing comma in supported models list

* Remove seed from HTML template

* Combine streamed reasoning parsing blocks

* Update logo image

* Unhide image inlining controls

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-11-19 22:10:29 +02:00
Cohee 4add4f0090 Add official GLM API as CC provider (#4678)
* Add UI elements

* Add support for model configuration

* fix: update API request parameters for improved handling

* Add logo img

* Fix tool calling with negative index

* Include tool calls into 'last in context' calculation

* feat: add support for captioning
2025-10-21 22:37:27 +03:00
Cohee 1d279e500e Allow saving empty secrets via secret manager and slash command (#4580)
* Allow saving empty secrets via secret manager and slash command
Closes #4577

* Fix logic on cancel

* Fix /secrets-read with empty secret value
2025-10-02 21:23:42 +03:00
nfuller286 1147507d06 feat: Add Azure OpenAI chat completions provider (#4456)
* feat: Add Azure OpenAI chat completions provider

This commit introduces comprehensive support for integrating Azure OpenAI as a new chat completion source within SillyTavern. The implementation specifically navigates Azure's reliance on deployment names, differing from standard model selection.

Includes:

- **New Feat / UI:** Dedicated settings in `public/index.html` for Azure parameters (Base URL, Deployment Name, API Version, API Key) and a new `public/img/azure_openai.svg` icon.
- **Frontend Logic (`public/scripts/openai.js`):** Manages Azure OpenAI settings and dynamic URL generation. The 'Connect' button triggers a `GET /models` endpoint call solely for API configuration validation (key, URL, version). Upon successful validation, a subsequent `POST` request is made to the AI, and the active model is extracted from its response payload, then populated for UI display (no direct user model selection).
- **Backend Logic (`src/endpoints/backends/chat-completions.js`):** Implements `sendAzureOpenAIRequest` to proxy requests, handling Azure’s unique authentication and URL structures. Enhanced the `/status` endpoint for Azure-specific validation.
- **Secret Management:** Secure handling of Azure OpenAI API keys in `public/scripts/secrets.js` and `src/endpoints/secrets.js`.
- **Autoconnect:** `public/scripts/RossAscends-mods.js` modified to enable automatic connection for Azure OpenAI if an API key is present.

Impact:
- Users can now connect to and utilize Azure OpenAI services.
- Requires new configuration details in the UI.
- Enhances API routing and validation with Azure-specific behavior.
- Navigates model handling: model name is *derived dynamically* from AI response, not directly selected, aligning with internal SillyTavern structure.

* fixed the html issues, openai.ujs and secrets.js

	modified:   public/index.html#
    modified:   public/scripts/openai.js
	modified:   public/scripts/secrets.js

* Extends Azure OpenAI with advanced capabilities

Enables advanced features such as function calling, image inlining, and model reasoning in the UI for Azure OpenAI.

Refactors the backend to support structured output (JSON mode), native thinking, and reasoning effort for compatible Azure OpenAI models. Adds support for logprobs, multiple responses (`n`), and seed, aligning with standard OpenAI behavior.

Improves request handling with a retry mechanism for rate limits and more robust error reporting. Ensures correct parameter handling for model-specific features and conflicts, such as when native thinking is enabled. Optimizes the Azure OpenAI status probe for efficiency.
	modified:   public/index.html
	modified:   public/scripts/openai.js
	modified:   src/endpoints/backends/chat-completions.js

* PR fixes
Simplification
Removed reasoning logic from backend
	modified:   src/endpoints/backends/chat-completions.js

	modified:   src/endpoints/backends/chat-completions.js

* Fix PR comments
Removed the front end compiled url UI element and related.
Misc simplifications
	modified:   public/index.html
	modified:   public/scripts/openai.js
	modified:   src/endpoints/backends/chat-completions.js

* Fixed accidental api temporary disabled
	modified:   public/index.html

* Don't transfer status code verbatim

* Fix formatting

* Enable tool calling

* Fix logo coloration

* Move model arrays to shared constants

* Fix capitalization

* Remove obsolete comment

* Improve response schema parameter format

* Fix tokenizer model selection

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-09-10 11:44:30 +03:00
Ngo Dinh Gia Bao 8687bb99f3 Add Electron Hub as Chat Completions Provider (#4458)
* fixed merge conflicts

* Supported max tokens + fixed wrong image model mapping

* fixed merge conflicts

* fixed merge conflicts

* updated the logic

* updated the logic

* replaced hard coded reasoning_effort mode list with a dynamic function

* replaced hard coded reasoning_effort model list with a dynamic function

* Fix eslint

* Adjust reasoning effort logic

* Code clean-up

* Add logo

* Add inline image quality

* Fix multimodal models list

* Fix seed not passed

* Add "detail" error parser

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-09-04 21:25:31 +03:00
TensorNull 41c74fd142 Add CometAPI as a model provider in "Chat Completion" (#4402)
* feat: Add support for CometAPI, including API key management and model selection features.

* Some code fixes

* Fix loading model from presets

* Add logo image

* Enable tool calling, reasoning effort, reasoning display, structured generation

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-08-22 20:30:42 +03:00
ershang-fireworks e9be0f1c64 Add Fireworks AI Provider Support (#4374)
* add fireworks provider

* fix

* add context length

* Fireworks fixes

* Add logo image

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-08-14 20:52:46 +03:00
Cohee 0e38bfbf05 Feat/moonshot api (#4330)
* moonshot

* Partial mode + JSON schema

* Add logo image

* Limit max temp to 1

* Add to captioning extension
2025-07-31 00:01:04 +03:00
Cohee 086f873f2f Deprecate 01.ai chat completion source (#4327) 2025-07-28 21:29:01 +03:00
An5w1r c283025b15 feat: add tts provider MiniMax (#4309)
* feat: add tts provider MiniMax

* fix: address code review feedback from @Cohee1207

- Moved inline styles to CSS classes in minimax.js
- Removed unused MINIMAX API key from secrets.js
- Removed static headers from debug logs
- Changed default API host to international endpoint
- Sorted TTS providers alphabetically in index.js

* feat: improve error handling and add language-specific test sentences based on selected voice

* fix: if no language mapping to MiniMax Format should use "auto"

* fix: move this minimax-tts.css under /public/scripts/extensions/tts/

* refactor: move minimax api communication to Node backend

* chore: unify import style for minimax router

* Move css into subfolder

* More secure secret key handling

* Better UI layout

* Finish secrets update

* Replace with a normal import

* This block shouldn't be here

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-07-27 15:56:26 +03:00
Cohee d641cbecc4 Remove Scale Spellbook from CC sources (#4293) 2025-07-24 22:02:45 +03:00
Cohee d91c6c28cb Translate: Update API key management 2025-06-28 15:32:29 +03:00
Cohee 0f73e361df Remove nomicai from secrets input map 2025-06-26 20:53:36 +03:00
Cohee ec428fd82f Export resolveSecretKey 2025-06-17 23:37:39 +03:00
Dmitry fece612f09 Merge pull request #4135 from D1m7asis/release
feat: Added AI/ML API Provider Support
2025-06-13 20:59:18 +03:00
Cohee 8d2b9d2dab Secrets manager (#4131)
* Secret manager (now for real)

* Refactor secret manager dialog

* Add error handling to secrets migration

* Adjust default value

* Add secret-id slash command

* Add secret management slash commands

* Improve type definitions

* Improve compatibility of UUID generator

* Add copy buttons to manager view

* Improve compatibility with Vertex AI service account
- Changed to input since textarea can't be used with datalist
- Unblock regular key placeholder
- Save email as a key label
- Interrupt validation if the input is a UUID (autocompleted)

* Add optional label input for secret values in key manager dialog

* Update masking rules

* /secret-id: make the arg "required" (it's not)
2025-06-11 21:26:19 +03:00
Cohee 134ade0951 secret.js: update for new popup 2025-06-02 23:49:56 +03:00
Cohee 4e75f2fa4d Change no neutral warning text to align with other inputs 2025-05-28 20:45:35 +03:00
InterestingDarkness 75e3f599e6 Derive Vertex AI Project ID from Service Account JSON
This commit refactors the Vertex AI integration to automatically derive the
Project ID from the provided Service Account JSON. This simplifies the
configuration process for users in "Full" (service account) authentication
mode by removing the need to specify the Project ID separately.
2025-05-28 21:57:17 +08:00
InterestingDarkness 1e2bec1751 Removed direct references to 'vertexai_project_id' from openai.js and related files, ensuring it is now managed through backend secrets for enhanced security. 2025-05-27 21:25:53 +08:00
InterestingDarkness 5656c7950d Implement Vertex AI authentication modes and configuration in UI
- Updated index.html to include options for Vertex AI authentication modes (Express and Full).
- Enhanced openai.js to manage Vertex AI settings, including project ID, region, and service account JSON.
- Added validation and handling for service account JSON in the backend.
- Modified API request handling in google.js to support both authentication modes for Vertex AI.
- Updated secrets.js to include a key for storing Vertex AI service account JSON.
- Improved error handling and user feedback for authentication issues.
2025-05-26 22:09:59 +08:00
NijikaMyWaifu 157315cd68 Add Vertex AI express mode support (#3977)
* Add Vertex AI express mode support
Split Google AI Studio and Vertex AI

* Add support for Vertex AI, including updating default models and related settings, modifying frontend HTML to include Vertex AI options, and adjusting request processing logic in the backend API.

* Log API name in the console

* Merge sysprompt toggles back

* Use Gemma tokenizers for Vertex and LearnLM

* AI Studio parity updates

* Add link to express mode doc. Also technically it's not a form

* Split title

* Use array includes

* Add support for Google Vertex AI in image captioning feature

* Specify caption API name, add to compression list

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-05-22 20:10:53 +03:00
Cohee 1c52099ed6 Add xAI as chat completion source 2025-04-10 22:59:10 +03:00
equal-l2 2a31f6af2d Remove Block Entropy references
Block Entropy shut down their service at the end of 2024.
2025-03-28 00:47:30 +09:00
Cohee 4ced7abaa3 OpenRouter: Fix OAuth flow with enabled accounts 2025-03-24 20:22:59 +02:00
Yokayo 40c3674da1 Update tl 2025-03-17 16:09:36 +07:00
Kristan Schlikow 6e0ed8552f Add support for FAL.AI as image gen provider 2025-02-13 19:34:34 +01:00
Cohee 5e540f4f97 Websearch: add Serper API endpoint 2025-02-08 22:28:12 +02:00
Cohee 4c7d160d41 DeepSeek
Closes #3233
2024-12-29 20:38:13 +02:00
Cohee 3167019faf Add generic text completion API type (100% OAI compatible) 2024-12-13 01:12:10 +02:00
Cohee 67869364a5 ImageGen: add BFL API for image generation 2024-11-19 00:30:28 +02:00
Cohee f4ef324203 Merge pull request #3024 from dylan1951/add-nano-gpt-provider
Add NanoGPT chat completions provider
2024-10-31 19:30:24 +02:00
Cohee f5bdb52c25 Merge branch 'staging' into webpack 2024-10-26 19:11:29 +03:00
dylan 0882fb2d15 Add NanoGPT as chat completions provider 2024-10-26 16:51:39 +13:00
Cohee 0f320dd362 WebSearch: Add endpoint for Tavily 2024-10-23 23:38:17 +03:00
Cohee 3387fe4bd6 unvendor: Replace DOMPurify 2024-10-16 23:11:13 +03:00