Skip to content

feat: Add support for default model per provider #1042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

crazywolf132
Copy link
Contributor

Description

This PR implements the feature requested in issue #1031 to allow setting default models per provider.

Changes

  • Added providerDefaultModels field to the configuration to store default models per provider
  • Added defaultModel property to each provider in the providers config
  • Modified the CLI code to use the default model for the selected provider when switching providers
  • Updated the documentation in README.md to explain the new feature
  • Added comprehensive tests to verify the functionality

How It Works

Now you can configure default models for each provider in two ways:

  1. Using the providerDefaultModels object in your config:
    {
      "providerDefaultModels": {
        "openai": "o4-mini",
        "ollama": "qwen2.5-coder:14b",
        "mistral": "mistral-large-latest"
      }
    }
  2. Or by adding a defaultModel property to each provider:
     {
       "providers": {
         "openai": {
           "name": "OpenAI",
           "baseURL": "https://api.openai.com/v1",
           "envKey": "OPENAI_API_KEY",
           "defaultModel": "o4-mini"
         }
       }
     }

When you switch providers using the /model command or the --provider flag, Codex will automatically use the default model for that provider if one is configured.

Additionally, when you select a model for a provider, it will be saved as the default model for that provider for future use.

Fixes #1031

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow setting default model per provider
1 participant