Fill `openrouter` record context windows from the OpenRouter API

Merged
AD
3mo ago
+655-5

OpenRouter's /models API reports context_length for every model it serves — first-party data for the openrouter provider's own records, which were almost entirely missing context_window (26 of 695 before this).

Scope rule: additive only. This PR adds windows; it never removes or changes a value that predates it.

How: source_openrouter.model_info() now carries context_length into ModelInfo.context_window, behind a new inc_context_window flag that only the openrouter provider's records use. It is deliberately never written into native provider files: OpenRouter's number describes their offering, and offerings genuinely differ (their google/gemini-3-pro-image-preview is 65,536 vs 1M native). Backfilled the existing openrouter.yml records the live API covers; future update_from_openrouter runs keep new models covered. Records OpenRouter no longer lists stay unknown rather than guessed.

Why the values are right: every candidate value was checked against OpenRouter's per-model endpoints API, because the model-level context_length is the max across endpoints and a routed request may land on a smaller one. 187 records where every active endpoint agrees carry that verified value; 60 candidates whose endpoints diverge (e.g. meta-llama/llama-3.3-70b-instruct: endpoints from 12,288 to 131,072) got no context_window, each with a comment recording the observed range — extending the existing deepseek/deepseek-v4-pro precedent. Match aliases were also swept: the one record whose aliases span models with different windows (openai/o1, which also matches the retired 128K o1-preview aliases) carries no window; every other alias is a dated/beta variant or shares the record's window. Values were additionally cross-checked against LiteLLM's catalog and our own canonical vendor records; every disagreement is a genuine per-offering difference, which is exactly why the value is scoped to openrouter records only.

Observed but deliberately untouched (follow-up material):

  • 7 pre-existing windows disagree with today's endpoints (anthropic/claude-sonnet-4.5 says 1M, endpoints serve 200K and 1M; deepseek/deepseek-v3.1-terminus, google/gemma-4-31b-it, moonshotai/kimi-k2.7-code, moonshotai/kimi-k3, z-ai/glm-5.2, z-ai/glm-5.3-flash) — left exactly as they were.
  • update_from_openrouter doesn't read comments, so a future metadata run would re-insert the model-level max on the commented divergent records; the durable fix is teaching the updater to consult the endpoints API and only write endpoint-unanimous values.
  • Splitting the o1-preview aliases into their own record would let openai/o1 carry its verified 200,000 again.