diff --git a/packages/coding-agent/docs/sdk.md b/packages/coding-agent/docs/sdk.md index edced9186..a4e4f2276 100644 --- a/packages/coding-agent/docs/sdk.md +++ b/packages/coding-agent/docs/sdk.md @@ -372,6 +372,13 @@ import { ModelRuntime } from "@earendil-works/pi-coding-agent"; const modelRuntime = await ModelRuntime.create(); +// create() restores cached catalogs but does not refresh them from pi.dev by default. +// Opt in to a create-time network refresh and bound how long it may take: +const refreshedRuntime = await ModelRuntime.create({ + allowModelNetwork: true, + modelRefreshTimeoutMs: 15_000, +}); + // Find specific built-in model (doesn't check if API key exists) const opus = getModel("anthropic", "claude-opus-4-5"); if (!opus) throw new Error("Model not found"); @@ -402,6 +409,8 @@ If no model is provided: 2. Uses default from settings 3. Falls back to first available model +Remote catalogs are persisted locally so later runtimes can restore them without a network request. The default file is `~/.pi/agent/models-store.json`; set `modelsStorePath` to choose another location, or inject `modelsStore` to control persistence. Network refreshes are throttled to once per provider every four hours unless forced. To force an immediate refresh, call `await modelRuntime.refresh({ allowNetwork: true, force: true, signal })`. Setting `PI_OFFLINE` disables model network access. + To match CLI model parsing, use the exported resolver helpers: ```typescript