Model Contract
link-model-contract is what Link knows of models, shipped as data,
and the model routes a program behind its proxy calls. lnk model show prints the facts, and the harness plugin hands a harness its
agent's model's facts with its settings (Settings::model_facts), so
any harness reads them (Model
Provider).
A model's facts
Each model's facts (link_model_contract::models::Facts) are its
window and longest answer in tokens, how it's asked to think and what
it costs, each optional, so a file may correct one field of another's.
thinking
How it's asked to think (Thinks): no, not at all or not in a way
Link knows; adaptive, Anthropic's adaptive thinking at an effort;
budget, Anthropic's thinking within a budget of tokens; or effort,
reasoning at an effort, as OpenAI and OpenRouter ask it.
price
What it costs in US dollars a million tokens (Price): input,
output and, when it has one, cached. Price::of prices a turn's
tokens.
Link's file and yours
Link ships its facts as a file (LINK_MODELS), refreshed with the
models' figures at every release. Yours, ~/.lnk/model-facts.toml
(path, yours), adds a model or corrects one, field by field, yours
winning (facts, known), so a model released after your Link is
described without a new one.
Read strictly
parse reads a models file strictly, at most 1 MiB (MAX_BYTES), and
check refuses a name that's empty, past 128 characters or holds a
control character, a window under 1024 tokens, an answer under 256, or
a price that's negative or not a number.
How a name is matched
plain is a name as Link's files match it: its own, after a router's
prefix (anthropic/claude-sonnet-4.6), without a dated snapshot's
suffix (Anthropic's -20251001, OpenAI's -2024-08-06), lowercase,
. read as -.
Refreshed at a release
refresh builds the next file from OpenRouter's models list, and is an
error for an answer with no models, so a release never ships an emptied
file. A figure that moves past plausible_change keeps the current
file's, and the change is said, one line each.
plausible_change
A change its provider could make: never a window or longest answer more than halved, or a price moved more than tenfold, a price of nothing or of anything from nothing included.
The model routes
link_model_contract::models::route holds the routes lnk-model's
bridge serves: a hosted model's at /_link/model (HOSTED), its key
added outside the sandbox, and this machine's model runtimes' at
/_link/local/<port>, for inference only. How each provider is spoken
to is the bridge's.
Hosted providers
The route adds keys for anthropic, openai and openrouter
(PROVIDERS). url is where a program behind its proxy reaches one:
the base URL its client takes in place of the provider's, /v1 added
by Anthropic's clients, not by OpenAI's and OpenRouter's.
The key
An agent's route names its key, and the bridge reads it from what the
store grants the route's caller at each call (Hosted::with_key), so a
key removed stops at the next. A program is given a placeholder in its
place (placeholder): its kind's prefix (sk-ant-api03-, sk-or-v1-,
sk-proj-), which clients look at, and a tag, none of the secret.
Models that search on their own
searches_by_nature says whether a model searches the web whatever a
request asks: Perplexity's Sonar models, and OpenAI's search and deep
research models, directly or on OpenRouter. Its provider fetches pages
for the program, past any list of hosts its sandbox has.