Wiremux
Map Chat Completions, Messages, Responses, Gemini, and Converse through one in-process IR. Refresh tokens from the same pasteable vendor profiles. The host keeps the agent loop.
Crates
| Crate | Job |
|---|---|
wiremux |
Dialect maps (decode / encode / stream) plus optional CLI and loopback proxy |
wiremux-auth |
Profile catalog and TokenProvider (static, OAuth, GCP, Azure, AWS) |
Maps-only hosts depend on wiremux with default-features = false.
That path does not pull clap, tokio, reqwest, or aws-lc.
This repository may be ahead of crates.io. Host attach notes in
docs/CONSUME.md pin the published cut.
Install
MSRV is 1.95 (see rust-toolchain.toml).
CLI and proxy:
Maps
Decode a vendor JSON body into IrRequest, then encode another wire.
Loss is typed (preserve / degrade / drop / hard-error), never
a silent strip.
use ;
let src = br#"{"model":"gpt-4o","messages":[{"role":"user","content":"ping"}]}"#;
let = decode.unwrap;
let profile = parse_profile_str
.unwrap;
let = encode.unwrap;
Run the same program from this tree:
Wires: chat-completions (CLI also accepts chat), messages,
responses, gemini, converse. Profile TOML uses
wire = "chat-completions", not wire = "chat".
Auth and profiles
Shipped vendors are ordinary TOML. A gist uses the same schema, so a
rotated token URL, client id, or beta header does not need a crate
release. Profiles are data: no functions, no !command, no
URL-as-script. $VAR / ${VAR} / {env:VAR} are allowed.
wiremux auth login follows the profile login engine. Several
shipped OAuth files use login = "none" until a public Wiremux
client id exists; those exit 2 with a setup hint.
Catalog ingest writes user-dir profiles from
models.dev (default) or LiteLLM
(--source litellm). Catalog misses fail closed.
Proxy
Loopback only (127.0.0.1). Incoming harness dialect is --from.
Upstream comes from --profile.
--dump-loss prints a LossReport on stderr per request.
Host attach
How a host application should pin, wrap TokenProvider, and map at
the adapter boundary: docs/CONSUME.md.
Architecture (IR, loss, what stays in the host):
docs/ARCHITECTURE.md.
Copy-paste examples: examples/.
Status
0.x. Public IR and error enums are #[non_exhaustive]. Dual license
MIT OR Apache-2.0.
This crate is not a LiteLLM clone, not a desktop switcher, and not a subscription pool. It does not ship a public Claude-Pro-in-Codex, Cline, or OpenCode preset.
Contributing
See CONTRIBUTING.md. make check is the local
gate. Commits need git commit -s (DCO).
Security reports go to SECURITY.md, not a public
issue.