@@ -106,6 +106,13 @@ client_request_definitions! {
106106 params: ListConversationsParams ,
107107 response: ListConversationsResponse ,
108108 } ,
109+ #[ serde( rename = "model/list" ) ]
110+ #[ ts( rename = "model/list" ) ]
111+ /// List available Codex models along with display metadata.
112+ ListModels {
113+ params: ListModelsParams ,
114+ response: ListModelsResponse ,
115+ } ,
109116 /// Resume a recorded Codex conversation from a rollout file.
110117 ResumeConversation {
111118 params: ResumeConversationParams ,
@@ -308,6 +315,40 @@ pub struct ListConversationsResponse {
308315 pub next_cursor : Option < String > ,
309316}
310317
318+ #[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , Default , JsonSchema , TS ) ]
319+ #[ serde( rename_all = "camelCase" ) ]
320+ pub struct ListModelsParams {
321+ /// Optional page size; defaults to a reasonable server-side value.
322+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
323+ pub page_size : Option < usize > ,
324+ /// Opaque pagination cursor returned by a previous call.
325+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
326+ pub cursor : Option < String > ,
327+ }
328+
329+ #[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , JsonSchema , TS ) ]
330+ #[ serde( rename_all = "camelCase" ) ]
331+ pub struct Model {
332+ pub id : String ,
333+ pub slug : String ,
334+ pub display_name : String ,
335+ pub description : String ,
336+ pub supported_reasoning_efforts : Vec < ReasoningEffort > ,
337+ pub default_reasoning_effort : ReasoningEffort ,
338+ // Only one model should be marked as default.
339+ pub is_default : bool ,
340+ }
341+
342+ #[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , JsonSchema , TS ) ]
343+ #[ serde( rename_all = "camelCase" ) ]
344+ pub struct ListModelsResponse {
345+ pub items : Vec < Model > ,
346+ /// Opaque cursor to pass to the next call to continue after the last item.
347+ /// if None, there are no more items to return.
348+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
349+ pub next_cursor : Option < String > ,
350+ }
351+
311352#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , JsonSchema , TS ) ]
312353#[ serde( rename_all = "camelCase" ) ]
313354pub struct ResumeConversationParams {
@@ -999,4 +1040,21 @@ mod tests {
9991040 ) ;
10001041 Ok ( ( ) )
10011042 }
1043+
1044+ #[ test]
1045+ fn serialize_list_models ( ) -> Result < ( ) > {
1046+ let request = ClientRequest :: ListModels {
1047+ request_id : RequestId :: Integer ( 2 ) ,
1048+ params : ListModelsParams :: default ( ) ,
1049+ } ;
1050+ assert_eq ! (
1051+ json!( {
1052+ "method" : "model/list" ,
1053+ "id" : 2 ,
1054+ "params" : { }
1055+ } ) ,
1056+ serde_json:: to_value( & request) ?,
1057+ ) ;
1058+ Ok ( ( ) )
1059+ }
10021060}
0 commit comments