Skip to slide
060 / 221

CH 04 · Model-Provider Abstraction and Multi-Model Strategy · 15/15

Read as one page

Read the source yourself

Five stops, in the order this chapter used them. Each link is pinned to the commit the excerpts came from.

  1. Replay. Start at transformMessages in earendil-works/pi. After the excerpt, read closePendingToolCalls. Then apply normalizeToolCallId on paper to | plus 80 a characters. The result is _ plus 63 a characters.
  2. The contract. Read LanguageModelV4, then list the type strings for text, reasoning, and tool input in language-model-v4-stream-part.ts. In the Anthropic model, find the thinking_delta case that enqueues a reasoning-delta.
  3. The registry. Trace claude-haiku-4-5, azure/chatgpt-v-2, and not-a-real-model through get_llm_provider. Then read the rule anthropic-claude-ids.
  4. The small model. Read selectTitle, then MINIMAL_REASONING_VARIANTS just below it, then Model.small, then the fallback in title.ts.
  5. The flag. Read getModelCapabilities for claude-sonnet-5-5, then resolveAnthropicReasoningConfig. Write down the object for 'none' on that id, and the object for 'high' on an id containing claude-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.