Skip to content
Back to skills

Filament Proxy

ASecurity

Filament as a model proxy other tools connect to — Claude Code, Codex, an Anthropic or OpenAI SDK pointed at one local address and key; the model name as a remote control (effort, fast, an agent's mode, its session); adding a provider step by step and each model's row; routes, upstreams, backups and failover; what Filament does when a provider is busy, silent, out of allowance or refusing (retries, can't serve, slots, restarts); rules and translation between formats; the console; the endpoint...

  • 35 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
ai-agentsgoshelldockerapisecurity

Works with

  • claude code
  • cursor
  • terminal
  • cli
  • api
  • mcp

Security analysis

A100/100

Scanned December 2, 2026

npx -y skills add invertibleMatrix/filament --skill filament-proxy --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Filament Proxy?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Filament Proxy
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/invertiblematrix-filament-proxy/badge)](https://www.skillsdirectory.com/skills/invertiblematrix-filament-proxy)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: filament-proxy
description: Filament as a model proxy other tools connect to — Claude Code, Codex, an Anthropic or OpenAI SDK pointed at one local address and key; the model name as a remote control (effort, fast, an agent's mode, its session); adding a provider step by step and each model's row; routes, upstreams, backups and failover; what Filament does when a provider is busy, silent, out of allowance or refusing (retries, can't serve, slots, restarts); rules and translation between formats; the console; the endpoints and admin API; how tokens, speed and cost are counted; and the proxy's security. Load it when the person asks to connect a tool to Filament, route a model, add a provider, why a call failed or was not backed up, or what a request cost.
---

# Filament as a model proxy

## In six lines

1. One address for every tool: `http://127.0.0.1:20300`, speaking Anthropic Messages, OpenAI Chat Completions and
   OpenAI Responses; Filament translates where the upstream speaks the other.
2. A tool sends Filament's **inbound key** (`Authorization: Bearer <key>` or `x-api-key`), never a provider's key.
   The key is the person's to copy (Settings › Connect other apps, or the console's Home): never print it whole.
3. Routes decide which upstream answers a model name: the first match, top to bottom.
4. Backups are used only with failover on (`rules.resilience.failover`, off at first).
5. Routes, upstreams and rules change in the console (then **Save changes**), the console's Assistant (then
   **Apply**), the harness's Settings › Providers (**Add a provider**, **Backups ›**, the failover switch), or the
   admin API. From a shell: `filament keys add` and `keys remove --also` make and remove a provider with its route,
   `filament keys set <id> <field> <value>` changes one field (`name`, `enabled`, `baseUrl`, `billing`,
   `hiddenModels`, `models`, `prefix`…; `keys show <id>` says them), `filament routes backups <model>
   <provider>=<model there>` sets a model's backups, `filament settings set rules.<path> <value>` a request rule
   (`rules.resilience.failover true`), and `filament agents connect` / `agents off` a coding agent's. A route the
   console set by hand stays the console's.
6. Keys are typed by the person: `filament keys add <provider>`, or a new one with `filament keys set <id> key`
   (stars at a terminal, or piped in with `--key-stdin`). A key or a header's value is never a word on a command line.

## Connecting a tool

- **Claude Code** (`~/.claude/settings.json`, or a project's `.claude/settings.json`):
  `{"env":{"ANTHROPIC_BASE_URL":"http://127.0.0.1:20300","ANTHROPIC_AUTH_TOKEN":"<the inbound key>"}}`, then pick a
  model with `/model`.
- **Codex** (`~/.codex/config.toml`, with `FILAMENT_KEY` set to the key where Codex starts): `model_provider =
  "filament"`, `model = "<a model name>"`, and `[model_providers.filament]` with `name = "filament"`, `base_url =
  "http://127.0.0.1:20300/v1"`, `env_key = "FILAMENT_KEY"`, `wire_api = "responses"`.
- **SDKs**: `Anthropic(base_url="http://127.0.0.1:20300", api_key=KEY)`,
  `OpenAI(base_url="http://127.0.0.1:20300/v1", api_key=KEY)`.
- Settings › Connect other apps holds these blocks with **Copy**, the newest key and **Make a new key** (the four keys
  before it keep working).
- Prefer the Anthropic format for Claude and the coding agents: it carries thinking and images natively.
- One conversation across calls: send `x-session-id`; `x-filament-cwd` names a coding agent's working folder.
- `GET /v1/models` lists the names a tool can type (hidden models still route).

## The model name is the remote control

`<route name>[-effort][-fast][@mode][#session]`:

- `-low`, `-medium`, `-high`, `-xhigh`, `-max`: effort, over what the tool sends (stripped before routing).
- `-fast`: Anthropic's fast mode (other models fall back to normal speed, with a note). `-flex` picks a flex tier
  where the model has one.
- `@agent`, `@plan`, `@ask`, or the agent's own mode id: a coding agent's mode.
- `#<session id>`: continue that coding agent's session.
- Examples: `claude-code/opus-xhigh@plan`, `cursor/composer-2.5@plan`, `codex/<model>-high`, `grok-build/grok-4.6`.
  Where an upstream cannot honour a part, Filament keeps the nearest and says so in the request's changes.

## Routes and upstreams

- A **route**: `match` (an exact name, a `*` glob, or `re:<regex>`, any case), `upstream`, `upstreamModel` (`{model}`,
  `{1}`…), `format` (auto, anthropic, openai), `fallbacks`, `strategy` (in_order, round_robin, random,
  least_latency, least_cost, quota_aware), `enabled`, its own `rules`. A plain-name route with fallbacks is a
  **virtual model** (**New virtual model**).
- An **upstream** (a provider): type `openai-compatible`, `anthropic-compatible`, `openai`, `anthropic`, `acp` (a
  coding agent), `codex`, `cursor-sdk`, `qoder`, `filament` (another machine's models, through its **Models** pill);
  `baseUrl`, `apiKey`, `headers`, `models`, `hiddenModels`,
  `discoverModels`, `pricing`, `rules`.
- `wireApi` (OpenAI-style upstreams): `auto`, `chat-completions` or `responses`. On `auto` the OpenAI API itself (an
  `openai` upstream at `api.openai.com`) is asked on Responses; any other server on Chat Completions, until a 404 or
  405 there (remembered for the server) or a 400 naming `/v1/responses` (remembered for that model) sends a request to
  Responses and Responses answers. A model that fails with "use /v1/responses" on a pinned upstream: set `responses`.
- A new provider's models need a route `<id>/*` (adding one from the catalogue makes it). Removing a provider takes
  the routes that point only at it (`filament keys remove <id> --also`).
- **Failover** moves to the next entry before the reply starts, only while failover is on: Home's switch, the tray
  card, or Settings › Providers › **Use backups when a provider fails**. On 429, 5xx, 529 or unreachable the failing
  upstream cools down (`rules.resilience.cooldownBaseSeconds` 10 s, doubling, at most
  `rules.resilience.cooldownMaxSeconds` 300 s) and is tried last, not skipped; 401, 403 and 404 (a refused key, a
  model it does not have) take the next entry without a cooldown.
- Per-model backups: **Backups ›** on a model's row in Settings › Providers, or `filament routes backups <model>
  <provider>=<model there> …` (`--none` takes them away; `filament routes` lists the models with backups). A coding
  agent's model takes none: a chat on it stays with its agent.

## Add a provider, step by step

1. Settings › Providers › **Add a provider**. **Which one**: a tile from the catalogue, or **Another address** for any
   server that speaks OpenAI's or Anthropic's format (Ollama, LM Studio, vLLM, a company gateway).
2. **Its plan** where the provider offers several (each with its own address), **Its address needs** where its address
   takes a value (a region, a resource name), or **Its address** for another address.
3. **The key**: the person pastes it here, never in a chat. A keyless server skips it.
4. **Prefix**: filled for them, what chats put before its models' names (`<prefix>/<model>`); it makes the
   `<prefix>/*` route.
5. **Test** runs by itself once the address and key are in, and lists its models (**Filter models**; untick the ones
   to keep out of pickers). **Add**.

On a provider's page: **Test**, its switch, Connection (**Address**, the key with **Replace**, headers), its models,
and **Remove this provider…** (with the routes only it serves). Each model row has **Agents at once** (1 to 64,
empty for no limit), **Tune ›** (what it can do here and its list price), **Backups ›**, a tick to hide it from
pickers (its name still answers), **Hide all** / **Show all**, and **Add a model by name** for one the list leaves out.
A coding agent's account is under Settings › Coding agents instead, and every account's plan at once in Library ›
**Accounts & limits** (skill **filament-setup**).

## When a provider fails

- **A busy provider is tried again** for a chat's own turns, sub-agents and compaction summaries: on 429, 529, a 5xx, a
  timeout or a dropped connection before any of the reply came, Filament waits 1 s, 2 s, 4 s and on up to 32 s
  (or what `Retry-After` asks), ten tries in all. A stream that breaks part-way on the provider's side is asked again;
  what it streamed stays on the page under a line saying where it broke. A wait of more than ten minutes ends the turn,
  saying when. **Stop** ends a wait. A request a client sends (Claude Code, an SDK) gets failover only: the client
  tries again itself.
- **A silent stream is cut**: a reply that sent part, then nothing for ten minutes with its connection open, counts as
  broken and is tried again. A slow reply that is still thinking is never cut, and no clock limits how long a reply
  takes to start.
- **An account that cannot be served stops at once**: an allowance used up (credits, a plan's window, a daily limit) or
  a refused account or key is never tried again ("Not tried again: zai says this account's allowance is used up").
  Words that say the balance or plan itself is gone read "this account or its key has no balance or plan left to
  serve it": recharge it, or sign in with a key a plan covers. Filament holds it as *can't serve*: a spent allowance
  until the reset the provider gave, else 15 minutes; a refused account until it is fixed. Meanwhile sub-agents launch
  on the next row of their list and a route's backups go first. The console's Home health panel says "can't serve ·
  allowance used up · 14 min" with **reset**; a call that succeeds, a change of its key, address or type, or **reset**
  lets it go, and for a coding agent a plan window that reset or a sign-in as another login.
- **Slots**: a model's **Agents at once** (on its row under its provider, or under its coding agent) caps Filament's
  agents on it there. A 429 about the account's rate teaches a lower cap (one fewer than were running) that lifts ten
  minutes after the last such 429; refused again at the same number, it holds twice as long each time, to an hour,
  then one more call is tried at a time; a day with no refusal forgets it. The model's row says so. Calls over a cap
  wait their turn ("waiting for a slot: …" on the turn's live line), which cools nothing down; **reset** on the health
  panel forgets the learned caps.
- **Retry** under a failed turn of Filament's own loop goes on from its last finished round, its work kept and no call
  run again; a coding agent's failed turn is sent again as its message.
- **A team's lead** hears a worker's provider failure in one line, with where the work stands, and decides: launch the
  brief on the worker's next row, follow it up once the provider serves, or tell the person.
- **Strategies** pick among a route's entries: in order, round robin, random, least latency, least cost (by price
  card), quota aware (prefers the ones that have not reported their quota spent).
- **Restarting** (the desktop app's Restart, `POST /api/shutdown`) refuses new turns ("Filament is restarting; send
  again in a few seconds"), lets those in flight finish for up to 20 seconds, then exits, and the app starts one new
  Filament. With `{"ifIdle": true}` it stops only while no turn, request, compaction or sub-agent runs, and otherwise
  answers 409 naming the chats whose turns run; Settings › About restarts it this way.

## Rules and translation

- Rules layer: your defaults (the console's Settings › Rules), then the upstream's, then the route's. Groups:
  thinking, effort, speed, translate, params, cache, tools, headers, resilience, autofit, trim. Each change a request
  gets is written in words on its record; Lab › **Dry run** shows it without sending.
- Translation (`rules.translate.mode` auto or never) converts system prompts, content, tools and their calls, effort,
  thinking, images, stop reasons, usage and errors. Signed thinking, server-side tools and fast mode do not cross
  whole, and the record says so. Responses' `previous_response_id` is kept an hour in memory; `background: true` is
  refused. The length goes to OpenAI's own API as `max_completion_tokens`, to every other server as `max_tokens`,
  unless `rules.translate.openaiMaxTokensField` (`auto` by default) names one.

## The console (`http://127.0.0.1:20300/`)

- **Home**: the key and address, the failover switch, today, live requests, quotas, upstream health (**Reset** a
  cooldown), agent sessions.
- **Traffic**: every call, with timing, tokens, headers, the changes applied, and bodies where kept.
- **Usage**: per day for 400 days, by upstream and model, CSV export.
- **Destinations**: Upstreams (Test connection, models, prices, **+ Add**), Routes, Models.
- **Lab**: Playground (real requests), Dry run.
- **Settings**: inbound keys (Rotate), server, observability, alerts, raw config; Rules; Templates.
- **Assistant**: configure by chatting; it works on a draft and saves only on **Apply**.
- Edits stay in the page until **Save changes**.

## Endpoints

- With the inbound key (unless `server.requireAuth` is off): `POST /v1/messages`, `POST /v1/messages/count_tokens`
  (a local estimate, no provider called), `POST /v1/chat/completions`, `POST /v1/responses`, `POST /v1/embeddings`,
  `GET /v1/models`; `/messages`, `/chat/completions`, `/responses`, `/embeddings` and `/models` answer without `/v1`
  too. The model list is Anthropic's shape with `anthropic-version` or `?format=anthropic`, else OpenAI's.
  `/mcp/memory` needs the key whenever one is set.
- No key: `GET /health`.
- The admin API (`/api/*`) never takes the inbound key: this computer with the owner key (the `filament` command line
  and the app send it), a paired device, or `server.adminToken`. While the desktop app runs, changes that loosen
  anything need the person's press there. `GET /api/failover` says whether failover is on and each route's backup
  chain; `POST` with `{ "enabled": … }` switches it.

## Security

- Loopback only at first. `server.host` `0.0.0.0` shares the endpoints: keep `server.requireAuth` on.
- Only a Host that names this machine is answered (else 421); a name like `host.docker.internal` or a reverse proxy's
  goes in `server.allowedHosts` (a host added from a shell while the app runs needs the person's press there).
- The request log keeps no conversation at first (`observability.storeBodies` `summary`); `shaped` or `full` keep
  bodies with secrets blanked.
- Only the upstreams the person set up are called, and redirects are never followed. No model request goes through
  filamentdev.com; telemetry carries no prompts, code, paths, keys or addresses.

## Counting

Tokens come from the provider's usage; cache hit rate = cache read ÷ (fresh input + cache read + cache write); first
byte from arrival; tokens/s after the first byte. Cost = tokens × the upstream's price (`pricing`), else built-in
rates; a subscription costs $0 with its list price shown. See them in Traffic, Home, Usage, and `/status` and `/cost`
in a chat.

## Common problems

- **401**: the tool sends no key or a wrong one (Bearer or `x-api-key`; an old key is refused after four rotations).
- **421 "Host … does not name this machine"**: call `127.0.0.1`, or add the name to `server.allowedHosts`.
- **"no route matches"**: the Routes page, or add `<id>/*` for a provider.
- **Backups never used**: failover is off.
- **A model answers but is not listed**: it is hidden.
- **"previous response not known"**: older than an hour, or Filament restarted.
- **A restart**: calls get 503 "Filament is restarting" for a moment.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.