50 lines
2.9 KiB
Markdown
50 lines
2.9 KiB
Markdown
# Model selection
|
|
|
|
The `models` service starts a conversation with `start({agent, cwd, ownership?}, context)`.
|
|
The `agent` field names a built-in definition or a project overlay.
|
|
The service stores that name in `models.profile`.
|
|
`discover(cwd)` exposes the same live definition resolver to subagents.
|
|
`configure(tx, id, {agent, inheritedTools, excludeTools?, model?, thinking?})` configures an existing child in its creation transaction.
|
|
It retains the parent's tool scope, explicit overrides, and exclusions for subsequent run boundaries.
|
|
It applies the definition during creation and before each new run.
|
|
Definitions without an explicit model follow their family, then the default family.
|
|
|
|
Each resolution reads `/src/sausage/agents/models.json` and the definition files through `host.fs`.
|
|
A file edit applies at the next run boundary without a restart.
|
|
The project definitions live under `<repo>/.sausage/agents/`.
|
|
The existing T37 parser controls validation, overlays, model suffixes, and tool denials.
|
|
|
|
The optional `models.pin` service supplies `pin(tx, conversationId)` for an external model override.
|
|
Without that provider, the definition or default family selects the model.
|
|
No login fallback runs.
|
|
|
|
Existing registered models retain their transport.
|
|
New model references reuse a template from their own registered provider and retain its proxy auth resolver.
|
|
They never inherit another provider's transport. Unknown providers fail instead of silently using OpenAI.
|
|
Models absent from the catalog receive zero prices, not the template's prices.
|
|
The extension never reads a credential or registers a direct provider SDK.
|
|
|
|
## Host proxy transports and prices
|
|
|
|
`host/js/proxy-models.ts` reads the authenticated `/v1/models` catalog once at host startup.
|
|
OpenAI models use pi-ai's Responses transport. Anthropic models use its Messages transport.
|
|
The catalog endpoint determines each model's base URL.
|
|
For Anthropic, effort capabilities select adaptive thinking and its advertised effort levels.
|
|
Both providers use the existing `llm-proxy` key and usage tag. No provider login or direct endpoint fallback runs.
|
|
|
|
If the catalog fails or exceeds five seconds, a small table supplies these defaults:
|
|
|
|
| Provider/model | API | Proxy path |
|
|
| --- | --- | --- |
|
|
| `openai/gpt-6.1-sol` | Responses | `/v1/responses` |
|
|
| `anthropic/claude-opus-5-5` | Messages, adaptive thinking | `/apis/anthropic/v1/messages` |
|
|
|
|
Catalog prices use USD per million tokens, with conversion from `unit_tokens` when necessary.
|
|
The host uses the first advertised route's quote, including cache reads and cache writes.
|
|
These costs are estimates, not billing totals. Another proxy route can charge different prices.
|
|
Unavailable prices remain zero. Catalog changes apply after a host restart.
|
|
World family edits still apply at the next run boundary without a restart.
|
|
`host/tests/proxy_models.rs` tests the real transports against a local fake proxy.
|
|
|
|
`host/tests/core_ext.rs` tests these services through the snapshot loader.
|