@@ -327,7 +327,7 @@ async fn handle_oauth_configuration(provider_name: &str, key_name: &str) -> anyh
327327 ) ) ;
328328
329329 // Create a temporary provider instance to handle OAuth
330- let temp_model = ModelConfig :: new ( "temp" ) ?;
330+ let temp_model = ModelConfig :: new ( "temp" ) ?. with_canonical_limits ( provider_name ) ;
331331 match create ( provider_name, temp_model, Vec :: new ( ) ) . await {
332332 Ok ( provider) => match provider. configure_oauth ( ) . await {
333333 Ok ( _) => {
@@ -682,7 +682,8 @@ pub async fn configure_provider_dialog() -> anyhow::Result<bool> {
682682 let spin = spinner ( ) ;
683683 spin. start ( "Attempting to fetch supported models..." ) ;
684684 let models_res = {
685- let temp_model_config = ModelConfig :: new ( & provider_meta. default_model ) ?;
685+ let temp_model_config =
686+ ModelConfig :: new ( & provider_meta. default_model ) ?. with_canonical_limits ( provider_name) ;
686687 let temp_provider = create ( provider_name, temp_model_config, Vec :: new ( ) ) . await ?;
687688 retry_operation ( & RetryConfig :: default ( ) , || async {
688689 temp_provider. fetch_recommended_models ( ) . await
@@ -1442,7 +1443,7 @@ pub async fn configure_tool_permissions_dialog() -> anyhow::Result<()> {
14421443 let model: String = config
14431444 . get_goose_model ( )
14441445 . expect ( "No model configured. Please set model first" ) ;
1445- let model_config = ModelConfig :: new ( & model) ?;
1446+ let model_config = ModelConfig :: new ( & model) ?. with_canonical_limits ( & provider_name ) ;
14461447
14471448 let agent = Agent :: new ( ) ;
14481449
@@ -1662,7 +1663,7 @@ pub async fn handle_openrouter_auth() -> anyhow::Result<()> {
16621663 println ! ( "\n Testing configuration..." ) ;
16631664 let configured_model: String = config. get_goose_model ( ) ?;
16641665 let model_config = match goose:: model:: ModelConfig :: new ( & configured_model) {
1665- Ok ( config) => config,
1666+ Ok ( config) => config. with_canonical_limits ( "openrouter" ) ,
16661667 Err ( e) => {
16671668 eprintln ! ( "⚠️ Invalid model configuration: {}" , e) ;
16681669 eprintln ! ( "Your settings have been saved. Please check your model configuration." ) ;
@@ -1742,7 +1743,7 @@ pub async fn handle_tetrate_auth() -> anyhow::Result<()> {
17421743 println ! ( "\n Testing configuration..." ) ;
17431744 let configured_model: String = config. get_goose_model ( ) ?;
17441745 let model_config = match goose:: model:: ModelConfig :: new ( & configured_model) {
1745- Ok ( config) => config,
1746+ Ok ( config) => config. with_canonical_limits ( "tetrate" ) ,
17461747 Err ( e) => {
17471748 eprintln ! ( "⚠️ Invalid model configuration: {}" , e) ;
17481749 eprintln ! ( "Your settings have been saved. Please check your model configuration." ) ;
0 commit comments