CH 04 · Model-Provider Abstraction and Multi-Model Strategy · 15/15
Read as one pageRead the source yourself
Five stops, in the order this chapter used them. Each link is pinned to the commit the excerpts came from.
- Replay. Start at
transformMessagesin earendil-works/pi. After the excerpt, readclosePendingToolCalls. Then applynormalizeToolCallIdon paper to|plus 80acharacters. The result is_plus 63acharacters. - The contract. Read
LanguageModelV4, then list thetypestrings for text, reasoning, and tool input inlanguage-model-v4-stream-part.ts. In the Anthropic model, find thethinking_deltacase that enqueues areasoning-delta. - The registry. Trace
claude-haiku-4-5,azure/chatgpt-v-2, andnot-a-real-modelthroughget_llm_provider. Then read the ruleanthropic-claude-ids. - The small model. Read
selectTitle, thenMINIMAL_REASONING_VARIANTSjust below it, thenModel.small, then the fallback intitle.ts. - The flag. Read
getModelCapabilitiesforclaude-sonnet-5-5, thenresolveAnthropicReasoningConfig. Write down the object for'none'on that id, and the object for'high'on an id containingclaude-haiku-4-5.
The exercise: take claude-haiku-4-5 and the description's example claude-newfamily-5. The first is an exact cost-map row whose litellm_provider is anthropic, so the name-set branch wins and the regex never runs. The second is not in the cost map, and the anthropic-claude-ids pattern matches it, so the last-resort rule returns anthropic. not-a-real-model matches neither and raises BadRequestError.
Finished this idea?
Your learning progress stays in this browser.