ReadonlyproviderProvider identifier (e.g., 'anthropic', 'openai')
ReadonlymodelModel identifier (e.g., 'claude-sonnet-4', 'gpt-4o')
ReadonlycapabilitiesCapabilities this model supports
Send a completion request.
The completion request
Result with response or ModelError
Stream a completion request.
The completion request
Count tokens in text.
Text to count tokens for
Approximate token count
Validate adapter configuration.
Ok if valid, ConfigError if invalid
Optionallist(Optional, #2529) List models served by this adapter's endpoint.
Implemented by adapters facing OpenAI-compatible endpoints (the
upstream OpenAI API, OpenRouter, vLLM, custom gateways, etc.) —
usually wraps GET /v1/models. Result is the harness-side identity
resolver's most-trusted signal for "what model is actually being
served behind this adapter."
Subprocess-CLI adapters (claude / codex / gemini / opencode) leave
this undefined; identity for those falls back to modelId parse.
Implementations should cache the result for ~5 minutes — operators shouldn't pay round-trip latency on every resolve. Failures (network error, endpoint unsupported, auth missing) should throw so the caller can fall back; do NOT silently return an empty list.
Minimal shape of
IResilientAdapter— duplicated here as a local type so thatmodel-not-found-fallback.tsdoesn't acquire a circular import withadapters/resilient-adapter-types.ts. The shape matches the resilient adapter's extension methods overIModelAdapter.