Skip to content

Commit 15fa228

Browse files
authored
feat: update NewConversationParams to take an optional model_provider (#5793)
An AppServer client should be able to use any (`model_provider`, `model`) in the user's config. `NewConversationParams` already supported specifying the `model`, but this PR expands it to support `model_provider`, as well. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/openai/codex/pull/5793). * #5803 * __->__ #5793
1 parent 5907422 commit 15fa228

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

codex-rs/app-server-protocol/src/protocol.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ pub struct NewConversationParams {
266266
#[serde(skip_serializing_if = "Option::is_none")]
267267
pub model: Option<String>,
268268

269+
/// Override the model provider to use for this session.
270+
#[serde(skip_serializing_if = "Option::is_none")]
271+
pub model_provider: Option<String>,
272+
269273
/// Configuration profile from config.toml to specify default options.
270274
#[serde(skip_serializing_if = "Option::is_none")]
271275
pub profile: Option<String>,
@@ -1032,6 +1036,7 @@ mod tests {
10321036
request_id: RequestId::Integer(42),
10331037
params: NewConversationParams {
10341038
model: Some("gpt-5-codex".to_string()),
1039+
model_provider: None,
10351040
profile: None,
10361041
cwd: None,
10371042
approval_policy: Some(AskForApproval::OnRequest),

codex-rs/app-server/src/codex_message_processor.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,7 @@ async fn derive_config_from_params(
16101610
) -> std::io::Result<Config> {
16111611
let NewConversationParams {
16121612
model,
1613+
model_provider,
16131614
profile,
16141615
cwd,
16151616
approval_policy,
@@ -1625,7 +1626,7 @@ async fn derive_config_from_params(
16251626
cwd: cwd.map(PathBuf::from),
16261627
approval_policy,
16271628
sandbox_mode,
1628-
model_provider: None,
1629+
model_provider,
16291630
codex_linux_sandbox_exe,
16301631
base_instructions,
16311632
include_apply_patch_tool,

0 commit comments

Comments
 (0)