Swap the model or per-call settings from runtime.context.
Reads two optional keys from the runtime context dict:
'model' — a provider:model spec (e.g. "openai:gpt-5").
When present and different from the current model, the request is
re-routed to the new model.
'model_params' — a dict of extra model settings (e.g.
{"temperature": 0}) that are shallow-merged into the
request's model_settings.
This middleware is typically the outermost layer so it intercepts every
model call before provider-specific middleware (like
AnthropicPromptCachingMiddleware) runs.