68 Commits
Author SHA1 Message Date
Benson WongandGitHub 6ffd67fdf2 internal/reference: add indexed docs and /api/tools endpoints (#1054)
Validate JSON Schema / validate-schema (push) Successful in 37s
Build Containers / build-and-push (cpu) (push) Failing after 39s
Build Containers / build-and-push (cuda) (push) Failing after 30s
Build Containers / build-and-push (cuda13) (push) Failing after 29s
Build Containers / build-and-push (intel) (push) Failing after 30s
Build Containers / build-and-push (musa) (push) Failing after 29s
Build Containers / build-and-push (rocm) (push) Failing after 40s
Build Containers / build-and-push (vulkan) (push) Failing after 32s
Build Containers / delete-untagged-containers (push) Skipped
Linux CI / run-tests (push) Failing after 2m33s
UI Tests / run-tests (push) Successful in 43s
Windows CI / run-tests (push) Canceled after 0s
Add an Docs agent to the playground that can help the user with more
advanced configuration.

- add mcp 2026-07-28 (stateless mcp) framework 
- add MCP tools for doc search and config search
- add initial set of guides for key topics
- add Docs to the Playground
- removed out of data documentation and plans
2026-08-29 23:43:09 -07:00
32c3d66cd3 config,server: add startup profile hook (#1053)
Validate JSON Schema / validate-schema (push) Successful in 45s
Linux CI / run-tests (push) Failing after 2m34s
Windows CI / run-tests (push) Canceled after 0s
An optional `hooks.on_startup.profile` setting for activating a profile
on startup and after a configuration reload:

```yaml
profiles:
  coding:
    pins:
      llm-code: "gpt-oss-120b"

hooks:
  on_startup:
    profile: "coding"
```

Another attempt to close #992 after unsuccessful #993 ;)

Co-authored-by: David Soušek <david.sousek@intelogy.co.uk>
2026-08-29 11:26:54 -07:00
Bernardo Gallegos-VallejoandGitHub 4cd0247afa config: accept video as an input and output modality (#1048)
Validate JSON Schema / validate-schema (push) Successful in 39s
Linux CI / run-tests (push) Failing after 2m20s
Windows CI / run-tests (push) Canceled after 0s
capabilities.in and capabilities.out accepted text, audio and image but not video, so a multimodal model that takes video input could not declare it and /v1/models reported it as image-only.

video is added to the shared validModalities set, which makes it valid on both in and out; tests assert both sides explicitly so that stays a decision rather than a side effect of the two lists sharing one map.

Updated together so no layer disagrees: the validModalities map, both validation error messages, both config-schema.json enums, and the valid-values comments in config.example.yaml.

Fixes: #1014
2026-08-23 17:35:20 -07:00
Benson WongandGitHub f94c94ac61 various: improvements to code layout and naming (#1003)
Validate JSON Schema / validate-schema (push) Successful in 46s
UI Tests / run-tests (push) Successful in 52s
Linux CI / run-tests (push) Successful in 4m11s
Windows CI / run-tests (push) Canceled after 0s
- rename model.workarounds to model.compat
- rename internal/shared to internal/swaputil, a better package name
2026-08-09 23:21:10 -07:00
Benson WongandGitHub 249797faad internal/server: add ComfyUI compatibility endpoint (#1002)
Add a dedicated /comfyui/ passthrough backed by the reserved
comfyui_auto local model.

- preserve escaped upstream paths such as encoded workflow separators
- allow only the root path to start an unloaded ComfyUI model
- enforce a minimum concurrency limit of 50 for the reserved model
- add example upstream.ignorePaths to prevent unintentional swaps by
ComfyUI
- add model.workarounds.ignoreWebsockets so ComfyUI does not block
swapping

fixes: #1001
fixes: #1000
2026-08-09 22:01:42 -07:00
Benson WongandGitHub 4c50064e3d internal/config: relax matrix model reference constraints (#957)
Linux CI / run-tests (push) Failing after 2m42s
Validate JSON Schema / validate-schema (push) Failing after 14m55s
Windows CI / run-tests (push) Has been cancelled
- increase matrix.var id size to 32 characters and allow - and .
- model IDs can be used in matrix sets and evict_costs

fixes: #699
closes: #715
2026-07-25 21:52:35 -07:00
Benson WongandGitHub fa607fe04e internal/config: refactor macro expansion (#955)
Resolve configuration macros against an untyped YAML representation
before decoding the typed Config. This materializes YAML anchors and
preserves scalar types without maintaining field-specific replacement
paths.

- apply environment, global, and model macros in their defined scopes
- centralize MODEL_ID, PORT, PID, key, and unknown-macro handling
- remove the capability-specific raw decoder and replacement loops
- document macro ordering, scope, and runtime behavior
- add coverage for anchors, scope isolation, validation, and runtime
macros

fixes #919
2026-07-25 21:46:29 -07:00
Benson WongandGitHub 7aa7f52074 internal/server,ui-svelte: add peer model namespaces (#950)
UI Tests / run-tests (push) Failing after 13m10s
Linux CI / run-tests (push) Failing after 14m54s
Validate JSON Schema / validate-schema (push) Failing after 14m56s
Windows CI / run-tests (push) Has been cancelled
Address peer models by fully qualified names across routing, selectors,
model listings, and the UI.

- support fully qualified peer/model routing names
- support peer models in selector spillover targets
- show peer models in Playground model pickers

fixes #944
2026-07-25 00:03:25 -07:00
Benson WongandGitHub 8b61e3dcc9 internal/server: implement selectors (#942)
Linux CI / run-tests (push) Failing after 13m8s
Validate JSON Schema / validate-schema (push) Failing after 14m56s
UI Tests / run-tests (push) Failing after 14m25s
Windows CI / run-tests (push) Has been cancelled
Implement selectors with pin, warm and spillover strategies.

Fixes: #719, #933 
Closes: #902
2026-07-21 20:54:55 -07:00
Benson WongandGitHub 3e87c022c4 internal/server: add support for profiles (#935)
Add configurable model ID profiles that can be switched without
restarting.

- rewrite request and upstream model IDs through active profile pins
- expose profile selection through API, SSE, and UI
- validate and document profile configuration

Updates #933
Supercedes: #774
2026-07-19 10:14:44 -07:00
Benson WongandGitHub 6b5320de5d internal/server: expand inflight request details (#923)
UI Tests / run-tests (push) Failing after 13m13s
Linux CI / run-tests (push) Failing after 14m53s
Validate JSON Schema / validate-schema (push) Failing after 14m55s
Windows CI / run-tests (push) Has been cancelled
Track request and streamed response metadata for active model requests.

- publish keyed updates through a non-blocking recoverable outbox
- add compact configurable activity columns and clock-safe elapsed time
- tag playground requests with a page-scoped session ID

Fixes #912
2026-07-14 21:01:54 -04:00
alvin-000andGitHub cd22a8c010 Add configurable UnloadTimeout variable (#904)
Replace the fixed 10 second shutdown timeout with a configurable one.
2026-07-14 20:35:07 -04:00
Benson WongandGitHub 6291bb8869 internal/store: persist activity metrics to sqlite (#898)
Store activity metrics in SQLite and use the store as the source for
activity APIs.

- add SQLite-backed activity store with migrations and activity stats
queries
- add new store.path configuration option
- add activity pagination and stats API endpoints
- update the activity UI to fetch paginated rows and server-side stats
- add optional store.path configuration for durable activity history

Fixes #310, #729
2026-07-06 21:45:25 -07:00
Benson WongandGitHub 316ad63f76 config,server: add upstream.ignorePaths (#869)
UI Tests / run-tests (push) Failing after 13m15s
Linux CI / run-tests (push) Failing after 14m54s
Validate JSON Schema / validate-schema (push) Failing after 14m56s
Windows CI / run-tests (push) Has been cancelled
Add upstream.ignorePaths config to prevent model swaps for static-asset
requests made through the /upstream/<model>/<path> passthrough endpoint.

- add UpstreamConfig with compiled *regexp.Regexp slice; invalid regex
returns an error at load time
- apply a default pattern matching common static-asset suffixes
(.js/.json/.css/.png/.gif/.jpg/.jpeg/.ico/.txt) when unset
- in handleUpstream, return 409 Conflict when a path matches and the
local model is not already loaded; peer and already-loaded models fall
through to normal dispatch
- update config-schema.json and config.example.yaml

Updates discussion: #868
2026-06-21 13:49:53 -07:00
Benson WongandGitHub 92b90447e8 Model capabilities 734 (#842)
UI Tests / run-tests (push) Failing after 13m13s
Linux CI / run-tests (push) Failing after 14m55s
Validate JSON Schema / validate-schema (push) Failing after 14m57s
Windows CI / run-tests (push) Has been cancelled
internal/config,server: implement model capabilities

- define the capabilities of a model using a simple config block on the
model
- v1/models renders out capabilities to be compatible with openrouter,
huggingface chat, and mistral formats for broader compatibility
- add support for capabilities in UI

Fixes #734
2026-06-13 23:23:19 -07:00
Benson WongandGitHub 9b3a33d7b9 Implement new scheduler (#823)
Linux CI / run-tests (push) Failing after 14m56s
Validate JSON Schema / validate-schema (push) Failing after 14m58s
Windows CI / run-tests (push) Has been cancelled
- introduce internal/router/scheduler to decouple routing, swapping and
queuing into interface contracts.
- introduce a new `routing` configuration section that supersedes
`matrix` and `group` while maintaining backwards compatibility
- add FIFO scheduler with prioritized queuing 
- add internal/router/design.md as developer documentation on
implementing new schedulers and routers

Fixes #797
2026-06-10 20:34:25 -07:00
Benson Wong 26bb17e57e config.example.yaml: Improve matrix vs groups info
Validate JSON Schema / validate-schema (push) Successful in 11s
UI Tests / run-tests (push) Successful in 50s
For some use cases groups are simpler to use. Note this in the
documentation that it is still fully supported.
2026-05-17 15:59:25 -07:00
Benson WongandGitHub a4b91e08cf Changes and fixes before the release (docs/small tweaks) (#750)
- update README.md with new docker instructions
- update docs/configuration.md
- update .github/workflows to have pinned action versions
- gofmt events package
- fix small bugs in CI scripts
- reduce config options for internal/perf/monitor and config. A ring buffer is used to keep 1hr of entries at max 5s granularity. For long term stats use prometheus monitoring on /metrics

Fixes #744
2026-05-13 21:18:19 -07:00
Benson WongandGitHub 7e3e94a08a proxy,ui: add performance monitoring with Prometheus metrics (#743)
Validate JSON Schema / validate-schema (push) Successful in 25s
UI Tests / run-tests (push) Successful in 1m16s
Linux CI / run-tests (push) Successful in 3m36s
Windows CI / run-tests (push) Has been cancelled
Add a comprehensive performance monitoring system that collects CPU, memory, swap, load average, network IO, and GPU stats. Provides both a REST API for the UI and a Prometheus /metrics endpoint.

Backend changes:
- New internal/perf package with configurable interval-based stats collection
- GPU monitoring via LACT (Unix socket) and nvidia-smi fallback on Linux
- Ring buffer (internal/ring) for time-series stat storage
- Prometheus /metrics endpoint with all system and GPU metrics
- Moved LogMonitor to internal/logmon package
- New PerformanceConfig for hot-reloadable monitoring settings
- REST /api/performance endpoint replacing SSE streaming

UI changes:
- New Performance page with real-time charts for CPU, memory, GPU, and network
- Reusable PerformanceChart component
- LLAMA_SWAP_URL environment variable support
- Improved capture dialog display

Other:
- Example Grafana dashboard for Prometheus metrics
- monitor-test standalone binary
- Config schema and example updates

fixes #596
2026-05-09 13:29:22 -07:00
Benson WongandGitHub 35193f82f1 proxy: add swap matrix with solver-based model swapping (#646)
Add a new swap matrix to supersede groups for running concurrent models.
The matrix uses a solver that picks the lowest cost evictions to make a
requested model available. This simple approach along with a very basic
DSL grammar can enable very complex swapping scenarios.

- add DSL parser for set expressions with & (AND), | (OR), (), +ref
- add MatrixConfig structs, validation, and topological sort for +ref
- add MatrixSolver with cost-minimizing swap decisions
- add Matrix runtime integrating solver with Process lifecycle
- integrate matrix into ProxyManager with if-branches at all endpoints
- update config.example.yaml and config-schema.json with matrix schema
- config enforces groups XOR matrix (cannot use both)

fixes #643
2026-04-14 21:55:30 -07:00
Benson WongandGitHub a9d840ffd7 proxy,proxy/config: restore timeouts to pre PR 619 (#648)
Build Containers / build-and-push (cpu) (push) Failing after 53s
Build Containers / build-and-push (cuda) (push) Failing after 57s
Build Containers / build-and-push (cuda13) (push) Failing after 11s
Build Containers / build-and-push (intel) (push) Failing after 11s
Build Containers / build-and-push (musa) (push) Failing after 11s
Build Containers / build-and-push (vulkan) (push) Failing after 29s
Build Containers / build-and-push (rocm) (push) Failing after 49s
goreleaser / goreleaser (push) Failing after 13s
Build Containers / delete-untagged-containers (push) Has been skipped
goreleaser / trigger-tap-update (push) Has been skipped
Reset the default ResponseHeader timeout to 0 (no timeout) which was set
to 60 seconds in PR #619.

Fixes #647
2026-04-11 20:42:13 -07:00
Ron MandGitHub a37b4866d8 proxy: add configurable HTTP timeouts for models and peers (#619)
Add configurable HTTP timeout settings to both models and peers to support installations that requires longer timeouts than the current hardcoded defaults.

Closes #618
2026-04-06 19:30:27 +08:00
Benson WongandGitHub cc77139ff8 proxy,proxy/config: add global TTL feature (#554)
Add a new configuration parameter globalTTL that all models will
inherit. The default value is 0 which matches the currently
functionality to never automatically unload a model.

The model.ttl's default has changed to -1, which means use the global
TTL value. Any model.ttl >=0 is now value with 0 meaning never unload.
This allows a model to override a globalTTL > 0 and be configured to
never unload.

Fixes #459
Closes #512
2026-03-01 21:02:12 -08:00
Benson WongandGitHub 19fb5f35e9 proxy: implement setParamsByID filter (#535)
Add setParamsByID filter that applies different request parameters based
on the requested model ID, enabling per-alias behaviour for a single
loaded model.

- add SetParamsByID field to Filters struct and SanitizedSetParamsByID
method
- substitute ${MODEL_ID} and other macros in setParamsByID keys and
values
- validate no unknown macros remain in keys or values after substitution
- apply setParamsByID in proxyInferenceHandler after setParams (can
override it)
- update config-schema.json with setParamsByID definition
- update UI to show aliases and make them selectable in the Playground

closes #534
2026-02-19 22:21:10 -08:00
Benson WongandGitHub b5fde8eb6d proxy,ui-svelte: add request/response capturing (#508)
Add saving request and response headers and bodies that go through
llama-swap in memory.

- captureBuffer added to configuration. Captures are enabled by default.
- 5MB of memory is allocated for req/response captures in a ring buffer.
Setting captureBuffer to 0 will disable captures.
- UI elements to view captured data added to Activity page. Includes
some
QOL features like json formatting and recombining SSE chat streams
- capture saving is done at the byte level and has minimal impact on
llama-swap performance

Fixes #464 
Ref #503
2026-02-07 15:40:01 -08:00
Benson WongandGitHub 75fced579e config: support macros in peer apiKey and filters (#469)
* config: support environment variable macros in peer apiKeys

Add ${env.VAR_NAME} substitution for peer apiKey fields, consistent
with existing env macro support for model fields and global apiKeys.

- Add env macro substitution for peers.{name}.apiKey in LoadConfigFromReader
- Add tests for peer apiKey env substitution
- Update config.example.yaml to show env macro usage

* config: support macros in peer apiKey and filters

Extend macro substitution to peer configuration fields:
- peers.{name}.apiKey supports both global macros and env macros
- peers.{name}.filters.stripParams supports both macro types
- peers.{name}.filters.setParams supports both macro types

Also renamed validateMetadataForUnknownMacros to validateNestedForUnknownMacros
for reuse across model metadata and peer filters validation.
2026-01-16 23:10:50 -08:00
Benson Wong b73f367f22 config-schema.json,config.example.yaml: Update examples and schema 2026-01-16 22:43:25 -08:00
Benson WongandGitHub 124007cc98 config: add environment variable macros (#466)
* config: add environment variable macros

Add support for ${env.VAR_NAME} syntax to pull values from system
environment variables during config loading.

- env macros processed before regular macros (allows macros to reference env vars)
- works in cmd, cmdStop, proxy, checkEndpoint, filters.stripParams, metadata
- returns error if env var is not set
- add comprehensive tests

fixes #462

* docs: add env macro example to config.example.yaml
2026-01-16 22:25:20 -08:00
Benson WongandGitHub eb5bfff0b0 proxy: unify filtering for local models and peers
This unifies the filtering capabilities for models and peers

- stripParams: removes params in the request
- setParams: sets params in the request

fixes #453
2026-01-15 18:59:43 -08:00
Benson WongandGitHub 22e098ac8b Add Peer Model Support (#438)
This PR allows a single llama-swap to be the central proxy for models served by other inference servers. The peer servers can be another llama-swap or any API that supports the /v1/* inference endpoint.

Updates: #433, #299
Closes: #296
2025-12-27 20:18:06 -08:00
Benson WongandGitHub 53b32f3601 proxy: add API key support (#436)
Add configuration support for api keys that are enforced by llama-swap. Keys are stripped before sending them to upstream servers. 

Updates: #433, #50 and #251
2025-12-23 23:39:33 -08:00
Benson WongandGitHub 565c44766d config,proxy: add new configuration logToStdout (#432)
The new logToStdout option controls what is logged to stdout. The
default has been changed to just the proxy logs, which contain swap and
http request logs.

There are four supported settings: none, proxy, upstream, both. The
"both" setting is the legacy setting where everything was spewed to
stdout.
2025-12-21 22:23:31 -08:00
Ryan SteedandGitHub 3acace810f proxy: add configurable logging timestamp format (#401)
introduces a new configuration option logTimeFormat that allows customizing the timestamp in log messages using golang's built in time format constants. The default remains no timestamp.
2025-11-16 10:21:59 -08:00
Ryan SteedandGitHub 554d29e87d feat: enhance model listing to include aliases (#400)
introduce includeAliasesInList as a new configuration setting (default false) that includes aliases in v1/models

Fixes #399
2025-11-15 14:35:26 -08:00
Benson Wong 38738525c9 config.example.yaml: add modeline for schema validation 2025-11-08 15:08:55 -08:00
Benson WongandGitHub a89b803d4a Stream loading state when swapping models (#371)
Swapping models can take a long time and leave a lot of silence while the model is loading. Rather than silently load the model in the background, this PR allows llama-swap to send status updates in the reasoning_content of a streaming chat response.

Fixes: #366
2025-10-29 00:09:39 -07:00
Benson WongandGitHub 00b738cd0f Add Macro-In-Macro Support (#337)
Add full macro-in-macro support so any user defined macro can contain another one as long as it was previously declared in the configuration file.

Fixes #336
Supercedes #335
2025-10-06 22:57:15 -07:00
Benson WongandGitHub 70930e4e91 proxy: add support for user defined metadata in model configs (#333)
Changes: 

- add Metadata key to ModelConfig
- include metadata in /v1/models under meta.llamaswap key
- add recursive macro substitution into Metadata
- change macros at global and model level to be any scalar type

Note: 

This is the first mostly AI generated change to llama-swap. See #333 for notes about the workflow and approach to AI going forward.
2025-10-04 19:56:41 -07:00
Benson WongandGitHub 1f6179110c proxy/config: add model level macros (#330)
* proxy/config: add model level macros

Add macros to model configuration. Model macros override macros that are
defined at the global configuration level. They follow the same naming
and value rules as the global macros.

* proxy/config: fix bug with macro reserved name checking

The PORT reserved name was not properly checked

* proxy/config: add tests around model.filters.stripParams

- add check that model.filters.stripParams has no invalid macros
- renamed strip_params to stripParams for camel case consistency
- add legacy code compatibility so  model.filters.strip_params continues to work

* proxy/config: add duplicate removal to model.filters.stripParams

* clean up some doc nits
2025-09-28 23:32:52 -07:00
Benson Wong a533aec736 small tweak to example config 2025-09-01 21:26:58 -07:00
Brett ProfittandGitHub 97b17fc47d Add ${MODEL_ID} macro (#226)
The automatic ${MODEL_ID} macro includes the name of the model and can be used in Cmd and CmdStop.
2025-09-01 21:21:37 -07:00
Benson Wong c55d0cc842 Add docs for model.concurrencyLimit #263 [skip ci] 2025-08-22 16:08:37 -07:00
Benson Wong 305e5a0031 improve example config [skip ci] 2025-08-17 09:19:04 -07:00
Benson WongandGitHub 5dc6b3e6d9 Add barebones but working implementation of model preload (#209, #235)
Add barebones but working implementation of model preload

* add config test for Preload hook
* improve TestProxyManager_StartupHooks
* docs for new hook configuration
* add a .dev to .gitignore
2025-08-14 10:27:28 -07:00
g2mtandGitHub 87dce5f8f6 Add metrics logging for chat completion requests (#195)
- Add token and performance metrics  for v1/chat/completions 
- Add Activity Page in UI
- Add /api/metrics endpoint

Contributed by @g2mt
2025-07-21 22:19:55 -07:00
Benson WongandGitHub c867a6c9a2 Add name and description to v1/models list (#179)
* Add support for name and description in v1/models list
* add configuration example for name and description
2025-06-30 23:02:44 -07:00
Benson WongandGitHub 4236cec03a Add Filters to Model Configuration (#174)
llama-swap can strip specific keys in JSON requests. This is useful for removing the ability for clients to set sampling parameters like temperature, top_k, top_p, etc.
2025-06-23 10:52:29 -07:00
Benson WongandGitHub 9a3c656738 New UI (#157, #164)
- Add a react UI to replace the plain HTML one. 
- Serve as a foundation for better GUI interactions
2025-06-16 16:45:19 -07:00
Benson Wong f9ee7156dc update configuration examples for multiline yaml commands #133 2025-05-16 11:45:39 -07:00
Benson Wong cb876c143b update example config 2025-05-12 10:20:18 -07:00