[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M723EVVMQQH8MFVBKTYMTW22":3,"skill-same:01M723EVVMQQH8MFVBKTYMTW22":49},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":28,"commitSha":29,"skillDirectory":30,"forksCount":31,"repositoryHtmlUrl":32,"repositoryHomepageUrl":6,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":34,"install":35,"resources":48},"01M723EVVMQQH8MFVBKTYMTW22","wire-the-llm-provider",null,"Pick a real LLM provider and wire it through Bifrost — OpenRouter \u002F Anthropic \u002F OpenAI \u002F Azure \u002F NVIDIA NIM \u002F OpenAI-compatible endpoints. Use when configuring the `llm:` block beyond the scaffold default, swapping models, setting model_profiles, or using the dev-only mock escape hatch.","hurtener\u002FHarbor","hurtener","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F117486687?v=4","01M723BZXGKZDHCZ9JHRV24W4D","Santi Benvenuto","01M723BZY77XR795N9PK1BS4GX",6,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Fwire-the-llm-provider\u002FSKILL.md",[],[],"2026-11-10 18:39:20",false,"---\nname: wire-the-llm-provider\ndescription: \"Pick a real LLM provider and wire it through Bifrost — OpenRouter \u002F Anthropic \u002F OpenAI \u002F Azure \u002F NVIDIA NIM \u002F OpenAI-compatible endpoints. Use when configuring the `llm:` block beyond the scaffold default, swapping models, setting model_profiles, or using the dev-only mock escape hatch.\"\nlicense: Apache-2.0\nmetadata:\n  framework: harbor\n  surface: llm\n  verbs: \"\"\n---\n\n# Wire the LLM provider\n\n## Optional external provider routes\n\nThe normal setup below remains the default and needs no route resolver. A host\nthat already authenticates callers and wants per-run provider selection may\nconfigure the optional `llm.provider_route` block with a boot-pinned resolver\nURL, runtime ID, and service-token environment-variable name. Protocol callers\nsend only opaque route\u002Fconnection IDs, immutable generations, a model selector,\nand an effective Agent within their signed reach. They never send a provider,\nendpoint, or credential. An explicit route fails when resolution fails; Harbor\nnever falls back to the runtime key. The resolver may choose Harbor's finite\nBifrost chat-provider set. Azure, vLLM, Ollama, SGLang, and OpenAI-compatible\nroutes use their typed endpoint binding; generic endpoint or cloud credential\nobjects are refused.\n\n```yaml\nllm:\n  provider_route:\n    resolver_url: https:\u002F\u002Fcoordinator.example.com\u002Fv1\u002Fprovider-route\n    auth_token_env: HARBOR_PROVIDER_ROUTE_TOKEN\n    timeout: 10s\n```\n\nThe resolver authentication token identifies the runtime; Harbor sends no runtime\nID and uses the identity from the verified coordinator-minted token of the run.\nDeploy the updated resolver before upgrading Harbor, then remove obsolete\nruntime-ID settings from the fleet.\n\nBifrost is Harbor's LLM driver — one wire surface that speaks many providers. You don't change Go code to swap providers; you change the `llm:` block in `harbor.yaml`. This skill walks the four common postures + the dev-mock escape hatch + the `model_profiles` block the planner needs for context budgeting.\n\n## 1. The four canonical postures\n\n### Posture A — OpenRouter (aggregator, easiest start)\n\n```yaml\nllm:\n  driver: bifrost\n  provider: openrouter\n  model: anthropic\u002Fclaude-haiku-4.5\n  api_key: env.OPENROUTER_API_KEY\n  timeout: 60s\n  model_profiles:\n    anthropic\u002Fclaude-haiku-4.5:\n      context_window_tokens: 200000\n```\n\nOpenRouter aggregates 100+ models behind one API key. Best for prototyping (\"does this model work for my agent?\") and for production agents that want provider failover without bespoke wiring. Pricing is per-token, slightly above raw provider list price. Get a key at `openrouter.ai`.\n\n### Posture B — Anthropic direct\n\n```yaml\nllm:\n  driver: bifrost\n  provider: anthropic\n  model: claude-haiku-4.5\n  api_key: env.ANTHROPIC_API_KEY\n  timeout: 60s\n  model_profiles:\n    claude-haiku-4.5:\n      context_window_tokens: 200000\n```\n\nDirect API access — usually cheapest per-token + lowest latency. Best when you've committed to Anthropic. Get a key at `console.anthropic.com`.\n\n### Posture C — OpenAI direct\n\n```yaml\nllm:\n  driver: bifrost\n  provider: openai\n  model: gpt-4.1-mini\n  api_key: env.OPENAI_API_KEY\n  timeout: 60s\n  model_profiles:\n    gpt-4.1-mini:\n      context_window_tokens: 1000000\n```\n\nSame posture for OpenAI's API. Get a key at `platform.openai.com`.\n\n### Posture D — Custom OpenAI-compatible endpoint (NIM, vLLM, ollama, …)\n\n```yaml\nllm:\n  driver: bifrost\n  provider: nim\n  model: nvidia\u002Fnemotron-3-super\n  timeout: 60s\n  custom_providers:\n    - name: nim\n      base_url: https:\u002F\u002Fintegrate.api.nvidia.com\u002Fv1\n      api_key_env_var: NVIDIA_API_KEY\n      models: [nvidia\u002Fnemotron-3-super]\n  model_profiles:\n    nvidia\u002Fnemotron-3-super:\n      context_window_tokens: 128000\n```\n\nFor any provider that exposes an OpenAI-compatible endpoint — NVIDIA NIM, vLLM serving, ollama for local LLMs, Together AI, Anyscale, Groq, Mistral, Cohere, Bedrock-compatible gateways. The `custom_providers` block tells Bifrost how to reach it; the `provider:` field references the name. Multiple custom providers can coexist — pick one as the active `provider:`, register the others for swap.\n\n## 2. `model_profiles` — the budgeting contract\n\n`model_profiles.\u003Cmodel>.context_window_tokens` is what the planner consults when it decides how much memory to replay, how much tool output to inline, and when to clip. **A profile for your `llm.model` is effectively REQUIRED: a model with no `model_profiles` entry has no context-window number, so the first LLM call hard-fails with `ErrUnsupportedModel` — there is no silent fallback.** Give every model you actually use a profile:\n\n```yaml\nmodel_profiles:\n  anthropic\u002Fclaude-haiku-4.5:\n    context_window_tokens: 200000\n  anthropic\u002Fclaude-sonnet-4.5:\n    context_window_tokens: 200000\n  gpt-4.1-mini:\n    context_window_tokens: 1000000\n```\n\nLook up the official context-window number from the provider's docs; never guess.\n\nThe profile is not a one-field shape: alongside `context_window_tokens`, the documented fields `token_estimator`, `json_schema_mode`, `default_max_tokens`, `reasoning_effort`, `cost_overrides`, `corrections`, `max_retries`, and optional `image_input` (see `docs\u002FCONFIG.md#llmmodel_profiles`) are all honoured. Declare `image_input: false` for a model known not to accept images; Harbor withholds image bytes and tells the model they were not inspected. Omit it when support is unknown. For an external route, the resolver supplies `model_profile.image_input` only after the runtime request advertises `image_input_supported: true`. `output_max_tokens` and per-token pricing (`pricing_per_input_token` \u002F `pricing_per_output_token`) are not profile fields today — leave them out of a profile.\n\n## 3. The dev-mock escape hatch\n\nCLAUDE.md §13 forbids stub LLMs as production defaults. The boot path is fail-loud: no key set, no provider configured, the binary exits with `ErrMissingAPIKey`. There IS a documented escape hatch for first-clone convenience and CI smoke:\n\n```bash\nHARBOR_DEV_ALLOW_MOCK=1 harbor dev\n```\n\nWhen `HARBOR_DEV_ALLOW_MOCK=1` is set, the binary boots with a deterministic stub LLM and prints a stderr banner on every boot:\n\n```text\n[DEV-ONLY MOCK LLM — DO NOT USE IN PRODUCTION]\n```\n\nThe banner is unmissable — it's bright, it's printed on every request to the LLM endpoint, and it's gated by a single env var. Production deployments NEVER set this var; CI smoke runs do, so we don't burn provider tokens validating the boot path. The flag does NOT degrade silently — a `production.yaml` with a misconfigured key + `HARBOR_DEV_ALLOW_MOCK=0` (the default) is still a fail-loud exit.\n\n## 4. Swap models without redeploying\n\nModels are hot-reloadable. With `harbor dev` running:\n\n1. Edit `harbor.yaml`, change `llm.model:` (and add the matching `model_profiles` entry).\n2. Save.\n3. `harbor dev`'s fsnotify watcher drains in-flight runs, re-reads the config, re-binds Bifrost to the new model, and accepts new runs.\n\nYou see this in the runtime stderr:\n\n```text\ntime=... msg=\"config reload: llm.model changed\" old=claude-haiku-4.5 new=claude-sonnet-4.5\n```\n\nThe Console's connection footer reflects the new model on the next Task run.\n\nProvider swap (e.g. OpenRouter → Anthropic direct) is the same flow — edit, save, watcher reloads. Bifrost handles the provider handshake internally.\n\n## 4b. Broker-pull the provider key (a coordinator custodies it)\n\nBy default the provider key resolves from `api_key` (env \u002F literal) once at boot — the **local** source. When a coordinator centrally custodies the key (mint \u002F rotate \u002F revoke, pulled per-runtime, never persisted), set the **broker-pull** source instead so a central rotate lands on the next call with no per-runtime env touch:\n\n```yaml\nllm:\n  provider: openai\n  model: gpt-4o\n  # api_key omitted — a brokered primary sources NO local key.\n  credential_source: remote          # \"\" \u002F \"local\" (default) or \"remote\"\n  inference_broker: openai-broker     # names an inference_brokers[] entry below\n  inference_brokers:\n    - name: openai-broker\n      credential_url: https:\u002F\u002Fcoordinator.example.com\u002Fruntimes\u002Fself\u002Fprovider-key\n      auth_token_env: HARBOR_COORDINATOR_TOKEN   # the runtime's OWN broker credential\n      # audience: openai            # optional boot-pinned ceiling\n      # scope_ceiling: [chat]       # optional boot-pinned ceiling\n      # cache_ttl: 5m               # in-memory serve horizon (default 5m)\n```\n\nRules the boot validator enforces (all fail loud):\n\n- **Brokered XOR local.** A `remote` primary MUST name an `inference_brokers[]` entry AND leave `api_key` empty. Both set, or neither, is a config error.\n- **No URL or secret on the wire.** Every sink-determining value (`credential_url`, `auth_token_env`, audience, scope ceiling) lives on the boot-declared broker, referenced by non-secret NAME. The `agent_config.set_llm_provider` Protocol write (below) can only reference a broker by name — it can never carry a URL or an env-var name.\n- **Fail-loud, no stale key.** A broker unreachable at connect, or a failed refresh once the cache TTL is crossed, raises `ErrProviderKeyUnavailable`; the runtime NEVER falls back to a local key and NEVER serves a stale key. The pull happens at connect + refresh only — the inference hot path reads the cached key with no per-call broker round-trip.\n- **Harbor-orchestrated failover, not the SDK's.** When a coordinator supplies an ordered chain of broker-pulled provider keys\u002Fproviders, Harbor walks that chain itself at the governance layer: on a *retryable* provider error it advances to the next key\u002Fprovider, emits a `governance.failover` event (identity + cost + from\u002Fto provider), **re-runs the budget \u002F rate-limit \u002F MaxTokens check BEFORE re-issuing** (a trip fails loud and stops the walk — a chain can never spend past a run's per-identity ceiling across hops), and re-issues through the same client. Cross-provider chains are expressible; the fallback keys are broker-pulled and never persisted. Harbor deliberately does NOT hand the provider SDK its native `Fallbacks` array — that would hide every hop from audit + bus + cost. Observe the hops on the event stream (`governance.failover`).\n\n**Rotate \u002F install over the Protocol.** An admin can bind (or rotate) a runtime's brokered provider without editing yaml via `agent_config.set_llm_provider` — a ZERO-URL, admin-only write carrying only `{name, provider, credential_source:\"remote\", inference_broker, model_allow?}`. A write carrying a `credential_url` \u002F `token_url` \u002F `*_env` \u002F secret field is rejected by name at the wire edge; an unknown broker or a `console:fleet`-only (read) token is rejected loud. See the `use-the-harbor-protocol` skill for the request shape.\n\n### Per-run coordinator-bound credentials\n\nExternal execution grants are a separate, optional per-run path from the\nruntime-level broker above. When `llm.external_grant.route_mode` is\n`coordinator_bound`, stock `harbor serve` can resolve the exact already-verified\ngrant's opaque credential binding through:\n\n```yaml\nllm:\n  external_grant:\n    coordinator:\n      credential_url: https:\u002F\u002Fcoordinator.example.com\u002Fv1\u002Fexternal-grant\u002Fcredential\n      auth_token_env: HARBOR_COORDINATOR_TOKEN\n```\n\nThe endpoint receives Harbor's canonical signed-grant envelope; there is no\ncaller-selectable organization, identity, provider, connection, generation,\nroute, key, or URL field. Required coordinator-bound mode fails boot if neither\nthis stock endpoint nor a host-injected resolver is wired. Omit the block for\ndisabled grants or `runtime_default`: those paths keep using the ordinary\nconfigured provider key and do not call a coordinator or require a model\ncatalog.\n\n## 5. Timeouts + retries\n\n```yaml\nllm:\n  # ... provider + model ...\n  timeout: 60s                  # request-level timeout\n  network_defaults:             # applies to every provider (native + custom)\n    max_retries: 2              # extra attempts after the first try\n    retry_backoff_initial: 1s   # backoff before the first retry\n    retry_backoff_max: 8s       # backoff ceiling\n  model_profiles:\n    anthropic\u002Fclaude-haiku-4.5:\n      context_window_tokens: 200000\n      max_retries: 4            # per-model override of network_defaults.max_retries\n```\n\n`network_defaults` sets the retry policy for every provider; a `model_profiles.\u003Cmodel>.max_retries` entry overrides it for that one model. The retry policy is per-attempt; the `timeout` applies to each individual attempt. Backoff grows from `retry_backoff_initial` up to the `retry_backoff_max` ceiling. Omit any field and it falls through to Bifrost's package-level default. Bifrost honours `Retry-After` headers from the provider when present.\n\nLong-running models (deep reasoning, large context) sometimes exceed the default 60s; bump to 120s or 240s for those. The Console's Task page surfaces timeout errors with the provider's verbatim response, so you can tune fast.\n\n**Prompt caching across turns.** Harbor sends an opaque prompt cache key per stable prompt prefix by default (`llm.prompt_cache.key: auto`; set `off` to disable). Retention (`llm.prompt_cache.retention: in_memory|24h`), OpenRouter session affinity (`llm.prompt_cache.sticky_routing: true`) and OpenRouter upstream pinning (`llm.provider_routing.order` \u002F `allow_fallbacks`) are opt-in. Check `cached_input_tokens` \u002F `cache_write_tokens` on the `llm.call.completed` log line to confirm hits; they are absent when the provider reports no cache breakdown. See `docs\u002FCONFIG.md` for each knob.\n\n## 6. Embeddings are a separate block (not an `llm` knob)\n\nHarbor's embedding client is a sibling seam to the chat client — turning text into vectors gets its **own** provider\u002Fmodel\u002Fkey, configured at the top-level `embeddings:` block, never inherited from `llm.*`:\n\n```yaml\nembeddings:\n  driver: bifrost                  # the default; omit freely\n  provider: openai\n  model: text-embedding-3-small\n  api_key: env.OPENAI_API_KEY      # same env.NAME convention as llm.api_key\n  # dimensions: 256                # optional reduced output dimension\n```\n\nYou only need it when something consumes embeddings — semantic skill retrieval (`skills.retrieval: semantic`; see [`configure-memory-and-skills`](..\u002Fconfigure-memory-and-skills\u002FSKILL.md)) or your own à-la-carte retrieval (`docs\u002Frecipes\u002Fembed-and-retrieve.md`). Enabling a semantic mode without the block fails validation loudly naming the missing keys; there is no mock embeddings driver and no fallback to the chat provider.\n\n## Common failure modes\n\n- **`harbor dev` exits immediately with `ErrMissingAPIKey: env.OPENROUTER_API_KEY not set`.** Source your `.env` or export the var in the shell that ran `harbor dev`. Verify with `echo $OPENROUTER_API_KEY`.\n- **`harbor dev` exits with `ErrUnknownProvider: \"nim\"`.** You set `provider: nim` but forgot the matching `custom_providers:` entry. Add it.\n- **Every LLM call times out.** Either your `timeout:` is too low for the model, OR the provider is unreachable from the runtime's network. Check with a `curl https:\u002F\u002Fapi.openrouter.ai\u002Fv1\u002Fmodels` from the runtime host first.\n- **`llm.context_leak` events fire mid-run.** A tool returned more than `artifacts.heavy_output_threshold_bytes` (128 KiB by default) inline instead of an `ArtifactStub`. See [`add-an-in-process-tool`](..\u002Fadd-an-in-process-tool\u002FSKILL.md) §4.\n- **`harbor dev` fails the first LLM call with `ErrUnsupportedModel: model has no configured ModelProfile`.** Your `llm.model` has no `model_profiles.\u003Cmodel>` entry, so the runtime has no context-window number for it and refuses the call — there is no fallback. Add the `model_profiles.\u003Cmodel>.context_window_tokens` entry.\n\n## See also\n\n- [`define-the-agent-yaml`](..\u002Fdefine-the-agent-yaml\u002FSKILL.md) — the `llm:` block in the context of the full yaml.\n- [`configure-memory-and-skills`](..\u002Fconfigure-memory-and-skills\u002FSKILL.md) — memory budgeting against the context window.\n- [`observe-with-the-console`](..\u002Fobserve-with-the-console\u002FSKILL.md) — the LLM tab in the Console's Task page shows every prompt\u002Fcompletion.\n- Bifrost's full provider matrix: `github.com\u002Fmaximhq\u002Fbifrost`.\n- The CONFIG.md reference: `docs\u002FCONFIG.md#llm` (and `#embeddings` for the embedding client).\n","# Wire the LLM provider\n\n## Optional external provider routes\n\nThe normal setup below remains the default and needs no route resolver. A host\nthat already authenticates callers and wants per-run provider selection may\nconfigure the optional `llm.provider_route` block with a boot-pinned resolver\nURL, runtime ID, and service-token environment-variable name. Protocol callers\nsend only opaque route\u002Fconnection IDs, immutable generations, a model selector,\nand an effective Agent within their signed reach. They never send a provider,\nendpoint, or credential. An explicit route fails when resolution fails; Harbor\nnever falls back to the runtime key. The resolver may choose Harbor's finite\nBifrost chat-provider set. Azure, vLLM, Ollama, SGLang, and OpenAI-compatible\nroutes use their typed endpoint binding; generic endpoint or cloud credential\nobjects are refused.\n\n```yaml\nllm:\n  provider_route:\n    resolver_url: https:\u002F\u002Fcoordinator.example.com\u002Fv1\u002Fprovider-route\n    auth_token_env: HARBOR_PROVIDER_ROUTE_TOKEN\n    timeout: 10s\n```\n\nThe resolver authentication token identifies the runtime; Harbor sends no runtime\nID and uses the identity from the verified coordinator-minted token of the run.\nDeploy the updated resolver before upgrading Harbor, then remove obsolete\nruntime-ID settings from the fleet.\n\nBifrost is Harbor's LLM driver — one wire surface that speaks many providers. You don't change Go code to swap providers; you change the `llm:` block in `harbor.yaml`. This skill walks the four common postures + the dev-mock escape hatch + the `model_profiles` block the planner needs for context budgeting.\n\n## 1. The four canonical postures\n\n### Posture A — OpenRouter (aggregator, easiest start)\n\n```yaml\nllm:\n  driver: bifrost\n  provider: openrouter\n  model: anthropic\u002Fclaude-haiku-4.5\n  api_key: env.OPENROUTER_API_KEY\n  timeout: 60s\n  model_profiles:\n    anthropic\u002Fclaude-haiku-4.5:\n      context_window_tokens: 200000\n```\n\nOpenRouter aggregates 100+ models behind one API key. Best for prototyping (\"does this model work for my agent?\") and for production agents that want provider failover without bespoke wiring. Pricing is per-token, slightly above raw provider list price. Get a key at `openrouter.ai`.\n\n### Posture B — Anthropic direct\n\n```yaml\nllm:\n  driver: bifrost\n  provider: anthropic\n  model: claude-haiku-4.5\n  api_key: env.ANTHROPIC_API_KEY\n  timeout: 60s\n  model_profiles:\n    claude-haiku-4.5:\n      context_window_tokens: 200000\n```\n\nDirect API access — usually cheapest per-token + lowest latency. Best when you've committed to Anthropic. Get a key at `console.anthropic.com`.\n\n### Posture C — OpenAI direct\n\n```yaml\nllm:\n  driver: bifrost\n  provider: openai\n  model: gpt-4.1-mini\n  api_key: env.OPENAI_API_KEY\n  timeout: 60s\n  model_profiles:\n    gpt-4.1-mini:\n      context_window_tokens: 1000000\n```\n\nSame posture for OpenAI's API. Get a key at `platform.openai.com`.\n\n### Posture D — Custom OpenAI-compatible endpoint (NIM, vLLM, ollama, …)\n\n```yaml\nllm:\n  driver: bifrost\n  provider: nim\n  model: nvidia\u002Fnemotron-3-super\n  timeout: 60s\n  custom_providers:\n    - name: nim\n      base_url: https:\u002F\u002Fintegrate.api.nvidia.com\u002Fv1\n      api_key_env_var: NVIDIA_API_KEY\n      models: [nvidia\u002Fnemotron-3-super]\n  model_profiles:\n    nvidia\u002Fnemotron-3-super:\n      context_window_tokens: 128000\n```\n\nFor any provider that exposes an OpenAI-compatible endpoint — NVIDIA NIM, vLLM serving, ollama for local LLMs, Together AI, Anyscale, Groq, Mistral, Cohere, Bedrock-compatible gateways. The `custom_providers` block tells Bifrost how to reach it; the `provider:` field references the name. Multiple custom providers can coexist — pick one as the active `provider:`, register the others for swap.\n\n## 2. `model_profiles` — the budgeting contract\n\n`model_profiles.\u003Cmodel>.context_window_tokens` is what the planner consults when it decides how much memory to replay, how much tool output to inline, and when to clip. **A profile for your `llm.model` is effectively REQUIRED: a model with no `model_profiles` entry has no context-window number, so the first LLM call hard-fails with `ErrUnsupportedModel` — there is no silent fallback.** Give every model you actually use a profile:\n\n```yaml\nmodel_profiles:\n  anthropic\u002Fclaude-haiku-4.5:\n    context_window_tokens: 200000\n  anthropic\u002Fclaude-sonnet-4.5:\n    context_window_tokens: 200000\n  gpt-4.1-mini:\n    context_window_tokens: 1000000\n```\n\nLook up the official context-window number from the provider's docs; never guess.\n\nThe profile is not a one-field shape: alongside `context_window_tokens`, the documented fields `token_estimator`, `json_schema_mode`, `default_max_tokens`, `reasoning_effort`, `cost_overrides`, `corrections`, `max_retries`, and optional `image_input` (see `docs\u002FCONFIG.md#llmmodel_profiles`) are all honoured. Declare `image_input: false` for a model known not to accept images; Harbor withholds image bytes and tells the model they were not inspected. Omit it when support is unknown. For an external route, the resolver supplies `model_profile.image_input` only after the runtime request advertises `image_input_supported: true`. `output_max_tokens` and per-token pricing (`pricing_per_input_token` \u002F `pricing_per_output_token`) are not profile fields today — leave them out of a profile.\n\n## 3. The dev-mock escape hatch\n\nCLAUDE.md §13 forbids stub LLMs as production defaults. The boot path is fail-loud: no key set, no provider configured, the binary exits with `ErrMissingAPIKey`. There IS a documented escape hatch for first-clone convenience and CI smoke:\n\n```bash\nHARBOR_DEV_ALLOW_MOCK=1 harbor dev\n```\n\nWhen `HARBOR_DEV_ALLOW_MOCK=1` is set, the binary boots with a deterministic stub LLM and prints a stderr banner on every boot:\n\n```text\n[DEV-ONLY MOCK LLM — DO NOT USE IN PRODUCTION]\n```\n\nThe banner is unmissable — it's bright, it's printed on every request to the LLM endpoint, and it's gated by a single env var. Production deployments NEVER set this var; CI smoke runs do, so we don't burn provider tokens validating the boot path. The flag does NOT degrade silently — a `production.yaml` with a misconfigured key + `HARBOR_DEV_ALLOW_MOCK=0` (the default) is still a fail-loud exit.\n\n## 4. Swap models without redeploying\n\nModels are hot-reloadable. With `harbor dev` running:\n\n1. Edit `harbor.yaml`, change `llm.model:` (and add the matching `model_profiles` entry).\n2. Save.\n3. `harbor dev`'s fsnotify watcher drains in-flight runs, re-reads the config, re-binds Bifrost to the new model, and accepts new runs.\n\nYou see this in the runtime stderr:\n\n```text\ntime=... msg=\"config reload: llm.model changed\" old=claude-haiku-4.5 new=claude-sonnet-4.5\n```\n\nThe Console's connection footer reflects the new model on the next Task run.\n\nProvider swap (e.g. OpenRouter → Anthropic direct) is the same flow — edit, save, watcher reloads. Bifrost handles the provider handshake internally.\n\n## 4b. Broker-pull the provider key (a coordinator custodies it)\n\nBy default the provider key resolves from `api_key` (env \u002F literal) once at boot — the **local** source. When a coordinator centrally custodies the key (mint \u002F rotate \u002F revoke, pulled per-runtime, never persisted), set the **broker-pull** source instead so a central rotate lands on the next call with no per-runtime env touch:\n\n```yaml\nllm:\n  provider: openai\n  model: gpt-4o\n  # api_key omitted — a brokered primary sources NO local key.\n  credential_source: remote          # \"\" \u002F \"local\" (default) or \"remote\"\n  inference_broker: openai-broker     # names an inference_brokers[] entry below\n  inference_brokers:\n    - name: openai-broker\n      credential_url: https:\u002F\u002Fcoordinator.example.com\u002Fruntimes\u002Fself\u002Fprovider-key\n      auth_token_env: HARBOR_COORDINATOR_TOKEN   # the runtime's OWN broker credential\n      # audience: openai            # optional boot-pinned ceiling\n      # scope_ceiling: [chat]       # optional boot-pinned ceiling\n      # cache_ttl: 5m               # in-memory serve horizon (default 5m)\n```\n\nRules the boot validator enforces (all fail loud):\n\n- **Brokered XOR local.** A `remote` primary MUST name an `inference_brokers[]` entry AND leave `api_key` empty. Both set, or neither, is a config error.\n- **No URL or secret on the wire.** Every sink-determining value (`credential_url`, `auth_token_env`, audience, scope ceiling) lives on the boot-declared broker, referenced by non-secret NAME. The `agent_config.set_llm_provider` Protocol write (below) can only reference a broker by name — it can never carry a URL or an env-var name.\n- **Fail-loud, no stale key.** A broker unreachable at connect, or a failed refresh once the cache TTL is crossed, raises `ErrProviderKeyUnavailable`; the runtime NEVER falls back to a local key and NEVER serves a stale key. The pull happens at connect + refresh only — the inference hot path reads the cached key with no per-call broker round-trip.\n- **Harbor-orchestrated failover, not the SDK's.** When a coordinator supplies an ordered chain of broker-pulled provider keys\u002Fproviders, Harbor walks that chain itself at the governance layer: on a *retryable* provider error it advances to the next key\u002Fprovider, emits a `governance.failover` event (identity + cost + from\u002Fto provider), **re-runs the budget \u002F rate-limit \u002F MaxTokens check BEFORE re-issuing** (a trip fails loud and stops the walk — a chain can never spend past a run's per-identity ceiling across hops), and re-issues through the same client. Cross-provider chains are expressible; the fallback keys are broker-pulled and never persisted. Harbor deliberately does NOT hand the provider SDK its native `Fallbacks` array — that would hide every hop from audit + bus + cost. Observe the hops on the event stream (`governance.failover`).\n\n**Rotate \u002F install over the Protocol.** An admin can bind (or rotate) a runtime's brokered provider without editing yaml via `agent_config.set_llm_provider` — a ZERO-URL, admin-only write carrying only `{name, provider, credential_source:\"remote\", inference_broker, model_allow?}`. A write carrying a `credential_url` \u002F `token_url` \u002F `*_env` \u002F secret field is rejected by name at the wire edge; an unknown broker or a `console:fleet`-only (read) token is rejected loud. See the `use-the-harbor-protocol` skill for the request shape.\n\n### Per-run coordinator-bound credentials\n\nExternal execution grants are a separate, optional per-run path from the\nruntime-level broker above. When `llm.external_grant.route_mode` is\n`coordinator_bound`, stock `harbor serve` can resolve the exact already-verified\ngrant's opaque credential binding through:\n\n```yaml\nllm:\n  external_grant:\n    coordinator:\n      credential_url: https:\u002F\u002Fcoordinator.example.com\u002Fv1\u002Fexternal-grant\u002Fcredential\n      auth_token_env: HARBOR_COORDINATOR_TOKEN\n```\n\nThe endpoint receives Harbor's canonical signed-grant envelope; there is no\ncaller-selectable organization, identity, provider, connection, generation,\nroute, key, or URL field. Required coordinator-bound mode fails boot if neither\nthis stock endpoint nor a host-injected resolver is wired. Omit the block for\ndisabled grants or `runtime_default`: those paths keep using the ordinary\nconfigured provider key and do not call a coordinator or require a model\ncatalog.\n\n## 5. Timeouts + retries\n\n```yaml\nllm:\n  # ... provider + model ...\n  timeout: 60s                  # request-level timeout\n  network_defaults:             # applies to every provider (native + custom)\n    max_retries: 2              # extra attempts after the first try\n    retry_backoff_initial: 1s   # backoff before the first retry\n    retry_backoff_max: 8s       # backoff ceiling\n  model_profiles:\n    anthropic\u002Fclaude-haiku-4.5:\n      context_window_tokens: 200000\n      max_retries: 4            # per-model override of network_defaults.max_retries\n```\n\n`network_defaults` sets the retry policy for every provider; a `model_profiles.\u003Cmodel>.max_retries` entry overrides it for that one model. The retry policy is per-attempt; the `timeout` applies to each individual attempt. Backoff grows from `retry_backoff_initial` up to the `retry_backoff_max` ceiling. Omit any field and it falls through to Bifrost's package-level default. Bifrost honours `Retry-After` headers from the provider when present.\n\nLong-running models (deep reasoning, large context) sometimes exceed the default 60s; bump to 120s or 240s for those. The Console's Task page surfaces timeout errors with the provider's verbatim response, so you can tune fast.\n\n**Prompt caching across turns.** Harbor sends an opaque prompt cache key per stable prompt prefix by default (`llm.prompt_cache.key: auto`; set `off` to disable). Retention (`llm.prompt_cache.retention: in_memory|24h`), OpenRouter session affinity (`llm.prompt_cache.sticky_routing: true`) and OpenRouter upstream pinning (`llm.provider_routing.order` \u002F `allow_fallbacks`) are opt-in. Check `cached_input_tokens` \u002F `cache_write_tokens` on the `llm.call.completed` log line to confirm hits; they are absent when the provider reports no cache breakdown. See `docs\u002FCONFIG.md` for each knob.\n\n## 6. Embeddings are a separate block (not an `llm` knob)\n\nHarbor's embedding client is a sibling seam to the chat client — turning text into vectors gets its **own** provider\u002Fmodel\u002Fkey, configured at the top-level `embeddings:` block, never inherited from `llm.*`:\n\n```yaml\nembeddings:\n  driver: bifrost                  # the default; omit freely\n  provider: openai\n  model: text-embedding-3-small\n  api_key: env.OPENAI_API_KEY      # same env.NAME convention as llm.api_key\n  # dimensions: 256                # optional reduced output dimension\n```\n\nYou only need it when something consumes embeddings — semantic skill retrieval (`skills.retrieval: semantic`; see [`configure-memory-and-skills`](..\u002Fconfigure-memory-and-skills\u002FSKILL.md)) or your own à-la-carte retrieval (`docs\u002Frecipes\u002Fembed-and-retrieve.md`). Enabling a semantic mode without the block fails validation loudly naming the missing keys; there is no mock embeddings driver and no fallback to the chat provider.\n\n## Common failure modes\n\n- **`harbor dev` exits immediately with `ErrMissingAPIKey: env.OPENROUTER_API_KEY not set`.** Source your `.env` or export the var in the shell that ran `harbor dev`. Verify with `echo $OPENROUTER_API_KEY`.\n- **`harbor dev` exits with `ErrUnknownProvider: \"nim\"`.** You set `provider: nim` but forgot the matching `custom_providers:` entry. Add it.\n- **Every LLM call times out.** Either your `timeout:` is too low for the model, OR the provider is unreachable from the runtime's network. Check with a `curl https:\u002F\u002Fapi.openrouter.ai\u002Fv1\u002Fmodels` from the runtime host first.\n- **`llm.context_leak` events fire mid-run.** A tool returned more than `artifacts.heavy_output_threshold_bytes` (128 KiB by default) inline instead of an `ArtifactStub`. See [`add-an-in-process-tool`](..\u002Fadd-an-in-process-tool\u002FSKILL.md) §4.\n- **`harbor dev` fails the first LLM call with `ErrUnsupportedModel: model has no configured ModelProfile`.** Your `llm.model` has no `model_profiles.\u003Cmodel>` entry, so the runtime has no context-window number for it and refuses the call — there is no fallback. Add the `model_profiles.\u003Cmodel>.context_window_tokens` entry.\n\n## See also\n\n- [`define-the-agent-yaml`](..\u002Fdefine-the-agent-yaml\u002FSKILL.md) — the `llm:` block in the context of the full yaml.\n- [`configure-memory-and-skills`](..\u002Fconfigure-memory-and-skills\u002FSKILL.md) — memory budgeting against the context window.\n- [`observe-with-the-console`](..\u002Fobserve-with-the-console\u002FSKILL.md) — the LLM tab in the Console's Task page shows every prompt\u002Fcompletion.\n- Bifrost's full provider matrix: `github.com\u002Fmaximhq\u002Fbifrost`.\n- The CONFIG.md reference: `docs\u002FCONFIG.md#llm` (and `#embeddings` for the embedding client).\n",{"name":5,"license":15,"metadata":24,"description":7},{"verbs":25,"surface":26,"framework":27},"","llm","harbor","main","7de2201d2ff639d1227fb0624684b328d943eea9","docs\u002Fskills\u002Fwire-the-llm-provider",1,"https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor","https:\u002F\u002Fgithub.com\u002Fhurtener","2026-11-15 04:22:13",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add hurtener\u002FHarbor --skill wire-the-llm-provider",{"tool":41,"command":42},"bunx","bunx skills add hurtener\u002FHarbor --skill wire-the-llm-provider",{"tool":44,"command":45},"pnpm","pnpm dlx skills add hurtener\u002FHarbor --skill wire-the-llm-provider","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Fwire-the-llm-provider\u002FSKILL.md",true,[],[50,57,64,71,78,85],{"skillNo":51,"name":52,"nameZh":6,"description":53,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":19},"01M723ESCAV3DX4FSWHB9QRXDT","validate-and-package","Run `harbor validate` + `make preflight` + the per-phase smoke gates before shipping an agent. Use when packaging an agent for a non-dev environment — production deploy, share with a teammate, hand off to CI, or ship a release tag.","https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Fvalidate-and-package\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M723E99VBZ6D9XCG10RPJMM1","scaffold-a-harbor-agent","Scaffold a new Harbor agent project with `harbor init` + `harbor scaffold`. Use when starting a fresh agent from zero — drops a tiered, commented `harbor.yaml`, the companion AGENTS.md \u002F CLAUDE.md \u002F README.md, and materialises the Go project so `harbor dev` boots a working runtime in under five minutes.","https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Fscaffold-a-harbor-agent\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M723E52YP0JSH9R22APN4T5M","run-the-dev-loop","Use `harbor dev` + `harbor console` to run an agent locally with the Console attached. Use when iterating on a Harbor project — single-process or multi-process attach posture, the `HARBOR_DEV_TOKEN` handshake, hot reload on yaml changes, and which posture to pick when.","https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Frun-the-dev-loop\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M723E1M9CF4V7ZMHAMA3GY2Y","observe-with-the-console","Tour the Console's observability pages — Overview, Live Runtime, Observability, Sessions, Tasks, Agents, Tools, Events, Background Jobs, Playground, Flows, Memory, MCP Connections, Artifacts, Settings. Use when debugging an agent's behavior, hunting a regression, or building intuition for what the runtime is actually doing under the hood.","https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Fobserve-with-the-console\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M723DXYEMV4VWKM7A65BHR5E","drive-the-playground","Use the Console's Playground page to chat against your agent, attach files (images \u002F PDFs \u002F audio), and steer or queue input during a run. Use when validating the agent end-to-end interactively, the foreground\u002Fbackground task posture, image-vs-PDF MIME dispatch, and the playground's steering UI.","https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Fdrive-the-playground\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M723DTS3RZ9NPSKF0T2D4YZ5","drive-the-harbor-tui","Attach Harbor's native terminal Runtime test\u002Fcontrol client with authenticated REST\u002FSSE. Use when testing sessions, tasks, tools, artifacts, events, posture, interventions, controls, reconnect, or transcript export without opening the Console.","https:\u002F\u002Fgithub.com\u002Fhurtener\u002FHarbor\u002Fblob\u002Fmain\u002Fdocs\u002Fskills\u002Fdrive-the-harbor-tui\u002FSKILL.md",[],[]]