Skip to content

Configure a provider

malac talks to models through providers. A provider is an endpoint plus a wire format: openai (chat completions) or anthropic (the Messages API). Anything that speaks one of the two works, including gateways and local servers. You can configure several providers at once and switch between their models at any time.

Two providers are always defined:

Provider Kind Base URL Key variable
anthropic anthropic https://api.anthropic.com ANTHROPIC_API_KEY
openai openai https://api.openai.com/v1 OPENAI_API_KEY

If no model is configured, malac picks anthropic/claude-sonnet-5-5 when ANTHROPIC_API_KEY is set, otherwise openai/gpt-5 when OPENAI_API_KEY is set. With neither, it asks you to add a provider.

malac provider add writes a [providers.<name>] table to ~/.malac/config.toml, replacing any provider with the same name:

printf '%s' "$LORA_API_KEY" | malac provider add lora \
--base-url https://lora.example.com/v1 --model default --api-key-stdin --set-default

This adds a provider called lora for an OpenAI-compatible gateway at lora.example.com, stores its key, and makes lora/default the default model.

Flag Meaning
<name> Provider name, used in model specs such as lora/smart
--base-url <url> Endpoint. Required.
--kind openai|anthropic Wire format. Default openai.
--model <id> Model to list for this provider and to use with --set-default
--api-key-env <VAR> Read the key from this environment variable
--api-key-stdin Read the key from stdin and store it in ~/.malac/credentials.toml (mode 0600)
--set-default Make <name>/<model> the default model. Needs --model.

To keep the key in your environment instead of on disk:

malac provider add anthropic-work --kind anthropic \
--base-url https://api.anthropic.com --api-key-env WORK_ANTHROPIC_KEY \
--model claude-sonnet-5-5

When malac needs a key, it looks in the provider’s api_key_env variable first, then in ~/.malac/credentials.toml.

malac provider list # providers, base URLs and whether a key is set
malac provider models lora # models one provider serves
malac models # every model of every provider; * marks the default
~/.malac/config.toml
model = "lora/default" # default model, as provider/model
small_model = "lora/fast" # used for compaction summaries
vision_model = "lora/vision" # describes images for models without vision
[providers.lora]
kind = "openai"
base_url = "https://lora.example.com/v1"
api_key_env = "LORA_API_KEY"
models = ["default", "smart", "fast", "vision"]
[providers.local]
kind = "openai"
base_url = "http://localhost:11434/v1"

models lists the ids offered by /model, the model picker and the web UI. headers adds extra HTTP headers to every request:

[providers.lora]
headers = { "X-Team" = "platform" }

A model is written provider/model, for example lora/smart. A bare name such as smart uses the provider of the default model. If the part before the first / is not a provider name, the whole string is a model id on the default provider, so deepseek/v4 with a default of lora/default means model deepseek/v4 on lora.

Pick a model per run with -m, or switch inside a session with /model:

malac -m lora/smart review the auth module
[models."lora/default"]
context_window = 200000 # compaction starts at 80% of this
max_output_tokens = 16384 # max_tokens sent with each request
vision = false # route images through vision_model
temperature = 0.2
[models."anthropic/claude-sonnet-5-5"]
thinking_budget = 8000 # Anthropic extended thinking

All keys are optional; see Configuration for the defaults.

A profile is a named overlay applied with --profile:

[profiles.fast]
model = "lora/fast"
[profiles.yolo]
mode = "autopilot"
malac --profile fast summarize the open TODOs

malac is created by lobirus and released under the MIT license. About malac