Models switch while your agent stays

Change what your agent thinks with, in one command. Use a model on your computer or a provider's, and your agent keeps its files and connections.

Switch in one command

Set the model you want. A running agent restarts with it; a stopped agent saves the selection for its next start.

lnk agent model set qwen3:8b                   # a model on this computer
ANTHROPIC_API_KEY=sk-ant-... lnk agent start   # a hosted model, its key from the variable
lnk agent model set claude-sonnet-5-5          # another model of that provider

The new model replaces the saved one and the agent restarts, saying so, and the start ends with the table lnk agent status shows, the model in bold. Later starts reuse it, in whichever harness runs the agent, until you name another. Models helps you choose.

See which model it uses

Use --chat <name> with lnk agent model set to change just that conversation through its running harness. Without it, the selection is the persistent default. lnk agent start --model <id> also selects a model when starting the agent.

Exact model IDs

Model IDs are exact. A known misspelling such as claude-haiku-5.5 is refused with claude-haiku-5-5 suggested. Hosted IDs absent from Link's catalogue are checked against the provider's model list before settings are saved. If that check fails, the saved selection stays as it was. Known IDs do not prove that your account has access to them.

Inspect the selection

Ask your agent's status for its model, and Link for what a model costs and which run on this computer.

lnk agent status                       # its model, and whose it is
lnk model show claude-haiku-5-5       # the window, longest answer and price of that model
lnk model list                         # the models running on this computer

status names the model and its provider, and model show what it costs a million tokens, in and out. A model Link doesn't know runs with a window of 32,768 tokens until you describe it (What Link knows of a model).

A model on your computer

Use a model running on your computer, which is free and private.

lnk model install              # Ollama and the model that suits this machine, if none runs
lnk agent start --model qwen3  # qwen3 finds qwen3:8b

Which runtimes

--model takes a name lnk model list shows. Link Harness takes any runtime list finds: Ollama, LM Studio, llama.cpp, vLLM or Jan. A harness from outside Link may take fewer, which Compare Harnesses and its own page say.

A small model

A small model may not take tools, and then its harness's tools, memory among them, don't work with it. A model whose name says it has fewer than 30 billion parameters (qwen3:8b) is marked ⚠️ in start and status, since it may not call its tools. To run, install and remove models, see On Your Computer.

A hosted model to fall back to

Give an agent a hosted model to fall back to, for a turn its own can't answer: when the model is off or sends nothing back for 60 seconds, the turn's prompt is past its window, or its provider answers busy or overloaded (429, or a 5xx).

lnk agent start --model qwen3 --fallback qwen/qwen3-32b   # from OpenRouter, its key from OPENROUTER_API_KEY
lnk agent start --model claude-opus-5-5 --fallback claude-sonnet-5-5   # another of the same provider, on its key
lnk agent start --no-fallback                             # none again

--fallback

--fallback names a hosted model as --model does, and its key is found the same way, or read from LNK_FALLBACK_CREDENTIAL for a model whose name doesn't say whose it is: never on the command line, which other users of this machine can see. Link keeps it with the agent's settings, its key with your secrets, and both move with the agent. lnk agent status shows it under the model.

The fallback's key

Its key stays outside the sandbox as the model's does: the proxy holds one key, so beside a hosted model the fallback must be the same provider's, with the same key, or start refuses it. A model on this computer can't be a fallback.

Which harness falls back

Link Harness falls back, one turn at a time (Link Harness). A harness that can't ignores the fallback, and keeps it for when one that can runs the agent.

A provider's, with your key

Use a model from Anthropic, OpenAI or OpenRouter with your own key.

Its default model

With a key and no --model, every harness gets claude-haiku-5-5 on Anthropic, gpt-6-luna on OpenAI and anthropic/claude-haiku-5.5 on OpenRouter. All three cost the same, $0.10 a million tokens in and $0.50 out, so switching provider doesn't change your bill. --model names another model the provider has, such as claude-sonnet-5-5 at twenty times the price; lnk model show <model> shows what one costs.

Its key

Give the key in the provider's variable, ANTHROPIC_API_KEY, OPENAI_API_KEY or OPENROUTER_API_KEY, or paste it when lnk asks: never on the command line, which other users of this machine can see while it starts, so no flag takes it. Link keeps the key with the agent's settings, and reads the variable again at each start to renew it. To change the key, start your agent again with a new one.

Whose a model is

A model's name says whose it is: claude-... is Anthropic's, gpt-... OpenAI's, and a name with a / OpenRouter's. --model with such a name takes the key from that provider's variable, else the key the agent keeps for that provider, else asks for it on the terminal and keeps it. So lnk agent start --model claude-sonnet-5-5 is all it takes to move from a model on your computer to Anthropic's.

A key set for a local agent

A key variable set while the agent runs a model on your computer is never ignored: in a terminal, the start asks whether to switch to that provider's default model, and otherwise says how. If more than one variable is set and the agent has no model yet, Link doesn't choose whom to bill, so unset all but the one to use.

Out of its reach

Your agent never sees the key: Link's proxy, outside its sandbox, adds it on the way to the provider (Model Provider).

Set its model and how hard it thinks

Your agent's spec holds its opinions of models, read at every start.

[model]
thinking = "medium"           # off, low, medium or high, where the model can think
allow = ["claude-haiku-5-5", "claude-sonnet-5-5"]   # the only models it may run

[model.anthropic]
default = "claude-sonnet-5-5" # the model on Anthropic when you name none
lnk agent start --spec agent.toml   # read it, and keep it with the agent
lnk agent show --opinions                      # the whole spec it runs, each key marked whose

Which setting wins

A provider's table beats [model] for that provider. A start refuses a model allow doesn't list. Link's own spec thinks low by default.

More about it

When a model doesn't start or answer, see Troubleshooting. Every flag is in lnk agent start --help. Decisions says why the default is what it is.

Docs

  • Troubleshooting: What to do when your agent's model doesn't start, answer or remember (Switch Models)