Documentation
¶
Overview ¶
Package modelresolve fetches fresh model.Config values for every OpenRouter model named in settings at startup, so a stale or absent cache entry never lets a session run against pricing/context data that no longer matches what OpenRouter reports.
Index ¶
Constants ¶
FetchTimeout bounds each per-model startup fetch. A blocking network call before the TUI appears would make jungi feel broken on a bad connection; on expiry the cached config (if any) is used instead.
Variables ¶
This section is empty.
Functions ¶
func Resolve ¶
func Resolve(ctx context.Context, apiKey string, ids []model.ID, transportOpts ...openrouter.SDKOption) error
Resolve fetches a fresh model.Config for every id in ids from the OpenRouter catalog, registers it in the runtime model registry, and writes it through to the on-disk cache. Fetches run concurrently (bounded by resolveConcurrency); each is bounded by FetchTimeout. A fetch that fails or times out falls back to the on-disk cache entry loaded before Resolve is called (see modelcache.LoadInto, which must run before Resolve to populate that fallback).
Resolve returns an error naming the first model that resolves via neither a fresh fetch nor the cache — such a model cannot be used safely, since jungi has no other source for its context limit or pricing.
transportOpts allows tests to redirect the SDK at an httptest server via openrouter.WithServerURL; production callers pass none.
Types ¶
This section is empty.
Source Files
¶
- modelresolve.go