Skip to content

feat: per-platform default model/provider overrides#11439

Open
Wang-tianhao wants to merge 1 commit into
NousResearch:mainfrom
Wang-tianhao:wang/main
Open

feat: per-platform default model/provider overrides#11439
Wang-tianhao wants to merge 1 commit into
NousResearch:mainfrom
Wang-tianhao:wang/main

Conversation

@Wang-tianhao

Copy link
Copy Markdown
Contributor

Summary

Allow different messaging platforms (Telegram, Slack, Discord, etc.) to have their own default model and provider settings via platforms..extra in config.yaml.

Precedence

/model session override > platform override > global default

Configuration

platforms:
  telegram:
    extra:
      model: glm-5-turbo
      provider: zai
      api_key: sk-xxx          # optional, overrides global
      base_url: https://example.com   # optional
      api_mode: chat          # optional
  slack:
    extra:
      model: claude-sonnet-4
      provider: anthropic

Platforms without an extra block fall back to the global model.default / model.provider — no behavior change for unconfigured platforms.

Changes

  • gateway/run.py — _get_platform_model_overrides(), modified _resolve_gateway_model(), _resolve_runtime_agent_kwargs(), _resolve_session_agent_runtime(), _platform_config_key()
  • tests/test_empty_model_fallback.py — 6 new test cases (platform overrides global, session overrides platform, unknown platform falls back, extra keys passthrough, no-platform-config fallback, string model config compat)
  • website/docs/reference/faq.md — FAQ entry with example config

Tests

32 passed, 1 skipped in gateway model test suite.

Allow different messaging platforms (Telegram, Slack, Discord, etc.)
to have their own default model and provider settings via
platforms.<platform>.extra in config.yaml.

Precedence: session /model override > platform override > global default

Supported keys: model, provider, api_key, base_url, api_mode

Example config:
  platforms:
    telegram:
      extra:
        model: glm-5-turbo
        provider: zai

- Add _get_platform_model_overrides() to read platform extra config
- Modify _resolve_gateway_model() and _resolve_runtime_agent_kwargs()
  to accept platform context and apply overrides
- Add _platform_config_key() to map Platform enum to config key
- Pass source.platform through session agent runtime creation
- Add 6 test cases covering override precedence and fallbacks
- Add FAQ documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants