Skip to main content
A provider plugin is an executable that adds an LLM provider to ChatCLI. Reach for one when the backend you need is not built in — a corporate gateway that fronts several model vendors behind its own authentication, or an internal SDK that is the only sanctioned way to reach a model. A provider plugin behaves like a built-in provider: it appears in /switch, /provider, /model and the command palette, answers to LLM_PROVIDER and --provider, and cost tracking, failover chains, model routing, compaction and memory all run on top of it.

Install and use

1

Install the binary

Install the signed bundle — the binary with its acme-provider.sig and acme-provider.pub beside it — from disk or from a release URL. The first install from a publisher shows its key’s fingerprint and asks once; the key is then trusted and pinned to the plugin (see Signature Verification). Without a terminal, pass the fingerprint you verified with --trust.
Plugins live in ~/.chatcli/providers/ and start with ChatCLI under the same signature policy as tool plugins: a key you or your administrator trust, or CHATCLI_ALLOW_UNSIGNED_PLUGINS=true with the quarantine window when one is configured.
2

Log in

In the REPL, /auth login acme renders the plugin’s login steps — prompts (secret fields are not echoed), a browser URL or a device code. For CI, servers and scripts, answer the fields up front:
The credential is stored encrypted in the auth store under plugin:ACME. A plugin that needs no login is available right away.
3

Use it

Pick it like any provider: the /switch palette, /provider ACME, --provider ACME, or LLM_PROVIDER=ACME with ACME_MODEL=<model>. /model (or /models) lists the plugin’s models; when the backend is unreachable, the last list it returned is still offered, tagged [catalog]. ACME_MAX_TOKENS caps the output like any *_MAX_TOKENS variable.

Operate plugins

Each plugin runs as one child process, started with ChatCLI. A plugin that crashes is restarted on the next call, with exponential backoff and jitter; after 5 failed starts in a row its circuit opens for 2 minutes and calls fail fast — which also lets a failover chain move on. A crash error quotes the last lines the plugin wrote to stderr.
A plugin inherits only what a process needs to run and to reach the network from a corporate machine — PATH, HOME, locale and temp variables, HTTP(S)_PROXY/NO_PROXY and CA bundles (SSL_CERT_FILE, CHATCLI_CA_BUNDLE, …) — plus the variables it declares in authEnv. Other providers’ keys never reach it.
/auth status lists each plugin with its login state. /auth logout acme or chatcli provider logout acme revokes the credential upstream (when the plugin supports it) and deletes it locally; the provider leaves /switch until the next login.
Provider plugins keep their own quarantine state, so a tool plugin and a provider plugin with the same file name never reset each other’s window. chatcli plugin quarantine (and /plugin quarantine) lists both and releases a name wherever it is held.
chatcli server loads the plugins in ~/.chatcli/providers at startup, before it resolves its provider, so --provider, LLM_PROVIDER and the fallback chain can name one. It never prompts: a plugin gets its credential from the credential store (run chatcli provider login <name> --input id=value beforehand) or from the variables it declares in authEnv, which in a pod come from the API keys Secret. The log says which plugins loaded and whether each can serve requests; a plugin provider with no model set uses the first model the plugin lists. The gateway colocated with the server uses the same plugin processes.On Kubernetes, put the binaries and their .sig in /providers/ of the plugins image, which the plugin-loader init container copies into the providers directory, and publish the signing key through a ConfigMap of .pub files: spec.plugins.trustedKeysConfigMap on the operator, plugins.trustedKeysConfigMap on the Helm chart. Both accept a plugin name as the provider and in the fallback chain.

How it fits

ChatCLI keeps everything above the wire: the coder loop, tool execution, history, memory, compaction, prompt-cache planning, cost and failover. The plugin owns only how to reach the backend.

Two modes

dialect

The plugin implements authentication (login, token, refresh) and the model list. ChatCLI talks to the backend with its built-in client for the wire format — openai-chat, openai-responses, anthropic-messages or gemini — sending the plugin’s headers.Native tools, streaming, prompt caching and exact usage come for free. Prefer this mode whenever the backend speaks one of those formats. The format can be set per plugin and overridden per model, so one gateway can serve OpenAI-format and Anthropic-format models side by side; for an Anthropic model behind a gateway id, the model’s upstream lets thinking, effort and fast mode resolve as for the direct API.

