Reference·Models and providersIndexClose
Models and providers
Providers, wire dialects, key lookup, Nodecode's own models, default and auxiliary model, effort, retries and the failover chain.
A provider is an endpoint, a key and the wire dialect it speaks. Providers live in ~/.nodecode/config.jsonc.
Providers
"providers": {
"anthropic": { "sdk": "anthropic", "api_key": "sk-ant-..." },
"local": {
"sdk": "openai-completions",
"base_url": "http://127.0.0.1:8000/v1",
"models": [{ "id": "gemma-3-27b" }]
}
}
Every provider key is listed in Config. /models connects a provider from the models.dev catalog and saves its key in auth.json. Ctrl+E on a connected provider replaces its key.
A provider whose base_url is a machine of your own, on localhost, your LAN or your tailnet, is listed under Local in /models. Its models come from GET <base_url>/models.
Ollama needs no entry. Each time /models or /setup opens, Nodecode asks http://127.0.0.1:11434/v1/models, or the address in OLLAMA_HOST, and lists the models Ollama answers with under Local. The provider list shows Ollama either way. While Ollama is not running or has no model, Enter on it says what to do and asks again. A model pulled or removed shows on the next open. A providers.ollama entry of your own replaces the built-in one.
Ollama gives a model a 4K context window by default on a GPU with less than 24 GiB of memory, and recommends at least 64K for agents. Set OLLAMA_CONTEXT_LENGTH=64000 before ollama serve (Ollama: context length).
A request to openrouter.ai carries HTTP-Referer: https://nodecode.ai and X-OpenRouter-Title: Nodecode, which credit the tokens to Nodecode on OpenRouter's app rankings. No other host gets them.
A chat request to api.mistral.ai carries no reasoning_content on its messages. Mistral refuses a message field its schema does not name, so a DeepSeek model it hosts would fail every turn after the first.
Dialects
sdk names the wire dialect. Nodecode never probes the endpoint for it.
sdk | Path added to base_url | Default endpoint |
|---|---|---|
openai-completions | /chat/completions | https://opencode.ai/zen/v1/chat/completions |
openai-responses | /responses | https://api.openai.com/v1/responses |
anthropic | /messages | https://api.anthropic.com/v1/messages |
google | Set per model | https://generativelanguage.googleapis.com/v1beta |
| Case | Dialect used |
|---|---|
sdk is set | That dialect. An unknown value leaves the provider unusable. |
No sdk, the id is a dialect name | That dialect. Example: "anthropic": {}. |
No sdk, any other id | Refused. The refusal names the key to set. |
| No config entry | The dialect of the id, or of its models.dev catalog entry. |
models[].sdk is set | That dialect, for that model only. |
base_url
| Rule | Detail |
|---|---|
| Composition | Trailing slashes are trimmed. The dialect path is appended. |
| Version segment | Include it. Write https://host/v1. |
No base_url, id openai-completions, anthropic or google | The default endpoint of that dialect. |
No base_url, id openai-responses or openai | https://api.openai.com/v1/responses. |
No base_url, a models.dev catalog provider | The catalog's api address. |
No base_url, anything else | Refused. Set providers.<id>.base_url. |
NODECODE_ENDPOINT | Overrides every rule above. It is the full endpoint URL. |
Keys
Nodecode takes the first key found, in this order.
| Order | Source |
|---|---|
| 1 | NODECODE_API_KEY |
| 2 | providers.<id>.api_key in the config |
| 3 | ~/.nodecode/auth.json, at api_keys.<id>.key. /models writes it when you connect a provider. |
| 4 | A cell's credential hook |
| 5 | <ID>_API_KEY. The id is uppercased, - becomes _. |
| 6 | OPENAI_API_KEY, ANTHROPIC_API_KEY or GOOGLE_API_KEY, by dialect |
| 7 | ANTHROPIC_AUTH_TOKEN, for the provider id anthropic only |
| 8 | The literal string public |
! command | Result |
|---|---|
| Success | The trimmed output is the key. |
| Runs past 10 seconds | Resolution fails. |
| Non-zero exit or empty output | Resolution fails. |
A provider with no key anywhere sends public as its key. An auth.json that is unreadable, invalid or over 1 MiB stops resolution.
Nodecode's own models
nodecode.ai serves Nodecode's own models at https://api.nodecode.ai/v1, on OpenAI's wire, under the provider id nodecode.
nodecode login, or /login in the shell, signs in at nodecode.ai in a browser, to run on the account's API credit. It saves the key in auth.json, at api_keys.nodecode.key, and writes the provider:
"providers": {
"nodecode": { "sdk": "openai-completions", "base_url": "https://api.nodecode.ai/v1" }
}
A sign-in never changes your default model. Pick one in /models: nodecode, then Cyber v1.
| Model | Id | What it is |
|---|---|---|
| Cyber v1 | nodecode-cyber-v1 | The security model. A chat model: 1M context, prompt and output together, and 16K output unless a call asks for more. A session can run on it. |
| Image v1 | nodecode-image-v1 | The image model, at POST /v1/images/generations. The images come back in the body as b64_json, never as URLs. |
| Decide v1 | nodecode-decide-v1 | The classifier. It answers named questions about one state as probabilities, never prose. 32K context. |
| Fact | Value |
|---|---|
| Keys | Start with sk-nc-. A key made at https://nodecode.ai/account/keys works the same. Any other key answers 401 invalid_api_key: run nodecode login again. |
| Who pays | The topped-up balance, per token; a plan the account already holds pays first. With neither, a call answers 402. A free key pays nothing. See Pricing. |
| What is left | GET /v1/usage: the plan's requests left, its reset and seats, the credit. The shell's footer and /usage show it. |
Calling these models from outside Nodecode is on a page of its own: the API quickstart has the routes, a first call, and Claude Code, Codex and the pentest agents on Cyber v1.
Free key
Cyber v1 is free from the Nodecode CLI once your account has topped up at least $2 (or €2). The top-up stays in your balance.
- Top up at https://nodecode.ai/account/top-up.
- Run
nodecode login(or/loginin a shell) and press Allow with a free key on the page it opens.
The CLI saves two keys: the account's key (provider nodecode) and the free key beside it (provider nodecode-free). /models lists Cyber v1 twice at the top:
| Row | Who pays |
|---|---|
nodecode-free/nodecode-cyber-v1 FREE | Nobody: the free key, with the limits below. A sign-in with a free key makes it the default model. |
nodecode/nodecode-cyber-v1 | Your plan or your balance, per token, with the full 1M context. Its row says which, e.g. from credit $2.00. |
The footer shows Free key · Cyber v1 while a session runs on the free one, and your plan or credit otherwise; /usage lists both.
| Fact | Value |
|---|---|
| Model | nodecode-cyber-v1 alone. Another model answers 403 model_not_free. |
| Client | The Nodecode CLI alone. Any other client answers 403 free_needs_nodecode. Claude Code, Codex and your own code take a paid key. |
| Context | 1M, prompt and output together, the same as a paid key. A longer prompt answers 400 context_length_exceeded. |
| At once | 2 requests per account; 1 for 14 days after your first card top-up. |
| A day | 10M tokens (input not read from the cache, and output) in any 24 hours; 3M for 14 days after your first card top-up. Past it, 429 free_daily_used, saying when the account can send again (when enough of its oldest tokens leave the 24 hours), with Retry-After in seconds. |
| A minute | 30 requests per account. The next answers 429 free_rate_limited with Retry-After, which the CLI waits out. |
| Capacity | Paid calls go first. A free call runs where a machine has room, and answers 503 free_capacity_busy after 30 s without it. |
| Footer | Free key · Cyber v1; Free key · top up first while the top-up is unpaid. |
A free key made at https://nodecode.ai/account/keys (tick Free key) runs without a sign-in once its provider is wired the way a sign-in wires it. A key alone names no provider or model, so NODECODE_API_KEY by itself runs no turn. Merge this into your config:
{
"general": { "default_model": { "provider": "nodecode-free", "model": "nodecode-cyber-v1" } },
"providers": {
"nodecode-free": { "sdk": "openai-completions", "base_url": "https://api.nodecode.ai/v1" }
}
}
Then hand it the key and run nodecode:
export NODECODE_FREE_API_KEY=sk-nc-...
general.default_model makes the free Cyber v1 the default, as a sign-in with a free key does. Leave it out to pick it in /models instead.
Default and auxiliary model
"general": {
"default_model": { "provider": "anthropic", "model": "claude-opus-5", "effort": "high" },
"auxiliary_model": { "provider": "local", "model": "gemma-3-27b" }
}
| Key | Used for | When unset |
|---|---|---|
general.default_model | New sessions. | The build default applies. The footer reads run /setup to add a model. |
general.auxiliary_model | Session names, recaps and summaries. | The session's own model, at its weakest effort rung. |
Both take provider, model and an optional effort. provider and model are required. The older string form of default_model is refused.
Session pinning
A model pick pins the session. The pin survives restarts.
| Event | Result |
|---|---|
/models pick | Pins this session. Writes general.default_model. |
| A session that already ran | Keeps its own model. |
| A child session, such as a fork | Starts on its parent's provider, model and effort. |
(select-model nil) in eval | Clears the pin. The session takes the default at its next turn. |
| Attached shells | Their footers follow the pick. |
/models
/models opens the providers under four tabs: Main, Auxiliary, Decider and Backup. Tab moves between them. Decider is the model that answers judgments as probabilities. Backup is the failover chain. In a chat room or on the web page, the same choices are rows.
| Tab | Does |
|---|---|
| Main | Picks a provider, then a model: this session's, and the one new sessions start on. Then the model's reasoning ladder opens. |
| Auxiliary | Picks the model that names sessions and writes recaps and summaries, in general.auxiliary_model. Pins no session. Same as main gives that work back to each session's own model. |
| Decider | Pins a decider in general.decider_model. The one decider is djev. None removes the pin. |
| Backup | The failover chain and its triggers. |
The decider pin offers djev, a decider on a machine of your own. Decide v1, nodecode.ai's hosted classifier, is called by its id and is not offered there.
The picker lists each provider from GET <base_url>/models.
| Cache | File | Kept |
|---|---|---|
| Provider listings | ~/.cache/nodecode/provider-models.json | 600 seconds. A failed listing: 60 seconds. |
| models.dev catalog | ~/.cache/nodecode/models.dev/api.json | Path override: NODECODE_MODELS_CATALOG. |
/think and effort
The ladder, weakest first: off, minimal, low, medium, high, xhigh, max. A model offers the rungs it declares.
/think, or its alias /effort, offers the rungs of the model's ladder, the one in use marked, and Default first.
| Row | Does |
|---|---|
| A rung | Sets the effort for this session and every new session. Applies from the next turn. |
auto | Offered while a decider is pinned. The decider picks each turn's rung. |
| Default | Uses the model's own reasoning. |
With auto, the decider reads each turn's ask before its first round and picks one of the model's own rungs, never off. That rung binds the whole turn, the same as a /think pick. If no decider is pinned, or it fails or takes more than 10 seconds, the turn runs at the default effort instead, or the model's own reasoning when the default is auto too. The failure stays in /status until a call succeeds. auto can also be set as general.default_model.effort.
While a turn runs, the footer shows the effort its requests carry: (auto: high) after the decider picked high, or the rung a :round hook moved it to. Between turns it shows the pick.
| Source | Detail |
|---|---|
general.default_model.effort | The default effort: a rung, or auto. /think writes it when default_model is set. |
NODECODE_REASONING_EFFORT | Outranks the config default. |
A session's /think pick | Outranks both. |
| Dialect | Effort on the wire |
|---|---|
openai-completions, openai-responses | Sent as written. |
google | Clamped to high. |
anthropic | An adaptive effort or a thinking budget, by what the model declares. |
A model declares its rungs in the models.dev catalog, under its id. A gateway that names a model its own way is in no catalog, so declare its rungs on its providers.<id>.models[] entry with reasoning_options, in the models.dev shape. They outrank the catalog. See Configuration.
Retries
Set these per provider, under providers.<id>.
| Key | Default | Counts |
|---|---|---|
request_max_retries | 4 | Failures before any stream bytes. Counted per stream attempt. |
stream_max_retries | 5 | Failures after the response started. |
stream_idle_timeout_ms | 120000 | Milliseconds with no byte before the attempt fails. Once the answer has started, three times this with no new text, reasoning or tool input fails it too. |
stream_rerun_ceiling_seconds | 120 | A stream cut after this much output is continued. 0: always re-run. |
The two retry budgets multiply. A stream that keeps sending content has no time limit. Keep-alives and empty chunks alone don't keep it going.
| HTTP status | Retried |
|---|---|
| None: network error, timeout, cut stream, empty response | Yes |
| 408, 409, 425, 429 | Yes |
| 500 and above | Yes |
| 400, 401, 403, 404, 413, 422 and every other status | No |
| Delay rule | Value |
|---|---|
Retry-After header | Used as sent, capped at 60 seconds. |
| No header | 0.2 seconds, doubling to 8 seconds, with 10% jitter. |
| Status 503 | Starts at 5 seconds, capped at 60 seconds. |
| Refused connection | Spends the request budget at once. |
A context overflow is handled apart: 413, or 400 with an overflow message. Nodecode evicts old history and retries, up to 8 times. See Context.
Failover
The failover chain is the backup models a failing round moves to, in order. Every session and every channel shares it. Set it on the Backup tab of /models, or in the config:
"failover": {
"chain": [
{ "provider": "local", "model": "gemma-3-27b" }
],
"on": ["rate_limit", "outage", "slow_start", "broken_answer", "refusal"],
"first_token_seconds": 60
}
on names the failures that move a round to the chain.
| Trigger | on id | The failure |
|---|---|---|
| rate limit | rate_limit | A 429. |
| outage | outage | A server or transport failure, a timeout or a stall. Also a status no retry cures: a rejected key, a spent balance, a model the provider does not serve. |
| slow start | slow_start | An attempt that streamed no token by its deadline, or was skipped while it waited. |
| broken answer | broken_answer | A stream cut short, an empty answer or a malformed tool call. |
| refusal | refusal | The model's refusal. |
| Rule | Detail |
|---|---|
on unset | Every trigger is on. |
on is [] | Every trigger is off. The chain stays set and is never walked. |
| A trigger that is off | The failure stays on the selected model. |
| Rate limit, outage, broken answer | The selected model's retries are spent first. Then the round re-runs on the next entry. A status no retry cures moves at once. |
| Slow start | Watched only while a chain entry stands behind the attempt. Past first_token_seconds, 60 unless set, 0 never, the round leaves for the next entry at once, without retrying. |
| Refusal | Never resent. The chain's first entry answers that round. The next round runs on the selected model. |
| On a chain entry | A failure no retry cures, or one whose retries are spent, moves to the next entry, whatever on says. |
| Scope | One turn. Its later rounds stay on the entry that answered. The next turn starts on the selected model. |
| Key | Each entry resolves its own key. NODECODE_API_KEY is not used for it. |
| Bad entry | An entry without provider or model is skipped with a warning, as is an on id no trigger has. |
| No chain | No failover. |
When every model fails, the turn's error starts every model failed and lists each model it tried, one a line, with what its provider said: 1. provider/model · HTTP 400: ....
Backup tab
/models, then Tab to Backup. Its rows, top to bottom:
| Row | Does |
|---|---|
1. MODEL, one per backup | Tried in order. The detail says its provider, when it last answered and how many chain moves it rescued. Enter takes it out. |
| Add a backup… | Pick a model; it goes last. |
| Test backups | Asks each backup once, with no retry and no chain. |
| Switch when the model hits | The five triggers. Enter turns one on or off. |
The tab writes failover.chain and failover.on. The next turn reads them.
Environment
NODECODE_PROVIDER, NODECODE_MODEL, NODECODE_API_KEY, NODECODE_ENDPOINT and NODECODE_REASONING_EFFORT override the config for one process. See Environment variables.