@@ -182,6 +182,28 @@ describe('PricingSyncService', () => {
182182 expect ( mockUpsert ) . not . toHaveBeenCalled ( ) ;
183183 } ) ;
184184
185+ it ( 'skips models with non-text input modalities' , async ( ) => {
186+ mockFetch . mockResolvedValue ( {
187+ ok : true ,
188+ json : async ( ) => ( {
189+ data : [
190+ {
191+ id : 'google/image-only-input-model' ,
192+ architecture : {
193+ input_modalities : [ 'image' ] ,
194+ output_modalities : [ 'text' ] ,
195+ } ,
196+ pricing : { prompt : '0.0000005' , completion : '0.000003' } ,
197+ } ,
198+ ] ,
199+ } ) ,
200+ } ) ;
201+
202+ const updated = await service . syncPricing ( ) ;
203+ expect ( updated ) . toBe ( 0 ) ;
204+ expect ( mockUpsert ) . not . toHaveBeenCalled ( ) ;
205+ } ) ;
206+
185207 it ( 'keeps multimodal-input models with text-only output modalities' , async ( ) => {
186208 mockFetch . mockResolvedValue ( {
187209 ok : true ,
@@ -498,6 +520,24 @@ describe('PricingSyncService', () => {
498520 expect ( deleteArg . model_name . _value ) . not . toContain ( 'gpt-4o' ) ;
499521 } ) ;
500522
523+ it ( 'removeUnsupportedModels defaults to an empty incompatible set and preserves openrouter/ prefixes' , async ( ) => {
524+ mockFind . mockResolvedValue ( [
525+ { model_name : 'ai21/jamba-1-5-large' , provider : 'AI21' } ,
526+ { model_name : 'openrouter/auto' , provider : 'Legacy' } ,
527+ { model_name : 'gpt-4o' , provider : 'OpenAI' } ,
528+ ] ) ;
529+
530+ await (
531+ service as never as { removeUnsupportedModels : ( ) => Promise < void > }
532+ ) . removeUnsupportedModels ( ) ;
533+
534+ expect ( mockDelete ) . toHaveBeenCalledTimes ( 1 ) ;
535+ const deleteArg = mockDelete . mock . calls [ 0 ] [ 0 ] ;
536+ expect ( deleteArg . model_name . _value ) . toContain ( 'ai21/jamba-1-5-large' ) ;
537+ expect ( deleteArg . model_name . _value ) . not . toContain ( 'openrouter/auto' ) ;
538+ expect ( deleteArg . model_name . _value ) . not . toContain ( 'gpt-4o' ) ;
539+ } ) ;
540+
501541 it ( 'removes previously synced non-chat-compatible models on sync' , async ( ) => {
502542 mockFind . mockResolvedValue ( [
503543 { model_name : 'gemini-3.1-flash-image-preview' , provider : 'Google' } ,
0 commit comments