# `SuperPi.AI.VirtualModel`
[🔗](https://github.com/oleksandr/super-pi-beam/blob/v0.1.0/lib/super_pi/ai/virtual_model.ex#L1)

Virtual Model Router and Prompt-Cache Session Affinity Manager (`spec.md` §4, Step 5).

Provides:
- Virtual model aliases (`"fast"`, `"balanced"`, `"deep"`, `"coding"`) that dynamically resolve
  to concrete `{provider, model_id, thinking_budget}` tuples based on task phase, complexity, or
  fallback health.
- Prompt-cache session affinity via `pi.provider` (`UUIDv7`): preserves the same `sessionId`
  across linear turns and allocates a fresh `UUIDv7` when a conversation forks.

# `ensure_provider_session!`

Ensures the conversation has a `pi.provider` document with a stable `sessionId` (`UUIDv7`)
for LLM prompt-cache affinity (`spec.md` §4.3).

# `resolve`

Resolves a virtual model name (or explicit `"provider/model"` string) into a normalized
routing descriptor `%{provider: atom(), model: String.t(), thinking_budget: non_neg_integer()}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
