Skip to content

Add configurable AI provider/model settings #96

Description

@giaphutran12

Context

Mabud noticed BigSet still has code-level model choices. Valid ask: we should let users/admins choose cheaper or better models instead of baking one expensive path into source.

Current origin/main proof:

  • backend/src/pipeline/schema-inference.ts returns openrouter("anthropic/claude-sonnet-4-6").
  • backend/src/mastra/agents/populate.ts uses openrouter("moonshotai/kimi-k2-0905") for the populate orchestrator.
  • backend/src/mastra/agents/investigate.ts uses openrouter("moonshotai/kimi-k2-0905") for investigate subagents.
  • .env.example only exposes OPENROUTER_API_KEY; there is no product/admin provider + model config surface.

OpenRouter is already wired, so the first useful version can support multiple OpenRouter model IDs before adding direct provider adapters.

Problem

AI model choice is not product/config controlled. That makes it hard to:

  • switch away from expensive Claude/Sonnet paths when cost spikes;
  • test cheaper models like Gemini Flash or Kimi variants;
  • route schema inference, populate orchestration, and investigate subagents to different models;
  • add provider-specific key/config management later without another rewrite.

Suggested scope

  • Add a backend-owned config contract for provider/model selection.
  • Support OpenRouter multi-model selection first.
  • Keep direct Gemini/Grok/Minimax/GLM provider adapters as follow-up unless we explicitly need direct billing/key management now.
  • Add a Settings page for provider/model configuration if this should be user/admin configurable, not env-only.
  • Validate provider/model config in the backend; frontend should not be source of truth.
  • Keep API logic in the backend. Frontend should call backend settings endpoints rather than adding Next API routes.

Acceptance criteria

  • No hardcoded production model literals remain in schema inference / populate / investigate paths except typed defaults or registry entries.
  • Backend has typed config for at least:
    • schema inference model;
    • populate orchestrator model;
    • investigate subagent model.
  • OpenRouter model options include current defaults plus at least one cheaper alternative.
  • Missing or invalid model/provider config fails with a clear error.
  • Settings UI, if included, shows current provider/model and persists updates through backend-owned API.
  • Docs and .env.example describe the default model settings without committing secrets.
  • Tests cover config parsing/defaults and model selection behavior.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions