Skip to content

Commit c7071e7

Browse files
authoredFeb 18, 2025··
Document muxing filter rules (#87)
* Add muxing filter rules * Update changelog * Add conversation summary note
1 parent 38f8f04 commit c7071e7

15 files changed

+69
-23
lines changed
 

‎docs/about/changelog.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ Major features and changes are noted here. To review all updates, see the
1313

1414
Related: [Upgrade CodeGate](../how-to/install.md#upgrade-codegate)
1515

16+
- **Muxing filter rules** - 18 Feb, 2025\
17+
CodeGate v0.1.23 adds filter rules for model muxing, allowing you to define
18+
which model should be used for a given file type. See the
19+
[model muxing docs](../features/muxing.mdx) for more.
20+
1621
- **PII redaction:** - 10 Feb, 2025\
1722
Starting with v0.1.18, CodeGate now redacts personally identifiable
1823
information (PII) found in LLM prompts and context. See the
@@ -21,7 +26,7 @@ Related: [Upgrade CodeGate](../how-to/install.md#upgrade-codegate)
2126
- **Model muxing** - 7 Feb, 2025\
2227
With CodeGate v0.1.17 you can use the new `/v1/mux` endpoint to configure
2328
model selection based on your workspace! Learn more in the
24-
[model muxing guide](../features/muxing.md).
29+
[model muxing guide](../features/muxing.mdx).
2530

2631
- **OpenRouter endpoint** - 7 Feb, 2025\
2732
CodeGate v0.1.17 adds a dedicated `/openrouter` provider endpoint for

‎docs/features/muxing.md renamed to ‎docs/features/muxing.mdx

+49-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
---
22
title: Model muxing
3-
description: Configure a per-workspace LLM
3+
description: Pick the right LLM for the job
44
---
55

6+
import useBaseUrl from '@docusaurus/useBaseUrl';
7+
import ThemedImage from '@theme/ThemedImage';
8+
69
## Overview
710

811
_Model muxing_ (or multiplexing), allows you to configure your AI assistant once
@@ -11,12 +14,13 @@ and models without reconfiguring your development environment. This feature is
1114
especially useful when you're working on multiple projects or tasks that require
1215
different AI models.
1316

14-
For each CodeGate workspace, you can select the AI provider and model
15-
combination you want to use. Then, configure your AI coding tool to use the
17+
In each of your CodeGate workspaces, you can select the AI provider and model
18+
combinations to use, even dynamically switching the active model based on file
19+
types found in your prompt. Then, configure your AI coding tool to use the
1620
CodeGate muxing endpoint `http://localhost:8989/v1/mux` as an OpenAI-compatible
1721
API provider.
1822

19-
To change the model currently in use, simply switch your active CodeGate
23+
To change the model(s) currently in use, simply switch your active CodeGate
2024
workspace.
2125

2226
```mermaid
@@ -44,6 +48,9 @@ flowchart LR
4448
- You have a project that requires a specific model for a particular task, but
4549
you also need to switch between different models during the course of your
4650
work.
51+
- You're working in a monorepo with several different languages/file types and
52+
want to dynamically switch to an optimal model as you move between different
53+
parts of the codebase.
4754
- You want to experiment with different LLM providers and models without having
4855
to reconfigure your AI assistant/agent every time you switch.
4956
- Your AI coding assistant doesn't support a particular provider or model that
@@ -58,7 +65,7 @@ flowchart LR
5865
## Configure muxing
5966

6067
To use muxing with your AI coding assistant, you need to add one or more AI
61-
providers to CodeGate, then select the model you want to use on a workspace.
68+
providers to CodeGate, then select the model(s) you want to use on a workspace.
6269

6370
CodeGate supports the following LLM providers for muxing:
6471

@@ -93,13 +100,47 @@ For locally-hosted models, you must use `http://host.docker.internal` instead of
93100

94101
:::
95102

96-
### Select the model for a workspace
103+
### Configure workspace models
97104

98105
Open the settings of one of your [workspaces](./workspaces.mdx) from the
99-
Workspace selection menu or the
106+
workspace selection menu or the
100107
[Manage Workspaces](http://localhost:9090/workspaces) screen.
101108

102-
In the **Preferred Model** section, select the model to use with the workspace.
109+
In the **Model Muxing** section, select the default ("catch-all") model to use
110+
with the workspace.
111+
112+
To assign a different model based on filename, click **Add Filter**. In the
113+
**Filter by** column, enter a file name or extension string to match. This is a
114+
simple substring match, wildcards are not supported. For example, to match
115+
Python files, enter `.py`. Then select the model to use with that file type.
116+
117+
Filter rules are evaluated top-down. CodeGate selects the active model for a
118+
request using the first matching rule. If the prompt contains multiple files in
119+
context, the first rule that matches _any_ of the files is used. If no filter is
120+
matched, the catch-all rule applies.
121+
122+
<ThemedImage
123+
alt='An example showing several muxing rules for different file types'
124+
sources={{
125+
light: useBaseUrl('/img/features/muxing-rules-light.webp'),
126+
dark: useBaseUrl('/img/quickstart/muxing-rules-dark.webp'),
127+
}}
128+
title='Example muxing rules'
129+
width={'800px'}
130+
/>
131+
_An example showing several muxing rules for different file types_
132+
133+
Breaking down the above example:
134+
135+
- Markdown files (`.md`) use the gpt-4o-mini model from the OpenAI provider.
136+
- JavaScript and TypeScript files (`.js` and `.ts`, which also matches `.jsx`
137+
and `.tsx`) use anthropic/claude-3.5-sonnet via OpenRouter.
138+
- All other requests use Ollama.
139+
- A request containing both a JavaScript and Markdown file will match the `.md`
140+
rule first and use OpenAI.
141+
142+
You can validate which provider was used for a given request by checking the
143+
**conversation summary** in the CodeGate dashboard.
103144

104145
### Manage existing providers
105146

‎docs/features/workspaces.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Workspaces offer several key features:
2727
for different types of tasks. Choose from CodeGate's library of community
2828
prompts or create your own.
2929

30-
- [**Model muxing**](./muxing.md): Configure the LLM provider/model for each
30+
- [**Model muxing**](./muxing.mdx): Configure the LLM provider/model for each
3131
workspace, allowing you to configure your AI assistant/agent once and switch
3232
between different models on the fly. This is useful when working on multiple
3333
projects or tasks that require different AI models.
@@ -115,7 +115,7 @@ In the workspace list, open the menu (**...**) next to a workspace to
115115
**Activate**, **Edit**, or **Archive** the workspace.
116116

117117
**Edit** opens the workspace settings page. From here you can rename the
118-
workspace, select the LLM provider and model (see [Model muxing](./muxing.md)),
118+
workspace, select the LLM provider and model (see [Model muxing](./muxing.mdx)),
119119
set the custom prompt instructions, or archive the workspace.
120120

121121
**Archived** workspaces can be restored or permanently deleted from the

‎docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ efficiency, including:
4141
information
4242
- [Dependency risk awareness](./features/dependency-risk.md) to update the LLM's
4343
knowledge of malicious or deprecated open source packages
44-
- [Model muxing](./features/muxing.md) to quickly select the best LLM
44+
- [Model muxing](./features/muxing.mdx) to quickly select the best LLM
4545
provider/model for your current task
4646
- [Workspaces](./features/workspaces.mdx) to organize and customize your LLM
4747
interactions

‎docs/integrations/aider.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ CodeGate works with the following AI model providers through aider:
1717
- Hosted:
1818
- [OpenAI](https://openai.com/api/) and OpenAI-compatible APIs
1919

20-
You can also configure [CodeGate muxing](../features/muxing.md) to select your
20+
You can also configure [CodeGate muxing](../features/muxing.mdx) to select your
2121
provider and model using [workspaces](../features/workspaces.mdx).
2222

2323
:::note

‎docs/integrations/avante.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ server.
6565

6666
### Model muxing
6767

68-
To take advantage of CodeGate's [model muxing feature](../features/muxing.md),
68+
To take advantage of CodeGate's [model muxing feature](../features/muxing.mdx),
6969
use **avante.nvim**'s OpenAI provider with the following configuration:
7070

7171
```lua

‎docs/integrations/cline.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ CodeGate works with the following AI model providers through Cline:
2121
- [OpenAI](https://openai.com/api/) and compatible APIs
2222
- [OpenRouter](https://openrouter.ai/)
2323

24-
You can also configure [CodeGate muxing](../features/muxing.md) to select your
24+
You can also configure [CodeGate muxing](../features/muxing.mdx) to select your
2525
provider and model using [workspaces](../features/workspaces.mdx).
2626

2727
## Install the Cline extension

‎docs/integrations/continue.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ CodeGate works with the following AI model providers through Continue:
2525
- [OpenAI](https://openai.com/api/)
2626
- [OpenRouter](https://openrouter.ai/)
2727

28-
You can also configure [CodeGate muxing](../features/muxing.md) to select your
28+
You can also configure [CodeGate muxing](../features/muxing.mdx) to select your
2929
provider and model using [workspaces](../features/workspaces.mdx).
3030

3131
## Install the Continue plugin
@@ -129,7 +129,7 @@ to the pre-release version (v0.9.x) of the Continue extension.
129129

130130
:::
131131

132-
First, configure your [provider(s)](../features/muxing.md#add-a-provider) and
132+
First, configure your [provider(s)](../features/muxing.mdx#add-a-provider) and
133133
select a model for each of your
134134
[workspace(s)](../features/workspaces.mdx#manage-workspaces) in the CodeGate
135135
dashboard.

‎docs/integrations/kodu.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ take their project from idea to execution.
1414

1515
CodeGate supports OpenAI-compatible APIs and OpenRouter with Claude Coder.
1616

17-
You can also configure [CodeGate muxing](../features/muxing.md) to select your
17+
You can also configure [CodeGate muxing](../features/muxing.mdx) to select your
1818
provider and model using [workspaces](../features/workspaces.mdx).
1919

2020
## Install the Claude Coder extension

‎docs/integrations/open-interpreter.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LLMs run code locally through a ChatGPT-like interface in your terminal.
1414
CodeGate works with [OpenAI](https://openai.com/api/) and compatible APIs
1515
through Open Interpreter.
1616

17-
You can also configure [CodeGate muxing](../features/muxing.md) to select your
17+
You can also configure [CodeGate muxing](../features/muxing.mdx) to select your
1818
provider and model using [workspaces](../features/workspaces.mdx).
1919

2020
:::note
@@ -33,7 +33,7 @@ set to CodeGate's local API port, `http://localhost:8989/<provider>`.
3333

3434
<Tabs groupId="provider" queryString="provider">
3535
<TabItem value="mux" label="CodeGate muxing" default>
36-
First, configure your [provider(s)](../features/muxing.md#add-a-provider) and
36+
First, configure your [provider(s)](../features/muxing.mdx#add-a-provider) and
3737
select a model for each of your
3838
[workspace(s)](../features/workspaces.mdx#manage-workspaces) in the CodeGate dashboard.
3939

‎docs/partials/_aider-providers.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import LocalModelRecommendation from './_local-model-recommendation.md';
77

88
<Tabs groupId="provider" queryString="provider">
99
<TabItem value="mux" label="CodeGate muxing" default>
10-
First, configure your [provider(s)](../features/muxing.md#add-a-provider) and
10+
First, configure your [provider(s)](../features/muxing.mdx#add-a-provider) and
1111
select a model for each of your
1212
[workspace(s)](../features/workspaces.mdx#manage-workspaces) in the CodeGate dashboard.
1313

‎docs/partials/_cline-providers.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import LocalModelRecommendation from './_local-model-recommendation.md';
99

1010
<Tabs groupId="provider" queryString="provider">
1111
<TabItem value="mux" label="CodeGate muxing" default>
12-
First, configure your [provider(s)](../features/muxing.md#add-a-provider) and
12+
First, configure your [provider(s)](../features/muxing.mdx#add-a-provider) and
1313
select a model for each of your
1414
[workspace(s)](../features/workspaces.mdx#manage-workspaces) in the CodeGate dashboard.
1515

‎docs/partials/_kodu-providers.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ expect to release in CodeGate v0.1.19.
1313

1414
:::
1515

16-
First, configure your [provider(s)](../features/muxing.md#add-a-provider) and
16+
First, configure your [provider(s)](../features/muxing.mdx#add-a-provider) and
1717
select a model for each of your
1818
[workspace(s)](../features/workspaces.mdx#manage-workspaces) in the CodeGate
1919
dashboard.
89.1 KB
Binary file not shown.
108 KB
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.