full

The plugin also implements chat over a normalized message schema: messages, tool calls, images, thinking blocks, streamed deltas and usage.Use it when the backend — or the SDK you are required to use — has a request format of its own.

Credentials stay with ChatCLI

The plugin never stores secrets. Its login ends with a credential — a flat key/value object — that ChatCLI encrypts, stores and hands back on every call that needs it. The login itself is a sequence of steps the plugin describes and ChatCLI renders: prompt fields, open_url and device_code. The plugin never touches the terminal, so the same flow works in the CLI, the web UI, IDE clients and messaging channels.

Gateway models keep their real limits and prices

Each listed model can name the built-in model it fronts with an upstream entry, for example {"provider": "CLAUDEAI", "model": "claude-sonnet-4-6"}. ChatCLI then reuses what it already knows about that model — context window, output limit, pricing and capabilities — unless the plugin sets them explicitly. A per-call cost reported by the gateway (costUSD) is treated as authoritative.

Build a plugin

The Go SDK, github.com/diillson/chatcli/pkg/providersdk, implements the protocol. Implement Provider plus the interfaces that match your backend; the capabilities announced to ChatCLI are derived from them, so a plugin can never advertise something it does not serve.A minimal dialect plugin for an OpenAI-compatible gateway:
While providersdk.Serve runs, os.Stdout points at stderr, so a stray fmt.Println in plugin code ends up in the log instead of corrupting the protocol stream. Use providersdk.Log(ctx, "info", "…") for structured log lines.
The repository ships a complete reference plugin in full mode — login, model list, streaming with cancellation, token counting and logout — at pkg/providersdk/examples/echo. It passes every conformance check and is the best starting point.

Rules every plugin must follow

Anything else on stdout corrupts the stream. Log to stderr — ChatCLI keeps a tail of it — or send $/log notifications.
The name must match ^[A-Z][A-Z0-9_]{1,31}$ and can never be the name of a built-in provider (OPENAI, CLAUDEAI, BEDROCK, …). It is the value users pass to LLM_PROVIDER and /switch.
Requests that arrived before shutdown are still served; later ones fail with -32600. After exit, the process terminates with status 0.

Verify a plugin with chatcli provider test

chatcli provider test runs the conformance kit against a plugin binary, talking to it over stdin and stdout exactly as ChatCLI does — the verdict is the same for a Go, Python or Java plugin.
The checks cover lifecycle ordering, version negotiation, name rules, the login state machine, token headers and expiry, model-list sanity (unique ids, valid upstream, non-negative limits and prices), chat results, streaming (the deltas must spell the final text), liveness after a cancelled request, token counting, a clean exit and stdout hygiene.
A check that needs something the run cannot provide is skipped with a hint, never failed: auth.login asks for --input when a prompt field has no value, and a browser or device-code login asks for --credential-file.
The command exits 0 when nothing failed, 1 when a check failed and 2 on a usage error, so a plugin repository can gate its CI on it:

Security model

Signed binaries

Sign provider plugins with the same tooling as tool plugins (chatcli plugin keygen and sign) and ship the .pub beside them. Users trust a publisher once by fingerprint, administrators through managed keys, and ChatCLI verifies every plugin when it loads it. See Signature Verification.

Least environment

A plugin declares the env vars it reads (authEnv). Those are the only credentials it should receive, and the secret redactor always treats them as secrets.

No secrets in the plugin

Credentials live in ChatCLI’s encrypted store and are passed per call. A plugin that writes a secret to stdout or stderr is broken.

Conversations reach the plugin

A provider plugin sees every prompt sent through it, exactly like the vendor it fronts. Install only plugins you trust.

See also

Plugin System

Tool plugins (@command) the model can call.

Supported Models

The built-in providers and their models.

Provider Fallback

Failover chains across providers.

Cost Tracking

How usage and prices become /cost.