Model actions
An agent's model has one API, whatever serves it. Link Harness uses it for inference and model discovery. An outside harness can keep its provider's native carrier; provider requests and credentials stay in the model bridge.
The grant
The proxy supplies LNK_MODEL_URL, including its URL secret. Append
an action to it. A request cannot supply a provider, address or key:
its proved grant selects those. Model names must be plain names and
fit the agent spec's allow list. A fallback has a separate grant and
URL.
| Method | Action | Request | Answer |
|---|---|---|---|
| GET | show | Optional ?name=<name> | Model details |
| GET | list | None | Sorted plain model names |
| GET | status | None | ready, and plain loaded names when known |
| POST | chat | chat::Chat | Newline-delimited chat::Stream events |
| POST | embed | texts, optional name | vectors |
| POST | transcribe | name, audio | text |
| POST | count | text, optional name | tokens |
| GET | usage | None | Requests, unmetered requests and token totals |
| POST | context | Optional chat | Kept chats and one chat's parts (Context Reporting) |
show also includes known numeric facts, including answer limits,
thinking support and price, when available. The types are in link_model_contract::chat and api. Unknown fields
are refused. chat takes a system string, messages, optional tools,
answer and window token limits, and optional thinking settings. A
message has a user or assistant role, text, and optional calls,
tool answers, thinking blocks and media. Media bytes are base64, with
an explicit MIME type; they are checked before a provider sees them.
The bridge applies its known price instead of trusting a caller's.
Streaming
A chat stream contains text events followed by one answer, or an
error with a closed failure kind. Its completed answer includes tool
calls, usage and thinking. A truncated stream has no completed answer.
Cancelling a client request ends its provider request; no inference is
retried automatically. Unsupported operations, including token
counting where the provider exposes no tokenizer, return HTTP 501.
Counts are never guessed. Usage is the calling agent's measured
lifetime total; it does not invent a daily budget or remaining tokens.
Limits
Requests are at most 32 MiB. Provider answers and chat streams are bounded at 8 MiB; discovery and small reads have tighter registry budgets. The bridge refuses redirects and uses action-specific time limits. Provider errors returned through these routes do not include host addresses, paths or credentials.
CLI and commands
lnk model status, usage, context, chat, embed, transcribe and count
use the same API at LNK_MODEL_URL. Request actions read typed JSON
from standard input, or --request <file>; chat prints stream events.
lnk agent model <action> --agent <name> uses that agent's grant.
Agent commands spell the actions /model:<action> and take JSON for
structured requests. The registry generates their discovery names.
Owner discovery
lnk model list --json prints plain names, as the route does. The owner
runtime inventory, including addresses, is lnk model runtime list --json;
lnk agent start uses it. lnk model show <name> returns the same
Shown type as the route to an agent, granted a runtime. Run by its
owner, it prints the model's known facts, including their overrides, as
blocks, which lnk issue asks for a model named in a failure.