## Summary Finish phase 9 of the configurable LLM provider/model work by aligning public docs, release notes, and guardrails with the implementation already landed in phases 0-8. - documents settings-driven providers/models, OpenAI-compatible gateway examples, typed `extra_headers`, model `api_id`, controls, and per-speed costs - adds the 2026-05-13 changelog entry and provider string migration note - updates the internal phase plan ledger to reflect current implementation status - adds a workspace policy test blocking direct production `Catalog::builtin()` usage outside catalog owner/test code - clarifies `Provider` as a built-in compatibility enum while open-ended identity is `ProviderId` ## Verification - `cargo nextest run -p fabro-dev --features dev --test it policy` - `cargo dev docs check` - `cargo nextest run -p fabro-model -p fabro-config -p fabro-auth -p fabro-llm` - `cargo build --workspace` - `cargo nextest run --workspace` (5717 passed, 182 skipped, nextest reported 1 leaky test) - `cargo +nightly-2026-04-14 fmt --check --all` - `cargo +nightly-2026-04-14 clippy --workspace --all-targets -- -D warnings` - `git diff --check`
4.8 KiB
Settings-Driven LLM Providers And Models
Goal: Implement a settings-driven LLM provider/model catalog so new providers and models can be configured through TOML when they use an existing adapter.
Architecture: Treat provider and model identity as layered settings data. Keep adapters, agent profiles, auth schemes, billing policy shapes, and request control kinds as explicit Rust behavior. Build a resolved Arc<Catalog> from settings and pass that catalog through server, workflow, CLI, auth, and LLM client seams.
Tech stack: Rust, serde/TOML settings layers, strum enums for code-owned control values, OpenAPI/progenitor, TypeScript API client generation, cargo nextest.
Implementation Status (2026-05-13)
Phases 0-8 have landed on main across PRs #207, #244, #245, #247, and #249.
- Settings and catalog:
[llm.providers.<id>]and[llm.models.<id>]are trusted, layered settings. Built-in catalog data is merged through the same settings path as overrides, and catalog construction validates provider adapters, aliases, enablement, priority, model controls, and per-speed cost rows. - Provider identity: public catalog/API provider fields use string-backed
ProviderId. The closedProviderenum remains intentionally for built-in compatibility paths such as install/auth strategy selection, env-var mappings, adapter defaults, and tests. - Runtime plumbing: server, workflow, CLI, hooks, auth, validation, and LLM client paths can use settings-resolved
Arc<Catalog>values.fabro_model::bootstrap_catalogis the explicit bootstrap hatch for install/API-key validation and legacy no-catalog compatibility wrappers. - Controls and billing:
ReasoningEffortandSpeedare typed,[run.model.controls]flows through resolved run settings, and catalog cost data supports per-speed overrides. - Phase 9: docs, release notes, status cleanup, and policy tests close the plan by preventing regressions to direct production bootstrap/default catalog usage.
Venice-specific built-in support is intentionally out of scope for phase 9. Custom OpenAI-compatible providers are documented through generic settings examples instead.
Key Interface Decisions
- Provider and model identity are string-backed catalog data. Built-in provider names such as
anthropic,openai, andgeminiremain valid, and custom provider IDs such asproxyare valid wherever the resolved catalog defines them. - Provider
adapteris a Rust-owned registry key. New providers can use existing adapters, especiallyopenai_compatible, without code changes. New adapter behavior remains a Rust change. api_idis the model identifier sent to the provider API. When omitted, the catalog model ID is used as the wire model ID.features.reasoning,features.effort, andcontrols.reasoning_effortare separate: model capability, native effort support, and user-facing allowed values.Speed::Standardis implicit and must not appear incontrols.speed.controls.speedlists additional native speed values such asfast; per-speed cost overrides must reference declared speeds.- Credential refs are typed. Provider credentials use
credential:<id>orenv:<NAME>. Providerextra_headersvalues use{ literal = "..." },{ env = "NAME" }, or{ credential = "id" }. Literal secret strings in credential lists are rejected. - Codex OAuth stays pinned to canonical
openai+openai_codex+ fixed ChatGPT Codex base URL. It is not a generic API key for arbitrarybase_urlrouting.
Implemented Phase Ledger
- Phase 0: groundwork and explicit bootstrap/default catalog policy.
- Phase 1: settings schema, merge behavior, and provider
extra_headers. - Phases 2-4: resolved catalog construction, OpenAPI provider string API, auth resolver changes, settings-defined provider registration, and catalog-aware validation.
- Phase 5: server/workflow/CLI/hooks plumbing for settings-resolved catalogs.
- Phases 6-8: typed controls, speed-aware request flow, per-speed billing, and built-in catalog cost/control data.
- Phase 9: public docs, generated settings reference, changelog/migration note, and workspace policy tests for direct production
Catalog::builtin()andbootstrap_catalogusage.
Verification
Phase 9 verification should include:
cargo nextest run -p fabro-dev --features dev --test it policycargo dev docs checkcargo nextest run -p fabro-model -p fabro-config -p fabro-auth -p fabro-llmcargo build --workspacecargo nextest run --workspacecargo +nightly-2026-04-14 fmt --check --allcargo +nightly-2026-04-14 clippy --workspace --all-targets -- -D warnings
Run cd apps/fabro-web && bun run typecheck only when API schema or generated TypeScript client files change. Phase 9 does not plan schema/client changes.